Skip to content

fix(window-button): load icon synchronously#636

Merged
mhduiy merged 1 commit into
linuxdeepin:masterfrom
mhduiy:windowbutton
Jun 11, 2026
Merged

fix(window-button): load icon synchronously#636
mhduiy merged 1 commit into
linuxdeepin:masterfrom
mhduiy:windowbutton

Conversation

@mhduiy

@mhduiy mhduiy commented Jun 10, 2026

Copy link
Copy Markdown
Contributor
  1. Override the window button content item with a DCI icon.
  2. Disable asynchronous loading for the icon to avoid a blank first frame.
  3. Keep the existing palette, state, theme, and source size bindings.

Log: Load window button icons synchronously to prevent startup flicker.

fix(window-button): 同步加载窗口按钮图标

  1. 使用 DCI 图标覆盖窗口按钮的内容项。
  2. 关闭图标异步加载,避免启动首帧空白。
  3. 保留原有调色板、状态、主题和源尺寸绑定。

Log: 同步加载窗口按钮图标,避免启动时图标闪烁。
PMS: TASK-390989

Summary by Sourcery

Bug Fixes:

  • Prevent startup flicker by disabling asynchronous loading for the window button icon and binding a synchronous DCI icon as the button content.

1. Override the window button content item with a DCI icon.
2. Disable asynchronous loading for the icon to avoid a blank first frame.
3. Keep the existing palette, state, theme, and source size bindings.

Log: Load window button icons synchronously to prevent startup flicker.

fix(window-button): 同步加载窗口按钮图标

1. 使用 DCI 图标覆盖窗口按钮的内容项。
2. 关闭图标异步加载,避免启动首帧空白。
3. 保留原有调色板、状态、主题和源尺寸绑定。

Log: 同步加载窗口按钮图标,避免启动时图标闪烁。
PMS: TASK-390989
@sourcery-ai

sourcery-ai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Switches the window button to use an explicit DCI icon content item that is loaded synchronously, eliminating startup flicker while preserving existing appearance-related bindings.

File-Level Changes

Change Details Files
Render the window button icon via an explicit DCI icon content item loaded synchronously to avoid initial blank frames while keeping existing visual bindings.
  • Extend copyright year range in the WindowButton QML file.
  • Introduce a custom contentItem using D.DciIcon bound to the control's icon name.
  • Disable asynchronous loading on the DCI icon to ensure the icon is available on the first frame.
  • Bind the DCI icon's palette, mode, theme, and sourceSize to the control's existing palette/state/theme and icon dimensions to preserve styling and sizing.
  • Retain the existing icon width and height bindings on the control.
qt6/src/qml/WindowButton.qml

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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


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-ci-robot

Copy link
Copy Markdown
Contributor

deepin pr auto review

我对这个代码变更进行了审查,以下是我的分析和改进建议:

  1. 版权信息变更:
  • 版权年份从 "2021 - 2022" 更新为 "2021 - 2026"
  • 这是一个正常的版权信息更新,没有问题
  1. 代码结构变更:
  • 添加了 contentItem 属性,使用 D.DciIcon 替换了原来的默认图标显示
  • 保留了原有的 icon 属性设置
  1. 改进建议:

代码质量:

  • 新增的 contentItem 实现合理,使用了 DTK 的图标组件,保持了与系统风格的一致性
  • 异步加载设置 asynchronous: false 是明确的,避免了潜在的加载时序问题

代码性能:

  • 设置了明确的 sourceSize 可以避免图标渲染时的缩放性能问题
  • 使用 D.DTK.makeIconPalette 确保图标调色板正确,有助于提升渲染效率

代码安全:

  • 使用了系统提供的调色板和主题设置,避免了硬编码的颜色值,提高了可维护性和安全性
  • 通过 control.D.ColorSelector 获取控制状态和主题,确保了状态的一致性

潜在改进点:

  1. 建议为 contentItem 添加错误处理机制,以防图标加载失败的情况
  2. 考虑为 asynchronous: false 添加注释,说明为什么禁用异步加载(可能是为了确保界面同步更新)
  3. 可以考虑将图标大小定义提取为可配置的常量,便于统一管理和调整

总体而言,这个代码变更是一个合理的改进,通过使用 DTK 的图标组件提升了系统的集成度和一致性。代码结构清晰,性能考虑周到,安全性有保障。

@mhduiy mhduiy requested a review from 18202781743 June 11, 2026 01:31
@deepin-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, mhduiy

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

@mhduiy mhduiy merged commit 85956b1 into linuxdeepin:master Jun 11, 2026
21 checks passed
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.

3 participants