Skip to content

Conversation

@wjyrich
Copy link
Contributor

@wjyrich wjyrich commented Nov 25, 2025

Changed battery icon fill colors from green (#3ACB00) to black/white for better visual consistency
Modified PowerStatusWidget::refreshIcon() to pass only the icon path instead of icon name and path
Updated all battery level icons (40%-100%) for both light and dark themes
Removed redundant icon name parameter from setIcon() call to simplify API usage

Log: Updated battery icon colors for better visual consistency

Influence:

  1. Test battery level display in system dock with different charge levels
  2. Verify battery icons appear correctly in both light and dark themes
  3. Check charging state icons when plugged in
  4. Test battery percentage display accuracy
  5. Verify icon updates when battery level changes

fix: 更新电池图标颜色和API调用

将电池图标填充颜色从绿色(#3ACB00)改为黑色/白色,以获得更好的视觉一致性
修改PowerStatusWidget::refreshIcon()方法,仅传递图标路径而非图标名称和 路径
更新所有电池电量级别图标(40%-100%),适用于浅色和深色主题
从setIcon()调用中移除冗余的图标名称参数,简化API使用

Log: 更新电池图标颜色以获得更好的视觉一致性

Influence:

  1. 测试系统托盘中不同电量级别的电池显示
  2. 验证浅色和深色主题下的电池图标显示正确
  3. 检查插入电源时的充电状态图标
  4. 测试电池百分比显示的准确性
  5. 验证电池电量变化时图标更新正常

PMS: BUG-342033

Summary by Sourcery

Align battery status dock icons with updated artwork and simplify the icon setting API usage.

Bug Fixes:

  • Correct battery icon appearance at various charge levels in light and dark themes for improved visual consistency.

Enhancements:

  • Update high-level battery status SVG icons (40%–100%, plugged and unplugged) to use the new color scheme.
  • Refine PowerStatusWidget icon refresh logic to pass only the icon path, removing redundant icon name parameters.

Changed battery icon fill colors from green (#3ACB00) to black/white for
better visual consistency
Modified PowerStatusWidget::refreshIcon() to pass only the icon path
instead of icon name and path
Updated all battery level icons (40%-100%) for both light and dark
themes
Removed redundant icon name parameter from setIcon() call to simplify
API usage

Log: Updated battery icon colors for better visual consistency

Influence:
1. Test battery level display in system dock with different charge
levels
2. Verify battery icons appear correctly in both light and dark themes
3. Check charging state icons when plugged in
4. Test battery percentage display accuracy
5. Verify icon updates when battery level changes

fix: 更新电池图标颜色和API调用

将电池图标填充颜色从绿色(#3ACB00)改为黑色/白色,以获得更好的视觉一致性
修改PowerStatusWidget::refreshIcon()方法,仅传递图标路径而非图标名称和
路径
更新所有电池电量级别图标(40%-100%),适用于浅色和深色主题
从setIcon()调用中移除冗余的图标名称参数,简化API使用

Log: 更新电池图标颜色以获得更好的视觉一致性

Influence:
1. 测试系统托盘中不同电量级别的电池显示
2. 验证浅色和深色主题下的电池图标显示正确
3. 检查插入电源时的充电状态图标
4. 测试电池百分比显示的准确性
5. 验证电池电量变化时图标更新正常

PMS: BUG-342033
@sourcery-ai
Copy link

sourcery-ai bot commented Nov 25, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR updates the battery dock widget to use a simplified icon-setting API while replacing the green-filled battery SVGs with black/white variants across 40–100% levels for both light and dark, plugged and unplugged states.

Sequence diagram for updated battery icon refresh flow

sequenceDiagram
    participant PowerStatusWidget
    participant IconWidget
    participant DockApplet

    PowerStatusWidget->>PowerStatusWidget: refreshIcon(percentage, plugged)
    PowerStatusWidget->>PowerStatusWidget: compute percentageStr
    PowerStatusWidget->>PowerStatusWidget: build iconStr
    PowerStatusWidget->>IconWidget: setIcon(iconPath)
    PowerStatusWidget->>DockApplet: refreshBatteryIcon(iconStr)
Loading

Class diagram for PowerStatusWidget icon update changes

classDiagram
    class PowerStatusWidget {
        - IconWidget m_iconWidget
        - DockApplet m_applet
        + refreshIcon(int percentage, bool plugged) void
    }

    class IconWidget {
        + setIcon(string iconPath) void
    }

    class DockApplet {
        + refreshBatteryIcon(string iconStr) void
    }

    PowerStatusWidget --> IconWidget : uses
    PowerStatusWidget --> DockApplet : uses
Loading

Flow diagram for selecting and applying battery icons

flowchart TD
    A_Start["Start refreshIcon"] --> B_GetStatus["Get current battery percentage and plugged state"]
    B_GetStatus --> C_PercentageStr["Compute percentageStr from percentage"]
    C_PercentageStr --> D_BuildIconStr["Build iconStr based on percentageStr and plugged state"]
    D_BuildIconStr --> E_BuildIconPath["Build iconPath = :/batteryicons/batteryicons/ + iconStr + .svg"]
    E_BuildIconPath --> F_SetIcon["IconWidget setIcon(iconPath)"]
    F_SetIcon --> G_NotifyApplet["DockApplet refreshBatteryIcon(iconStr)"]
    G_NotifyApplet --> H_End["End refreshIcon"]
Loading

File-Level Changes

Change Details Files
Simplified PowerStatusWidget icon refresh to pass only the icon resource path to the icon widget.
  • Updated refreshIcon() to construct the full icon resource path from the icon key string.
  • Changed setIcon() usage from taking icon name and path to taking just the full path.
  • Kept applet battery icon refresh logic using the icon key string unchanged for status tracking.
plugins/dde-dock/power/powerstatuswidget.cpp
Updated battery SVG assets to use black/white fills for mid-to-high charge levels across light and dark themes.
  • Replaced green-filled battery icons with black or white fill to improve visual consistency with the system theme.
  • Updated all 40–100% battery icons for plugged and unplugged states in both light and dark variants.
  • Ensured naming and resource paths for updated SVGs remain consistent so existing code can load them without further changes.
plugins/dde-dock/power/resources/batteryicons/battery-040-plugged-symbolic-dark.svg
plugins/dde-dock/power/resources/batteryicons/battery-040-plugged-symbolic.svg
plugins/dde-dock/power/resources/batteryicons/battery-040-symbolic-dark.svg
plugins/dde-dock/power/resources/batteryicons/battery-040-symbolic.svg
plugins/dde-dock/power/resources/batteryicons/battery-050-plugged-symbolic-dark.svg
plugins/dde-dock/power/resources/batteryicons/battery-050-plugged-symbolic.svg
plugins/dde-dock/power/resources/batteryicons/battery-050-symbolic-dark.svg
plugins/dde-dock/power/resources/batteryicons/battery-050-symbolic.svg
plugins/dde-dock/power/resources/batteryicons/battery-060-plugged-symbolic-dark.svg
plugins/dde-dock/power/resources/batteryicons/battery-060-plugged-symbolic.svg
plugins/dde-dock/power/resources/batteryicons/battery-060-symbolic-dark.svg
plugins/dde-dock/power/resources/batteryicons/battery-060-symbolic.svg
plugins/dde-dock/power/resources/batteryicons/battery-070-plugged-symbolic-dark.svg
plugins/dde-dock/power/resources/batteryicons/battery-070-plugged-symbolic.svg
plugins/dde-dock/power/resources/batteryicons/battery-070-symbolic-dark.svg
plugins/dde-dock/power/resources/batteryicons/battery-070-symbolic.svg
plugins/dde-dock/power/resources/batteryicons/battery-080-plugged-symbolic-dark.svg
plugins/dde-dock/power/resources/batteryicons/battery-080-plugged-symbolic.svg
plugins/dde-dock/power/resources/batteryicons/battery-080-symbolic-dark.svg
plugins/dde-dock/power/resources/batteryicons/battery-080-symbolic.svg
plugins/dde-dock/power/resources/batteryicons/battery-090-plugged-symbolic-dark.svg
plugins/dde-dock/power/resources/batteryicons/battery-090-plugged-symbolic.svg
plugins/dde-dock/power/resources/batteryicons/battery-090-symbolic-dark.svg
plugins/dde-dock/power/resources/batteryicons/battery-090-symbolic.svg
plugins/dde-dock/power/resources/batteryicons/battery-100-plugged-symbolic-dark.svg
plugins/dde-dock/power/resources/batteryicons/battery-100-plugged-symbolic.svg
plugins/dde-dock/power/resources/batteryicons/battery-100-symbolic-dark.svg
plugins/dde-dock/power/resources/batteryicons/battery-100-symbolic.svg

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

@deepin-ci-robot
Copy link

deepin pr auto review

我来对这个diff进行代码审查:

  1. 代码逻辑审查:
  • 主要修改在powerstatuswidget.cpp中,简化了setIcon()的调用,移除了多余的iconStr参数
  • 其他修改都是SVG图标文件的颜色变更,将绿色(#3ACB00)改为黑色(#000000)或白色(#FFFFFF)
  1. 代码质量改进:
  • powerstatuswidget.cpp中的修改是合理的,因为之前传入iconStr参数但在函数内部并没有使用该参数
  • 建议在setIcon()函数定义中也相应移除未使用的参数,以保持接口一致性
  1. 代码性能:
  • 这些修改不会对性能产生显著影响
  • 移除未使用的参数可以略微提高代码效率
  1. 代码安全:
  • 修改不涉及安全性问题
  • SVG图标的颜色修改不会引入安全风险
  1. 其他建议:
  • 考虑为SVG图标颜色的变更添加注释,说明修改原因
  • 建议检查其他使用setIcon()的地方是否也需要相应修改
  • 可以考虑使用CSS变量来管理图标颜色,便于后续主题切换

总结:
这是一个相对简单的修改,主要目的是统一电池图标的显示颜色。代码逻辑清晰,修改合理。建议继续完善相关接口的一致性,并添加适当的注释说明。

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • Now that setIcon() only takes a path, consider renaming the parameter or adding a brief comment at the call site to clarify that iconStr is still used as a logical icon identifier only by refreshBatteryIcon(), while the widget receives a full resource path.
  • You’ve updated the 40%–100% battery icons to the new color scheme; if intentional, it might still be worth double‑checking whether the 0%–30% icons should also follow the same black/white style for visual consistency across all levels.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Now that setIcon() only takes a path, consider renaming the parameter or adding a brief comment at the call site to clarify that iconStr is still used as a logical icon identifier only by refreshBatteryIcon(), while the widget receives a full resource path.
- You’ve updated the 40%–100% battery icons to the new color scheme; if intentional, it might still be worth double‑checking whether the 0%–30% icons should also follow the same black/white style for visual consistency across all levels.

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.

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mhduiy, 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

@wjyrich
Copy link
Contributor Author

wjyrich commented Nov 25, 2025

/forcemerge

@deepin-bot
Copy link

deepin-bot bot commented Nov 25, 2025

This pr force merged! (status: blocked)

@deepin-bot deepin-bot bot merged commit 8e50618 into linuxdeepin:master Nov 25, 2025
8 of 10 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