Skip to content

feat: add configurable system version text on login/lock screen - #86

Merged
xionglinlin merged 1 commit into
linuxdeepin:masterfrom
xionglinlin:master
Sep 9, 2026
Merged

xionglinlin merged 1 commit into
linuxdeepin:masterfrom
xionglinlin:master

Conversation

@xionglinlin

@xionglinlin xionglinlin commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor
  1. Add new dconfig key "systemVersionText" to lock and greeter configuration files
  2. Set default value to empty string, displaying system default version info when empty
  3. When configured, custom text replaces default version info on login/ lock screens
  4. Implement dynamic config binding and property change handling
  5. Add unit tests covering custom text display, fallback behavior, and dconfig change callbacks
  6. Update copyright years
  7. Escape $ and backticks in the commit message using backslashes

Log: When systemVersionText is set, the custom text will display instead of the default version number and type. Set as empty to restore.

Influence:

  1. Verify the login screen displays the correct system version info by default
  2. Configure systemVersionText in dconfig and verify the custom text appears
  3. Clear systemVersionText and verify the default version info is displayed again
  4. Test on the lock screen to ensure the same behavior applies
  5. Verify the setting persists across login/logout and lock/unlock cycles

feat: 支持自定义登录/锁屏界面系统版本信息

  1. 在锁屏和登录界面配置文件中添加新的 dconfig 键 "systemVersionText"
  2. 设置默认值为空字符串,为空时显示系统默认版本信息
  3. 配置了自定义文本时,替换默认版本信息显示在登录/锁屏界面上
  4. 实现动态配置绑定和属性变更处理
  5. 添加单元测试覆盖自定义文本显示、回退行为和 dconfig 变更回调
  6. 更新版权年份

Log: 当设置了 systemVersionText 时,将显示自定义文本并替代默认的版本号和
系统类型。设置空值即可恢复默认显示。

Influence:

  1. 验证登录界面默认显示正确的系统版本信息
  2. 在 dconfig 中配置 systemVersionText,验证自定义文本正确出现
  3. 清空 systemVersionText,验证默认版本信息恢复显示
  4. 在锁屏界面进行相同测试,确保行为一致
  5. 验证设置在登录/注销及锁屏/解锁周期中保持生效

PMS: TASK-395357
Change-Id: I2664dc814ef98bf9f31cc0f450c57ab7e1508fe5

Summary by Sourcery

Add configurable system version text for login and lock screens while preserving the default version display when unset.

New Features:

  • Allow login and lock screens to display configurable custom system version text, with the existing version information shown when the setting is empty.

Enhancements:

  • Support live updates to the displayed version text when the configuration changes.

Tests:

  • Add coverage for custom version text, default fallback behavior, and runtime configuration change callbacks.

Chores:

  • Update copyright years and add the new configuration key to the greeter and lock-screen configurations.

1. Add new dconfig key "systemVersionText" to lock and greeter
configuration files
2. Set default value to empty string, displaying system default version
info when empty
3. When configured, custom text replaces default version info on login/
lock screens
4. Implement dynamic config binding and property change handling
5. Add unit tests covering custom text display, fallback behavior, and
dconfig change callbacks
6. Update copyright years
7. Escape `$` and backticks in the commit message using backslashes

Log: When systemVersionText is set, the custom text will display instead
of the default version number and type. Set as empty to restore.

Influence:
1. Verify the login screen displays the correct system version info
by default
2. Configure systemVersionText in dconfig and verify the custom text
appears
3. Clear systemVersionText and verify the default version info is
displayed again
4. Test on the lock screen to ensure the same behavior applies
5. Verify the setting persists across login/logout and lock/unlock
cycles

feat: 支持自定义登录/锁屏界面系统版本信息

1. 在锁屏和登录界面配置文件中添加新的 dconfig 键 "systemVersionText"
2. 设置默认值为空字符串,为空时显示系统默认版本信息
3. 配置了自定义文本时,替换默认版本信息显示在登录/锁屏界面上
4. 实现动态配置绑定和属性变更处理
5. 添加单元测试覆盖自定义文本显示、回退行为和 dconfig 变更回调
6. 更新版权年份

Log: 当设置了 systemVersionText 时,将显示自定义文本并替代默认的版本号和
系统类型。设置空值即可恢复默认显示。

Influence:
1. 验证登录界面默认显示正确的系统版本信息
2. 在 dconfig 中配置 systemVersionText,验证自定义文本正确出现
3. 清空 systemVersionText,验证默认版本信息恢复显示
4. 在锁屏界面进行相同测试,确保行为一致
5. 验证设置在登录/注销及锁屏/解锁周期中保持生效

PMS: TASK-395357
Change-Id: I2664dc814ef98bf9f31cc0f450c57ab7e1508fe5
@sourcery-ai

