Repository navigation
fix: show hint when mkfs progress reaches cap - #51
deepin-bot[bot] merged 1 commit into
Conversation
Reviewer's GuideThe PR addresses the apparent 99% hang during slow mkfs.ext3 operations by showing a localized large-disk hint and stopping the simulated progress timer at the existing cap, while resetting the reusable formatting page so retries start without stale hints or progress. Sequence diagram for capped quick-format progress hintsequenceDiagram
participant MainWindow
participant FormatingPage
participant Timer
participant DUDisksJob
MainWindow->>Timer: start(300)
loop simulated progress
Timer->>MainWindow: timeout
MainWindow->>FormatingPage: setProgress(progress)
end
Timer->>MainWindow: timeout at cap
MainWindow->>FormatingPage: setProgress(0.99)
MainWindow->>FormatingPage: setHintText(tr(...))
MainWindow->>Timer: stop()
DUDisksJob->>FormatingPage: setProgress(1)
DUDisksJob->>MainWindow: completed
Sequence diagram for formatting retry resetsequenceDiagram
participant User
participant MainWindow
participant FormatingPage
participant DWaterProgress
User->>MainWindow: formatDevice()
MainWindow->>FormatingPage: reset()
FormatingPage->>DWaterProgress: setValue(1)
FormatingPage-->>MainWindow: hint cleared and hidden
MainWindow->>FormatingPage: setProgress(progress)
FormatingPage-->>User: fresh formatting progress
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
a21697c to
684277c
Compare
1. Root cause: mkfs (quick format) simulates progress at a fixed rate (0.06 per 300ms), reaching the 0.99 cap in about 5 seconds, while mkfs.ext3 on a large disk takes tens of seconds to minutes. The progress indicator sits at 99% with no feedback, so users believe the program has frozen. 2. Fix: keep the 0.99 cap unchanged and show a hint text "Large capacity disks may take longer" once progress caps; stop the timer after capping to avoid repeated setHintText() calls. Add FormatingPage::reset() and call it from formatDevice(), because the formating page is reused when the user retries after a failure and would otherwise keep the stale hint visible from 0%; fill in the new string for both the English and zh_CN translation files. 3. Impact: the mkfs path only; the erase path and the DUDisksJob::completed chain are unchanged, so progress still reaches 100% on completion. Log: Show hint when mkfs progress reaches the cap Influence: 1. Format a small disk with quick format (no hint, completes normally) 2. Format a large disk with quick format (progress caps at 99% with hint) 3. Fail a format then retry (hint must not appear before the cap) 4. Verify the erase format path is unaffected PMS: BUG-291279
684277c to
203c3fe
Compare
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题: 建议: [] 2. 代码质量 ✅评价: 代码结构清晰,注释完整 ✅ 通过 潜在问题: 建议: [] 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: [] 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: [] 💡 改进建议代码示例本次代码质量良好,无需修复。以下为当前实现的关键代码片段,供参考:
// formatingpage.cpp - reset() 方法实现 void FormatingPage::reset() {
if (m_hintLabel) {
m_hintLabel->clear();
m_hintLabel->hide();
}
// setProgress 会跳过 0 值,这里直接复位动画进度
if (m_progressBox) {
m_progressBox->setValue(1);
}
}本报告由 AI 代码审查工具自动生成 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: max-lvs, tianming-1996 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 |
|
/forcemerge |
|
This pr force merged! (status: unstable) |
1cbd333
into
linuxdeepin:develop/eagle
修复:格式化 EXT3 卡在 99% (PMS BUG-291279)
根因
MainWindow::initConnect()中 mkfs(快速格式化)路径使用固定速率模拟进度(0.06/300ms),约 5 秒到达 0.99 上限后停住。大容量磁盘mkfs.ext3实际耗时数十秒至数分钟,进度条长时间停留在 99% 且没有任何提示,用户误以为程序卡死。实机复现数据(114.5 GB USB 机械盘,快速格式化 ext3):
同盘对照:ext4 只需 8.63 秒(有
uninit_bg,inode 表延迟初始化),ext3 必须写满 inode 表,慢 3.7 倍。修复方案:保留 99% 封顶,仅补充提示
不在 0.99 → 0.95 上做改动,原因:
0.06 × 16 = 0.96会先显示 96%,下一拍才进 else 设成 95%,进度条会当着用户的面倒退一格。而 95% 与 99% 在用户感知上没有区别,真正解决"像卡死"的是提示文字。保留 0.99 意味着完全不动已有进度逻辑,零回归风险。同时修复:失败重试时提示残留
FormatingPage在构造函数中只创建一次,格式化失败后用户点「重新格式化」走FormattError → Normal → Warn → Formating,复用同一个页面对象。setHintText()只有show()没有hide(),导致第二次格式化时进度条刚从 0% 爬升,提示文字已经挂在界面上了。新增
FormatingPage::reset(),在formatDevice()开头调用(erase和mkfs两条路径的唯一入口):改动文件
view/formatingpage.hQLabel前置声明、setHintText()/reset()接口、m_hintLabel成员view/formatingpage.cppinitUI()中创建提示标签(自动换行、居中、默认隐藏),实现两个新方法view/mainwindow.cppsetHintText()并停止定时器;formatDevice()开头调用reset()translations/dde-device-formatter.tstranslations/dde-device-formatter_zh_CN.ts验证
代码层(
FormatingPage独立 UI 测试,Qt5 + Dtk,offscreen):文案在不同宽度下的排版(实测主窗口 1040 px):
真机验证(UOS 20 专业版 arm64, 5.10.97):编译通过,无错误无警告;
strings确认新串已编入二进制;lconvert反解 qm 确认中文翻译正确。影响范围
erase(完整格式化)路径使用真实的progressChanged信号,未改动DUDisksJob::completed→setProgress(1)→onFormatingFinished完成链路未改动,进度仍能正常到 100%测试建议
PMS: BUG-291279
Summary by Sourcery
Prevent quick formatting from appearing stuck at 99% by showing a large-disk wait hint and resetting formatting state on retries.
New Features:
Bug Fixes:
Enhancements: