Skip to content

refactor: use theme lookup for fallback icon - #843

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
wjyrich:fix-svg-398355
Nov 10, 2026
Merged

deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
wjyrich:fix-svg-398355

Conversation

@wjyrich

@wjyrich wjyrich commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor
  1. Remove the bundled application-x-desktop.svg image resource
  2. Drop its qresource entry from qml.qrc
  3. Replace the hardcoded resource path fallback in IconUtils::getThemeIcon with DIconTheme::findQIcon lookup for "application-x-desktop"

The embedded SVG was a duplicate of a standard theme icon, so relying on the system icon theme reduces bundled resources and keeps the fallback consistent with the rest of the icon resolution logic.

Influence:

  1. Verify that missing icons still display the fallback desktop icon when the system theme provides application-x-desktop
  2. Check fallback behavior when the icon theme lacks application- x-desktop
  3. Verify existing theme icon resolution still works for normal icon names
  4. Confirm the application builds without the removed qrc entry
  5. Check the fallback warning is still logged when an icon cannot be found
  6. Confirm no runtime errors referencing the old :/images/application-x- desktop.svg path

refactor: 使用主题查找替代内置回退图标

  1. 移除内置的 application-x-desktop.svg 图片资源
  2. 从 qml.qrc 中删除对应的 qresource 条目
  3. 将 IconUtils::getThemeIcon 中硬编码的资源路径回退替换为 DIconTheme::findQIcon 查找 "application-x-desktop"

该内嵌 SVG 与系统主题图标重复,依赖系统图标主题可减少打包资源,并使回退
逻辑与其他图标解析流程保持一致。

Influence:

  1. 验证系统主题提供 application-x-desktop 时,缺失图标仍显示回退桌面图标
  2. 检查图标主题缺少 application-x-desktop 时的回退行为
  3. 验证常规图标名称的主题解析仍然正常
  4. 确认移除 qrc 条目后应用可正常构建
  5. 检查找不到图标时仍会输出回退警告日志
  6. 确认运行时不再引用旧的 :/images/application-x-desktop.svg 路径

PMS: TASK-398355

Summary by Sourcery

Replace the bundled desktop fallback icon with system theme lookup to reduce duplicate resources and keep icon resolution consistent.

Enhancements:

  • Use the system icon theme to resolve the default desktop icon fallback instead of bundling a duplicate SVG resource.

Chores:

  • Remove the bundled application-x-desktop SVG and its QML resource registration.

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: wjyrich

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

1. Remove the bundled application-x-desktop.svg image resource
2. Drop its qresource entry from qml.qrc
3. Replace the hardcoded resource path fallback in
IconUtils::getThemeIcon with DIconTheme::findQIcon lookup for
"application-x-desktop"

The embedded SVG was a duplicate of a standard theme icon, so relying on
the system icon theme reduces bundled resources and keeps the fallback
consistent with the rest of the icon resolution logic.

Influence:
1. Verify that missing icons still display the fallback desktop icon
when the system theme provides application-x-desktop
2. Check fallback behavior when the icon theme lacks application-
x-desktop
3. Verify existing theme icon resolution still works for normal icon
names
4. Confirm the application builds without the removed qrc entry
5. Check the fallback warning is still logged when an icon cannot be
found
6. Confirm no runtime errors referencing the old :/images/application-x-
desktop.svg path

refactor: 使用主题查找替代内置回退图标

1. 移除内置的 application-x-desktop.svg 图片资源
2. 从 qml.qrc 中删除对应的 qresource 条目
3. 将 IconUtils::getThemeIcon 中硬编码的资源路径回退替换为
DIconTheme::findQIcon 查找 "application-x-desktop"

该内嵌 SVG 与系统主题图标重复,依赖系统图标主题可减少打包资源,并使回退
逻辑与其他图标解析流程保持一致。

