Skip to content

fix(theme): skip initGlobalTheme for treeland environment#272

Merged
mhduiy merged 1 commit into
linuxdeepin:masterfrom
mhduiy:initwallpaper
Jun 25, 2026
Merged

fix(theme): skip initGlobalTheme for treeland environment#272
mhduiy merged 1 commit into
linuxdeepin:masterfrom
mhduiy:initwallpaper

Conversation

@mhduiy

@mhduiy mhduiy commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Treeland does not need global theme initialization logic. All personalization settings in treeland follow the control center protocol instead.

treeland环境下跳过全局主题初始化,treeland下所有个性化设置走控制中心协议。

Log: treeland下跳过全局主题初始化
PMS: TASK-391987
Influence: treeland环境下不再执行全局主题初始化,避免与控制中心协议冲突。
Change-Id: I70dcfee6981869a740bd444799f273efa34d41bc

Summary by Sourcery

Skip global theme initialization in treeland environments to align personalization handling with the control center protocol.

Bug Fixes:

  • Prevent global theme initialization from running in treeland, avoiding conflicts with control center-based personalization settings.

Enhancements:

  • Log when global theme initialization is skipped in treeland and ensure the current global theme is taken from existing properties.

Documentation:

  • Update copyright header years in appearance manager implementation source file.

Treeland does not need global theme initialization logic.
All personalization settings in treeland follow the control
center protocol instead.

treeland环境下跳过全局主题初始化,treeland下所有个性化设置走控制中心协议。

Log: treeland下跳过全局主题初始化
PMS: TASK-391987
Influence: treeland环境下不再执行全局主题初始化,避免与控制中心协议冲突。
Change-Id: I70dcfee6981869a740bd444799f273efa34d41bc
@sourcery-ai

sourcery-ai Bot commented Jun 25, 2026

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

Reviewer's Guide

This PR updates the global theme initialization logic so that in the Treeland environment global theme init is skipped and the theme is instead aligned with the property-based value, avoiding conflict with the control center protocol.

Sequence diagram for updated initGlobalTheme behavior in Treeland

sequenceDiagram
    participant Caller
    participant AppearanceManager
    participant utils
    participant Subthemes

    Caller->>AppearanceManager: initGlobalTheme()
    AppearanceManager->>utils: isTreeland()
    utils-->>AppearanceManager: bool
    alt [Treeland environment]
        AppearanceManager->>AppearanceManager: m_currentGlobalTheme = m_property->globalTheme
        AppearanceManager-->>Caller: return
    else [Non-Treeland environment]
        AppearanceManager->>Subthemes: listGlobalThemes()
        Subthemes-->>AppearanceManager: QVector<Theme>
        AppearanceManager->>AppearanceManager: select and apply global theme
        AppearanceManager-->>Caller: return
    end
Loading

File-Level Changes

Change Details Files
Skip global theme initialization in Treeland environments to rely solely on control center-driven personalization.
  • Add an early return in global theme initialization when running in Treeland, guarded by a utils::isTreeland() check.
  • Log a diagnostic message when global theme initialization is skipped in Treeland.
  • Set the current global theme directly from the stored globalTheme property when skipping initialization in Treeland.
  • Update the file copyright year range to extend through 2026.
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 found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="src/service/impl/appearancemanager.cpp" line_range="1698-1703" />
<code_context>
 {
+    // treeland 不需要走初始化全局主题逻辑,treeland下所有的个性化设置全部走控制中心的协议
+    if (utils::isTreeland()) {
+        qInfo() << "treeland, skip initGlobalTheme";
+        m_currentGlobalTheme = m_property->globalTheme;
+        return;
</code_context>
<issue_to_address>
**suggestion:** Evaluate whether qInfo is the appropriate log level for this path, given it runs on every Treeland startup.

Since this runs on every Treeland startup, please confirm whether this message is truly noteworthy in production. If it’s part of a normal path, consider downgrading to debug or removing it to reduce log noise; otherwise keeping it at info is fine.

```suggestion
    // treeland 不需要走初始化全局主题逻辑,treeland下所有的个性化设置全部走控制中心的协议
    if (utils::isTreeland()) {
        // 正常启动路径上的日志,降低到 debug 级别以减少生产环境中的日志噪音
        qDebug() << "treeland, skip initGlobalTheme";
        m_currentGlobalTheme = m_property->globalTheme;
        return;
    }
```
</issue_to_address>

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.

Comment thread src/service/impl/appearancemanager.cpp
@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

★ 总体评分:100分

■ 【总体评价】

代码增加了对treeland环境的跳过逻辑,质量优秀且无任何安全风险
逻辑正确、注释清晰、性能无损耗且无安全漏洞,满分通过

■ 【详细分析】

  • 1.语法逻辑(完全正确)✓
    AppearanceManager::initGlobalTheme() 函数入口处增加了条件判断,使用 if 语句结合提前返回控制流程,未发现语法或逻辑错误。
    建议:保持现有逻辑。
  • 2.代码质量(优秀)✓
    注释准确说明了跳过初始化全局主题逻辑的业务原因,代码简洁明了,变量使用符合上下文规范。
    建议:保持现有注释风格。
  • 3.代码性能(高效)✓
    在 treeland 环境下通过提前返回避免了后续 listGlobalThemes 等潜在的资源消耗操作,非 treeland 环境仅增加一次极低开销的条件判断。
    建议:无需优化。
  • 4.代码安全(存在0个安全漏洞)✓
    漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个
    代码仅包含环境检测与变量赋值,未引入外部输入处理、内存操作或命令执行,无安全风险。
  • 建议:继续保持安全的编码习惯。

■ 【改进建议代码示例】

// 当前代码已足够优秀,无需改进,此处展示当前最佳实践
void AppearanceManager::initGlobalTheme()
{
    // treeland 不需要走初始化全局主题逻辑,treeland下所有的个性化设置全部走控制中心的协议
    if (utils::isTreeland()) {
        qInfo() << "treeland, skip initGlobalTheme";
        m_currentGlobalTheme = m_property->globalTheme;
        return;
    }

    QVector<QSharedPointer<Theme>> globalList = m_subthemes->listGlobalThemes();
    bool bFound = false;
}

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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 29bcac3 into linuxdeepin:master Jun 25, 2026
18 of 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