From 8ca9c126710f44355280beeaf302305bdfd037cc Mon Sep 17 00:00:00 2001 From: re2zero Date: Mon, 12 Oct 2026 15:57:09 +0800 Subject: [PATCH] fix: add scan completion notification message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Root cause: onScanFinished() only logged debug output and wrote to a hidden m_historyEdit widget, no user-visible notification shown 2. Fix: use DMessageManager to display success/failure messages after scan save completes, matching existing pattern in mainwindow.cpp 3. Impact: users now see a confirmation message when scan completes successfully or fails to save Log: Added scan completion notification message Influence: 1. Test scan completion with a connected scanner device 2. Verify success message displays with saved file path 3. Verify failure message displays when save fails fix: 添加扫描完成提示消息 1. 根因:onScanFinished() 仅输出 debug 日志并写入隐藏的 m_historyEdit 控件,无任何用户可见通知 2. 方案:使用 DMessageManager 在扫描保存完成后显示成功/失败提示, 与 mainwindow.cpp 中现有模式一致 3. 影响:用户现在可以看到扫描完成成功或保存失败的提示消息 Log: 添加扫描完成提示消息 Influence: 1. 测试连接扫描仪设备后完成扫描 2. 验证成功时显示包含保存文件路径的提示 3. 验证保存失败时显示失败提示 PMS: BUG-323729 --- src/ui/scanwidget.cpp | 5 +++ translations/deepin-scanner_en_US.ts | 58 ++++++++++++++++------------ translations/deepin-scanner_zh_CN.ts | 58 ++++++++++++++++------------ translations/deepin-scanner_zh_HK.ts | 58 ++++++++++++++++------------ translations/deepin-scanner_zh_TW.ts | 58 ++++++++++++++++------------ 5 files changed, 141 insertions(+), 96 deletions(-) diff --git a/src/ui/scanwidget.cpp b/src/ui/scanwidget.cpp index ba12d1c..34e9697 100644 --- a/src/ui/scanwidget.cpp +++ b/src/ui/scanwidget.cpp @@ -30,6 +30,7 @@ #include #include #include +#include using namespace DDLog; @@ -625,8 +626,12 @@ void ScanWidget::onScanFinished(const QImage &image) // add the saved file path to the top of the history box m_historyEdit->moveCursor(QTextCursor::Start); m_historyEdit->insertPlainText(result.filePath + "\n"); + DMessageManager::instance()->sendMessage(window(), QIcon::fromTheme("dialog-ok"), + tr("Scan completed, saved to: %1").arg(result.filePath)); } else { qCWarning(app) << "Failed to save scan to:" << result.filePath; + DMessageManager::instance()->sendMessage(window(), QIcon::fromTheme("dialog-warning"), + tr("Failed to save scan.")); } }); watcher->setFuture(QtConcurrent::run(&ScanWidget::saveScan, request)); diff --git a/translations/deepin-scanner_en_US.ts b/translations/deepin-scanner_en_US.ts index e722bd7..2b9179f 100644 --- a/translations/deepin-scanner_en_US.ts +++ b/translations/deepin-scanner_en_US.ts @@ -47,110 +47,120 @@ ScanWidget - + Scan Settings Scan Settings - + Resolution Resolution - + Color Mode Color Mode - + Image Format Image Format - + Paper Size Paper Size - + Scan Scan - + View Scanned Image View Scanned Image - + Scan history will be shown here Scan history will be shown here - + Scan Mode Scan Mode - - - + + + Flatbed Flatbed - + Video Format Video Format - + Color Color - + Grayscale Grayscale - + Black White Black White - + Auto Auto - + Device not initialized Device not initialized - - + + Initializing preview... Initializing preview... - + Device preview not available Device preview not available - + No preview image No preview image - + + Scan completed, saved to: %1 + Scan completed, saved to: %1 + + + + Failed to save scan. + Failed to save scan. + + + ADF ADF - + Duplex Duplex diff --git a/translations/deepin-scanner_zh_CN.ts b/translations/deepin-scanner_zh_CN.ts index 177ea61..05e7580 100644 --- a/translations/deepin-scanner_zh_CN.ts +++ b/translations/deepin-scanner_zh_CN.ts @@ -59,37 +59,37 @@ Scanner functionality will be unavailable. ScanWidget - + Scan Settings 扫描设置 - + Resolution 分辨率 - + Color Mode 色彩模式 - + Image Format 图像格式 - + Paper Size 纸张尺寸 - + View Scanned Image 查看已扫描图像 - + Scan 扫描 @@ -98,75 +98,85 @@ Scanner functionality will be unavailable. 保存 - + Scan Mode 扫描模式 - - - + + + Flatbed 平板扫描 - + Duplex 双面扫描 - + Video Format 视频格式 - + Color 彩色 - + Grayscale 灰度 - + Black White 黑白 - + + Scan completed, saved to: %1 + 扫描完成,已保存至:%1 + + + + Failed to save scan. + 扫描保存失败。 + + + ADF ADF - + Scan history will be shown here 扫描历史将在此处显示 - + Auto 自动 - + Device not initialized 设备未初始化 - - + + Initializing preview... 正在初始化预览... - + Device preview not available 设备预览不可用 - + No preview image 无预览图像 diff --git a/translations/deepin-scanner_zh_HK.ts b/translations/deepin-scanner_zh_HK.ts index e583b50..115fa39 100644 --- a/translations/deepin-scanner_zh_HK.ts +++ b/translations/deepin-scanner_zh_HK.ts @@ -59,37 +59,37 @@ Scanner functionality will be unavailable. ScanWidget - + Scan Settings 掃描設定 - + Resolution 解析度 - + Color Mode 色彩模式 - + Image Format 圖像格式 - + Paper Size 紙張尺寸 - + View Scanned Image 查看掃描圖像 - + Scan 掃描 @@ -98,75 +98,85 @@ Scanner functionality will be unavailable. 儲存 - + Scan Mode 掃描模式 - - - + + + Flatbed 平板掃描 - + Duplex 雙面掃描 - + Video Format 視頻格式 - + Color 彩色 - + Grayscale 灰度 - + Black White 黑白 - + + Scan completed, saved to: %1 + 掃描完成,已儲存至:%1 + + + + Failed to save scan. + 掃描儲存失敗。 + + + ADF ADF - + Scan history will be shown here 掃描歷史將顯示在這裡 - + Auto 自動 - + Device not initialized 設備未初始化 - - + + Initializing preview... 正在初始化預覽... - + Device preview not available 設備預覽不可用 - + No preview image 無預覽圖像 diff --git a/translations/deepin-scanner_zh_TW.ts b/translations/deepin-scanner_zh_TW.ts index 8a70431..fbbcc90 100644 --- a/translations/deepin-scanner_zh_TW.ts +++ b/translations/deepin-scanner_zh_TW.ts @@ -59,37 +59,37 @@ Scanner functionality will be unavailable. ScanWidget - + Scan Settings 掃描設定 - + Resolution 解析度 - + Color Mode 色彩模式 - + Image Format 圖像格式 - + Paper Size 紙張尺寸 - + View Scanned Image 查看掃描圖像 - + Scan 掃描 @@ -98,75 +98,85 @@ Scanner functionality will be unavailable. 儲存 - + Scan Mode 掃描模式 - - - + + + Flatbed 平板掃描 - + Duplex 雙面掃描 - + Video Format 影片格式 - + Color 彩色 - + Grayscale 灰階 - + Black White 黑白 - + + Scan completed, saved to: %1 + 掃描完成,已儲存至:%1 + + + + Failed to save scan. + 掃描儲存失敗。 + + + ADF ADF - + Scan history will be shown here 掃描歷史將顯示在這裡 - + Auto 自動 - + Device not initialized 設備未初始化 - - + + Initializing preview... 正在初始化預覽... - + Device preview not available 設備預覽不可用 - + No preview image 無預覽圖像