-
Notifications
You must be signed in to change notification settings - Fork 55
feat: implement real-time trash file count monitoring #1307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reviewer's GuideThis PR implements real-time trash file count monitoring by introducing a centralized TRASH_FILES_PATH constant, integrating a QFileSystemWatcher to track changes in the trash directory, and replacing the static trash tip text with a dynamic trashFilesCount property and signal for seamless UI updates. Sequence diagram for real-time trash file count monitoring and UI updatesequenceDiagram
participant TaskManager
participant QFileSystemWatcher
participant UI
TaskManager->>QFileSystemWatcher: setupTrashWatcher()
QFileSystemWatcher-->>TaskManager: directoryChanged signal
TaskManager-->>UI: trashFilesCountChanged signal
UI->>TaskManager: Read trashFilesCount property
Updated class diagram for TaskManager with trash monitoringclassDiagram
class TaskManager {
+QString trashFilesCount()
+void setupTrashWatcher()
+signal trashFilesCountChanged()
-QFileSystemWatcher *m_trashWatcher
}
class QFileSystemWatcher
TaskManager --> QFileSystemWatcher : uses
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there - I've reviewed your changes - here's some feedback:
- Replace the TRASH_FILES_PATH macro with a static const QString (or constexpr) and build the path using QDir::cleanPath or QDir::separator instead of hard-coding "/" for better readability and portability.
- Emit trashFilesCountChanged() once after setupTrashWatcher runs so the UI receives the initial file count immediately on startup.
- Consider changing trashFilesCount to expose an integer property instead of a QString so QML can format the count directly and maintain semantic clarity.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Replace the TRASH_FILES_PATH macro with a static const QString (or constexpr) and build the path using QDir::cleanPath or QDir::separator instead of hard-coding "/" for better readability and portability.
- Emit trashFilesCountChanged() once after setupTrashWatcher runs so the UI receives the initial file count immediately on startup.
- Consider changing trashFilesCount to expose an integer property instead of a QString so QML can format the count directly and maintain semantic clarity.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
1. Move tooltip text assignment from property initialization to onTriggered handler 2. This ensures the trash tip text is dynamically updated when tooltip is shown 3. Fixes potential stale trash status display in tooltips 4. Maintains same functionality but with proper timing fix: 将工具提示文本赋值移动到显示处理程序 1. 将工具提示文本赋值从属性初始化移动到 onTriggered 处理程序 2. 确保垃圾桶提示文本在工具提示显示时动态更新 3. 修复工具提示中可能显示过时垃圾桶状态的问题 4. 保持相同功能但具有正确的时机控制 PMS: BUG-336825
39f426d to
0449eef
Compare
deepin pr auto review这是一个关于 Qt/QML 代码的修改,主要涉及到了工具提示(tooltip)文本的设置时机。让我来分析一下这个改动:
总的来说,这是一个合理的优化,提高了代码的效率和可维护性。建议采纳这个修改。 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, wjyrich The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
feat: 实现实时回收站文件数量监控
PMS: BUG-336825
Summary by Sourcery
Implement real-time Trash file count monitoring by adding a dynamic property, defining a constant path, setting up a filesystem watcher that emits updates, and updating the UI to reflect live count changes
New Features: