fix(ui): normalize invalid available size to dash in size info widget - #221
Conversation
When m_availableSize contains a "-" (e.g. from negative value formatting), normalize it to "-" to avoid displaying invalid available space. 当可用空间值含"-"(如负值格式化结果)时,将其统一为"-",避免显示无效的可用空间值。 Log: 修复可用空间显示含"-"的异常值 PMS: BUG-204631 Influence: 修复后分区信息中可用空间显示为"-"而非负值,避免界面显示异常。
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThe size information widget now converts available-size values containing a hyphen into a standalone “-” before painting, ensuring invalid or negative formatted values are shown as unavailable space rather than displayed directly. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 无需要修改的语法逻辑问题 2. 代码质量 ✅评价: 优秀 ✅ 通过 潜在问题:
建议: 建议在新增代码前添加简短注释,说明规范化逻辑的目的,与commit message描述保持一致 3. 代码性能 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 无需性能优化,QString::contains()操作复杂度为O(n),字符串长度通常很短(<20字符),在paintEvent中的开销可忽略不计 4. 代码安全 🔒评价: 优秀 ✅ 通过
安全漏洞详情: 建议: 无安全风险,代码仅处理内部成员变量的字符串显示,不涉及用户输入、文件操作或网络通信 💡 改进建议代码示例// 绘制首页下方标注
if (m_flag) {
DGuiApplicationHelper::ColorType themeType = DGuiApplicationHelper::instance()->themeType();
// 规范化可用空间显示,避免负值格式化结果显示异常
if (m_availableSize.contains("-"))
m_availableSize = "-";
if (themeType == DGuiApplicationHelper::LightType) {本报告由 AI 代码审查工具自动生成 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: GongHeng2017, max-lvs 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 |
|
/merge |
When m_availableSize contains a "-" (e.g. from negative value formatting), normalize it to "-" to avoid displaying invalid available space.
当可用空间值含"-"(如负值格式化结果)时,将其统一为"-",避免显示无效的可用空间值。
Log: 修复可用空间显示含"-"的异常值
PMS: BUG-204631
Influence: 修复后分区信息中可用空间显示为"-"而非负值,避免界面显示异常。
Summary by Sourcery
Bug Fixes: