diff --git a/app/scanner2/Scanner_zh_CN.qm b/app/scanner2/Scanner_zh_CN.qm index a5757040..84358ac1 100644 Binary files a/app/scanner2/Scanner_zh_CN.qm and b/app/scanner2/Scanner_zh_CN.qm differ diff --git a/app/scanner2/Scanner_zh_CN.ts b/app/scanner2/Scanner_zh_CN.ts index 3d52f7c2..616d96ee 100644 --- a/app/scanner2/Scanner_zh_CN.ts +++ b/app/scanner2/Scanner_zh_CN.ts @@ -636,17 +636,17 @@ Page range will be 'Chosen Pages'. 停止导出 - + export failed: 导出失败: - + tip 提示 - + export succeed 导出完成 @@ -2522,13 +2522,14 @@ Do you want to clear? - + + Please go to 'Menu Bar ->Scan' to select a device 请前往“菜单栏->扫描”选择设备 - + default scheme 默认配置方案 @@ -2679,10 +2680,22 @@ Please finish scanning first. 设备正在运行! 请先结束扫描。 + + + Device is offline + 设备已断开 + + + + Open failed + 打开失败 + - + + + Prompt 提示 @@ -2744,7 +2757,7 @@ Please finish scanning first. - + Device %1 is open 设备 %1 已打开 @@ -2753,76 +2766,76 @@ Please finish scanning first. 关于 - + cache path folder limit:%1 无法访问当前缓存路径:%1 请尝试在【用户】菜单登录管理员账户,前往【缓存设置】更改缓存路径。 - + aquireinto folder limit:%1 无法访问当前缓存路径:%1 请尝试在【扫描到】更改缓存路径。 - + Image processing failed 图像处理失败 - + Ocr init failed OCR初始化错误 - + Ocr failed OCR错误 - + File does not exist 文件不存在 - + Failed to load dynamic library 加载动态库失败 - + File data error 文件数据错误 - + Image format processing error 图像格式处理错误 - + Out of memory 内存不足 - + Failed 错误 - + The Device has reached roller life 纸轮搓纸次数已超过设计使用范围,扫描过程中搓纸失败、歪斜、搓多张等异常频次可能会明显增多, 请注意及时清洁、并联系设备供应商购买替换纸轮! - - + + The language switch is successful and takes effect the next time the software is started! 语言切换成功,下次启动软件时生效! - + Are you sure to delete selected file? 您确定彻底删除选中项文件? @@ -2840,7 +2853,7 @@ Please finish scanning first. 请尝试在【用户】菜单登录管理员账户,前往【缓存设置】更改缓存路径 - + Insufficient access rights 文件访问权限不足 @@ -2865,18 +2878,18 @@ Please finish scanning first. 关闭 - + tip 提示 - + Other versions not available 未获取到其他版本 - - + + The device does not support this operation 设备不支持该操作 @@ -2885,8 +2898,8 @@ Please finish scanning first. IO错误 - - + + error 错误 @@ -3145,12 +3158,12 @@ Continue to close? 滚轴张数: %1 - + Detected that there is less than 1GB of disk space. Do you want to continue? 检测到磁盘空间已不足1GB,是否继续? - + start failed! 启动安装程序失败! @@ -3177,12 +3190,12 @@ Are you sure to close? - - - - - - + + + + + + tips 提示 @@ -3304,7 +3317,7 @@ Are you sure to close? Widget zuobiaozhou - 坐标轴 + 坐标轴 diff --git a/app/scanner2/Scanner_zh_EN.qm b/app/scanner2/Scanner_zh_EN.qm index 859dfb48..a3082309 100644 Binary files a/app/scanner2/Scanner_zh_EN.qm and b/app/scanner2/Scanner_zh_EN.qm differ diff --git a/app/scanner2/Scanner_zh_EN.ts b/app/scanner2/Scanner_zh_EN.ts index f5702f4a..adc46ea9 100644 --- a/app/scanner2/Scanner_zh_EN.ts +++ b/app/scanner2/Scanner_zh_EN.ts @@ -642,17 +642,17 @@ The page range will be “selected pages” Stop exporting - + export succeed Export completed - + export failed: Export failed: - + tip Prompt @@ -2452,7 +2452,8 @@ Please reselect a path or clear disk space immediately. - + + Please go to 'Menu Bar ->Scan' to select a device Please go to 'Menu Bar ->Scan' to select a device @@ -2477,7 +2478,7 @@ Please reselect a path or clear disk space immediately. - + default scheme Default scheme @@ -2549,12 +2550,12 @@ Clear? - - - - - - + + + + + + tips prompt @@ -2700,7 +2701,17 @@ Are you sure to close? Are you sure you want to log out of the administrator account? - + + Device is offline + Device is offline + + + + Open failed + Open failed + + + The Device has reached roller life The paper roller has reached its service life, and the frequency of abnormalities during the scanning process may increase. Please contact the equipment supplier promptly to purchase a replacement paper roller! @@ -2708,7 +2719,9 @@ Please contact the equipment supplier promptly to purchase a replacement paper r - + + + Prompt Prompt @@ -2803,13 +2816,13 @@ Please contact the equipment supplier promptly to purchase a replacement paper r Total count: %1 - + Detected that there is less than 1GB of disk space. Do you want to continue? Detected that there is less than 1GB of disk space. Do you want to continue? - + Device %1 is open Device %1 is open @@ -2860,13 +2873,13 @@ Please contact the equipment supplier promptly to purchase a replacement paper r About - + cache path folder limit:%1 Unable to access the current path:%1 Please try to log in to the administrator account in the [User] menu and go to the [Cache settings] to change the cache path. - + aquireinto folder limit:%1 Unable to access the current path:%1 Please try to change the cache path in [Scan to]. @@ -2925,13 +2938,13 @@ Please try to change the cache path in [Scan to]. failed - - + + error Error - + start failed! Failed to start! @@ -2941,52 +2954,52 @@ Please try to change the cache path in [Scan to]. Please go to “Scan to” and change the accessible scan folder and then perform the scan. - + Insufficient access rights Insufficient file access permissions - + Image processing failed Image processing failed - + Ocr init failed OCR initialization error - + Ocr failed OCR failed - + File does not exist File does not exist - + Failed to load dynamic library Failed to load dynamic library - + File data error File data error - + Image format processing error Image format processing error - + Out of memory Insufficient memory - + Failed Failed @@ -3007,18 +3020,18 @@ Please go to “Scan to” and change the accessible scan folder and then perfor Close - + tip Prompt - + Other versions not available No other versions obtained - - + + The device does not support this operation Device does not support this operation @@ -3027,13 +3040,13 @@ Please go to “Scan to” and change the accessible scan folder and then perfor IO error - - + + The language switch is successful and takes effect the next time the software is started! The language switch is successful and takes effect the next time the software is started! - + Are you sure to delete selected file? Are you sure to delete the selected file completely? @@ -3053,7 +3066,7 @@ Please go to “Scan to” and change the accessible scan folder and then perfor Widget zuobiaozhou - Coordinate axis + Coordinate axis diff --git a/app/scanner2/mainwindow.cpp b/app/scanner2/mainwindow.cpp index 90986a0b..ff7a1868 100644 --- a/app/scanner2/mainwindow.cpp +++ b/app/scanner2/mainwindow.cpp @@ -2895,7 +2895,19 @@ void MainWindow::on_act_about_triggered() void MainWindow::on_act_scannerSettings_triggered() { if (nullptr != m_devUser) - m_devUser->ShowSettingDlg(); + { + HGResult ret = m_devUser->ShowSettingDlg(); + if (HGTWAIN_ERR_DEVICEOFFLINE == ret) + { + QMessageBox::information(this, tr("Prompt"), tr("Device is offline")); + deleteDevUser(); + } + else if (ret == HGTWAIN_ERR_FAIL) + { + QMessageBox::information(this, tr("Prompt"), tr("Open failed")); + deleteDevUser(); + } + } } void MainWindow::on_act_acquire_triggered() @@ -3646,6 +3658,21 @@ void MainWindow::updateSideBar() m_propertyAnimation2->setDuration(600); } +void MainWindow::deleteDevUser() +{ + if (nullptr != m_devUser) + { + disconnect(m_devUser, SIGNAL(newImage(void*)), this, SLOT(on_newImage(void*))); + disconnect(m_devUser, SIGNAL(scanWorkingEvent()), this, SLOT(on_scanWorkingEvent())); + disconnect(m_devUser, SIGNAL(scanFinishEvent()), this, SLOT(on_scanFinishEvent())); + m_devUser->Logout(); + delete m_devUser; + m_devUser = nullptr; + m_wndStatusBar->setDeviceStatusInfo(tr("Please go to 'Menu Bar ->Scan' to select a device"), false); + updateActionStatus(); + } +} + #if !defined(HG_CMP_MSC) void MainWindow::checkRollerLife() { diff --git a/app/scanner2/mainwindow.h b/app/scanner2/mainwindow.h index b2c98b01..69b46b0b 100644 --- a/app/scanner2/mainwindow.h +++ b/app/scanner2/mainwindow.h @@ -244,6 +244,7 @@ private: void deleteUpgradePkg(const QString& cfgFilePath); void initAcquireIntoComboBox(); void updateSideBar(); + void deleteDevUser(); #if !defined(HG_CMP_MSC) void checkRollerLife(); diff --git a/modules/twain_user/HGTwainErr.h b/modules/twain_user/HGTwainErr.h index 86a91449..3e66278d 100644 --- a/modules/twain_user/HGTwainErr.h +++ b/modules/twain_user/HGTwainErr.h @@ -7,4 +7,7 @@ /* UI取消操作 */ #define HGTWAIN_ERR_CANCELUI 0x00001002L +/* 设备离线 */ +#define HGTWAIN_ERR_DEVICEOFFLINE 0x00001003L + #endif /* __HGTWAINERR_H__ */ diff --git a/modules/twain_user/HGTwainImpl.cpp b/modules/twain_user/HGTwainImpl.cpp index e241b5d7..f258982f 100644 --- a/modules/twain_user/HGTwainImpl.cpp +++ b/modules/twain_user/HGTwainImpl.cpp @@ -617,18 +617,23 @@ HGResult HGTwainDSImpl::EnableUIOnly(HWND parent, HGDSEventFunc eventFunc, HGPoi twUI.ShowUI = (TW_BOOL)HGTRUE; twUI.hParent = (TW_HANDLE)parent; USHORT ret = m_dsmImpl->m_pDSMProc(&m_dsmImpl->m_AppId, &m_iden, DG_CONTROL, DAT_USERINTERFACE, MSG_ENABLEDSUIONLY, (TW_MEMREF)&twUI); - if (TWRC_SUCCESS != ret) - { - return HGTWAIN_ERR_FAIL; + if (TWRC_SUCCESS != ret) + { + TW_STATUS status; + m_dsmImpl->m_pDSMProc(&m_dsmImpl->m_AppId, &m_iden, DG_CONTROL, DAT_STATUS, MSG_GET, (TW_MEMREF)&status); + if (status.ConditionCode == TWCC_CHECKDEVICEONLINE) + return HGTWAIN_ERR_DEVICEOFFLINE; + + return HGTWAIN_ERR_FAIL; } - m_showUI = HGTRUE; - m_parent = parent; - m_eventFunc = eventFunc; - m_eventParam = eventParam; - m_imageFunc = NULL; - m_imageParam = NULL; - return HGBASE_ERR_OK; + m_showUI = HGTRUE; + m_parent = parent; + m_eventFunc = eventFunc; + m_eventParam = eventParam; + m_imageFunc = NULL; + m_imageParam = NULL; + return HGBASE_ERR_OK; } HGResult HGTwainDSImpl::Enable(HGBool showUI, HWND parent, HGDSEventFunc eventFunc, HGPointer eventParam,