Skip to content

fix: 修复通过 dde-dconfig-editor 修改字体后控制中心 UI 不刷新 - #282

Open
mhduiy wants to merge 1 commit into
masterfrom
fix/bug-353505-font-dconfig-ui-not-refresh
Open

mhduiy wants to merge 1 commit into
masterfrom
fix/bug-353505-font-dconfig-ui-not-refresh

Conversation

@mhduiy

@mhduiy mhduiy commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

问题

PMS BUG-353505

用户通过 dde-dconfig-editor 手动修改 org.deepin.dde.appearance 的标准字体或等宽字体后,控制中心 UI 不刷新,仍显示旧字体。

根因

handleSettingDConfigChangeGSKEYFONTSTANDARD / GSKEYFONTMONOSPACE 两个分支只调用了 doSetStandardFont / doSetMonospaceFont 应用字体变更,但遗漏了 setStandardFont / setMonospaceFont 来更新 DBus 属性 m_property

m_property 未更新 → PropertiesChanged DBus 信号未发出 → 控制中心 Q_PROPERTY NOTIFY 信号未收到 → UI 不刷新。

证据

  • doSetStandardFont / doSetMonospaceFont 内部不调用 setXxx(与 doSetGtkTheme / doSetIconTheme / doSetCursorTheme 内部已调用 setXxx 不同),形成确定性遗漏。
  • 同文件 Set 方法对 TYPESTANDARDFONT / TYPEMONOSPACEFONT 使用 doSetXxx + setXxx 正确写法。
  • handleSettingDConfigChangeGSKEYGLOBALTHEME 分支也使用 doSetGlobalTheme + setGlobalTheme 正确写法(doSetGlobalTheme 内部同样不调用 setGlobalTheme)。

修复

handleSettingDConfigChange 中为两个分支补充 setXxx 调用,与 GSKEYGLOBALTHEME 分支保持一致:

bSuccess = doSetStandardFont(value);
if (bSuccess) {
    setStandardFont(value);      // 新增
}
// monospaceFont 同理
bSuccess = doSetMonospaceFont(value);
if (bSuccess) {
    setMonospaceFont(value);     // 新增
}

改动量:6 行,仅涉及 appearancemanager.cppsetStandardFont / setMonospaceFont 内部有值比对守卫,无重复触发风险。

影响

仅 standardFont / monospaceFont 两个设置项受影响,其余设置项不受影响。

Summary by Sourcery

Bug Fixes:

  • Refresh the control center UI after standard or monospace fonts are changed through dde-dconfig-editor by updating the corresponding properties and emitting their change notifications.

When the user changes the standard font or monospace font via
dde-dconfig-editor, handleSettingDConfigChange is triggered but only
calls doSetStandardFont/doSetMonospaceFont without calling
setStandardFont/setMonospaceFont. As a result, m_property is never
updated, the PropertiesChanged DBus signal is not emitted, and the
control center UI does not refresh.

This patch adds the missing setStandardFont/setMonospaceFont calls
(guarded by bSuccess), matching the existing pattern used by the
GSKEYGLOBALTHEME branch and the Set method.

Fixes: PMS BUG-353505
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 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

@sourcery-ai

sourcery-ai Bot commented Sep 14, 2026

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

Reviewer's Guide

修复通过 dde-dconfig-editor 修改标准字体或等宽字体后控制中心 UI 不刷新的问题:在字体实际应用成功后同步更新对应 DBus 属性,从而触发 PropertiesChanged 和 Q_PROPERTY NOTIFY 通知。

Sequence diagram for font changes from dconfig to refreshed control center UI

sequenceDiagram
    participant Editor as dde-dconfig-editor
    participant Manager as AppearanceManager
    participant DBus as DBus Properties
    participant ControlCenter as ControlCenter UI

    Editor->>Manager: handleSettingDConfigChange(key)
    alt standardFont
        Manager->>Manager: doSetStandardFont(value)
        Manager->>Manager: setStandardFont(value)
    else monospaceFont
        Manager->>Manager: doSetMonospaceFont(value)
        Manager->>Manager: setMonospaceFont(value)
    end
    Manager->>DBus: PropertiesChanged
    DBus-->>ControlCenter: Q_PROPERTY NOTIFY
    ControlCenter->>ControlCenter: Refresh displayed font
Loading

File-Level Changes

Change Details Files
在通过 DConfig 处理字体变更时同步更新 DBus 属性,确保控制中心收到属性变化通知并刷新 UI。
  • 标准字体变更成功后调用 setStandardFont 更新属性
  • 等宽字体变更成功后调用 setMonospaceFont 更新属性
  • 保留底层字体应用失败时不更新属性的行为
src/service/impl/appearancemanager.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

@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 ✨

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 100 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 本次提交修复了通过 dde-dconfig-editor 修改字体后控制中心 UI 不刷新的问题。在 handleSettingDConfigChange 函数中,当标准字体和等宽字体的 DConfig 配置变更成功后,新增了对 setStandardFont 和 setMonospaceFont 的调用来更新 DBus 属性,从而触发 UI 刷新。代码遵循了函数中已有的模式(如 GSKEYGLOBALTHEME 处理逻辑),语法正确,逻辑清晰,无安全漏洞。

🔍 详细分析

1. 语法逻辑 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


2. 代码质量 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


3. 代码性能 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


4. 代码安全 🔒

评价: 优秀 ✅ 通过

🔐 发现 0 个安全漏洞

安全漏洞详情:
✅ 未发现安全漏洞

建议: []


💡 改进建议代码示例

// 暂无代码示例

本报告由 AI 代码审查工具自动生成

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