Conversation
as title pms: BUG-298681
任务栏亮度插件使用 SVG 图标 display-brightness-control(半填充太阳), 而控制中心插件区域使用 DCI 图标 dcc-dde-brightness(空心太阳), 两套图标资源独立维护导致视觉不一致。 将任务栏亮度插件改为加载与控制中心相同的 DCI 图标 dcc-dde-brightness,并添加 DCI 搜索路径。 Log: 修复任务栏亮度图标与控制中心插件区域图标不一致的问题 Bug: https://pms.uniontech.com/bug-view-296501.html
|
[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 guide (collapsed on small PRs)Reviewer's GuideThe PR changes the brightness taskbar plugin to load the same DCI icon as the control center by configuring the DCI search path and using dcc-dde-brightness; it also includes unrelated-looking wireless-casting icon packaging and metadata changes that should be reviewed separately. Sequence diagram for unified brightness icon loadingsequenceDiagram
participant BrightnessItem
participant DIconTheme
participant IconTheme
participant Taskbar
participant ControlCenter
BrightnessItem->>DIconTheme: dciThemeSearchPaths()
BrightnessItem->>DIconTheme: setDciThemeSearchPaths(dciPaths)
BrightnessItem->>IconTheme: fromTheme(dcc-dde-brightness)
IconTheme-->>BrightnessItem: DCI brightness icon
BrightnessItem->>Taskbar: setIcon(dcc-dde-brightness)
ControlCenter->>IconTheme: fromTheme(dcc-dde-brightness)
IconTheme-->>ControlCenter: Same DCI brightness icon
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="plugins/dde-dock/brightness/brightnessitem.cpp" line_range="56" />
<code_context>
- m_icon->setIcon(QIcon::fromTheme("display-brightness-control"));
+
+ auto dciPaths = Dtk::Gui::DIconTheme::dciThemeSearchPaths();
+ dciPaths.prepend("/usr/share/dde-dock/icons/dcc-setting");
+ Dtk::Gui::DIconTheme::setDciThemeSearchPaths(dciPaths);
+
</code_context>
<issue_to_address>
**issue (bug_risk):** The DCI search path is hard-coded to `/usr/share/dde-dock/icons/dcc-setting`, while CMake installs the icon relative to `CMAKE_INSTALL_PREFIX`. Builds or packages using a non-`/usr` prefix install `dcc-dde-brightness.dci` elsewhere, so `QIcon::fromTheme("dcc-dde-brightness")` cannot find the icon and the taskbar icon is empty.
**Triggers:** When the project is built or packaged with a `CMAKE_INSTALL_PREFIX` other than `/usr`.
**Suggested fix:** Use the configured install prefix or a runtime-resolved data path instead of hard-coding `/usr/share`.
</issue_to_address>| m_icon->setIcon(QIcon::fromTheme("display-brightness-control")); | ||
|
|
||
| auto dciPaths = Dtk::Gui::DIconTheme::dciThemeSearchPaths(); | ||
| dciPaths.prepend("/usr/share/dde-dock/icons/dcc-setting"); |
There was a problem hiding this comment.
issue (bug_risk): The DCI search path is hard-coded to /usr/share/dde-dock/icons/dcc-setting, while CMake installs the icon relative to CMAKE_INSTALL_PREFIX. Builds or packages using a non-/usr prefix install dcc-dde-brightness.dci elsewhere, so QIcon::fromTheme("dcc-dde-brightness") cannot find the icon and the taskbar icon is empty.
Triggers: When the project is built or packaged with a CMAKE_INSTALL_PREFIX other than /usr.
Suggested fix: Use the configured install prefix or a runtime-resolved data path instead of hard-coding /usr/share.
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 代码语法正确,逻辑清晰,无需修改 2. 代码质量 ✅评价: 优秀 ✅ 通过 潜在问题:
建议: 建议将硬编码路径提取为常量或宏定义,并为 DCI 搜索路径修改添加简要注释说明原因 3. 代码性能 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: DCI 路径设置仅在 init() 中执行一次,无性能问题 4. 代码安全 🔒评价: 优秀 ✅ 通过
安全漏洞详情: 建议: 无安全漏洞,代码安全合规 💡 改进建议代码示例// 建议使用常量定义路径,并添加注释
constexpr auto kDccSettingIconPath = "/usr/share/dde-dock/icons/dcc-setting";
void BrightnessItem::init()
{
m_icon->setFixedSize(Dock::DOCK_PLUGIN_ITEM_FIXED_SIZE);
// 添加控制中心插件图标搜索路径,确保 DCI 图标能被正确加载
auto dciPaths = Dtk::Gui::DIconTheme::dciThemeSearchPaths();
dciPaths.prepend(kDccSettingIconPath);
Dtk::Gui::DIconTheme::setDciThemeSearchPaths(dciPaths);
m_icon->setIcon(QIcon::fromTheme("dcc-dde-brightness"));
connect(m_applet, &BrightnessApplet::requestHideApplet, this, &BrightnessItem::requestHideApplet);
}本报告由 AI 代码审查工具自动生成 |
|
Closing: wrong direction. Fix moved to dde-control-center instead (per user feedback: Control Center should use taskbar's display-brightness-control icon, not the reverse). |
Root Cause Analysis
The brightness plugin in the taskbar (
brightnessitem.cpp) loads the SVG icondisplay-brightness-control(half-filled sun) viaQIcon::fromTheme(), while the control center plugin area loads the DCI icondcc-dde-brightness(hollow sun) from/usr/share/dde-dock/icons/dcc-setting/. Two independently maintained icon resources with no unified contract cause visual inconsistency.Key evidence:
brightnessitem.cpp:53usesQIcon::fromTheme("display-brightness-control")(SVG, half-filled sun)dccdockexport.cpploadPluginData()usesQIcon::fromTheme("dcc-dde-brightness")(DCI, hollow sun)dcc-dde-brightness.dciis installed by the same plugin'sCMakeLists.txtFix
Unify the taskbar brightness plugin to load the same DCI icon
dcc-dde-brightnessused by the control center:#include <DIconTheme>/usr/share/dde-dock/icons/dcc-settingviaDtk::Gui::DIconTheme::setDciThemeSearchPaths()display-brightness-controltodcc-dde-brightnessOnly 1 file changed (
brightnessitem.cpp), ~5 lines added/modified.Change Safety Assessment
Risk level: Low
BrightnessItem::init()was introduced in the initial commit and never modified sinceBusiness impact:
Verification suggestions:
根因分析
任务栏亮度插件(
brightnessitem.cpp)通过QIcon::fromTheme("display-brightness-control")加载 SVG 图标(半填充太阳),而控制中心插件区域通过QIcon::fromTheme("dcc-dde-brightness")加载 DCI 图标(空心太阳)。两套图标资源独立维护、无统一引用合约,导致视觉不一致。修复方案
将任务栏亮度插件改为加载与控制中心相同的 DCI 图标
dcc-dde-brightness:#include <DIconTheme>Dtk::Gui::DIconTheme::setDciThemeSearchPaths()添加 DCI 搜索路径/usr/share/dde-dock/icons/dcc-settingdisplay-brightness-control改为dcc-dde-brightness仅改动
brightnessitem.cpp1 个文件,约 5 行。改动安全评估
风险等级:低风险
BrightnessItem::init()自初始提交引入后从未修改业务影响范围:
验证建议:
Summary by Sourcery
Unify dock plugin icon resources so brightness and wireless casting icons use the intended DCI assets consistently.
Bug Fixes:
Build:
Chores: