Conversation
When a theme icon has no DCI file (e.g. CutefishDark's user-trash), DciIcon falls back to QIcon which draws SVG at native size without scaling. Add isDciIcon() check and route non-DCI icons through LauncherAppIconProvider which uses DSvgRenderer for proper scaling. Log: BUG-342397
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mhduiy 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 |
Reviewer's GuideFullscreen launcher icons now detect whether their theme provides DCI assets: DCI icons retain the existing DciIcon rendering, while non-DCI icons use a registered SVG-capable provider and standard Image sizing so they scale to the requested launcher dimensions instead of remaining at native SVG size. Sequence diagram for fullscreen launcher icon renderingsequenceDiagram
participant Delegate as IconItemDelegate
participant Integration as DesktopIntegration
participant Theme as DIconTheme
participant DCI as DciIcon
participant Provider as LauncherAppIconProvider
participant Renderer as DSvgRenderer
Delegate->>Integration: isDciIcon(iconSource)
Integration->>Theme: findDciIconFile(iconName, themeName)
Theme-->>Integration: DCI file path or empty
alt DCI file exists
Integration-->>Delegate: true
Delegate->>DCI: Render icon
else DCI file absent
Integration-->>Delegate: false
Delegate->>Provider: Load image://appicon/iconSource
Provider->>Renderer: Render SVG at requested sourceSize
Renderer-->>Provider: Scaled image
Provider-->>Delegate: Image data
end
File-Level Changes
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="qml/IconItemDelegate.qml" line_range="345" />
<code_context>
fillMode: Image.PreserveAspectFit
}
}
</code_context>
<issue_to_address>
**issue (broader_impact):** The non-DCI branch passes every `iconSource` through `LauncherAppIconProvider`, whose request parser strips the leading slash from absolute file paths and treats `data:image/...` values as icon names. Fullscreen icons supplied as an absolute SVG/bitmap path or data URL therefore fail to load and fall back to the provider's default/empty pixmap, whereas the previous `DciIcon` path accepted those sources.
**Triggers:** When an application's icon source is an absolute filesystem path or a data URL rather than a theme icon name.
**Suggested fix:** Use the provider only for theme icon names, or preserve and handle file paths/data URLs before routing the source through the theme-icon provider.
</issue_to_address>| objectName: "appIcon" | ||
| anchors.fill: parent | ||
| source: "image://appicon/" + iconSource | ||
| fillMode: Image.PreserveAspectFit |
There was a problem hiding this comment.
issue (broader_impact): The non-DCI branch passes every iconSource through LauncherAppIconProvider, whose request parser strips the leading slash from absolute file paths and treats data:image/... values as icon names. Fullscreen icons supplied as an absolute SVG/bitmap path or data URL therefore fail to load and fall back to the provider's default/empty pixmap, whereas the previous DciIcon path accepted those sources.
Triggers: When an application's icon source is an absolute filesystem path or a data URL rather than a theme icon name.
Suggested fix: Use the provider only for theme icon names, or preserve and handle file paths/data URLs before routing the source through the theme-icon provider.
deepin pr auto review
|
|
这个图标是一个较小的svg图标,且 DDE 的自动转dci逻辑在这里不生效,因为自动转dci的逻辑只针对application图标,这个图标是放在/usr/share/icons/cutefishdark.382952b6/places/16/user-trash.svg 这里的,另外,dtk绘制图标的时候为了能够控制图标颜色,使用paint函数绘制,这个函数绘制图标的时候是不会缩大图标的,当画板过大,或者原始图标资源过小的时候,会造成图标无法撑满画板的情况,最终表现出来就是图标偏小。目前暂时没有比较好的解决办法,暂时遗留 |
Root Cause Analysis
When a theme icon has no DCI file (e.g. CutefishDark's
user-trash), DTK'sDciIconfalls back to theQIconpath whereicon.paint()draws the SVG at its native 16px size onto a 128×128 transparent canvas without scaling. The result is a tiny 16px icon centered in a 128×128 image, andfillMode: PreserveAspectFitcannot help because the output is already 128×128. Key evidence:dquickimageprovider.cpp:97paints at SVG native size;dquickdciiconimage.cpp:72-86falls back to QIcon when no DCI file is found;IconItemDelegate.qml:317-326requests 128×128 in fullscreen mode.Fix
Added
DesktopIntegration.isDciIcon()— aQ_INVOKABLEstatic method that checks whether a DCI file exists for the given icon name in the current icon theme. InIconItemDelegate.qml, theimageComponentnow uses a conditionalLoader: DCI icons take the originalDciIconpath (unchanged), while non-DCI icons route through a standardImagecomponent backed byLauncherAppIconProvider, which usesDSvgRendererfor proper SVG scaling. TheLauncherAppIconProvideris registered inLauncherItem::init().Change Safety Assessment
Code Safety
DciIconlogic unchanged insidedciIconComponent.Business Impact Scope
imageComponent).Verification Suggestion
根因分析
当主题图标没有 DCI 文件时(如 CutefishDark 的
user-trash),DTK 的DciIcon回退到QIcon路径,icon.paint()以 SVG 原生 16px 尺寸绘制到 128×128 透明画布上,不进行缩放。最终输出 128×128 图像中只有一个 16px 小图标,fillMode: PreserveAspectFit对已是 128×128 的输出无效。关键证据:dquickimageprovider.cpp:97以 SVG 原生尺寸绘制;dquickdciiconimage.cpp:72-86无 DCI 文件时回退到 QIcon;IconItemDelegate.qml:317-326全屏模式请求 128×128。修复方案
新增
DesktopIntegration.isDciIcon()— 一个Q_INVOKABLE静态方法,检查当前图标主题中是否存在指定图标名的 DCI 文件。在IconItemDelegate.qml中,imageComponent改为条件Loader:DCI 图标走原DciIcon路径(不变),非 DCI 图标走标准Image组件,通过LauncherAppIconProvider(使用DSvgRenderer正确缩放 SVG)。LauncherAppIconProvider在LauncherItem::init()中注册。改动安全评估
代码安全评估
DciIcon逻辑完整保留在dciIconComponent中,未做修改。业务影响范围
imageComponent)。验证建议
Summary by Sourcery
Fix fullscreen launcher icon sizing for themes that do not provide DCI icon files.
Bug Fixes:
Enhancements: