Skip to content

Conversation

@18202781743
Copy link
Contributor

@18202781743 18202781743 commented Jun 24, 2025

  1. Added resetIcon() method to X11Window class to clear cached icon and
    emit change signal
  2. Implemented icon theme change detection in X11WindowMonitor
  3. Added connection to DGuiApplicationHelper's theme change signal
  4. When theme changes, all window icons are reset to force reload with
    new theme
  5. This ensures task manager icons update properly when system icon
    theme changes

feat: 为X11窗口添加图标主题变更处理

  1. 在X11Window类中添加resetIcon()方法用于清除缓存的图标并发出变更信号
  2. 在X11WindowMonitor中实现图标主题变更检测
  3. 添加与DGuiApplicationHelper主题变更信号的连接
  4. 当主题变更时,所有窗口图标会被重置以强制使用新主题重新加载
  5. 这确保了任务管理器图标在系统图标主题变更时能正确更新

Summary by Sourcery

Handle icon theme changes for X11 windows by clearing cached icons and forcing reload when the system icon theme changes

New Features:

  • Detect system icon theme changes in X11WindowMonitor and trigger icon resets for all tracked windows
  • Add X11Window::resetIcon() to clear cached icons and emit the iconChanged signal

@sourcery-ai
Copy link

sourcery-ai bot commented Jun 24, 2025

Reviewer's Guide

Introduces dynamic icon theme support by clearing and reloading window icons when the system icon theme changes, ensuring task manager icons stay in sync.

Sequence diagram for icon theme change handling in X11WindowMonitor

sequenceDiagram
    participant DPlatformTheme as DPlatformTheme
    participant X11WindowMonitor as X11WindowMonitor
    participant X11Window as X11Window
    DPlatformTheme->>X11WindowMonitor: iconThemeNameChanged()
    X11WindowMonitor->>X11Window: resetIcon() (for each window)
    X11Window-->>X11WindowMonitor: iconChanged() signal (emitted)
Loading

Class diagram for X11Window and X11WindowMonitor icon theme change support

classDiagram
    class X11Window {
        +QString icon()
        +void resetIcon()
        +QString title()
        ...
    }
    class X11WindowMonitor {
        +void onIconThemeChanged()
        ...
    }
    X11WindowMonitor --> X11Window : manages
Loading

File-Level Changes

Change Details Files
Added resetIcon method to clear cached icons and emit change notifications
  • Declared resetIcon() in X11Window header
  • Implemented resetIcon() to clear m_icon and emit AbstractWindow::iconChanged()
panels/dock/taskmanager/x11window.h
panels/dock/taskmanager/x11window.cpp
Hooked into icon theme change signal and reset all window icons
  • Imported DGuiApplicationHelper and DPlatformTheme
  • Connected DPlatformTheme::iconThemeNameChanged to onIconThemeChanged() in X11WindowMonitor ctor
  • Declared onIconThemeChanged() slot in monitor header
  • Implemented onIconThemeChanged() to iterate m_windows and call resetIcon()
panels/dock/taskmanager/x11windowmonitor.h
panels/dock/taskmanager/x11windowmonitor.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @18202781743 - I've reviewed your changes - here's some feedback:

  • Consider disconnecting the iconThemeNameChanged signal in X11WindowMonitor’s destructor (or using a scoped connection) to avoid dangling subscriptions if the monitor is torn down before the application helper.
  • Resetting icons for all tracked windows in one go on every theme change could be costly; consider debouncing rapid theme-change events or limiting resets to only visible/mapped windows to reduce unnecessary work.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider disconnecting the iconThemeNameChanged signal in X11WindowMonitor’s destructor (or using a scoped connection) to avoid dangling subscriptions if the monitor is torn down before the application helper.
- Resetting icons for all tracked windows in one go on every theme change could be costly; consider debouncing rapid theme-change events or limiting resets to only visible/mapped windows to reduce unnecessary work.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@deepin-bot
Copy link

deepin-bot bot commented Jul 3, 2025

TAG Bot

New tag: 2.0.2
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #1178

1. Added sorting of notification entities by creation time (cTime) in
descending order
2. Ensures newest notifications appear first in the list
3. Improves user experience by showing most recent notifications at
the top
4. Sorting happens before the model reset to maintain data consistency

fix: 在显示前按时间戳排序通知

1. 添加了按创建时间(cTime)降序排列通知实体的功能
2. 确保最新的通知显示在列表最前面
3. 通过将最新通知显示在顶部来提升用户体验
4. 排序操作在模型重置前完成以保持数据一致性

pms:BUG-299935
@deepin-ci-robot
Copy link

deepin pr auto review

关键摘要:

  • 在新增的排序函数中,使用了lambda表达式,但没有对NotifyEntitycTime方法进行异常处理,可能存在未处理的异常。
  • 排序函数中使用了std::sort,但没有考虑NotifyEntitycTime方法的时间复杂度,可能影响性能。

是否建议立即修改:

@18202781743 18202781743 closed this Jul 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants