Skip to content

fix(keyboard): use DTK font manager for shortcuts edit button#3053

Merged
deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
add-uos:fix-BUG-338385
Mar 7, 2026
Merged

fix(keyboard): use DTK font manager for shortcuts edit button#3053
deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
add-uos:fix-BUG-338385

Conversation

@add-uos
Copy link
Contributor

@add-uos add-uos commented Mar 6, 2026

Replace hardcoded font size with DTK font manager to ensure consistent styling across different DDE themes.

使用DTK字体管理器替代硬编码字体大小,确保在不同DDE主题下样式一致。

Log: 修复快捷键编辑按钮字体样式
PMS: BUG-338385
Influence: 快捷键编辑按钮现在使用DTK字体管理器,在深色/浅色主题下显示效果更加统一。

Summary by Sourcery

Bug Fixes:

  • Fix inconsistent font styling of the shortcuts edit/done button across different DDE themes.

@sourcery-ai
Copy link

sourcery-ai bot commented Mar 6, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Replaces the hardcoded font size of the shortcuts edit/done button with a DTK font manager-provided font to ensure consistent appearance across themes.

File-Level Changes

Change Details Files
Use DTK font manager for the shortcuts edit/done button font instead of a hardcoded point size.
  • Replaced explicit font.pointSize: 12 with font: D.DTK.fontManager.t8 on the edit/done button in the shortcuts list.
  • Keeps other visual properties (layout, text, background, textColor) unchanged so only font styling source is modified.
src/plugin-keyboard/qml/Shortcuts.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

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 - 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.

Replace hardcoded font size with DTK font manager to ensure consistent
styling across different DDE themes.

使用DTK字体管理器替代硬编码字体大小,确保在不同DDE主题下样式一致。

Log: 修复快捷键编辑按钮字体样式
PMS: BUG-338385
Influence: 快捷键编辑按钮现在使用DTK字体管理器,在深色/浅色主题下显示效果更加统一。
@deepin-ci-robot
Copy link

deepin pr auto review

针对您提供的 git diff 内容,我主要关注了 QML 文件 Shortcuts.qml 中的变更。以下是针对语法逻辑、代码质量、代码性能和代码安全的详细审查意见:

1. 变更内容分析

这段代码主要包含两处修改:

  1. 版权年份更新:将 SPDX-FileCopyrightText 中的年份范围从 2024 - 2027 修改为 2024 - 2026
  2. 字体样式统一:将按钮的 font.pointSize: 12 修改为使用 DTK 统一字体管理接口 font: D.DTK.fontManager.t8

2. 详细审查意见

A. 语法逻辑

  • 状态:通过
  • 分析
    • 版权年份的修改符合字符串字面量的语法规则。
    • font: D.DTK.fontManager.t8 的写法在 QML 中是合法的属性绑定,前提是 D.DTK.fontManager 对象及其 t8 属性已正确定义并导入。这通常用于替换旧的 font.pointSize 写法,以适应新的设计系统。

B. 代码质量

  • 状态:优秀
  • 分析
    • 字体管理规范化:将硬编码的 font.pointSize: 12 替换为 D.DTK.fontManager.t8 是极佳的改进。这使得 UI 能够跟随 DDE (Deepin Desktop Environment) 的主题系统自动调整字体大小,提高了代码的可维护性和一致性,避免了“魔法数字”。
    • 版权信息:版权年份的更新属于常规维护,确保了法律声明的准确性。

C. 代码性能

  • 状态:无影响
  • 分析
    • font.pointSize 切换到 font 属性绑定(绑定到对象引用),在性能上几乎没有区别。两者都是在组件初始化或属性变化时进行计算。
    • 这不属于频繁调用的热点路径,因此不会对性能产生负面影响。

D. 代码安全

  • 状态:安全
  • 分析
    • 修改仅涉及显示文本的版权年份和字体样式,不涉及任何数据处理、网络请求、权限提升或用户输入验证,因此不引入安全风险。

3. 改进建议与总结

虽然当前的修改是正确的,但为了确保代码的健壮性,提出以下建议:

  1. 关于字体回退

    • 建议:确认 D.DTK.fontManager 是否在所有运行环境中都可用。如果该模块可能加载失败或未定义,建议在代码中增加防御性检查(尽管在 DCC 控制中心模块中通常假设 DTK 环境是存在的)。
    • 代码示例(仅供参考)
      // 如果需要防御性编程,可以写成这样,但在 DTK 环境下通常直接使用即可
      font: D.DTK.fontManager ? D.DTK.fontManager.t8 : Qt.font({ family: "Noto Sans", pointSize: 12 })
  2. 关于版权年份

    • 建议:确认 2026 是预期的结束年份。通常如果是持续维护的项目,结束年份可能会留空或设置为当前年份 + 若干年。如果这是特定版本的有效期,则当前修改是正确的。

总结
这段代码修改质量很高,主要是为了适配 DTK 的设计规范(字体管理)和更新版权信息。它提升了代码的可维护性和 UI 的一致性,没有引入逻辑错误或安全隐患。可以放心合并。

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

@add-uos
Copy link
Contributor Author

add-uos commented Mar 7, 2026

/merge

1 similar comment
@add-uos
Copy link
Contributor Author

add-uos commented Mar 7, 2026

/merge

@deepin-bot
Copy link

deepin-bot bot commented Mar 7, 2026

This pr cannot be merged! (status: behind)

@add-uos
Copy link
Contributor Author

add-uos commented Mar 7, 2026

/merge

@deepin-bot
Copy link

deepin-bot bot commented Mar 7, 2026

This pr cannot be merged! (status: behind)

@add-uos
Copy link
Contributor Author

add-uos commented Mar 7, 2026

/forcemerge

@deepin-bot
Copy link

deepin-bot bot commented Mar 7, 2026

This pr force merged! (status: behind)

@deepin-bot deepin-bot bot merged commit 0dbf3c6 into linuxdeepin:master Mar 7, 2026
19 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