sourcery-ai Bot commented Sep 9, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds systemVersionText to greeter and lock configurations, uses it to replace the default version label when non-empty, and dynamically restores or updates the display as dconfig changes; unit tests cover the main display and callback paths.

Sequence diagram for dynamic system version text updates

sequenceDiagram
    participant DConfig as DConfigHelper
    participant LogoWidget
    participant Label as VersionLabel

    LogoWidget->>DConfig: getConfig(SYSTEM_VERSION_TEXT, "")
    DConfig-->>LogoWidget: systemVersionText
    LogoWidget->>LogoWidget: updateVersionText(customText)
    alt customText is empty
        LogoWidget->>LogoWidget: getVersion()
        LogoWidget->>Label: setText(default version)
    else customText is configured
        LogoWidget->>Label: setText(customText)
    end

    DConfig->>LogoWidget: onDConfigPropertyChanged(SYSTEM_VERSION_TEXT, value, objPtr)
    LogoWidget->>LogoWidget: updateVersionText(value)
    LogoWidget->>Label: setText(updated version text)
Loading

File-Level Changes

Change Details Files
Expose a new configurable system version text with empty-value fallback semantics.
  • Add systemVersionText with an empty default to both greeter and lock dconfig schemas, including snipe variants.
  • Define a shared configuration key for the feature.
  • Use custom text when non-empty and retain the existing system version otherwise.
configs/org.deepin.dde.lightdm-deepin-greeter.json
configs/org.deepin.dde.lock.json
configs/snipe/org.deepin.dde.lightdm-deepin-greeter.json
configs/snipe/org.deepin.dde.lock.json
src/global_util/constants.h
src/widgets/logowidget.cpp
src/widgets/logowidget.h
Support live updates to the displayed version text through dconfig property binding.
  • Bind systemVersionText alongside existing logo and visibility settings.
  • Handle runtime changes by updating the version label and preserving fallback behavior.
  • Reapply the configured value during locale updates.
src/widgets/logowidget.cpp
src/widgets/logowidget.h
Add unit coverage for custom, fallback, and callback-driven version display behavior.
  • Verify the default label is populated where version information is supported.
  • Exercise custom text, empty fallback, and dconfig callback updates.
tests/dde-lock/ut_logowidget.cpp
Refresh SPDX copyright years in modified implementation and test files.
  • Update copyright ranges through 2026.
src/widgets/logowidget.cpp
src/widgets/logowidget.h
tests/dde-lock/ut_logowidget.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 ✨

Comment thread src/widgets/logowidget.cpp
@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

AI 代码审查报告

PR: feat: add configurable system version text on login/lock screen
作者: xionglinlin
项目: linuxdeepin/dde-session-shell
PMS: TASK-395357
分析模式: 全量分析(GitHub PR)
扫描时间: 2026-09-09 13:25:00


总体评分:98 分(优秀)

维度 评分 满分 标记 评价词
语法逻辑 25 25 ✓ 语法正确,逻辑清晰
代码质量 23 25 ✓ 代码结构清晰,注释完整
代码性能 20 20 ✓ 性能良好,资源使用合理
代码安全 30 30 ✓ 存在0个安全漏洞

总体评价

代码审查通过。本次提交实现了通过 dconfig 配置自定义登录/锁屏界面系统版本信息的功能,代码实现清晰,功能完整,测试覆盖充分。4个 JSON 配置文件新增 systemVersionText 键,C++ 代码新增 updateVersionText 方法处理自定义文本与默认版本号的切换逻辑,单元测试覆盖了自定义文本显示、空值回退和 dconfig 变更回调场景。未发现安全漏洞。仅 updateVersionText 方法缺少简要注释,建议补充。


维度1:语法逻辑 ✓(25/25)

语法正确,逻辑清晰

分析内容:

本次提交涉及 8 个文件的修改,核心逻辑如下:

  1. 配置文件(4个 JSON 文件):在 configs/ 和 configs/snipe/ 目录下的 lightdm-deepin-greeter 和 lock 配置文件中新增 systemVersionText 键,默认值为空字符串,具有 global 标志和 private 可见性,与同文件中其他配置项格式一致。

  2. constants.h(第93行):新增常量 SYSTEM_VERSION_TEXT = QStringLiteral("systemVersionText"),命名规范与同文件中 SHOW_SYSTEM_VERSION 一致。

  3. logowidget.cpp:

    • initUI()(第84行):将原来的 m_logoVersionLabel->setText(getVersion()) 替换为 updateVersionText(DConfigHelper::instance()->getConfig(SYSTEM_VERSION_TEXT, "").toString()),从 dconfig 读取配置值并委托给新方法处理。
    • 新增 DConfigHelper::instance()->bind(this, SYSTEM_VERSION_TEXT, &LogoWidget::onDConfigPropertyChanged) 绑定配置变更回调。
    • 新增方法 updateVersionText()(第127-129行):当 customText 为空时调用 getVersion() 显示系统默认版本号,不为空时显示自定义文本。
    • updateLocale()(第131行):同样替换为调用 updateVersionText,保持一致性。
    • onDConfigPropertyChanged()(第157-158行):新增 SYSTEM_VERSION_TEXT 键的处理分支,调用 updateVersionText。
  4. logowidget.h(第24行):新增 void updateVersionText(const QString &customText) 方法声明。

  5. ut_logowidget.cpp:新增 versionText 测试用例,覆盖自定义文本显示、空值回退、dconfig 变更回调等场景。

