diff --git a/app/fwupgrade/mainwindow.cpp b/app/fwupgrade/mainwindow.cpp index 84ad30d3..0364c6dd 100644 --- a/app/fwupgrade/mainwindow.cpp +++ b/app/fwupgrade/mainwindow.cpp @@ -411,11 +411,7 @@ void MainWindow::on_btnDownloadUpgrade_clicked() HGChar savePath[512]; HGBase_GetConfigPath(savePath, 512); - HGResult ret = HGBase_CreateDir(savePath); - if(ret != HGBASE_ERR_OK) - { - HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "create DownloadUpgrade dir failed,%s", savePath); - } + HGBase_CreateDir(savePath); HGChar fileName[128]; sprintf(fileName, "%s.%s", versionNum.toStdString().c_str(), suffix); strcat(savePath, fileName); @@ -521,11 +517,7 @@ void MainWindow::on_btnModifyPassword_clicked() { HGChar cfgPath[256]= {0}; HGBase_GetConfigPath(cfgPath, 256); - HGResult ret = HGBase_CreateDir(cfgPath); - if(ret != HGBASE_ERR_OK) - { - HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "while modifying password, create config path failed, %s", cfgPath); - } + HGBase_CreateDir(cfgPath); strcat(cfgPath, "config.ini"); HGChar str[256] = {0}; HGBase_GetProfileString(cfgPath, "login", "password", "", str, 256); diff --git a/app/scanner/Scanner_zh_CN.qm b/app/scanner/Scanner_zh_CN.qm index f1522eea..b89c89c7 100644 Binary files a/app/scanner/Scanner_zh_CN.qm and b/app/scanner/Scanner_zh_CN.qm differ diff --git a/app/scanner/Scanner_zh_CN.ts b/app/scanner/Scanner_zh_CN.ts index 28cafb0a..2b0d15be 100644 --- a/app/scanner/Scanner_zh_CN.ts +++ b/app/scanner/Scanner_zh_CN.ts @@ -327,20 +327,20 @@ 所有页 - - - - + + + + e.g. '%1%2' 例如.“%1%2” - + ok 确定 - + cancel 取消 @@ -528,17 +528,25 @@ Page range will be 'Chosen Pages'. 停止导出 - + tip 提示 - + export succeed 导出完成 - + Insufficient access rights + 文件访问权限不足 + + + Ocr processing failed + OCR功能处理失败 + + + ok 确定 @@ -548,7 +556,7 @@ Page range will be 'Chosen Pages'. Dialog - + @@ -1353,6 +1361,21 @@ This operation will NOT rotate the files that may contain multiple pages, such a stop 停止批量旋转 + + + operation success + 操作成功 + + + + tip + 提示 + + + + ok + 确定 + Dialog_OpenImageIndex @@ -1569,12 +1592,12 @@ Please make sure the two passwords are the same. Dialog - + detect result. versionNum: - + @@ -1697,7 +1720,7 @@ bug description: Dialog - + @@ -1793,382 +1816,382 @@ bug description: 文件 - + menu_scan 扫描 - + menu_view 视图 - + menu_Auto_Image_Size menuAuto_Image_Size 自动图片尺寸 - + menu_page 页面 - + menu_multiPages 多页 - + menu_image 图像 - + menuRotate 旋转 - + menu_user 用户 - + menu_info 信息 - + menu_device 设备 - + toolBar 工具栏 - + act_open 打开... - + act_insert 插入本地文件... - + act_save 保存 - + act_saveAs 另存为... - + act_Export 导出... - + act_closeFile 关闭选中项 - + act_closeAll 关闭所有项 - + act_imageInfo 图像信息 - + act_exit 退出 - + act_scannerSettings 扫描设置... - + act_acquire 扫描 - + act_acquireSingle 扫描单张 - + act_acquireInto 扫描至... - + act_fullscreen 全屏显示 - + act_fitWindowSize 适应视图框尺寸 - + act_fitWindowWidth 适应视图框宽度 - + act_realSize 真实大小 - + act_zoomIn 放大 - + act_zoomOut 缩小 - + act_toolBar 工具栏 - + act_statusBar 状态栏 - + act_thumbnailBar 缩略图栏 - + act_colorInfo 色彩信息 - + act_previous 上一张 - + act_next 下一张 - + act_first 第一张 - + act_last 最后一张 - + act_openPageNum 跳转至... - + act_previousPage 上一页 - + act_nextPage 下一页 - + act_firstPage 第一页 - + act_lastPage 最后一页 - + act_adjust 亮度/对比度/伽马... - + act_90Left 左旋转90度 - + act_90Right 右旋转90度 - + act_180 旋转180度 - + act_multiRotate 多页旋转... - + act_autoCrop 自动裁剪... - + act_signIn 登录... - + act_passwordChange 密码修改... - + act_signOut 登出 - + act_log 日志管理... - + act_clrCache 清除缓存... - + act_consume 耗材状态... - + act_help 帮助 - + act_about 关于... - + act_insertFromScanner 从扫描插入... - + act_clearRoller 清除滚轴计数 - + act_imageEdit 图像编辑... - + act_sortPages 书籍排序 - + act_autoSave 自动保存 - + act_update 检查更新... - + act_feedback 意见反馈... - + act_device_log 导出设备日志 - + act_driver_log 导出驱动日志 - + HuaGoScan 华高扫描软件 - + Grid 多列显示 - + Move To... 移动到... - + Insert files 插入文件 - - - + + + nodevice 没有发现扫描仪 - - - - - - + + + + + + Question 警告 - - + + modified, save it? 图像已被修改。 是否保存修改? - + file lost, remove it? 文件已丢失,是否删除? @@ -2177,7 +2200,7 @@ bug description: 已连接 - + disconnected 已断开连接 @@ -2194,39 +2217,39 @@ bug description: 扫描完成 - + Clear, then start scan 清空并启动扫描 - + Do NOT clear, then start scan 不清空并启动扫描 - + Already exist images in image list. Do you want to clear? 图像列表中已存在图像。 是否清空? - + Information 消息 - + Insufficient disk space 磁盘空间不足,请删除不需要的文件,以保证有足够的空间 - + Open images 打开图片 - + Insert images 插入图片 @@ -2235,230 +2258,239 @@ Do you want to clear? 信息 - - - - - - - - - save failed - 保存失败 + 保存失败 - + binary 黑白 - + gray 256级灰度 - + rgb 24位彩色 - + thumbnailBar enabled 显示缩略图栏 - + thumbnailBar hidden 隐藏缩略图栏 - - - + + + save succeed 保存成功 - - + + find savePath in thumbnail 图片名在列表中已存在 - + File name 文件名 - + File path 文件路径 - + File size 文件大小 - + Creation date/time 创建时间 - + Modified date/time 修改时间 - + Accessed date/time 访问时间 - + Format 格式 - + Width 宽度 - + Height 高度 - + depth 深度 - + Color model 色彩模式 - + DPI 每英寸像素点 - + Print size 打印尺寸 - + Frame - + None - + Mono 黑白 - + Gray 灰度 - + Color 彩色 - + Warning 警告 - + Device is Running! Please finish scanning first. 设备正在运行! 请先结束扫描。 - - - - - - - - - - + + Image processing failed + 图像处理失败 + + + + + + + + + + + + already waked up device 已唤醒设备 - + be ready 就绪 - - - - - - + + + + + + folder limit 无法访问“我的文档”, 请前往“扫描至”更换可访问的扫描目录再进行扫描。 - + + Insufficient access rights + 文件访问权限不足 + + + export succeed + 导出完成 + + + Ocr processing failed + 图像处理失败 + + + Are you sure to close 您确定要关闭 - + ? 吗? - - + + close 关闭 - + tip 提示 - + Other versions not available 未获取到其他版本 - - + + The device does not support this operation 设备不支持该操作 - - + + IO error IO错误 - - - + + + error 错误 @@ -2473,17 +2505,17 @@ Continue to close? 是否继续关闭? - + Sure to sign out administrator account? 是否确定登出管理员账户? - + confirm the operation 确认操作 - + Are you sure to clear the rollor acount? 你确定要清除滚轴计数吗 @@ -2492,34 +2524,34 @@ Continue to close? 请重新进入关于界面以获取最新值 - + <p>%1: <a href='%2'>%3</a> - + - + <p>%1: %2 - + - + roller number 滚轴张数 - + open scanner 打开扫描仪 - - + + app name 华高扫描软件 - - + + success 成功 @@ -2536,18 +2568,18 @@ Continue to close? 失败 - - + + failed 失败 - + warning 警告 - + the disk space in the current path is unsufficient, please select a new path or clear the disk space in time. 当前路径磁盘空间不足, 请重新选择路径或及时清理磁盘空间。 @@ -2557,219 +2589,218 @@ Continue to close? 配置丢失 - + apply setting 应用配置 - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + start failed 启动失败 - + HanvonScan 汉王扫描软件 - + LanxumScan 立思辰扫描软件 - + CumtennScan 沧田扫描软件 - + auto save 自动保存 - - + when switching pictures, save the edited pictures directly without reminding 切换图片时,不提醒,直接保存编辑过的图片 - + statusBar displayed 显示状态栏 - + statusBar hidden 隐藏状态栏 - + toolBar displayed 显示工具栏 - + toolBar hidden 隐藏工具栏 - + colorInfo enabled 启用图像信息 - + colorInfo disenabled 关闭图像信息 - + enabling automatic saving 启用自动保存 - + cancel auto save 取消自动保存 - + Automatically save the edited the edited iamge when switching pictures. To cancel, uncheck the menu item: image-> automatically save 切换图片时,自动保存编辑过的图像。若想取消,请取消勾选菜单项:图像->自动保存 - - - - - - - - - - - + + + + + + + + + + + yes 确定 - + save, do not remind again 保存,不再提醒 - - - - - - - - - + + + + + + + + + no 取消 - + found device 发现设备 - + reconnected 重新连接 - + already connected, but open faild 已经连接,但打开失败 - - + + %1%2%3.%4 %1%2%3.%4 - + start failed! 启动安装程序失败! - + There are pictures that have not been saved. Are you sure to close? 有图像未保存,确定关闭? - - - - - - - - - + + + + + + + + + tips 提示 - + Are you sure to close? 确定关闭? - + confirm operation 确认操作 - + are you sure to clear the roller count? 您确定要清除滚轴计数吗 - - - + + + hint 提示 - - + + Roller scanned count has been set to 0. 辊轴计数已置零 - - + + Roller scanned count reset failed. 重置滚轴计数失败 - + Error 错误 - + Document missing! It would be deleted or renamed. 文档丢失!文档可能已被删除或被重命名。 @@ -2802,28 +2833,28 @@ Are you sure to close? <br>导航地址: <a href='https://j.map.baidu.com/7e/1TO'>百度地图访问</a> - + About %1 关于 %1 - + <p>%1</p><p>Version: %2<br>CopyRight: &#169; %3</p><p>%4%5%6%7%8%9</p> <p>%1</p><p>版本: %2<br>版权: &#169; %3</p><p>%4%5%6%7%8%9</p> - + about %1 关于 %1 - + <p>Version: %1</p> <p>版本: %1</p> <p>版本: %1</p> - + <p>CopyRight: &#169; %1</p> <p>版权: &#169; %1</p> <p>版权: &#169; %1</p> @@ -2979,7 +3010,7 @@ Are you sure to close? (epicycle scanning images %u picture) - (本轮共扫描 %u 幅) + (本轮共扫描 %u 幅) fold @@ -3192,7 +3223,8 @@ No: add new configuration - 自定 + 自定义 + 自定 diff --git a/app/scanner/dialog_exportimagefile.cpp b/app/scanner/dialog_exportimagefile.cpp index 0250a129..e1f0efb4 100644 --- a/app/scanner/dialog_exportimagefile.cpp +++ b/app/scanner/dialog_exportimagefile.cpp @@ -52,6 +52,7 @@ void HGAPI Dialog_ExportImageFile::ThreadFunc(HGThread thread, HGPointer param) { (void)thread; Dialog_ExportImageFile *p = (Dialog_ExportImageFile *)param; + HGResult ret = HGBASE_ERR_FAIL; if (p->m_isSaveAsMulti) { @@ -60,8 +61,8 @@ void HGAPI Dialog_ExportImageFile::ThreadFunc(HGThread thread, HGPointer param) if (p->m_isOcr) { HGOCRMgr ocrMgr = nullptr; - HGImgProc_CreateOCRMgr(0, &ocrMgr); - if (nullptr != ocrMgr) + ret = HGImgProc_CreateOCRMgr(0, &ocrMgr); + if (HGBASE_ERR_OK == ret) { for (int i = 0; i < p->m_srcFiles.size(); ++i) { @@ -89,28 +90,36 @@ void HGAPI Dialog_ExportImageFile::ThreadFunc(HGThread thread, HGPointer param) HGImgFmt_LoadImageFromReader(imgFmtReader, j, nullptr, 0, HGBASE_IMGORIGIN_TOP, &img); if (nullptr != img) { - HGImgProc_AddToImageOCRList(ocrMgr, img); + ret = HGImgProc_AddToImageOCRList(ocrMgr, img); HGBase_DestroyImage(img); + + if (ret != HGBASE_ERR_OK) + { + break; + } } } HGImgFmt_CloseImageReader(imgFmtReader); } + + if (ret != HGBASE_ERR_OK) + break; } - HGResult ret = HGImgProc_ImageListOCRToFile(ocrMgr, 0, getStdString(fileName).c_str(), NULL, NULL); - if(ret != HGBASE_ERR_OK) + if (ret == HGBASE_ERR_OK) { - HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "HGImgProc_ImageListOCRToFile:%u", ret); + ret = HGImgProc_ImageListOCRToFile(ocrMgr, 0, getStdString(fileName).c_str(), NULL, NULL); } + HGImgProc_DestroyOCRMgr(ocrMgr); } } else { HGImgFmtWriter imgFmtWriter = nullptr; - HGImgFmt_OpenImageWriter(getStdString(fileName).c_str(), 0, &imgFmtWriter); - if (nullptr != imgFmtWriter) + ret = HGImgFmt_OpenImageWriter(getStdString(fileName).c_str(), 0, &imgFmtWriter); + if (HGBASE_ERR_OK == ret) { for (int i = 0; i < p->m_srcFiles.size(); ++i) { @@ -160,13 +169,21 @@ void HGAPI Dialog_ExportImageFile::ThreadFunc(HGThread thread, HGPointer param) saveInfo.tiffCompression = HGIMGFMT_TIFFCOMP_JPEG; } - HGImgFmt_SaveImageToWriter(imgFmtWriter, img, &saveInfo); + ret = HGImgFmt_SaveImageToWriter(imgFmtWriter, img, &saveInfo); HGBase_DestroyImage(img); + + if (ret != HGBASE_ERR_OK) + { + break; + } } } HGImgFmt_CloseImageReader(imgFmtReader); } + + if (ret != HGBASE_ERR_OK) + break; } HGImgFmt_CloseImageWriter(imgFmtWriter); @@ -236,17 +253,23 @@ void HGAPI Dialog_ExportImageFile::ThreadFunc(HGThread thread, HGPointer param) saveInfo.tiffCompression = HGIMGFMT_TIFFCOMP_JPEG; } - MainWindow::saveImage(img, &saveInfo, p->m_isOcr, getStdString(saveFileName).c_str()); + ret = MainWindow::saveImage(img, &saveInfo, p->m_isOcr, getStdString(saveFileName).c_str()); HGBase_DestroyImage(img); + + if (ret != HGBASE_ERR_OK) + break; } } HGImgFmt_CloseImageReader(imgFmtReader); + + if (ret != HGBASE_ERR_OK) + break; } } } - emit p->finish(); + emit p->finish(ret); } void Dialog_ExportImageFile::on_updateProgress(int value) @@ -254,12 +277,13 @@ void Dialog_ExportImageFile::on_updateProgress(int value) ui->progressBar->setValue(value); } -void Dialog_ExportImageFile::on_finish() +void Dialog_ExportImageFile::on_finish(HGResult ret) { - QMessageBox msg(QMessageBox::Information, tr("tip"), tr("export succeed"), QMessageBox::Ok, this); + QString str = (ret == HGBASE_ERR_OK) ? tr("export succeed") : MainWindow::getLogInfo(ret); + QMessageBox msg(QMessageBox::Information, tr("tip"), str, QMessageBox::Ok, this); msg.setButtonText(QMessageBox::Ok, tr("ok")); - close(); msg.exec(); + close(); } void Dialog_ExportImageFile::on_pushButton_clicked() diff --git a/app/scanner/dialog_exportimagefile.h b/app/scanner/dialog_exportimagefile.h index 75b04ef3..64242fe1 100644 --- a/app/scanner/dialog_exportimagefile.h +++ b/app/scanner/dialog_exportimagefile.h @@ -23,10 +23,10 @@ private: signals: void updateProgress(int value); - void finish(); + void finish(HGResult ret); private slots: void on_updateProgress(int value); - void on_finish(); + void on_finish(HGResult ret); void on_pushButton_clicked(); diff --git a/app/scanner/dialog_multirotateimagefile.cpp b/app/scanner/dialog_multirotateimagefile.cpp index a57d8afc..88d4cd24 100644 --- a/app/scanner/dialog_multirotateimagefile.cpp +++ b/app/scanner/dialog_multirotateimagefile.cpp @@ -2,6 +2,8 @@ #include "ui_dialog_multirotateimagefile.h" #include "imgfmt/HGImgFmt.h" #include "HGUIGlobal.h" +#include "mainwindow.h" +#include Dialog_MultiRotateImageFile::Dialog_MultiRotateImageFile(const QStringList &fileList, int rotateType, QWidget *parent) : QDialog(parent), @@ -38,6 +40,7 @@ void HGAPI Dialog_MultiRotateImageFile::ThreadFunc(HGThread thread, HGPointer pa { (void)thread; Dialog_MultiRotateImageFile *p = (Dialog_MultiRotateImageFile *)param; + HGResult ret = HGBASE_ERR_FAIL; for (int i = 0; i < (int)p->m_fileList.count(); ++i) { @@ -102,16 +105,22 @@ void HGAPI Dialog_MultiRotateImageFile::ThreadFunc(HGThread thread, HGPointer pa if (nullptr != img) { - if (HGBASE_ERR_OK == HGImgFmt_SaveImage(img, 0, nullptr, getStdString(p->m_fileList[i]).c_str())) + ret = HGImgFmt_SaveImage(img, 0, nullptr, getStdString(p->m_fileList[i]).c_str()); + if (HGBASE_ERR_OK == ret) { emit p->updateImageFile(p->m_fileList[i]); } HGBase_DestroyImage(img); } + + if (ret != HGBASE_ERR_OK) + { + break; + } } - emit p->finish(); + emit p->finish(ret); } void Dialog_MultiRotateImageFile::on_updateProgress(int value) @@ -124,8 +133,12 @@ void Dialog_MultiRotateImageFile::on_updateImageFile(QString fileName) emit refreshImageFile(fileName); } -void Dialog_MultiRotateImageFile::on_finish() +void Dialog_MultiRotateImageFile::on_finish(HGResult ret) { + QString str = (ret == HGBASE_ERR_OK) ? tr("operation success") : MainWindow::getLogInfo(ret); + QMessageBox msg(QMessageBox::Information, tr("tip"), str, QMessageBox::Ok, this); + msg.setButtonText(QMessageBox::Ok, tr("ok")); + msg.exec(); close(); } diff --git a/app/scanner/dialog_multirotateimagefile.h b/app/scanner/dialog_multirotateimagefile.h index 40c31d16..32b496cc 100644 --- a/app/scanner/dialog_multirotateimagefile.h +++ b/app/scanner/dialog_multirotateimagefile.h @@ -25,11 +25,11 @@ private: signals: void updateProgress(int value); void updateImageFile(QString fileName); - void finish(); + void finish(HGResult ret); private slots: void on_updateProgress(int value); void on_updateImageFile(QString fileName); - void on_finish(); + void on_finish(HGResult ret); void on_pushButton_clicked(); diff --git a/app/scanner/mainwindow.cpp b/app/scanner/mainwindow.cpp index 2c3380c4..69d3d51d 100644 --- a/app/scanner/mainwindow.cpp +++ b/app/scanner/mainwindow.cpp @@ -378,14 +378,10 @@ HGResult MainWindow::saveImage(HGImage image, const HGImgFmtSaveInfo* info, bool HGResult ret = HGBASE_ERR_FAIL; // 韫囩晫鏆恑nfo HGOCRMgr ocrMgr = nullptr; - HGImgProc_CreateOCRMgr(0, &ocrMgr); - if (nullptr != ocrMgr) + ret = HGImgProc_CreateOCRMgr(0, &ocrMgr); + if (HGBASE_ERR_OK == ret) { ret = HGImgProc_ImageOCRToFile(ocrMgr, image, 0, fileName); - if (ret != HGBASE_ERR_OK) - { - HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "HGImgProc_ImageOCRToFile:%u", ret); - } HGImgProc_DestroyOCRMgr(ocrMgr); } @@ -926,8 +922,8 @@ void MainWindow::on_new_image(void *img, int statu) } else { - m_dialogLog->addLog(tr("save failed"), true); - m_wndStatusBar->setDeviceStatusInfo(tr("save failed"), true); + m_dialogLog->addLog(getLogInfo(ret), true); + m_wndStatusBar->setDeviceStatusInfo(getLogInfo(ret), true); } } else if (2 == m_scanType) @@ -961,7 +957,8 @@ void MainWindow::on_new_image(void *img, int statu) HGResult ret = HGBase_CreateDir(getStdString(m_aquireIntoSaveParam.m_savePath).c_str()); if (ret != HGBASE_ERR_OK) { - HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "create aquireInto path failed, %s", getStdString(m_aquireIntoSaveParam.m_savePath).c_str()); + m_dialogLog->addLog(getLogInfo(ret), true); + m_wndStatusBar->setDeviceStatusInfo(getLogInfo(ret), true); } QString scanFileName; @@ -982,7 +979,13 @@ void MainWindow::on_new_image(void *img, int statu) } } - HGImgFmt_OpenImageWriter(getStdString(getStdFileName(scanFileName)).c_str(), 0, &m_scanImgFmtWriter); + ret = HGImgFmt_OpenImageWriter(getStdString(getStdFileName(scanFileName)).c_str(), 0, &m_scanImgFmtWriter); + if(ret != HGBASE_ERR_OK) + { + m_dialogLog->addLog(getLogInfo(ret), true); + m_wndStatusBar->setDeviceStatusInfo(getLogInfo(ret), true); + } + if (nullptr != m_scanImgFmtWriter) m_scanFileName = scanFileName; } @@ -1011,7 +1014,13 @@ void MainWindow::on_new_image(void *img, int statu) saveInfo.tiffCompression = HGIMGFMT_TIFFCOMP_JPEG; } - HGImgFmt_SaveImageToWriter(m_scanImgFmtWriter, image, &saveInfo); + HGResult ret = HGImgFmt_SaveImageToWriter(m_scanImgFmtWriter, image, &saveInfo); + if(ret != HGBASE_ERR_OK) + { + m_dialogLog->addLog(getLogInfo(ret), true); + m_wndStatusBar->setDeviceStatusInfo(getLogInfo(ret), true); + } + ++m_aquireIntoMultiPageCount; } } @@ -1061,10 +1070,11 @@ void MainWindow::on_new_image(void *img, int statu) savePath = getStdFileName(savePath + colorModeName + "/"); } - HGResult result = HGBase_CreateDir(getStdString(savePath).c_str()); - if (result != HGBASE_ERR_OK) + HGResult ret = HGBase_CreateDir(getStdString(savePath).c_str()); + if(ret != HGBASE_ERR_OK) { - HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "HGBase_CreateDir:%u file:%s line:%d", result, __FILE__, __LINE__); + m_dialogLog->addLog(getLogInfo(ret), true); + m_wndStatusBar->setDeviceStatusInfo(getLogInfo(ret), true); } QString scanFileName; @@ -1107,12 +1117,17 @@ void MainWindow::on_new_image(void *img, int statu) saveInfo.tiffCompression = HGIMGFMT_TIFFCOMP_JPEG; } - HGResult ret = saveImage(image, &saveInfo, m_aquireIntoSaveParam.m_isOcr, getStdString(scanFileName).c_str()); + ret = saveImage(image, &saveInfo, m_aquireIntoSaveParam.m_isOcr, getStdString(scanFileName).c_str()); if(ret == HGBASE_ERR_OK) { m_thumb->addItem(scanFileName); ++m_aquireIntoSaveParam.m_fileNameStartIndex; } + else + { + m_dialogLog->addLog(getLogInfo(ret), true); + m_wndStatusBar->setDeviceStatusInfo(getLogInfo(ret), true); + } } } @@ -1394,11 +1409,7 @@ QString MainWindow::getCacheFileName(HGImage img) HGBase_GetImageInfo(img, &imgInfo); QString cachePath = Dialog_ClrCache::getCachePath(); - HGResult ret = HGBase_CreateDir(getStdString(cachePath).c_str()); - if(ret != HGBASE_ERR_OK) - { - HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "create cache file failed, %s", getStdString(cachePath).c_str()); - } + HGBase_CreateDir(getStdString(cachePath).c_str()); char uuid[256] = {0}; HGBase_GetUuid(uuid, 256); @@ -1916,6 +1927,7 @@ void MainWindow::on_act_exit_triggered() void MainWindow::on_act_save_triggered() { + HGResult ret = HGBASE_ERR_FAIL; HGImage img = nullptr; m_view->getImage(&img); if (nullptr == img || -1 == m_currIndex || 1 != m_multiPageCount) @@ -2033,7 +2045,8 @@ void MainWindow::on_act_save_triggered() saveInfo.tiffCompression = HGIMGFMT_TIFFCOMP_JPEG; } - if (HGBASE_ERR_OK == saveImage(img, &saveInfo, isOcr, getStdString(savePath).c_str())) + ret = saveImage(img, &saveInfo, isOcr, getStdString(savePath).c_str()); + if (HGBASE_ERR_OK == ret) { if (auto_save_changes_) { @@ -2051,9 +2064,9 @@ void MainWindow::on_act_save_triggered() } else { - QMessageBox::critical(this, tr("tips"), tr("save failed")); - m_dialogLog->addLog(tr("save failed"), true); - m_wndStatusBar->setDeviceStatusInfo(tr("save failed"), true); + QMessageBox::critical(this, tr("tips"), getLogInfo(ret)); + m_dialogLog->addLog(getLogInfo(ret), true); + m_wndStatusBar->setDeviceStatusInfo(getLogInfo(ret), true); } } else @@ -2091,8 +2104,8 @@ void MainWindow::on_act_save_triggered() tiffInfo.yResolution = yDpi; HGTiffWriter tiffWriter = nullptr; - HGImgFmt_OpenTiffWriter(getStdString(m_currFilePath).c_str(), &tiffWriter); - if (nullptr != tiffWriter) + saveRet = HGImgFmt_OpenTiffWriter(getStdString(m_currFilePath).c_str(), &tiffWriter); + if (HGBASE_ERR_OK == saveRet) { saveRet = HGImgFmt_SaveImageToTiffWriter(tiffWriter, img, &tiffInfo); HGImgFmt_CloseTiffWriter(tiffWriter); @@ -2117,7 +2130,9 @@ void MainWindow::on_act_save_triggered() } else { - QMessageBox::critical(this, tr("tips"), tr("save failed")); + QMessageBox::critical(this, tr("tips"), getLogInfo(ret)); + m_dialogLog->addLog(getLogInfo(ret), true); + m_wndStatusBar->setDeviceStatusInfo(getLogInfo(ret), true); } } @@ -2187,7 +2202,8 @@ void MainWindow::on_act_saveAs_triggered() saveInfo.tiffCompression = HGIMGFMT_TIFFCOMP_JPEG; } - if (HGBASE_ERR_OK == saveImage(img, &saveInfo, isOcr, getStdString(savePath).c_str())) + HGResult ret = saveImage(img, &saveInfo, isOcr, getStdString(savePath).c_str()); + if (HGBASE_ERR_OK == ret) { if(!auto_save_changes_) { @@ -2196,9 +2212,9 @@ void MainWindow::on_act_saveAs_triggered() } else { - QMessageBox::critical(this, tr("tips"), tr("save failed")); - m_dialogLog->addLog(tr("save failed"), true); - m_wndStatusBar->setDeviceStatusInfo(tr("save failed"), true); + QMessageBox::critical(this, tr("tips"), getLogInfo(ret)); + m_dialogLog->addLog(getLogInfo(ret), true); + m_wndStatusBar->setDeviceStatusInfo(getLogInfo(ret), true); } } else @@ -2556,11 +2572,7 @@ void HGAPI MainWindow::FwUpgradeAndDevLockThread(HGThread thread, HGPointer para HGChar savePath[512]; HGBase_GetConfigPath(savePath, 512); - HGResult ret = HGBase_CreateDir(savePath); - if(ret != HGBASE_ERR_OK) - { - HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "create fwUpgrade file failed, %s", savePath); - } + HGBase_CreateDir(savePath); HGChar fileName[128]; sprintf(fileName, "%s.%s", versionInfo[0].version, suffix); strcat(savePath, fileName); @@ -3670,29 +3682,23 @@ bool MainWindow::isLimitAccessFolder(QString filePath) HGChar procName[512]; HGBase_GetProcessName(procName, 512); strcat(documentsPath, procName); - HGResult ret = HGBase_CreateDir(getStdString(documentsPath).c_str()); - if (ret != HGBASE_ERR_OK) - { - HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "Mainwindow::isLimitAccessFolder(), create documentsPath1 file failed, %s", getStdString(documentsPath).c_str()); - } + HGBase_CreateDir(getStdString(documentsPath).c_str()); HGChar uuid[512]; HGBase_GetUuid(uuid, 512); strcat(documentsPath, "/"); strcat(documentsPath, uuid); - HGResult result = HGBase_CreateDir(getStdString(documentsPath).c_str()); - if(result != HGBASE_ERR_OK) + HGResult ret = HGBase_CreateDir(getStdString(documentsPath).c_str()); + if(ret != HGBASE_ERR_OK) { - HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "Mainwindow::isLimitAccessFolder(), create documentsPath2 file failed, %s", getStdString(documentsPath).c_str()); if(!filePath.isEmpty()) { HGChar uuid2[512]; HGBase_GetUuid(uuid2, 512); filePath += uuid2; - HGResult result2 = HGBase_CreateDir(getStdString(filePath).c_str()); - if (result2 != HGBASE_ERR_OK) + ret = HGBase_CreateDir(getStdString(filePath).c_str()); + if (ret != HGBASE_ERR_OK) { - HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "Mainwindow::isLimitAccessFolder(), create scanPath3 file failed, %s", getStdString(filePath).c_str()); QMessageBox::critical(this, tr("error"), tr("folder limit")); m_dialogLog->addLog(tr("folder limit"), true); m_wndStatusBar->setDeviceStatusInfo(tr("folder limit"), true); @@ -3824,6 +3830,21 @@ void MainWindow::upgradeFwAndLockDevice() } } +QString MainWindow::getLogInfo(HGResult ret) +{ + QString str; + if (HGBASE_ERR_ACCESSDENIED == ret) + { + str = tr("Insufficient access rights"); + } + else if (HGIMGPROC_ERR_FAIL == ret) + { + str = tr("Image processing failed"); + } + + return str; +} + //void MainWindow::deleteFile(QString filePath) //{ // QDir dir(filePath); @@ -3962,11 +3983,7 @@ void MainWindow::on_actionact_update_triggered() HGChar savePath[512]; HGBase_GetConfigPath(savePath, 512); - HGResult ret = HGBase_CreateDir(savePath); - if(ret != HGBASE_ERR_OK) - { - HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "create upgrade app savefile failed, %s", savePath); - } + HGBase_CreateDir(savePath); HGChar fileName[128]; sprintf(fileName, "%s.%s", versionNum.toStdString().c_str(), suffix); diff --git a/app/scanner/mainwindow.h b/app/scanner/mainwindow.h index 5db024e4..4c8a1a91 100644 --- a/app/scanner/mainwindow.h +++ b/app/scanner/mainwindow.h @@ -83,6 +83,7 @@ public: void exitFullScreen(); static HGResult saveImage(HGImage image, const HGImgFmtSaveInfo* info, bool ocr, const HGChar *fileName); + static QString getLogInfo(HGResult ret); private slots: void on_act_90Left_triggered(); diff --git a/app/scanner/qt_zh_CN.ts b/app/scanner/qt_zh_CN.ts index 949fe181..3079560b 100644 --- a/app/scanner/qt_zh_CN.ts +++ b/app/scanner/qt_zh_CN.ts @@ -1051,6 +1051,18 @@ This operation will NOT rotate the files that may contain multiple pages, such a stop + + operation success + + + + tip + + + + ok + + Dialog_OpenImageIndex @@ -1727,10 +1739,6 @@ Do you want to clear? Insert images - - save failed - - find savePath in thumbnail @@ -2089,6 +2097,14 @@ Are you sure to close? CumtennScan + + Insufficient access rights + + + + Image processing failed + + Phonon:: @@ -8356,10 +8372,6 @@ No: add new configuration 自定义色调曲线 - - 自定 - - 负片(RGB) @@ -8408,5 +8420,9 @@ No: add new configuration 输出: + + 自定义 + +