Influence:
1. 验证系统主题提供 application-x-desktop 时,缺失图标仍显示回退桌面图标
2. 检查图标主题缺少 application-x-desktop 时的回退行为
3. 验证常规图标名称的主题解析仍然正常
4. 确认移除 qrc 条目后应用可正常构建
5. 检查找不到图标时仍会输出回退警告日志
6. 确认运行时不再引用旧的 :/images/application-x-desktop.svg 路径

PMS: TASK-398355
@sourcery-ai

sourcery-ai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Implementation

Replace the bundled-resource fallback with a theme lookup for the desktop icon while preserving the existing fallback warning.

  • src/utils/iconutils.cpp L1, L80

Configuration

Remove the bundled desktop-icon SVG and its qresource entry now that the fallback uses the system theme.

  • images/application-x-desktop.svg (deleted)
  • qml.qrc L2 (removed lines)

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/utils/iconutils.cpp" line_range="80" />
<code_context>
         // TODO why icon is not null, but it's name is empty.
         if (icon.isNull() || icon.name().isEmpty()) {
-            icon = QIcon(":/images/application-x-desktop.svg");
+            icon = DIconTheme::findQIcon(QStringLiteral("application-x-desktop"));
             qWarning() << "It fallbacks to default icon for [" << actualIconName << "].";
             findIcon = false;
</code_context>
<issue_to_address>
**Missing icons render blank**

When the active icon theme does not provide a usable `application-x-desktop` icon, `DIconTheme::findQIcon(...)` returns a null icon, so `icon.pixmap(...)` stays null and `getThemeIcon` or the icon providers return blank or transparent icons instead of the bundled desktop fallback.

Keep the bundled SVG as the fallback when the theme lookup fails, or otherwise provide a guaranteed non-null icon.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread src/utils/iconutils.cpp
// TODO why icon is not null, but it's name is empty.
if (icon.isNull() || icon.name().isEmpty()) {
icon = QIcon(":/images/application-x-desktop.svg");
icon = DIconTheme::findQIcon(QStringLiteral("application-x-desktop"));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · Missing icons render blank

When the active icon theme does not provide a usable application-x-desktop icon, DIconTheme::findQIcon(...) returns a null icon, so icon.pixmap(...) stays null and getThemeIcon or the icon providers return blank or transparent icons instead of the bundled desktop fallback.

Keep the bundled SVG as the fallback when the theme lookup fails, or otherwise provide a guaranteed non-null icon.

Prompt for AI agents
In `src/utils/iconutils.cpp` at line 80:

**Missing icons render blank**

When the active icon theme does not provide a usable `application-x-desktop` icon, `DIconTheme::findQIcon(...)` returns a null icon, so `icon.pixmap(...)` stays null and `getThemeIcon` or the icon providers return blank or transparent icons instead of the bundled desktop fallback.

Keep the bundled SVG as the fallback when the theme lookup fails, or otherwise provide a guaranteed non-null icon.

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

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

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 本次提交将 fallback 图标加载方式从嵌入式 SVG 资源改为 DDE 主题图标查找(DIconTheme::findQIcon),同时清理了 qml.qrc 中不再使用的资源条目。改动范围小、目的明确,四维度均无问题,启发式扫描和 OCR 审查均未发现问题。

🔍 详细分析

1. 语法逻辑 ✅

评价: 语法正确,逻辑清晰 ✅ 通过

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

建议: []


2. 代码质量 ✅

评价: 代码结构清晰,注释完整 ✅ 通过

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

建议: []


3. 代码性能 ✅

评价: 性能良好,资源使用合理 ✅ 通过

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

建议: []


4. 代码安全 🔒

评价: 存在0个安全漏洞 ✅ 通过

🔐 发现 0 个安全漏洞

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

建议: []


💡 改进建议代码示例


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

@wjyrich

wjyrich commented Nov 10, 2026

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot

deepin-bot Bot commented Nov 10, 2026

Copy link
Copy Markdown

This pr force merged! (status: blocked)

@deepin-bot
deepin-bot Bot merged commit 5834ba7 into linuxdeepin:master Nov 10, 2026
5 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