潜在问题:

  1. 无编译错误,逻辑正确
  2. 空字符串回退到默认版本号的逻辑处理完善
  3. DConfig 绑定确保配置变更时实时更新显示
  4. 教育版跳过逻辑在 updateLocale 和测试中均保持一致

维度2:代码质量 ✓(23/25)

代码结构清晰,注释完整

分析内容:

  1. 代码重构:提取 updateVersionText 方法消除了 initUI() 和 updateLocale() 中的重复代码,提高了可维护性。
  2. 测试覆盖:单元测试覆盖了核心功能路径——自定义文本设置、空值回退、dconfig 回调触发,并正确处理了教育版跳过场景。
  3. 配置规范:4个 JSON 配置文件均包含完整的 name、name[zh_CN]、description[zh_CN]、permissions、visibility 字段,描述清晰准确。
  4. 命名规范:常量 SYSTEM_VERSION_TEXT 与配置键 systemVersionText 命名一致,方法名 updateVersionText 语义明确。
  5. 版权更新:logowidget.cpp、logowidget.h、ut_logowidget.cpp 的版权年份已更新至 2026。

潜在问题:

  1. src/widgets/logowidget.cpp 第127行,updateVersionText 方法缺少简要注释。该方法是本次提交的核心新增方法,建议添加注释说明其功能:当 customText 为空时回退到默认版本信息,不为空时显示自定义文本内容。(-2分)

改进建议代码示例:

/**
 * @brief 更新版本文本显示
 * @param customText 自定义版本文本,为空时显示系统默认版本号
 */
void LogoWidget::updateVersionText(const QString &customText)
{
    m_logoVersionLabel->setText(customText.isEmpty() ? getVersion() : customText);
}

维度3:代码性能 ✓(20/20)

性能良好,资源使用合理

分析内容:

  1. 参数传递:updateVersionText 使用 const QString & 引用参数,避免不必要的字符串拷贝。
  2. 配置读取:DConfigHelper::instance()->getConfig() 是轻量级的配置读取操作,与现有代码模式一致,无性能隐患。
  3. 事件绑定:DConfigHelper::instance()->bind() 仅在初始化时绑定一次,配置变更时通过回调触发更新,效率合理。
  4. 无冗余计算:getVersion() 仅在需要显示默认版本号时调用,配置了自定义文本时不会触发。

潜在问题:

  1. 无性能瓶颈
  2. 资源使用合理
  3. 算法复杂度合理

维度4:代码安全 ✓(30/30)

存在0个安全漏洞

漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个

分析内容:

  1. 输入安全:systemVersionText 配置值仅用于 QLabel::setText() 显示,QLabel 默认不解析 HTML,不存在 XSS 风险。
  2. 权限控制:配置项设置为 private 可见性和 readwrite 权限,与同文件其他敏感配置项一致。
  3. 无注入风险:代码中无命令执行、SQL 查询、文件路径拼接等危险操作。
  4. 无硬编码凭证:未发现硬编码的密钥、密码或 Token。
  5. 无敏感信息泄露:日志和显示内容均为系统版本信息,不涉及敏感数据。

安全漏洞详情:
无安全漏洞。


审查结论

本次提交为 新增功能 类型,目的是实现通过 dconfig 配置自定义登录/锁屏界面系统版本信息。代码实现与 commit message 描述的功能完全一致:

  1. 在锁屏和登录界面配置文件中添加 systemVersionText dconfig 键 ✓
  2. 默认值为空字符串,为空时显示系统默认版本信息 ✓
  3. 配置自定义文本时替换默认版本信息 ✓
  4. 实现动态配置绑定和属性变更处理 ✓
  5. 添加单元测试覆盖核心场景 ✓
  6. 更新版权年份 ✓

代码质量良好,建议补充 updateVersionText 方法的注释以提升可维护性。


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

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: xionglinlin, yixinshark

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

@xionglinlin
xionglinlin merged commit 604aadf into linuxdeepin:master Sep 9, 2026
14 of 15 checks passed
xionglinlin pushed a commit to linuxdeepin/dde-session-shell-snipe that referenced this pull request Sep 9, 2026
Synchronize source files from linuxdeepin/dde-session-shell.

Source-pull-request: linuxdeepin/dde-session-shell#86
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