Repository navigation
refactor: use theme lookup for fallback icon - #843
Conversation
|
[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. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
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
5e7072a to
00ec09e
Compare
Reviewer's GuideImplementationReplace the bundled-resource fallback with a theme lookup for the desktop icon while preserving the existing fallback warning.
ConfigurationRemove the bundled desktop-icon SVG and its qresource entry now that the fallback uses the system theme.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
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>| // 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")); |
There was a problem hiding this comment.
🟡 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 pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题: 建议: [] 2. 代码质量 ✅评价: 代码结构清晰,注释完整 ✅ 通过 潜在问题: 建议: [] 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: [] 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: [] 💡 改进建议代码示例本报告由 AI 代码审查工具自动生成 |
|
/forcemerge |
|
This pr force merged! (status: blocked) |
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:
refactor: 使用主题查找替代内置回退图标
该内嵌 SVG 与系统主题图标重复,依赖系统图标主题可减少打包资源,并使回退
逻辑与其他图标解析流程保持一致。
Influence:
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:
Chores: