From e7d9e3d0d046a5e7440c52cd08331edbc237f688 Mon Sep 17 00:00:00 2001 From: yangjiaxuan <171295266@qq.com> Date: Thu, 4 May 2023 14:55:26 +0800 Subject: [PATCH] =?UTF-8?q?app=E4=BF=AE=E6=94=B9=E4=B8=BA=E7=9B=B4?= =?UTF-8?q?=E6=8E=A5=E8=B0=83=E7=94=A8twain=E5=92=8Csane?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scanner/Scanner_zh_CN.qm | Bin 40816 -> 35672 bytes app/scanner/Scanner_zh_CN.ts | 988 +++++------- app/scanner/Scanner_zh_EN.qm | Bin 55232 -> 46203 bytes app/scanner/Scanner_zh_EN.ts | 938 +++++------ app/scanner/cutdialog.cpp | 464 ------ app/scanner/cutdialog.h | 100 -- app/scanner/cutdialog.ui | 44 - app/scanner/cutpapertool.cpp | 219 --- app/scanner/cutpapertool.h | 59 - app/scanner/cutpapertool.ui | 298 ---- app/scanner/device_menu.cpp | 189 --- app/scanner/device_menu.h | 506 ------ app/scanner/device_user.cpp | 193 +++ app/scanner/device_user.h | 109 ++ app/scanner/dialog_export.cpp | 1 - app/scanner/dialog_exportimagefile.cpp | 1 - app/scanner/dialog_log.cpp | 179 --- app/scanner/dialog_log.h | 69 - app/scanner/dialog_log.ui | 31 - app/scanner/dialog_saveas.cpp | 1 - app/scanner/dialog_upgradefirmware.cpp | 62 - app/scanner/dialog_upgradefirmware.h | 43 - app/scanner/dialog_upgradefirmware.ui | 127 -- app/scanner/gaosixy.cpp | 54 - app/scanner/gaosixy.h | 17 - app/scanner/hg_settingdialog.cpp | 1965 ------------------------ app/scanner/hg_settingdialog.h | 141 -- app/scanner/mainwindow.cpp | 1391 +++-------------- app/scanner/mainwindow.h | 50 +- app/scanner/mainwindow.ui | 19 +- app/scanner/ocrPdf.cpp | 148 -- app/scanner/ocrPdf.h | 9 - app/scanner/sane_device.cpp | 65 - app/scanner/sane_device.h | 38 - app/scanner/setpicclrtool.cpp | 315 ---- app/scanner/setpicclrtool.h | 82 - app/scanner/setpicclrtool.ui | 167 -- app/scanner/widget.cpp | 855 ----------- app/scanner/widget.h | 132 -- app/scanner/widget.ui | 91 -- build2/qt/HGScanner/HGScanner.pro | 52 +- 41 files changed, 1310 insertions(+), 8902 deletions(-) delete mode 100644 app/scanner/cutdialog.cpp delete mode 100644 app/scanner/cutdialog.h delete mode 100644 app/scanner/cutdialog.ui delete mode 100644 app/scanner/cutpapertool.cpp delete mode 100644 app/scanner/cutpapertool.h delete mode 100644 app/scanner/cutpapertool.ui delete mode 100644 app/scanner/device_menu.cpp delete mode 100644 app/scanner/device_menu.h create mode 100644 app/scanner/device_user.cpp create mode 100644 app/scanner/device_user.h delete mode 100644 app/scanner/dialog_log.cpp delete mode 100644 app/scanner/dialog_log.h delete mode 100644 app/scanner/dialog_log.ui delete mode 100644 app/scanner/dialog_upgradefirmware.cpp delete mode 100644 app/scanner/dialog_upgradefirmware.h delete mode 100644 app/scanner/dialog_upgradefirmware.ui delete mode 100644 app/scanner/gaosixy.cpp delete mode 100644 app/scanner/gaosixy.h delete mode 100644 app/scanner/hg_settingdialog.cpp delete mode 100644 app/scanner/hg_settingdialog.h delete mode 100644 app/scanner/ocrPdf.cpp delete mode 100644 app/scanner/ocrPdf.h delete mode 100644 app/scanner/sane_device.cpp delete mode 100644 app/scanner/sane_device.h delete mode 100644 app/scanner/setpicclrtool.cpp delete mode 100644 app/scanner/setpicclrtool.h delete mode 100644 app/scanner/setpicclrtool.ui delete mode 100644 app/scanner/widget.cpp delete mode 100644 app/scanner/widget.h delete mode 100644 app/scanner/widget.ui diff --git a/app/scanner/Scanner_zh_CN.qm b/app/scanner/Scanner_zh_CN.qm index 49d5ba3e9c97e11cf5b02c11a65d784cd7a72643..4ce697dec7e6149d61e63606f4eff75a305d5da2 100644 GIT binary patch delta 4836 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 delta 9264 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 diff --git a/app/scanner/Scanner_zh_CN.ts b/app/scanner/Scanner_zh_CN.ts index f6a3ee9a..da20cfb8 100644 --- a/app/scanner/Scanner_zh_CN.ts +++ b/app/scanner/Scanner_zh_CN.ts @@ -4,87 +4,8 @@ CutPaperTool - - 自定义扫描区域 - - - - - 纸张尺寸: - - - - - A4 - - - - - (210*297) - - - - - DPI(像素/英寸): - - - - 200 - 0×0×0 {200?} - - - - 单位: - - - - - 毫米(mm) - - - - - 英寸(in) - - - - - 像素(px) - - - - - 初始化选择区域 - - - - - x: - - - - - - - - mm - - - - - y: - - - - - w: - - - - - h: - + 0×0×0 {200?} @@ -612,36 +533,36 @@ Page range will be "Chosen Pages". 多页保存(TIFF/PDF/OFD/GIF) - - - + + + Input is not valid. Page range will be 'Chosen Pages'. 输入无效。 页码范围将是“被选页码” - + English 英语 - + Simplified Chinese 中文(简体) - + Traditional Chinese 中文(繁体) - + Japanese 日文 - + Korean 韩文 @@ -659,17 +580,17 @@ Page range will be 'Chosen Pages'. 停止导出 - + export failed: 导出失败: - + tip 提示 - + export succeed 导出完成 @@ -1677,27 +1598,27 @@ Please make sure the two passwords are the same. OCR类型: - + English 英语 - + Simplified Chinese 中文(简体) - + Traditional Chinese 中文(繁体) - + Japanese 日文 - + Korean 韩文 @@ -1919,29 +1840,16 @@ bug description: Dialog_upgradeFirmware - - Dialog - - - - - gif - - - - text - 文字 + 文字 - upgrade - 更新升级 + 更新升级 - firmware upgrade in progress, please wait... - 设备固件自动更新升级中,请稍候... + 设备固件自动更新升级中,请稍候... @@ -2046,386 +1954,389 @@ bug description: 扫描 - + 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 导出驱动日志 - + act_deleteFile 删除选中项 - + act_enhanceText 文本增强 - + + act_selectDevice + 选择设备源... + + + HuaGoScan 华高扫描软件 - + Grid 多列显示 - + Move To... 移动到... - + Insert files 插入文件 - - - + + nodevice 没有发现扫描仪 - - - - - + + + + + Question 询问 - + modified, save it? 图像已被修改。 是否保存修改? - + file lost, remove it? 文件已丢失,是否删除? @@ -2434,9 +2345,8 @@ bug description: 已连接 - disconnected - 已断开连接 + 已断开连接 %1/%2%3.%4 @@ -2451,17 +2361,17 @@ bug description: 扫描完成 - + Clear, then start scan 清空并启动扫描 - + Do NOT clear, then start scan 不清空并启动扫描 - + Already exist images in image list. Do you want to clear? 图像列表中已存在图像。 @@ -2476,12 +2386,12 @@ Do you want to clear? 磁盘空间不足,请删除不需要的文件,以保证有足够的空间 - + Open images 打开图片 - + Insert images 插入图片 @@ -2494,287 +2404,281 @@ Do you want to clear? 保存失败 - + binary 黑白 - + gray 256级灰度 - + rgb 24位彩色 - - - - - - - - - - - - Please wake up the device manually - 请手动唤醒设备 + 请手动唤醒设备 - + UniScan 紫光扫描软件 - + Scan 扫描软件 - - + + default scheme 默认配置方案 - + thumbnailBar enabled 显示缩略图栏 - + thumbnailBar hidden 隐藏缩略图栏 - + cancel 取消 - - - + + + save succeed 保存成功 - - + + find savePath in thumbnail 图片名在列表中已存在 - + Please select at least one picture before export 请至少选中一张图片再进行导出 - + 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 彩色 - + Not supported 不支持 - + Warning 警告 - + Device is Running! Please finish scanning first. 设备正在运行! 请先结束扫描。 - - about - 关于 + + type: %1 + 设备类型: %1 - + + mac: %1 + MAC地址: %1 + + + + totalCount: %1 + 扫描张数: %1 + + + + Device %1 is open + 设备 %1 已打开 + + + about + 关于 + + + 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 language switch is successful and takes effect the next time the software is started! 语言切换成功,下次启动软件时生效! - + Are you sure to delete selected file? 您确定彻底删除选中项文件? - - - - - - - - - - - - already waked up device - 已唤醒设备 + 已唤醒设备 - be ready - 就绪 + 就绪 folder limit @@ -2782,7 +2686,7 @@ Please finish scanning first. 请尝试在【用户】菜单登录管理员账户,前往【缓存设置】更改缓存路径 - + Insufficient access rights 文件访问权限不足 @@ -2795,46 +2699,38 @@ Please finish scanning first. 图像处理失败 - Are you sure to close - 您确定要断开设备: + 您确定要断开设备: - ? - 吗? + 吗? - - close - 关闭 + 关闭 - + tip 提示 - + Other versions not available 未获取到其他版本 - - The device does not support this operation - 设备不支持该操作 + 设备不支持该操作 - - IO error - IO错误 + IO错误 - - + + error 错误 @@ -2849,56 +2745,37 @@ Continue to close? 是否继续关闭? - + Sure to sign out administrator account? 是否确定登出管理员账户? - confirm the operation - 确认操作 + 确认操作 - Are you sure to clear the rollor acount? - 你确定要清除滚轴计数吗 + 你确定要清除滚轴计数吗 Please re-enter the Abount screen to obtain the latest value 请重新进入关于界面以获取最新值 - - - <p>%1: <a href='%2'>%3</a> - - - - - - <p>%1: %2 - - - - roller number - 滚轴张数 + 滚轴张数 - open scanner - 打开扫描仪 + 打开扫描仪 - app name - 华高扫描软件 + 华高扫描软件 - - success - 成功 + 成功 apply setting @@ -2913,24 +2790,16 @@ 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. - 当前路径磁盘空间不足, + 当前路径磁盘空间不足, 请重新选择路径或及时清理磁盘空间。 @@ -2938,119 +2807,110 @@ Continue to close? 配置丢失 - apply setting - 应用配置 + 应用配置 - - - - - - - - - - - - - - - - - - + + + + + + + + + + start failed 启动失败 - + HanvonScan 汉王扫描软件 - + LanxumScan 立思辰扫描软件 - + CumtennScan 沧田扫描软件 - + MicrotekScan Microtek DocWizard EX 扫描软件 - + menu_language 语言 - + act_simpCN 简体中文 - + act_English English - + 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 切换图片时,自动保存编辑过的图像。若想取消,请取消勾选菜单项:图像->自动保存 @@ -3071,26 +2931,21 @@ Continue to close? 发现设备 - reconnected - 重新连接 + 重新连接 - already connected, but open faild - 已经连接,但打开失败 + 已经连接,但打开失败 - - + save image failed: 存图失败: - - - - + + create savepath failed: 创建文件夹失败: @@ -3099,102 +2954,129 @@ Continue to close? %1%2%3.%4 - - + create image doc failed: 创建图片文件失败: - - - - - - - - - - - - - + + + + + + save image doc failed: 保存图片文件失败: - + + model: %1 + type: %1 + + + 设备型号: %1 + + + + fwVer: %1 + sn: %1 + + + 固件版本号: %1 + + + + sn: %1 + ip: %1 + + + 序列号: %1 + + + + ip: %1 + mac: %1 + + + 设备IP: %1 + + + + rollerCount: %1 + totalCount: %1 + + 滚轴张数: %1 + + + + Detected that there is less than 1GB of disk space. Do you want to continue? + 检测到磁盘空间已不足1GB,是否继续? + + + start failed! 启动安装程序失败! - + There are pictures that have not been saved. Are you sure to close? 有图像未保存,确定关闭? - found device : %1 - 发现设备 : %1 + 发现设备 : %1 - - - - - - - - - - - - - + + + + + + + + + + + + + + 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. 文档丢失!文档可能已被删除或被重命名。 @@ -3235,25 +3117,19 @@ Are you sure to close? <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>版本: %1</p> - - <p>CopyRight: &#169; %1</p> <p>版权: &#169; %1</p> - <p>版权: &#169; %1</p> + <p>版权: &#169; %1</p> <p>%1: <a href='%2'>%3</a></p> @@ -3271,27 +3147,19 @@ Are you sure to close? 错误 - default_setting - 默认设置 + 默认设置 - &Save - 保存(&S) + 保存(&S) Widget - - Widget - - - - zuobiaozhou - 坐标轴 + 坐标轴 @@ -3407,63 +3275,46 @@ Are you sure to close? 缩放 - - cutDialog - - - cutDialog - - - device_menu - no device - 没有发现扫描仪 + 没有发现扫描仪 - default setting - 默认设置 + 默认设置 dialog_log - 日志 - 扫描状态信息 + 扫描状态信息 - cancel scan - 取消扫描 + 取消扫描 - auto scroll - 自动滚动 + 自动滚动 - export images - 导出图片 + 导出图片 - continue scan - 继续扫描 + 继续扫描 - finish scan - 完成扫描 + 完成扫描 - (epicycle scanning images %u picture) - (本轮共扫描 %u 幅) + (本轮共扫描 %u 幅) fold @@ -3474,9 +3325,8 @@ Are you sure to close? 展开 - clear - 清空信息 + 清空信息 @@ -3515,75 +3365,60 @@ Are you sure to close? 删除配置 - existing configuration scheme - 现有配置方案: + 现有配置方案: - change name - 改名 + 改名 - delete - 删除 + 删除 - apply - 应用 + 应用 - delete all configurations - 删除所有配置 + 删除所有配置 - confgiuration information: - 配置信息: + 配置信息: - - ok - 确定 + 确定 - cancel - 取消 + 取消 - configuration scheme management - 配置方案管理 + 配置方案管理 - regional crop - 区域裁剪 + 区域裁剪 - custom tone curve - 自定义色调曲线 + 自定义色调曲线 - Please select to overwrite the original configuration: - 请选择覆盖原来的配置: + 请选择覆盖原来的配置: - ,or add a new configuration - ,或者新增配置 + ,或者新增配置 - save the configuration - 保存配置 + 保存配置 The Settings you just set are in the original configuration " @@ -3615,84 +3450,64 @@ No: add new configuration - <h6><b> - <h6><b> + <h6><b> - cover original configuration: - 覆盖原来配置: + 覆盖原来配置: - add new configuration - 新增配置 + 新增配置 - rename: - 更名: + 更名: - - - tips - 提示 + 提示 - scheme name cannot be empty - 配置名不能为空 + 配置名不能为空 - - scheme name: - 配置名: + 配置名: - - already exists - 已存在 + 已存在 - :</b></h6> - :</b></h6> + :</b></h6> - <p> - <p> + <p> - </p> - </p> + </p> - configuration scheme name change - 配置改名 + 配置改名 - - be sure to delete the configuration - 确认删除配置 + 确认删除配置 - Are you sure you want to delete the configuration " - 您确认要删除配置 + 您确认要删除配置 - " ? - + Are you sure you want to delete the configuration ‘ @@ -3703,83 +3518,8 @@ No: add new configuration ’ 吗? - Are you sure you want to delete the configuration? - 您确认要删除所有配置吗? - - - - setPicClrTool - - - 自定义色调曲线 - - - - - 自定义 - 自定 - - - - - 负片(RGB) - - - - - 彩色负片(RGB) - - - - - 较暗(RGB) - - - - - 较亮(RGB) - - - - - RGB - - - - - 灰 - - - - - 红 - - - - - 蓝 - - - - - 绿 - - - - - 初始化 - - - - - 输入: - - - - - 输出: - + 您确认要删除所有配置吗? diff --git a/app/scanner/Scanner_zh_EN.qm b/app/scanner/Scanner_zh_EN.qm index 558dcdf8f9d6cb7e377e07cdc7acdc5fde61d0d6..0f7375f9de0dde63b8a28c5819f8b31a28ce641f 100644 GIT binary patch delta 5027 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 HxlHzdy&0kJ diff --git a/app/scanner/Scanner_zh_EN.ts b/app/scanner/Scanner_zh_EN.ts index 05c05336..a3837a70 100644 --- a/app/scanner/Scanner_zh_EN.ts +++ b/app/scanner/Scanner_zh_EN.ts @@ -4,87 +4,36 @@ CutPaperTool - 自定义扫描区域 - Custom scan area + Custom scan area - 纸张尺寸: - Paper size: + Paper size: - - A4 - - - - - (210*297) - - - - DPI(像素/英寸): - DPI(Primitive / inches): + DPI(Primitive / inches): - - 200 - - - - 单位: - Unit: + Unit: - 毫米(mm) - Millimeter(mm) + Millimeter(mm) - 英寸(in) - Inch(in) + Inch(in) - 像素(px) - Primitive(px) + Primitive(px) - 初始化选择区域 - Initialize selected area - - - - x: - - - - - - - - mm - - - - - y: - - - - - w: - - - - - h: - + Initialize selected area @@ -589,36 +538,36 @@ The page range will be “selected pages” Cancel - - - + + + Input is not valid. Page range will be 'Chosen Pages'. Input invalid. The page range will be “selected pages” - + English English - + Simplified Chinese Simplified Chinese - + Traditional Chinese Traditional Chinese - + Japanese Japanese - + Korean Korean @@ -636,17 +585,17 @@ The page range will be “selected pages” Stop exporting - + export succeed Export completed - + export failed: Export failed: - + tip Prompt @@ -1589,27 +1538,27 @@ Please make sure the two passwords are the same. OCR type: - + English English - + Simplified Chinese Simplified Chinese - + Traditional Chinese Traditional Chinese - + Japanese Japanese - + Korean Korean @@ -1770,29 +1719,12 @@ Please make sure the two passwords are the same. Dialog_upgradeFirmware - - Dialog - - - - - gif - - - - - text - - - - upgrade - Update and upgrade + Update and upgrade - firmware upgrade in progress, please wait... - Device firmware currently updating; please wait... + Device firmware currently updating; please wait... @@ -1882,469 +1814,472 @@ Please make sure the two passwords are the same. Scan - + menu_view View - + menu_Auto_Image_Size Automatic image size - + menu_page Page - + menu_multiPages Multiple pages - + menu_image Image - + menuRotate Rotate - + menu_user User - + menu_info Information - menu_device - Device + Device - + toolBar Toolbar - + act_open Open... - + act_insert Insert local file... - + act_save Save - + act_saveAs Save as... - + act_Export Export... - + act_closeFile Close selected item - + act_closeAll Close all items - + act_imageInfo Image information... - + act_exit Exit - + act_scannerSettings Scan settings - + act_acquire Scan - + act_acquireSingle Scan single page - - + + act_acquireInto Scan to... - + act_fullscreen Fullscreen display - + act_fitWindowSize Fit view box size - + act_fitWindowWidth Fit view box width - + act_realSize Real size - + act_zoomIn Zoom in - + act_zoomOut Zoom out - + act_toolBar ToolBar - + act_statusBar Status bar - + act_thumbnailBar Thumbnail bar - + act_colorInfo Color information - + act_previous Previous - + act_next Next - + act_first First - + act_last Last - + act_openPageNum Jump to... - + act_previousPage Previous page - + act_nextPage Next page - + act_firstPage First page - + act_lastPage Last page - + act_adjust Brightness/ contrast/ gamma... - + act_90Left Rotate 90 degrees left - + act_90Right Rotate 90 degrees right - + act_180 Rotate 180 degrees - + act_multiRotate Rotate multiple pages... - + act_autoCrop Crop/ Deskew/ Remove black box... - + act_signIn Login... - + act_passwordChange Change password... - + act_signOut Logout - + act_log Log management... - + act_clrCache Cache settings... - + act_consume Consumable status... - + act_help Help - + act_about About... - + act_insertFromScanner Insert from scan... - + act_clearRoller Clear roller count - + act_imageEdit Image edit... - + act_sortPages Book sorting - + act_autoSave Auto save - + act_update Check for updates... - + act_feedback Opinions and feedback... - + act_device_log Export device log... - + act_driver_log Export drive log... - + act_deleteFile Delete selected item - + act_enhanceText Enhance text - + + act_selectDevice + Select device source... + + + HanvonScan Hanvon scanning software - + LanxumScan LANXUM scanning software - + CumtennScan CUMTENN scanning software - + MicrotekScan Microtek DocWizard EX V1.0 - + HuaGoScan HUAGOSCAN scanning software - + menu_language Language - + act_simpCN 简体中文 - + act_English English - + Grid Multi-column display - + Move To... Move to... - + Insert files Insert file - - - + + nodevice No scanner detected - + auto save Auto save - + when switching pictures, save the edited pictures directly without reminding Do not show prompt and save the edited images directly when switching images. - + statusBar displayed Show status bar - + statusBar hidden Hide status bar - + toolBar displayed Show toolbar - + toolBar hidden Hide toolbar - + colorInfo enabled Enable image information - + colorInfo disenabled Disable image information - + enabling automatic saving Enable auto save - + cancel auto save Cancel auto save - + Automatically save the edited the edited iamge when switching pictures. To cancel, uncheck the menu item: image-> automatically save Save edited images automatically when switching images. If you want to cancel, please deselect the menu item: Auto save images. - - - - - + + + + + Question Ask - + modified, save it? Image modified, save changes? @@ -2361,7 +2296,7 @@ Please make sure the two passwords are the same. No - + file lost, remove it? File lost; delete? @@ -2370,424 +2305,424 @@ Please make sure the two passwords are the same. Device discovered - found device : %1 - Device discovered: %1 + Device discovered: %1 - reconnected - reconnect + reconnect - already connected, but open faild - connected, but failed to open + connected, but failed to open - disconnected - disconnected + disconnected - - - the disk space in the current path is unsufficient, please select a new path or clear the disk space in time. - Insufficient disk space for the current path. + Insufficient disk space for the current path. Please reselect a path or clear disk space immediately. - - - warning - Warning + Warning - - + save image failed: Failed to save image: - - - - + + create savepath failed: Failed to create folder: - - + create image doc failed: Failed to create image file: - - - - - - - - - - - - - + + + + + + save image doc failed: Failed to save image: - + binary Black and white - + gray Grayscale - + rgb Color - - - - - - - - - - - - - - - - - - + + + + + + + + + + start failed Failed to start - + UniScan UNI scanning software - - + + default scheme Default scheme - - - - - - - - - - - - Please wake up the device manually - Please wake up the device manually + Please wake up the device manually - + Scan Scanning software - - - - - - - - - - - - already waked up device - Device is awake + Device is awake - + thumbnailBar enabled Show thumbnail bar - + thumbnailBar hidden Hide thumbnail bar - + Clear, then start scan Clear and start scan - + Do NOT clear, then start scan Do not clear and start scan - + cancel Cancel - + Already exist images in image list. Do you want to clear? Image already exists in the list of images. Clear? - + Open images Open image - + Insert images Insert image - - - - - - - - - - - - - + + + + + + + + + + + + + + tips prompt - - - + + + save succeed Saved successfully - - + + find savePath in thumbnail Image name already exists in the list - + Please select at least one picture before export Please select at least one image and then export - + File name File name - + File path File path - + File size File size - + Creation date/time Creation time - + Modified date/time Modification time - + Accessed date/time Access time - + Format Format - + Width Width - + Height Height - + depth Depth - + Color model Color mode - + DPI Pixels per inch - + Print size Print size - + Frame Frame - + None None - + Mono Black and white - + Gray Gray scale - + Color Color - + Not supported Not supported - + Warning Warning - + Device is Running! Please finish scanning first. Device is currently running! Please stop scanning first. - + There are pictures that have not been saved. Are you sure to close? There are unsaved images; are you sure you want to close? - + Are you sure to close? Are you sure you want to close? - + Sure to sign out administrator account? Are you sure you want to log out of the administrator account? - + + type: %1 + Type: %1 + + + + mac: %1 + MAC: %1 + + + + model: %1 + type: %1 + + + Model: %1 + + + + fwVer: %1 + sn: %1 + + + Firmware version: %1 + + + + sn: %1 + ip: %1 + + + Serial number: %1 + + + + ip: %1 + mac: %1 + + + Device IP: %1 + + + + rollerCount: %1 + totalCount: %1 + + Roller count: %1 + + + + totalCount: %1 + 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 + + confirm operation - Confirm operation + Confirm operation - are you sure to clear the roller count? - Are you sure you want to clear the roller count? + Are you sure you want to clear the roller count? - - - hint - Prompt + Prompt - - Roller scanned count has been set to 0. - Roller count reset to zero. + Roller count reset to zero. - - Roller scanned count reset failed. - Failed to reset roller count. + Failed to reset roller count. - + Error Error - + Document missing! It would be deleted or renamed. File lost! File may be deleted or renamed. - confirm the operation - Confirm operation + Confirm operation - Are you sure to clear the rollor acount? - Are you sure you want to clear the roller count? + Are you sure you want to clear the roller count? - about - About + 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]. @@ -2801,76 +2736,58 @@ Please try to change the cache path in [Scan to]. <p>%1</p><p>Version: %2<br>Copyright: &#169; %3</p><p>%4%5%6%7%8%9</p> - - + about %1 About %1 - - - <p>Version: %1</p> - <p>Version: %1</p> + <p>Version: %1</p> - - <p>CopyRight: &#169; %1</p> - <p>Copyright: &#169; %1</p> + <p>Copyright: &#169; %1</p> - - <p>%1: <a href='%2'>%3</a> - <p>%1: <a href='%2'>%3</a> + <p>%1: <a href='%2'>%3</a> - - <p>%1: %2 - <p>%1: %2 + <p>%1: %2 - roller number - Number of rollers + Number of rollers - open scanner - Open scanner + Open scanner - app name - HUAGOSCAN scanning software + HUAGOSCAN scanning software - - success - successfully + successfully - be ready - Ready + Ready - - failed - failed + failed - - + + error Error - + start failed! Failed to start! @@ -2880,106 +2797,97 @@ 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 - apply setting - Apply configuration + Apply configuration - Are you sure to close - Are you sure you want to disconnect device: + Are you sure you want to disconnect device: - ? - ? + ? - - close - Close + Close - + tip Prompt - + Other versions not available No other versions obtained - - The device does not support this operation - Device does not support this operation + Device does not support this operation - - IO error - IO error + 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? @@ -2987,27 +2895,19 @@ Please go to “Scan to” and change the accessible scan folder and then perfor QObject - default_setting - Default setting + Default setting - &Save - &Save + &Save Widget - - Widget - - - - zuobiaozhou - Coordinate axis + Coordinate axis @@ -3123,222 +3023,169 @@ Please go to “Scan to” and change the accessible scan folder and then perfor Zoom - - cutDialog - - - cutDialog - - - device_menu - no device - No scanner detected + No scanner detected - default setting - Default settings + Default settings dialog_log - 日志 - Scan status information + Scan status information - cancel scan - Cancel scan + Cancel scan - auto scroll - Auto scroll + Auto scroll - clear - Clear information + Clear information - export images - Export image + Export image - continue scan - Continue scanning + Continue scanning - finish scan - Scan complete + Scan complete - (epicycle scanning images %u picture) - (A total of %u frames scanned this time) + (A total of %u frames scanned this time) hg_settingdialog - existing configuration scheme - Existing configuration plan: + Existing configuration plan: - change name - Rename + Rename - delete - Delete + Delete - apply - Apply + Apply - delete all configurations - Delete all configurations + Delete all configurations - confgiuration information: - Configuration information: + Configuration information: - - ok - OK + OK - cancel - Cancel + Cancel - configuration scheme management - Configuration plan management + Configuration plan management - regional crop - Regional crop + Regional crop - custom tone curve - Custom tone curve + Custom tone curve - Please select to overwrite the original configuration: - Please select overwrite original configuration: + Please select overwrite original configuration: - ,or add a new configuration - , or add new configuration + , or add new configuration - save the configuration - Save configuration + Save configuration - cover original configuration: - Overwrite original configuration: + Overwrite original configuration: - add new configuration - Add new configuration + Add new configuration - rename: - Rename: + Rename: - - - tips - Prompt + Prompt - scheme name cannot be empty - Configuration name cannot be blank + Configuration name cannot be blank - - scheme name: - Configuration name: + Configuration name: - - already exists - already exists + already exists - <h6><b> - <h6><b> + <h6><b> - :</b></h6> - :</b></h6> + :</b></h6> - <p> - <p> + <p> - </p> - </p> + </p> - configuration scheme name change - Rename configuration + Rename configuration - - be sure to delete the configuration - Delete configuration + Delete configuration - Are you sure you want to delete the configuration " - Are you sure you want to delete configuration + Are you sure you want to delete configuration - " ? - ? + ? yes @@ -3349,82 +3196,67 @@ Please go to “Scan to” and change the accessible scan folder and then perfor No - Are you sure you want to delete the configuration? - Are you sure you want to delete all configurations? + Are you sure you want to delete all configurations? setPicClrTool - 自定义色调曲线 - Custom tone curve + Custom tone curve - 自定义 - Customize + Customize - 负片(RGB) - Negative(RGB) + Negative(RGB) - 彩色负片(RGB) - Color negative(RGB) + Color negative(RGB) - 较暗(RGB) - Darker(RGB) + Darker(RGB) - 较亮(RGB) - Brighter(RGB) + Brighter(RGB) - RGB - RGB + RGB - 灰 - Gray + Gray - 红 - Red + Red - 蓝 - Blue + Blue - 绿 - Green + Green - 初始化 - Initialize + Initialize - 输入: - Input: + Input: - 输出: - OutPut: + OutPut: diff --git a/app/scanner/cutdialog.cpp b/app/scanner/cutdialog.cpp deleted file mode 100644 index ff701baa..00000000 --- a/app/scanner/cutdialog.cpp +++ /dev/null @@ -1,464 +0,0 @@ -#include "cutdialog.h" -#include "ui_cutdialog.h" -#include -#include -#include -#include "HGString.h" -#include "sane/sane_option_definitions.h" - -cutDialog::cutDialog(QWidget *parent) : - QWidget(parent), - ui(new Ui::cutDialog) -{ - ui->setupUi(this); - divisor = 8; - dpi = 1; - sizeType = 0; - paperWidth = 185; - h_w = 260.0/185.0; - sizeRate = 1; - paperHeight = paperWidth*h_w; - - this->setFixedSize(paperWidth,paperHeight); - setMouseTracking(true); - m_startPoint = QPoint(10,10); - m_endPoint = QPoint(50,50); - m_mouse_down = false; - - initAllCorner(); -} - -cutDialog::~cutDialog() -{ - delete ui; -} - -void cutDialog::setPaperSize(QString type, const int w) -{ - paperType = type; - - if (paperType == OPTION_VALUE_ZZCC_A3) h_w = 420.0 / 297.0; - else if (paperType == OPTION_VALUE_ZZCC_8K) h_w = 390.0 / 270.0; - else if (paperType == OPTION_VALUE_ZZCC_16K) h_w = 270.0 / 190.0; - else if (paperType == OPTION_VALUE_ZZCC_16KHX) h_w = 190.0 / 270.0; - else if (paperType == OPTION_VALUE_ZZCC_A4) h_w = 297.0 / 210.0; - else if (paperType == OPTION_VALUE_ZZCC_A4HX) h_w = 210.0 / 297.0; - else if (paperType == OPTION_VALUE_ZZCC_A5) h_w = 210.0 / 148.0; - else if (paperType == OPTION_VALUE_ZZCC_A5HX) h_w = 148.0 / 210.0; - else if (paperType == OPTION_VALUE_ZZCC_A6) h_w = 148.0 / 105.0; - else if (paperType == OPTION_VALUE_ZZCC_A6HX) h_w = 105.0 / 148.0; - else if (paperType == OPTION_VALUE_ZZCC_B4) h_w = 353.0 / 250.0; - else if (paperType == OPTION_VALUE_ZZCC_B5) h_w = 250.0 / 176.0; - else if (paperType == OPTION_VALUE_ZZCC_B5HX) h_w = 176.0 / 250.0; - else if (paperType == OPTION_VALUE_ZZCC_B6) h_w = 176.0 / 125.0; - else if (paperType == OPTION_VALUE_ZZCC_B6HX) h_w = 125.0 / 176.0; - else if (paperType == OPTION_VALUE_ZZCC_Letter) h_w = 279.0 / 216.0; - else if (paperType == OPTION_VALUE_ZZCC_LetterHX) h_w = 216.0 / 279.0; - else if (paperType == OPTION_VALUE_ZZCC_DoubleLetter) h_w = 559.0 / 216.0; - else if (paperType == OPTION_VALUE_ZZCC_LEGAL) h_w = 356.0 / 216.0; - else if (paperType == OPTION_VALUE_ZZCC_SLSJ) h_w = 560.0 / 270.0; - else if(paperType == OPTION_VALUE_ZZCC_ZDSMCC) h_w = 3307.0*2/2338; - else if(paperType == OPTION_VALUE_ZZCC_PPYSCC) { - if(dpi == 100.0) h_w = 1795.0/1189; - if(dpi == 150.0) h_w = 1795.0/1784; - if(dpi == 200.0) h_w = 3307.0/2338; - if(dpi == 240.0) h_w = 4308.0/2854; - if(dpi == 200.0) h_w = 5385.0/3567; - }; - - - if(type.contains("3")) divisor = 2; - else if (type.contains("4")) divisor = 4; - else if (type.contains("5")) divisor = 6; - else if (type.contains("6")) divisor = 8; - else divisor = 4; - paperWidth = w; - if(type.contains(StdStringToUtf8("横向").c_str())) - paperWidth = paperWidth*h_w*1.5; - double realW = paperWidth; - - if (paperType == OPTION_VALUE_ZZCC_A3 || paperType == OPTION_VALUE_ZZCC_A4HX) realRate = 297.0 / realW; - else if (paperType == OPTION_VALUE_ZZCC_A4 || paperType == OPTION_VALUE_ZZCC_A5HX) realRate = 210.0 / realW; - else if (paperType == OPTION_VALUE_ZZCC_A5 || paperType == OPTION_VALUE_ZZCC_A6HX) realRate = 148.0 / realW; - else if (paperType == OPTION_VALUE_ZZCC_A6) realRate = 105.0 / realW; - else if (paperType == OPTION_VALUE_ZZCC_16K) realRate = 190.0 / realW; - else if (paperType == OPTION_VALUE_ZZCC_8K || paperType == OPTION_VALUE_ZZCC_16KHX) realRate = 270.0 / realW; - else if (paperType == OPTION_VALUE_ZZCC_B4 || paperType == OPTION_VALUE_ZZCC_B5HX) realRate = 250.0 / realW; - else if (paperType == OPTION_VALUE_ZZCC_B5 || paperType == OPTION_VALUE_ZZCC_B6HX) realRate = 176.0 / realW; - else if (paperType == OPTION_VALUE_ZZCC_B6) realRate = 125.0 / realW; - else if (paperType == OPTION_VALUE_ZZCC_Letter) realRate = 216.0 / realW; - else if (paperType == OPTION_VALUE_ZZCC_LetterHX) realRate = 279.0 / realW; - else if (paperType == OPTION_VALUE_ZZCC_DoubleLetter) realRate = 216.0 / realW; - else if (paperType == OPTION_VALUE_ZZCC_LEGAL) realRate = 216.0 / realW; - else if (paperType == OPTION_VALUE_ZZCC_SLSJ) realRate = 270.0 / realW; - else if(paperType == OPTION_VALUE_ZZCC_ZDSMCC) realRate = 297.0/realW; - else if(paperType == OPTION_VALUE_ZZCC_PPYSCC) { - if(dpi == 100.0) realRate = 1189.0*0.039377/dpi/realW; - if(dpi == 150.0) realRate = 1784*0.039377/dpi/realW; - if(dpi == 200.0) realRate = 2338*0.039377/dpi/realW; - if(dpi == 240.0) realRate = 2854*0.039377/dpi/realW; - if(dpi == 200.0) realRate = 3567*0.039377/dpi/realW; - }; - - paperHeight = paperWidth*h_w; - this->setFixedSize(paperWidth+4,paperHeight+4); - scaleRec = QRectF(0,0,paperWidth,paperHeight+0.5); - m_rect = QRectF(m_startPoint,m_endPoint); - update(); - refreshView(); -} - -void cutDialog::setDpiValue(const double d) -{ - dpi = d; - if(sizeType == PIXEL) sizeRate = 0.03937*dpi; - update(); -} - -void cutDialog::setSizeType(const SIZETYPE &t) -{ - sizeType = t; - switch (sizeType) { - case MILLIM: - sizeRate = 1; - break; - case INCH: - sizeRate = 0.03937; - break; - case PIXEL: - sizeRate = 0.03937*dpi; - break; - } - update(); -} - -void cutDialog::setCutRectWidth(double w) -{ - m_endPoint.setX(m_startPoint.x()+scaleRec.width()*w/getPaperSize().width()); - update(); -} - -void cutDialog::setCutRectHeight(double h) -{ - m_endPoint.setY(m_startPoint.y()+scaleRec.height()*h/getPaperSize().height()); - update(); -} - -void cutDialog::setCutRectStartX(double x) -{ - m_startPoint.setX(scaleRec.width()*x/getPaperSize().width()); - update(); -} - -void cutDialog::setCutRectStartY(double y) -{ - m_startPoint.setY(scaleRec.height()*y/getPaperSize().height()); - update(); -} - -QSizeF cutDialog::getPaperSize() const -{ - double realW = paperWidth*realRate*sizeRate; - double realH = paperHeight*realRate*sizeRate; - return QSizeF(realW,realH); -} - -QSizeF cutDialog::getCutRectSize() const -{ - double realCutW = getPaperSize().width()*m_rect.width()/scaleRec.width(); - double realCutH = getPaperSize().height()*m_rect.height()/scaleRec.height(); - return QSizeF(realCutW,realCutH); -} - -QPointF cutDialog::getCutRectStartPos() const -{ - double realCutX = getPaperSize().width()*m_startPoint.x()/scaleRec.width(); - double realCutY = getPaperSize().height()*m_startPoint.y()/scaleRec.height(); - return QPointF(realCutX,realCutY); -} - -QRectF cutDialog::getCutRectPixel() const -{ - double x = 0.03937*dpi*paperWidth*realRate*m_startPoint.x()/scaleRec.width(); - double y = 0.03937*dpi*paperHeight*realRate*m_startPoint.y()/scaleRec.height(); - double w = 0.03937*dpi*paperWidth*realRate*m_rect.width()/scaleRec.width(); - double h = 0.03937*dpi*paperHeight*realRate*m_rect.height()/scaleRec.height(); - return QRectF(x,y,w,h); -} - -void cutDialog::setCutRectPixel(QRectF &rect) -{ - m_startPoint.setX(scaleRec.width()*rect.x()/(paperWidth*realRate*0.03937*dpi)); - m_startPoint.setY(scaleRec.height()*rect.y()/(paperHeight*realRate*0.03937*dpi)); - m_endPoint.setX(m_startPoint.x()+scaleRec.width()*rect.width()/(paperWidth*realRate*0.03937*dpi)); - m_endPoint.setY(m_startPoint.y()+scaleRec.height()*rect.height()/(paperHeight*realRate*0.03937*dpi)); - update(); -} - -int cutDialog::getCutRectRight() const -{ - return getPaperSize().width()*m_rect.right()/scaleRec.right(); -} - -int cutDialog::getCutRectBottom() const -{ - return getPaperSize().height()*m_rect.bottom()/scaleRec.bottom(); -} - -void cutDialog::mousePressEvent(QMouseEvent *event) -{ - int x = event->x()/**paperWidth/width()*/; - int y = event->y()/**paperHeight/height()*/; - m_moveStart = QPoint(x,y); - m_mouse_down = event->button() == Qt::LeftButton; - update(); -} - -void cutDialog::mouseMoveEvent(QMouseEvent *event) -{ - int x = event->x()/**paperWidth/width()*/; - int y = event->y()/**paperHeight/height()*/; - if(m_mouse_down){ - int dx = m_moveStart.x() - x; - int dy = m_moveStart.y() - y; - m_moveStart = QPoint(x,y); - - if(m_leftCorn){ - m_startPoint.setX(x); - }else if(m_rightCorn){ - m_endPoint.setX(x); - }else if(m_topCorn){ - m_startPoint.setY(y); - }else if(m_bottomCorn){ - m_endPoint.setY(y); - }else if(m_leftTop){ - m_startPoint.setX(x); - m_startPoint.setY(y); - }else if(m_leftBottom){ - m_startPoint.setX(x); - m_endPoint.setY(y); - }else if(m_rightTop){ - m_startPoint.setY(y); - m_endPoint.setX(x); - }else if(m_rightBottom){ - m_endPoint.setX(x); - m_endPoint.setY(y); - } - else if(!m_out){ - if(m_startPoint.x() - dx < 0) dx = 0; - if(m_startPoint.y() - dy < 0) dy = 0; - if(m_endPoint.x() - dx > scaleRec.right()) dx = 0; - if(m_endPoint.y() - dy > scaleRec.bottom()) dy = 0; - m_startPoint.setX(m_rect.left()-dx); - m_startPoint.setY(m_rect.top()-dy); - m_endPoint.setX(m_rect.right()-dx); - m_endPoint.setY(m_rect.bottom()-dy); - } - if(m_startPoint.x()<=0) m_startPoint.setX(0); - if(m_startPoint.y()<=0) m_startPoint.setY(0); - if(m_endPoint.x()>=scaleRec.width()) m_endPoint.setX(scaleRec.right()); - if(m_endPoint.y()>=scaleRec.height()) m_endPoint.setY(scaleRec.bottom()); - - - if(qAbs(m_startPoint.x() - m_endPoint.x()) <= 10 || m_startPoint.x() > m_endPoint.x()){ - m_startPoint.setX(m_rect.left()); - m_endPoint.setX(m_rect.right()); - } - if(qAbs(m_startPoint.y() - m_endPoint.y()) <= 10 || m_startPoint.y() > m_endPoint.y()){ - m_startPoint.setY(m_rect.top()); - m_endPoint.setY(m_rect.bottom()); - } - - update(); - }else{ - mousePosition(QPoint(x,y)); - } -} - -void cutDialog::mouseReleaseEvent(QMouseEvent *) -{ - m_mouse_down = false; - update(); -} - -void cutDialog::enterEvent(QEvent *) -{ - emit lineEditEnable(false); -} - -void cutDialog::leaveEvent(QEvent *) -{ - emit lineEditEnable(true); -} - -void cutDialog::paintEvent(QPaintEvent *) -{ - QPainter painter(this); - painter.translate(0,0); - - drawScale(painter); - drawCutRect(painter); - drawTransparentColor(painter); - if(m_mouse_down){ - if(sizeType == INCH || sizeType == MILLIM){ - emit cutRectX(QString::number(getCutRectStartPos().x(),'f',2).toDouble()); - emit cutRectY(QString::number(getCutRectStartPos().y(),'f',2).toDouble()); - emit cutRectWidth(QString::number(getCutRectSize().width(),'f',2).toDouble()); - emit cutRectHeight(QString::number(getCutRectSize().height(),'f',2).toDouble()); - }else{ - emit cutRectX(double(int(getCutRectStartPos().x()))); - emit cutRectY(double(int(getCutRectStartPos().y()))); - emit cutRectWidth(double(int(getCutRectSize().width()))); - emit cutRectHeight(double(int(getCutRectSize().height()))); - } - } - - painter.end(); -} - -void cutDialog::drawScale(QPainter& painter) -{ - painter.setPen(QPen(Qt::black,1)); - scaleRec = QRectF(0,0,paperWidth,paperHeight+0.5); - painter.drawRect(scaleRec); - for(int i = 6 ; i <= paperWidth-6; i++){ - if(int(paperWidth/2) == i || int(paperWidth/4) == i || int(paperWidth*3/4) == i){ - painter.setPen(QPen(Qt::gray,1)); - painter.drawLine(i,0,i,paperHeight); - painter.setPen(QPen(Qt::black,1)); - } - if(i%divisor == 0){ - painter.drawLine(i,paperHeight-4,i,paperHeight); - painter.drawLine(i,0,i,4); - } - if(i%(divisor*5) == 0){ - painter.drawLine(i,paperHeight-8,i,paperHeight); - painter.drawLine(i,0,i,8); - } - } - for(int i = 6 ; i <= paperHeight-6; i++){ - if(int(paperHeight/2) == i || int(paperHeight/4) == i || int(paperHeight*3/4) == i){ - painter.setPen(QPen(Qt::gray,1)); - painter.drawLine(0,i,paperWidth,i); - painter.setPen(QPen(Qt::black,1)); - } - if(i%divisor == 0){ - painter.drawLine(0,i,4,i); - painter.drawLine(paperWidth,i,paperWidth-4,i); - } - if(i%(divisor*5) == 0){ - painter.drawLine(0,i,8,i); - painter.drawLine(paperWidth,i,paperWidth-8,i); - } - } -} - -void cutDialog::drawCutRect(QPainter &painter) -{ - painter.setPen(QPen(Qt::green,1)); - m_rect = QRectF(m_startPoint,m_endPoint); - - QRectF r(m_rect); - if(r.right() + 6 > paperWidth) - r.setRight(paperWidth - 6); - if(r.bottom() + 2 > paperHeight) - r.setBottom(paperHeight - 2); - - painter.drawRect(r); - painter.setPen(QPen(Qt::red,1)); - painter.setBrush(Qt::red); - painter.drawEllipse(r.left()-2,(r.bottom()-r.top())/2+r.top()-2,4,4); - painter.drawEllipse(r.left()-2,r.top()-2,4,4); - painter.drawEllipse(r.left()-2,r.bottom()-2,4,4); - painter.drawEllipse(r.right()-2,r.top()-2,4,4); - painter.drawEllipse(r.right()-2,r.bottom()-2,4,4); - painter.drawEllipse(r.right()-2,(r.bottom()-r.top())/2+r.top()-2,4,4); - painter.drawEllipse((r.right()-r.left())/2+r.left()-2,r.top()-2,4,4); - painter.drawEllipse((r.right()-r.left())/2+r.left()-2,r.bottom()-2,4,4); -} - -void cutDialog::drawTransparentColor(QPainter &painter) -{ - QPainterPath painterPath; - QPainterPath p; - p.addRect(scaleRec); - painterPath.addRect(m_rect); - QPainterPath drawPath =p.subtracted(painterPath); - painter.setOpacity(0.7); - painter.fillPath(drawPath,QBrush(Qt::gray)); -} - -void cutDialog::mousePosition(const QPoint& e) -{ - initAllCorner(); - QRectF r = QRectF(m_rect); - int x = e.x(); - int y = e.y(); - m_left = qAbs(x - r.left()) < 5; - m_right = qAbs(x - r.right()) < 5; - m_bottom = qAbs(y - r.bottom()) < 5; - m_top = qAbs(y - r.top()) < 5; - m_out = r.left()-x>=5 || x-r.right()>=5 || r.top()-y>=5 || y-r.bottom()>=5; - bool lorr = m_left | m_right; - bool torb = m_top | m_bottom; - if(lorr && torb) - { - if((m_left && m_top) || (m_right && m_bottom)) - setCursor(Qt::SizeFDiagCursor); - else - setCursor(Qt::SizeBDiagCursor); - } - else if(lorr) - setCursor(Qt::SizeHorCursor); - else if(torb) - setCursor(Qt::SizeVerCursor); - else if(!m_out) - { - setCursor(Qt::SizeAllCursor); - m_bottom = m_left = m_right = m_top = false; - }else if(m_out){ - setCursor(Qt::ArrowCursor); - m_bottom = m_left = m_right = m_top = false; - } - - if(m_left && m_top) m_leftTop = true; - else if(m_left && m_bottom) m_leftBottom = true; - else if(m_right && m_top) m_rightTop = true; - else if(m_right && m_bottom) m_rightBottom = true; - else if(m_left && !m_top && !m_bottom) m_leftCorn = true; - else if(m_right && !m_top && !m_bottom) m_rightCorn = true; - else if(m_top && !m_left && !m_right) m_topCorn = true; - else if(m_bottom && !m_left && !m_right) m_bottomCorn = true; - else initAllCorner(); -} - -void cutDialog::refreshView() -{ - if(sizeType == INCH){ - emit cutRectX(QString::number(getCutRectStartPos().x(),'f',2).toDouble()); - emit cutRectY(QString::number(getCutRectStartPos().y(),'f',2).toDouble()); - emit cutRectWidth(QString::number(getCutRectSize().width(),'f',2).toDouble()); - emit cutRectHeight(QString::number(getCutRectSize().height(),'f',2).toDouble()); - }else{ - emit cutRectX(QString::number(getCutRectStartPos().x(),'f',0).toDouble()); - emit cutRectY(QString::number(getCutRectStartPos().y(),'f',0).toDouble()); - emit cutRectWidth(double(int(getCutRectSize().width()))); - emit cutRectHeight(double(int(getCutRectSize().height()))); - } -} - -void cutDialog::initAllCorner() -{ - m_left = false; - m_right = false; - m_bottom = false; - m_top = false; - m_leftCorn = false; - m_rightCorn = false; - m_topCorn = false; - m_bottomCorn = false; - m_leftTop = false; - m_leftBottom = false; - m_rightTop = false; - m_rightBottom = false; -} diff --git a/app/scanner/cutdialog.h b/app/scanner/cutdialog.h deleted file mode 100644 index 2f77ef2a..00000000 --- a/app/scanner/cutdialog.h +++ /dev/null @@ -1,100 +0,0 @@ -#ifndef CUTDIALOG_H -#define CUTDIALOG_H - -#include -#include -#include -#include - -namespace Ui { -class cutDialog; -} - -enum SIZETYPE{ - MILLIM , - INCH, - PIXEL -}; - -class cutDialog : public QWidget -{ - Q_OBJECT - -public: - explicit cutDialog(QWidget *parent = nullptr); - ~cutDialog(); - void setPaperSize(QString type = "A1", const int w = 200); - void setDpiValue(const double d); - void setSizeType(const SIZETYPE& t); - void setCutRectWidth(double w); - void setCutRectHeight(double h); - void setCutRectStartX(double x); - void setCutRectStartY(double y); - QSizeF getPaperSize()const; - QSizeF getCutRectSize()const; - QPointF getCutRectStartPos()const; - QRectF getCutRectPixel()const; - void setCutRectPixel(QRectF& rect); - int getCutRectRight()const; - int getCutRectBottom()const; - void refreshView(); - -signals: - void cutRectX(double x); - void cutRectY(double y); - void cutRectWidth(double w); - void cutRectHeight(double h); - void lineEditEnable(bool b); - -private: - void mousePressEvent(QMouseEvent*); - void mouseMoveEvent(QMouseEvent*); - void mouseReleaseEvent(QMouseEvent*); - void enterEvent(QEvent*); - void leaveEvent(QEvent*); - //void resizeEvent(QResizeEvent*); - void paintEvent(QPaintEvent *); - void drawScale(QPainter &painter); - void drawCutRect(QPainter &painter); - void drawTransparentColor(QPainter &painter); - void drawPaperSize(); - void mousePosition(const QPoint &e); - void initAllCorner(); - //void mouseChangeRect(int dx,int dy); - -private: - Ui::cutDialog *ui; - QPointF m_startPoint; - QPointF m_endPoint; - QPointF m_moveStart; - - QRectF m_rect; - QRectF scaleRec; - - QString paperType; - double paperWidth; - double paperHeight; - int divisor; - int sizeType; - double dpi; - double h_w; - double realRate; - double sizeRate; - - bool m_mouse_down; - bool m_left; - bool m_right; - bool m_bottom; - bool m_top; - bool m_leftCorn; - bool m_rightCorn; - bool m_topCorn; - bool m_bottomCorn; - bool m_leftTop; - bool m_rightTop; - bool m_leftBottom; - bool m_rightBottom; - bool m_out; -}; - -#endif // CUTDIALOG_H diff --git a/app/scanner/cutdialog.ui b/app/scanner/cutdialog.ui deleted file mode 100644 index de03c34e..00000000 --- a/app/scanner/cutdialog.ui +++ /dev/null @@ -1,44 +0,0 @@ - - - cutDialog - - - true - - - - 0 - 0 - 321 - 342 - - - - - 0 - 0 - - - - - 2 - 0 - - - - - 2 - 0 - - - - true - - - cutDialog - - - - - - diff --git a/app/scanner/cutpapertool.cpp b/app/scanner/cutpapertool.cpp deleted file mode 100644 index ab2f84e0..00000000 --- a/app/scanner/cutpapertool.cpp +++ /dev/null @@ -1,219 +0,0 @@ -#include "cutpapertool.h" -#include "ui_cutpapertool.h" -#include -#include - -CutPaperTool::CutPaperTool(QWidget *parent) : - QDialog(parent), - ui(new Ui::CutPaperTool) -{ - ui->setupUi(this); - setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint); - connect(ui->widget,SIGNAL(cutRectX(double)),this,SLOT(cutRectXSlot(double))); - connect(ui->widget,SIGNAL(cutRectY(double)),this,SLOT(cutRectYSlot(double))); - connect(ui->widget,SIGNAL(cutRectWidth(double)),this,SLOT(cutRectWidthSlot(double))); - connect(ui->widget,SIGNAL(cutRectHeight(double)),this,SLOT(cutRectHeightSlot(double))); - connect(ui->widget,SIGNAL(lineEditEnable(bool)),this,SLOT(lineEditEnableSlot(bool))); - //setDpi(200); - //setPaperType(200,"A4",400); - ui->widget->setSizeType(MILLIM); - setSizeLabel(); - //ui->pbtn_init->setFixedWidth(160); - this->setFixedWidth(ui->widget->width()+40); -} - -CutPaperTool::~CutPaperTool() -{ - delete ui; -} - -void CutPaperTool::paintEvent(QPaintEvent *) -{ - -} - -void CutPaperTool::setPaperType(const int d, const QString &t, const int& w) -{ - dpi = d; - ui->dpiLab->setText(QString::number(dpi)); - ui->widget->setDpiValue(dpi); - paperType = t; - ui->paperLab->setText(paperType); - ui->widget->setPaperSize(paperType,w); - //ui->widget->refreshView(); - setSizeLabel(); - this->setFixedWidth(ui->widget->width()+40); - setSizeInit(); -} - -QRectF CutPaperTool::getCutRectPixel() -{ - return QRectF(ui->widget->getCutRectPixel()); -} - -void CutPaperTool::setCutRect(QRectF &rect) -{ - ui->widget->setCutRectPixel(rect); - ui->startXEdt->setText(QString::number(rect.x()/dpi/0.03937)); - ui->startYEdt->setText(QString::number(rect.y()/dpi/0.03937)); - ui->rectWidth->setText(QString::number(rect.width()/dpi/0.03937)); - ui->rectHeight->setText(QString::number(rect.height()/dpi/0.03937)); -} - -void CutPaperTool::setSizeLabel() -{ - QString wSize; - QString hSize; - if(ui->comboBox_2->currentIndex() == INCH){ - wSize = QString::number(ui->widget->getPaperSize().width(),'f',2); - hSize = QString::number(ui->widget->getPaperSize().height(),'f',2); - } - else { - wSize = QString::number(int(ui->widget->getPaperSize().width()+0.001)); - hSize = QString::number(int(ui->widget->getPaperSize().height()+0.001)); - } - ui->sizeLabel->setText("("+wSize + " * " +hSize+")"); -} - -void CutPaperTool::setSizeInit() -{ - ui->widget->setCutRectStartX(0); - ui->widget->setCutRectStartY(0); - ui->widget->setCutRectWidth(ui->widget->getPaperSize().width()); - ui->widget->setCutRectHeight(ui->widget->getPaperSize().height()); - ui->startXEdt->setText("0"); - ui->startYEdt->setText("0"); - ui->rectWidth->setText(QString::number(int(ui->widget->getPaperSize().width()))); - ui->rectHeight->setText(QString::number(int(ui->widget->getPaperSize().height()))); -} - -void CutPaperTool::setSizeInit(QRectF& rect){ - setSizeInit(); - if(rect != QRectF(0,0,0,0)) - setCutRect(rect); -} - -void CutPaperTool::cutRectXSlot(double x) -{ - ui->startXEdt->setText(QString::number(x)); -} - -void CutPaperTool::cutRectYSlot(double y) -{ - ui->startYEdt->setText(QString::number(y)); -} - -void CutPaperTool::cutRectWidthSlot(double w) -{ - ui->rectWidth->setText(QString::number(w)); -} - -void CutPaperTool::cutRectHeightSlot(double h) -{ - ui->rectHeight->setText(QString::number(h)); -} - -void CutPaperTool::lineEditEnableSlot(bool b) -{ - ui->startXEdt->setEnabled(b); - ui->startYEdt->setEnabled(b); - ui->rectWidth->setEnabled(b); - ui->rectHeight->setEnabled(b); -} - -void CutPaperTool::on_startXEdt_textEdited(QString arg1) -{ - double x = arg1.toDouble(); - if(x >ui->widget->getCutRectRight()) { - //arg1.chop(1); - //x = arg1.toDouble(); - //x = ui->widget->getCutRectRight(); - return ; - } - if(type == PIXEL) x = arg1.toInt(); - ui->widget->setCutRectStartX(x); -} - -void CutPaperTool::on_startYEdt_textEdited(QString arg1) -{ - double y = arg1.toDouble(); - if(y >ui->widget->getCutRectBottom()) { - //arg1.chop(1); - //y = arg1.toDouble(); - return ; - } - if(type == PIXEL) y = arg1.toInt(); - ui->widget->setCutRectStartY(y); -} - -void CutPaperTool::on_rectWidth_textEdited(QString arg1) -{ - double v = arg1.toDouble(); - if(v > ui->widget->getPaperSize().width() - ui->widget->getCutRectStartPos().x()) { - //arg1.chop(1); - //v = arg1.toDouble(); - //v=ui->widget->getPaperSize().width() - ui->widget->getCutRectStartPos().x(); - return ; - } - if(type == PIXEL) v = arg1.toInt(); - ui->widget->setCutRectWidth(v); -} - -void CutPaperTool::on_rectHeight_textEdited(QString arg1) -{ - double v = arg1.toDouble(); - if(v > ui->widget->getPaperSize().height() - ui->widget->getCutRectStartPos().y()) { - //arg1.chop(1); - //v = arg1.toDouble(); - //v = ui->widget->getPaperSize().height() - ui->widget->getCutRectStartPos().y(); - return ; - } - if(type == PIXEL) v = arg1.toInt(); - ui->widget->setCutRectHeight(v); -} - -void CutPaperTool::on_comboBox_2_currentIndexChanged(int index) -{ - switch(index){ - case 0: - ui->xLabel->setText("mm"); - ui->yLabel->setText("mm"); - ui->wLabel->setText("mm"); - ui->hLabel->setText("mm"); - ui->widget->setSizeType(MILLIM); - break; - case 1: - ui->xLabel->setText("in"); - ui->yLabel->setText("in"); - ui->wLabel->setText("in"); - ui->hLabel->setText("in"); - ui->widget->setSizeType(INCH); - break; - case 2: - ui->xLabel->setText("px"); - ui->yLabel->setText("px"); - ui->wLabel->setText("px"); - ui->hLabel->setText("px"); - ui->widget->setSizeType(PIXEL); - break; - } - update(); - setSizeLabel(); - ui->widget->refreshView(); -} - - -void CutPaperTool::on_buttonBox_accepted() -{ - accept(); -} - -void CutPaperTool::on_buttonBox_rejected() -{ - reject(); -} - -void CutPaperTool::on_pbtn_init_clicked() -{ - setSizeInit(); -} diff --git a/app/scanner/cutpapertool.h b/app/scanner/cutpapertool.h deleted file mode 100644 index cf6d40eb..00000000 --- a/app/scanner/cutpapertool.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef CUTPAPERTOOL_H -#define CUTPAPERTOOL_H - -#include -#include "cutdialog.h" - -namespace Ui { -class CutPaperTool; -} - -class CutPaperTool : public QDialog -{ - Q_OBJECT - -public: - explicit CutPaperTool(QWidget *parent = nullptr); - ~CutPaperTool(); - void setPaperType(const int dpi, const QString& t,const int& w=200); - QRectF getCutRectPixel(); - void setCutRect(QRectF& rect); - void setSizeInit(); - void setSizeInit(QRectF& rect); - - -private: - void paintEvent(QPaintEvent *); - void setSizeLabel(); - -private slots: - void cutRectXSlot(double x); - void cutRectYSlot(double y); - void cutRectWidthSlot(double w); - void cutRectHeightSlot(double h); - void lineEditEnableSlot(bool b); - - void on_startXEdt_textEdited(QString arg1); - - void on_startYEdt_textEdited(QString arg1); - - void on_rectWidth_textEdited(QString arg1); - - void on_rectHeight_textEdited(QString arg1); - - void on_comboBox_2_currentIndexChanged(int index); - - void on_buttonBox_accepted(); - - void on_buttonBox_rejected(); - - void on_pbtn_init_clicked(); - -private: - Ui::CutPaperTool *ui; - SIZETYPE type; - int dpi; - QString paperType; -}; - -#endif // CUTPAPERTOOL_H diff --git a/app/scanner/cutpapertool.ui b/app/scanner/cutpapertool.ui deleted file mode 100644 index 0e5178d6..00000000 --- a/app/scanner/cutpapertool.ui +++ /dev/null @@ -1,298 +0,0 @@ - - - CutPaperTool - - - true - - - - 0 - 0 - 439 - 676 - - - - - 0 - 0 - - - - 自定义扫描区域 - - - - - - - - 纸张尺寸: - - - - - - - A4 - - - - - - - (210*297) - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - DPI(像素/英寸): - - - Qt::AlignJustify|Qt::AlignVCenter - - - - - - - 200 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - 单位: - - - - - - - - 毫米(mm) - - - - - 英寸(in) - - - - - 像素(px) - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - 初始化选择区域 - - - - - - - - - true - - - - - 0 - 0 - 421 - 430 - - - - - - - - 0 - 0 - - - - - - - - - - - - - - x: - - - - - - - - - - mm - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - y: - - - - - - - - - - mm - - - - - - - - - - - w: - - - - - - - - - - mm - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - h: - - - - - - - - - - mm - - - - - - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - cutDialog - QWidget -
cutdialog.h
- 1 -
-
- - -
diff --git a/app/scanner/device_menu.cpp b/app/scanner/device_menu.cpp deleted file mode 100644 index 1259f158..00000000 --- a/app/scanner/device_menu.cpp +++ /dev/null @@ -1,189 +0,0 @@ -#include "device_menu.h" - -#define ACTION_DEVICE_NAME_PROPERTY "device_name" - -device_menu::device_menu(QWidget *parent) - : QMenu(parent) - , cur_action_(nullptr), none_action_(nullptr) -{ - group_action_ = new QActionGroup(this); - deviceMenuUpdate(nullptr); - connect(group_action_, SIGNAL(triggered(QAction*)), this, SLOT(on_act_triggered(QAction*))); -} - -device_menu::device_menu(const QString &title, QWidget *parent) - : QMenu(title, parent) - , cur_action_(nullptr), none_action_(nullptr) -{ - group_action_ = new QActionGroup(this); - deviceMenuUpdate(nullptr); - connect(group_action_, SIGNAL(triggered(QAction*)), this, SLOT(on_act_triggered(QAction*))); -} - -QMenu* device_menu::find_device_menu(const QString& dev_name) -{ - std::lock_guard lock(mutex_); - std::vector::iterator it = std::find(menus_.begin(), menus_.end(), dev_name); - - if(it == menus_.end()) - return nullptr; - else - return it->menu; -} -QAction* device_menu::find_device_config(const QString& dev_name, const QString& cfg_name) -{ - std::lock_guard lock(mutex_); - std::vector::iterator it = std::find(menus_.begin(), menus_.end(), dev_name); - - if(it == menus_.end()) - return NULL; - - for(size_t i = 0; i < it->actions.size(); ++i) - { - if(it->actions[i]->text() == cfg_name) - return it->actions[i]; - } - - return NULL; -} - -void device_menu::connectedDevice(const QString &device) -{ - QMenu* menu = find_device_menu(device); - if (menu) - menu->setEnabled(true); -} - -void device_menu::disconnectedDevice(const QString &device) -{ - QMenu* menu = find_device_menu(device); - if (menu) - menu->setEnabled(false); -} - -void device_menu::setOptionChecked(const QString &device, const QString &opt, bool checked) -{ - QAction* act = find_device_config(device, opt); - - if(act) - { - act->setChecked(checked); - if(checked) - cur_action_ = act; - else - { - if(cur_action_ == act) - cur_action_ = nullptr; - } - } - else if(checked) - cur_action_ = nullptr; -} - -void device_menu::get_online_devices(QList& dev_names) -{ - std::lock_guard lock(mutex_); - - for(size_t i = 0; i < menus_.size(); ++i) - { - if(menus_[i].menu->isEnabled()) - dev_names.push_back(menus_[i].menu->title()); - } -} - -void device_menu::deviceMenuUpdate(dev_que* que) -{ - std::lock_guard lock(mutex_); - - cur_action_ = nullptr; - if(none_action_) - { - removeAction(none_action_); - none_action_ = nullptr; - } - - for(size_t i = 0; i < menus_.size(); ++i) - menus_[i].menu->setEnabled(false); - if (!que || que->scanners() == 0) - { - if(menus_.empty()) - { - none_action_ = addAction(tr("no device")); - none_action_->setEnabled(false); - } - - return; - } - - for (size_t i = 0; i < que->scanners(); i++) - { - SCANNER s = que->get_at(i); - std::vector::iterator it = std::find(menus_.begin(), menus_.end(), QString::fromStdString((s.name))); - POPMENU pm; - std::vector schemes; - - if(it == menus_.end()) - pm.menu = addMenu(QString::fromStdString(s.name)); - else - { - pm = *it; - menus_.erase(it); - } - pm.menu->setEnabled(true); - pm.menu->setToolTipsVisible(true); - for(size_t j = 0; j < pm.actions.size(); ++j) - { - pm.menu->removeAction(pm.actions[j]); - group_action_->removeAction(pm.actions[j]); - } - pm.actions.clear(); - s.cfg->get_all_schemes(schemes); - for (size_t j = 0; j < schemes.size(); j++) - { - QAction *child = group_action_->addAction(QString::fromStdString(schemes[j])); - child->setProperty(ACTION_DEVICE_NAME_PROPERTY, QVariant(QString::fromStdString(s.name))); - child->setCheckable(true); - - if(que->opened_scanner_name() == s.name && - schemes[j] == s.cfg->get_current_scheme_name()) - { - cur_action_ = child; - child->setChecked(true); - } - - pm.menu->addAction(child); - pm.actions.push_back(child); - - QString tips; - if(tips.isNull()) - { - tips = tr("default setting"); - } - // child->setToolTip(tips); - } - menus_.push_back(pm); - s.cfg->release(); - } -} - -void device_menu::on_act_triggered(QAction* act) -{ - QString deviceName = act->property(ACTION_DEVICE_NAME_PROPERTY).toString(); - QString opt = act->text(); - bool checked_now = act->isChecked(); - - if(cur_action_ == act) - { - checked_now = false; - act->setChecked(false); - cur_action_ = nullptr; -// emit scanOptionsChanged("", "", false); -// return; - } - else { - cur_action_ = act; - checked_now = true; - } - - emit scanOptionsChanged(deviceName, opt, checked_now); -} diff --git a/app/scanner/device_menu.h b/app/scanner/device_menu.h deleted file mode 100644 index 316f2bcf..00000000 --- a/app/scanner/device_menu.h +++ /dev/null @@ -1,506 +0,0 @@ -#ifndef DEVICE_MENU_H -#define DEVICE_MENU_H - -#include -#include -#include "sane/sane_ex.h" -#include "sane/sane_option_definitions.h" -#include "../../../sdk/include/huagao/hgscanner_error.h" - -#include "cfg/gb_json.h" -#include "lang/app_language.h" - -typedef struct _scanner -{ - std::string name; - std::string model; - bool online; - gb::scanner_cfg *cfg; -}SCANNER; -class dev_que -{ - std::vector que_; - std::string root_dir_; - std::string opened_scanner_; - std::string applied_scheme_; - SANE_Handle handle_; - - - static void trans_number(const char* name, std::string& val, void* param) - { - if (strcmp(name, "tl-x") == 0 - || strcmp(name, "br-x") == 0 - || strcmp(name, "tl-y") == 0 - || strcmp(name, "br-y") == 0 - || strcmp(name, "gamma") == 0 - || strcmp(name, "search-hole-range-l") == 0 - || strcmp(name, "search-hole-range-r") == 0 - || strcmp(name, "search-hole-range-t") == 0 - || strcmp(name, "search-hole-range-b") == 0 - || strcmp(name, "feed-strength-value") == 0 - ) - { - float v = atof(val.c_str()); - SANE_Fixed f = SANE_FIX(v); - - val = std::string((char*)&f, sizeof(f)); - } - else if (strcmp(name, "binary-threshold") == 0 - || strcmp(name, "bkg-color-range") == 0 - || strcmp(name, "noise-size") == 0 - || strcmp(name, "blank-sensitivity") == 0 - || strcmp(name, "resolution") == 0 - || strcmp(name, "brightness") == 0 - || strcmp(name, "contrast") == 0 - || strcmp(name, "threshold") == 0 - || strcmp(name, "anti-noise-level") == 0 - || strcmp(name, "margin") == 0 - || strcmp(name, "scan-count") == 0 - || strcmp(name, "askew-range") == 0 - || strcmp(name, "dog-ear-size") == 0 - ) - { - SANE_Int v = atoi(val.c_str()); - val = std::string((char*)&v, sizeof(v)); - } - else if (strcmp(val.c_str(), "true") == 0) - { - SANE_Bool b = SANE_TRUE; - val = std::string((char*)&b, sizeof(b)); - } - else if (strcmp(val.c_str(), "false") == 0) - { - SANE_Bool b = SANE_FALSE; - val = std::string((char*)&b, sizeof(b)); - } - } - static const char* title_2_name(const char* title, void* param) - { - struct - { - const char* name; - const char* title; - }g_opts[] = { {SANE_STD_OPT_NAME_RESTORE , OPTION_TITLE_HFMRSZ} - , {SANE_STD_OPT_NAME_HELP , OPTION_TITLE_BZ} - , {SANE_STD_OPT_NAME_IS_MULTI_OUT , OPTION_TITLE_DLSC} - , {SANE_STD_OPT_NAME_MULTI_OUT_TYPE , OPTION_TITLE_DLSCLX} - , {SANE_STD_OPT_NAME_COLOR_MODE , OPTION_TITLE_YSMS} - , {SANE_STD_OPT_NAME_BINARY_THRESHOLD , OPTION_TITLE_HBTXYZ} - , {SANE_STD_OPT_NAME_REVERSE_01 , OPTION_TITLE_HBTXFSSC} - , {SANE_STD_OPT_NAME_FILTER , OPTION_TITLE_HDHHBTX_CSYZQ} - , {SANE_STD_OPT_NAME_RID_MULTIOUT_RED , OPTION_TITLE_24WCSTX_DLSCCH} - , {SANE_STD_OPT_NAME_RID_ANSWER_SHEET_RED , OPTION_TITLE_24WCSTX_DTKCH} - , {SANE_STD_OPT_NAME_ERASE_BACKGROUND , OPTION_TITLE_BJYC} - , {SANE_STD_OPT_NAME_BKG_COLOR_RANGE , OPTION_TITLE_BJSCFDFW} - , {SANE_STD_OPT_NAME_SHARPEN , OPTION_TITLE_RHYMH} - , {SANE_STD_OPT_NAME_RID_MORR , OPTION_TITLE_QCMW} - , {SANE_STD_OPT_NAME_RID_GRID , OPTION_TITLE_CWW} - , {SANE_STD_OPT_NAME_ERROR_EXTENSION , OPTION_TITLE_CWKS} - , {SANE_STD_OPT_NAME_NOISE_OPTIMIZE , OPTION_TITLE_HBTXZDYH} - , {SANE_STD_OPT_NAME_NOISE_SIZE , OPTION_TITLE_ZDYHCC} - , {SANE_STD_OPT_NAME_PAPER , OPTION_TITLE_ZZCC} - , {SANE_STD_OPT_NAME_CUSTOM_AREA , OPTION_TITLE_ZDYSMQY} - , {SANE_STD_OPT_NAME_CUSTOM_AREA_LEFT , OPTION_TITLE_SMQYZCmm} - , {SANE_STD_OPT_NAME_CUSTOM_AREA_RIGHT , OPTION_TITLE_SMQYYCmm} - , {SANE_STD_OPT_NAME_CUSTOM_AREA_TOP , OPTION_TITLE_SMQYSCmm} - , {SANE_STD_OPT_NAME_CUSTOM_AREA_BOTTOM , OPTION_TITLE_SMQYXCmm} - , {SANE_STD_OPT_NAME_SIZE_CHECK , OPTION_TITLE_CCJC} - , {SANE_STD_OPT_NAME_PAGE , OPTION_TITLE_SMYM} - , {SANE_STD_OPT_NAME_DISCARD_BLANK_SENS , OPTION_TITLE_TGKBYLMD} - , {SANE_STD_OPT_NAME_RESOLUTION , OPTION_TITLE_FBL} - , {SANE_STD_OPT_NAME_TIME_TO_SLEEP , OPTION_TITLE_XMSJ} - , {SANE_STD_OPT_NAME_IMAGE_QUALITY , OPTION_TITLE_HZ} - , {SANE_STD_OPT_NAME_EXCHANGE ,OPTION_TITLE_JHZFM} - , {SANE_STD_OPT_NAME_SPLIT ,OPTION_TITLE_TXCF } - , {SANE_STD_OPT_NAME_ANTI_SKEW , OPTION_TITLE_ZDJP} - , {SANE_STD_OPT_NAME_IS_CUSTOM_GAMMA , OPTION_TITLE_QYSDQX} - , {SANE_STD_OPT_NAME_GAMMA , OPTION_TITLE_JMZ} - , {SANE_STD_OPT_NAME_BRIGHTNESS , OPTION_TITLE_LDZ} - , {SANE_STD_OPT_NAME_CONTRAST , OPTION_TITLE_DBD} - , {SANE_STD_OPT_NAME_IS_PHOTO_MODE , OPTION_TITLE_ZPMS} - , {SANE_STD_OPT_NAME_ERASE_BLACK_FRAME , OPTION_TITLE_XCHK} - , {SANE_STD_OPT_NAME_DARK_SAMPLE , OPTION_TITLE_SSYZ} - , {SANE_STD_OPT_NAME_THRESHOLD , OPTION_TITLE_YZ} - , {SANE_STD_OPT_NAME_ANTI_NOISE_LEVEL , OPTION_TITLE_BJKZDJ} - , {SANE_STD_OPT_NAME_MARGIN , OPTION_TITLE_BYSJ} - , {SANE_STD_OPT_NAME_FILL_BKG_MODE , OPTION_TITLE_BJTCFS} - , {SANE_STD_OPT_NAME_IS_ANTI_PERMEATE , OPTION_TITLE_FZST} - , {SANE_STD_OPT_NAME_ANTI_PERMEATE_LEVEL , OPTION_TITLE_FZSTDJ} - , {SANE_STD_OPT_NAME_RID_HOLE_L , OPTION_TITLE_CKYCZC} - , {SANE_STD_OPT_NAME_SEARCH_HOLE_RANGE_L , OPTION_TITLE_ZCCKSSFWZFMBL} - , {SANE_STD_OPT_NAME_RID_HOLE_R , OPTION_TITLE_CKYCYC} - , {SANE_STD_OPT_NAME_SEARCH_HOLE_RANGE_R , OPTION_TITLE_YCCKSSFWZFMBL} - , {SANE_STD_OPT_NAME_RID_HOLE_T , OPTION_TITLE_CKYCSC} - , {SANE_STD_OPT_NAME_SEARCH_HOLE_RANGE_T , OPTION_TITLE_SCCKSSFWZFMBL} - , {SANE_STD_OPT_NAME_RID_HOLE_B , OPTION_TITLE_CKYCXC} - , {SANE_STD_OPT_NAME_SEARCH_HOLE_RANGE_B , OPTION_TITLE_XCCKSSFWZFMBL} - , {SANE_STD_OPT_NAME_IS_FILL_COLOR , OPTION_TITLE_SCTC} - , {SANE_STD_OPT_NAME_IS_ULTROSONIC_CHECK , OPTION_TITLE_CSBJC} - , {SANE_STD_OPT_NAME_DOUBLE_FEED_HANDLE , OPTION_TITLE_SZTPCL} - , {SANE_STD_OPT_NAME_IS_CHECK_STAPLE , OPTION_TITLE_ZDJC} - , {SANE_STD_OPT_NAME_SCAN_MODE , OPTION_TITLE_SMZS} - , {SANE_STD_OPT_NAME_SCAN_COUNT , OPTION_TITLE_SMSL} - , {SANE_STD_OPT_NAME_TEXT_DIRECTION , OPTION_TITLE_WGFX} - , {SANE_STD_OPT_NAME_IS_ROTATE_BKG_180 , OPTION_TITLE_BMXZ180} - , {SANE_STD_OPT_NAME_IS_CHECK_DOG_EAR , OPTION_TITLE_ZJJC} - , {SANE_STD_OPT_NAME_DOG_EAR_SIZE , OPTION_TITLE_ZJDX} - , {SANE_STD_OPT_NAME_IS_CHECK_ASKEW , OPTION_TITLE_WXJC} - , {SANE_STD_OPT_NAME_ASKEW_RANGE , OPTION_TITLE_WXRRD} - , {SANE_STD_OPT_NAME_FEED_STRENGTH , OPTION_TITLE_FZQD} - , {SANE_STD_OPT_NAME_IS_AUTO_FEED_STRENGTH , OPTION_TITLE_ZDFZQD} - , {SANE_STD_OPT_NAME_FEED_STRENGTH_VALUE , OPTION_TITLE_JZSBL} - , {SANE_STD_OPT_NAME_WAIT_TO_SCAN , OPTION_TITLE_DZSM} - , {SANE_STD_OPT_NAME_FOLD_TYPE , OPTION_TITLE_DZMS} - }, - g_discard[] = { {SANE_STD_OPT_NAME_REVERSE_01 , "\351\273\221\347\231\275\345\233\276\345\203\217\345\217\215\350\211\262\350\276\223\345\207\272\357\274\210\346\255\243\345\270\270\351\242\234\350\211\262\344\270\272\357\274\2320-\351\273\221\350\211\262\357\274\2331-\347\231\275\350\211\262\357\274\211"} // 黑白图像反色输出(正常颜色为:0-黑色;1-白色) - , {SANE_STD_OPT_NAME_FILTER , "\347\201\260\345\272\246\346\210\226\351\273\221\347\231\275\345\233\276\345\203\217 - \351\231\244\350\211\262"} // 灰度或黑白图像 - 除色 - , {SANE_STD_OPT_NAME_IS_AUTO_FEED_STRENGTH , "\350\207\252\345\212\250\346\220\223\347\272\270\345\274\272\345\272\246"} // 自动搓纸强度 - , {SANE_STD_OPT_NAME_FEED_STRENGTH_VALUE , "\346\220\223\347\272\270\351\230\210\345\200\274"} // " 搓纸阈值" - }; - while (*title == ' ') - title++; - - for (size_t i = 0; i < _countof(g_opts); ++i) - { - if (strcmp(title, g_opts[i].title) == 0) - return g_opts[i].name; - } - for (size_t i = 0; i < _countof(g_discard); ++i) - { - if (strcmp(title, g_discard[i].title) == 0) - return g_discard[i].name; - } - - return title; - } - -public: - dev_que() : handle_(nullptr) - {} - ~dev_que() - { - close_scanner(); - - for(auto& v : que_) - v.cfg->release(); - } - - static void update_old_cfg(const char* conf) - { - gb::scanner_cfg::UDF func; - - func.func_param = nullptr; - func.title2name = &dev_que::title_2_name; - func.trans_number = &dev_que::trans_number; - - gb::scanner_cfg::update(conf, &func); - } - static void apply_scheme(SANE_Handle h, gb::sane_config_schm* schm) - { - SANE_Int count = 0, none = 0; - std::string name(""), val(""); - - none = sane_io_control(h, IO_CTRL_CODE_RESTORE_SETTINGS, NULL, NULL); - if(schm && schm->id_from_name(SANE_STD_OPT_NAME_COLOR_MODE) == -1) - { - SANE_Int dev_options = 0; - sane_control_option(h, 0, SANE_ACTION_GET_VALUE, &dev_options, nullptr); - for(int i = 1; i < dev_options; ++i) - { - const SANE_Option_Descriptor* opt = sane_get_option_descriptor(h, i); - if(!opt) - continue; - - unsigned int n = i; - if(opt->type == SANE_TYPE_BOOL) - { - SANE_Bool v = SANE_TRUE; - sane_io_control(h, IO_CTRL_CODE_GET_DEFAULT_VALUE, &v, &n); - schm->set_default_value(i, opt->name, (char*)&v, sizeof(v)); - } - else if (opt->type == SANE_TYPE_INT) { - SANE_Int v = 0; - sane_io_control(h, IO_CTRL_CODE_GET_DEFAULT_VALUE, &v, &n); - schm->set_default_value(i, opt->name, (char*)&v, sizeof(v)); - } - else if(opt->type == SANE_TYPE_FIXED) - { - SANE_Fixed v = 0; - sane_io_control(h, IO_CTRL_CODE_GET_DEFAULT_VALUE, &v, &n); - schm->set_default_value(i, opt->name, (char*)&v, sizeof(v)); - } - else { - char *buf = new char[opt->size + 4]; - memset(buf, 0, opt->size + 4); - sane_io_control(h, IO_CTRL_CODE_GET_DEFAULT_VALUE, buf, &n); - std::string langCN(to_default_language(buf, nullptr)); - schm->set_default_value(i, opt->name, &langCN[0], langCN.length()); - delete[] buf; - } - } - } - if(schm && schm->first_config(name, val)) - { - do - { - int id = schm->id_from_name(name.c_str()); - if(id == -1) - { - if(gb::sane_config_schm::is_option_data(name)) - { - if(name == SANE_STD_OPT_NAME_IS_CUSTOM_GAMMA && val.length() == sizeof(SANE_Gamma)) - { - unsigned int l = val.length(); - sane_io_control(h, IO_CTRL_CODE_SET_CUSTOM_GAMMA, &val[0], &l); - } - } - } - else { - const SANE_Option_Descriptor* opt = reinterpret_cast(sane_get_option_descriptor(h, id)); - if(opt) - { - if(opt->type == SANE_TYPE_STRING) - { - char *buf = new char[opt->size + 4]; - memset(buf, 0, opt->size + 4); - strcpy(buf, val.c_str()); - std::string langCN(from_default_language(buf, nullptr)); - sane_control_option(h, id, SANE_ACTION_SET_VALUE, &langCN[0], &none); - delete[] buf; - } - else { - sane_control_option(h, id, SANE_ACTION_SET_VALUE, &val[0], &none); - } - } - } - - }while(schm->next_config(name, val)); - } - } - - -public: - void set_root_dir(const char* root) - { - root_dir_ = std::string(root) + PATH_SYMBOL; - } - void add_scanner(const char* sane_name) - { - bool found = false; - - for(auto& v: que_) - { - if(v.name == sane_name) - { - found = true; - break; - } - } - - if(!found) - { - SCANNER s; - size_t pos = 0; - - s.model = s.name = sane_name; - s.cfg = nullptr; - pos = s.model.find(" - "); - if(pos != std::string::npos) - { - pos = s.model.find(" - ", pos + 3); - if(pos != std::string::npos) - s.model.erase(pos); - } - for(auto& v: que_) - { - if(v.model == s.model) - { - s.cfg = v.cfg; - s.cfg->add_ref(); - break; - } - } - - if(!s.cfg) - { - s.cfg = new gb::scanner_cfg(); - s.cfg->load_file((root_dir_ + s.model + ".cfg").c_str()); - } - s.online = true; - que_.push_back(s); - } - } - void get_schemes(const char* scanner_name, std::vector& schemes) - { - schemes.clear(); - for(auto& v : que_) - { - if(v.name == scanner_name) - { - v.cfg->get_all_schemes(schemes); - break; - } - } - } - SANE_Handle handle(void) - { - return handle_; - } - std::string opened_scanner_name(void) - { - return opened_scanner_; - } - std::string applied_scheme(void) - { - return applied_scheme_; - } - int open_scanner(const char* scanner_name, const char* scheme = nullptr) - { - SANE_Status statu = SANE_STATUS_GOOD; - - close_scanner(); - statu = sane_open(scanner_name, &handle_); - if(statu == SANE_STATUS_GOOD && handle_) - { - opened_scanner_ = scanner_name; - apply_scheme(scheme); - } - - return statu; - } - int close_scanner(void) - { - if(handle_) - { - sane_close(handle_); - handle_ = nullptr; - opened_scanner_ = ""; - applied_scheme_ = ""; - } - - return SANE_STATUS_GOOD; - } - int scanners(void) - { - return que_.size(); - } - SCANNER get_at(int pos) - { - SCANNER s; - - s.name = s.model = ""; - s.cfg = nullptr; - if(pos >= 0 && pos < que_.size()) - { - s = que_[pos]; - s.cfg->add_ref(); - } - - return s; - } - bool is_online(const char* scanner = nullptr) - { - if(!scanner) - scanner = opened_scanner_.c_str(); - - for(auto& v : que_) - { - if(v.name == scanner) - return v.online; - } - - return false; - } - void set_online(bool online, const char* scanner = nullptr) - { - if(!scanner) - scanner = opened_scanner_.c_str(); - - for(auto& v : que_) - { - if(v.name == scanner) - { - v.online = online; - break; - } - } - } - void get_scanners(std::vector& que) - { - for(auto& v: que_) - que.push_back(v.name); - } - int apply_scheme(const char* scheme_name) - { - if(!handle_) - return SCANNER_ERR_NOT_OPEN; - - for(auto& v: que_) - { - if(v.name == opened_scanner_) - { - gb::sane_config_schm* schm = v.cfg->get_scheme(scheme_name); - dev_que::apply_scheme(handle_, schm); - if(schm) - { - v.cfg->select_scheme(schm->get_scheme_name().c_str()); - schm->release(); - } - else { - v.cfg->select_scheme(scheme_name); - } - applied_scheme_ = v.cfg->get_current_scheme_name(); - v.cfg->save(); - break; - } - } - - return SCANNER_ERR_OK; - } -}; - - -class device_menu : public QMenu -{ - Q_OBJECT - typedef struct _pop_menu - { - QMenu* menu; - std::vector actions; - - bool operator==(const QString& menu_title) - { - return menu->title() == menu_title; - } - }POPMENU; - std::vector menus_; - QAction* cur_action_; - QAction* none_action_; - QActionGroup* group_action_; - std::mutex mutex_; - - QMenu* find_device_menu(const QString& dev_name); - QAction* find_device_config(const QString& dev_name, const QString& cfg_name); - -public: - device_menu(QWidget* parent = nullptr); - device_menu(const QString& title, QWidget* parent = nullptr); - - void deviceMenuUpdate(dev_que* que); - - void connectedDevice(const QString& device); - - void disconnectedDevice(const QString& device); - - void setOptionChecked(const QString& device, const QString& opt, bool checked); - - void get_online_devices(QList& dev_names); - -signals: - void scanOptionsChanged(const QString& device, const QString& opt, bool checked_now); - -private slots: - void on_act_triggered(QAction* act); -}; - -#endif // DEVICE_MENU_H diff --git a/app/scanner/device_user.cpp b/app/scanner/device_user.cpp new file mode 100644 index 00000000..4d448782 --- /dev/null +++ b/app/scanner/device_user.cpp @@ -0,0 +1,193 @@ +#include "device_user.h" +#include + +#if defined(HG_CMP_MSC) + +DeviceUserMgr::DeviceUserMgr(QWidget *wnd) +{ + m_wnd = wnd; + m_twainDSM = nullptr; + HGTwain_CreateDSM((HWND)m_wnd->winId(), &m_twainDSM); +} + +DeviceUserMgr::~DeviceUserMgr() +{ + HGTwain_DestroyDSM(m_twainDSM); + m_twainDSM = nullptr; +} + +class DeviceUser* DeviceUserMgr::OpenDeviceUser() +{ + HGTwainDS ds = nullptr; + HGTwain_OpenSelectedDSEx(m_twainDSM, &ds); + if (nullptr == ds) + return nullptr; + return new DeviceUser(m_wnd, ds); +} + +DeviceUser::DeviceUser(QWidget *wnd, HGTwainDS ds) +{ + m_wnd = wnd; + m_twainDS = ds; +} + +DeviceUser::~DeviceUser() +{ + HGTwain_CloseDS(m_twainDS); + m_twainDS = nullptr; +} + +QString DeviceUser::GetName() +{ + HGChar devName[256]; + HGTwain_GetDSName(m_twainDS, devName, 256); + return QString(devName); +} + +HGResult DeviceUser::ShowSettingDlg() +{ + return HGTwain_EnableDSUIOnly(m_twainDS, (HWND)m_wnd->winId(), DSCloseReqFunc, this); +} + +HGResult DeviceUser::StartScan() +{ + return HGTwain_EnableDS(m_twainDS, HGFALSE, nullptr, DSCloseReqFunc, this, DSImageFunc, this); +} + +HGResult DeviceUser::StopScan() +{ + return HGTwain_DisableDS(m_twainDS); +} + +HGResult DeviceUser::GetDeviceCustomInfo(HGTwainDeviceCustomInfo *info) +{ + return HGTwain_GetDSDeviceCustomInfo(m_twainDS, info); +} + +void HGAPI DeviceUser::DSCloseReqFunc(HGTwainDS ds, HGPointer param) +{ + DeviceUser* p = (DeviceUser*)param; + HGTwain_DisableDS(p->m_twainDS); + emit p->finishScan(); +} + +void HGAPI DeviceUser::DSImageFunc(HGTwainDS ds, HGImage image, HGPointer param) +{ + DeviceUser* p = (DeviceUser*)param; + HGImage image2 = nullptr; + HGBase_CloneImage(image, 0, 0, &image2); + if (nullptr != image2) + { + emit p->newImage(image2); + } +} + +#else + +DeviceUserMgr::DeviceUserMgr(QWidget *wnd) +{ + m_wnd = wnd; + m_saneMgr = nullptr; + HGSane_CreateManager(&m_saneMgr); +} + +DeviceUserMgr::~DeviceUserMgr() +{ + HGSane_DestroyManager(m_saneMgr); + m_saneMgr = nullptr; +} + +class DeviceUser* DeviceUserMgr::OpenDeviceUser() +{ + HGSaneSource source = nullptr; + HGSane_OpenSelectedSource(m_saneMgr, m_wnd, &source); + if (nullptr == source) + return nullptr; + + HGUInt devCount = 0; + HGSane_GetDeviceCount(source, &devCount); + if (0 == devCount) + { + HGSane_CloseSource(source); + return nullptr; + } + else if (1 == devCount) + { + HGChar errInfo[256]; + HGSaneDevice dev = nullptr; + HGSane_OpenDevice(source, 0, &dev, errInfo, 256); + if (nullptr == dev) + { + HGSane_CloseSource(source); + QMessageBox::information(m_wnd, tr("tips"), QString::fromUtf8(errInfo)); + return nullptr; + } + + return new DeviceUser(m_wnd, source, dev); + } + + HGSaneDevice dev = nullptr; + HGSane_OpenSelectedDevice(source, m_wnd, &dev); + if (nullptr == dev) + { + HGSane_CloseSource(source); + return nullptr; + } + + return new DeviceUser(m_wnd, source, dev); +} + +DeviceUser::DeviceUser(QWidget *wnd, HGSaneSource source, HGSaneDevice dev) +{ + m_wnd = wnd; + m_source = source; + m_saneDev = dev; +} + +DeviceUser::~DeviceUser() +{ + HGSane_CloseDevice(m_saneDev); + m_saneDev = nullptr; + HGSane_CloseSource(m_source); + m_source = nullptr; +} + +QString DeviceUser::GetName() +{ + HGChar devName[256]; + HGSane_GetSourceName(m_source, devName, 256); + return QString(devName); +} + +HGResult DeviceUser::ShowSettingDlg() +{ + return HGSane_ShowDeviceSettingDlg(m_saneDev, m_wnd); +} + +HGResult DeviceUser::StartScan() +{ + return HGSane_StartDeviceWithUI(m_saneDev, m_wnd, DeviceImageFunc, this); +} + +HGResult DeviceUser::StopScan() +{ + return HGSane_StopDevice(m_saneDev); +} + +HGResult DeviceUser::GetDeviceCustomInfo(HGSaneCustomInfo *info) +{ + return HGSane_GetDeviceCustomInfo(m_saneDev, info); +} + +void HGAPI DeviceUser::DeviceImageFunc(HGSaneDevice dev, HGImage image, HGPointer param) +{ + DeviceUser* p = (DeviceUser*)param; + HGImage image2 = nullptr; + HGBase_CloneImage(image, 0, 0, &image2); + if (nullptr != image2) + { + emit p->newImage(image2); + } +} + +#endif diff --git a/app/scanner/device_user.h b/app/scanner/device_user.h new file mode 100644 index 00000000..08cc31fa --- /dev/null +++ b/app/scanner/device_user.h @@ -0,0 +1,109 @@ +#ifndef __DEVICE_USER_H__ +#define __DEVICE_USER_H__ + +#include "base/HGDef.h" +#include + +#if defined(HG_CMP_MSC) +#include "twain_user/HGTwain.h" + +class DeviceUserMgr : public QObject +{ + Q_OBJECT + +public: + DeviceUserMgr(QWidget *wnd); + ~DeviceUserMgr(); + + // 弹出设备选择对话框,选择twain源 + class DeviceUser* OpenDeviceUser(); + +private: + QWidget *m_wnd; + HGTwainDSM m_twainDSM; +}; + +class DeviceUser : public QObject +{ + Q_OBJECT + + friend class DeviceUserMgr; + DeviceUser(QWidget *wnd, HGTwainDS ds); +public: + ~DeviceUser(); + + // 获取设备名字 + QString GetName(); + // 弹出配置对话框 + HGResult ShowSettingDlg(); + // 弹出扫描对话框 + HGResult StartScan(); + HGResult StopScan(); + HGResult GetDeviceCustomInfo(HGTwainDeviceCustomInfo *info); + +private: + static void HGAPI DSCloseReqFunc(HGTwainDS ds, HGPointer param); + static void HGAPI DSImageFunc(HGTwainDS ds, HGImage image, HGPointer param); + +signals: + void newImage(void *image); + void finishScan(); + +private: + QWidget *m_wnd; + HGTwainDS m_twainDS; +}; + +#else +#include "sane_user/HGSane.h" + +class DeviceUserMgr : public QObject +{ + Q_OBJECT + +public: + DeviceUserMgr(QWidget *wnd); + ~DeviceUserMgr(); + + // 弹出设备选择对话框,选择设备 + class DeviceUser* OpenDeviceUser(); + +private: + QWidget *m_wnd; + HGSaneManager m_saneMgr; +}; + +class DeviceUser : public QObject +{ + Q_OBJECT + + friend class DeviceUserMgr; + DeviceUser(QWidget *wnd, HGSaneSource source, HGSaneDevice dev); +public: + ~DeviceUser(); + + // 获取设备名字 + QString GetName(); + // 弹出配置对话框 + HGResult ShowSettingDlg(); + // 弹出扫描对话框 + HGResult StartScan(); + HGResult StopScan(); + HGResult GetDeviceCustomInfo(HGSaneCustomInfo *info); + +private: + static void HGAPI DeviceImageFunc(HGSaneDevice dev, HGImage image, HGPointer param); + +signals: + void newImage(void *image); + void finishScan(); + +private: + QWidget *m_wnd; + HGSaneSource m_source; + HGSaneDevice m_saneDev; +}; + +#endif + +#endif /* __DEVICE_USER_H__ */ diff --git a/app/scanner/dialog_export.cpp b/app/scanner/dialog_export.cpp index 5fd8a23a..78fc4a73 100644 --- a/app/scanner/dialog_export.cpp +++ b/app/scanner/dialog_export.cpp @@ -9,7 +9,6 @@ #include "base/HGBase.h" #include "HGUIGlobal.h" #include "app_cfg.h" -#include "ocrPdf.h" #include #define ARRAY_SIZE(a) sizeof(a) / sizeof(a[0]) diff --git a/app/scanner/dialog_exportimagefile.cpp b/app/scanner/dialog_exportimagefile.cpp index 3739aa3e..84e06d43 100644 --- a/app/scanner/dialog_exportimagefile.cpp +++ b/app/scanner/dialog_exportimagefile.cpp @@ -9,7 +9,6 @@ #include "HGString.h" #include #include -#include "ocrPdf.h" #include "app_cfg.h" Dialog_ExportImageFile::Dialog_ExportImageFile(const QString &destPath, const QString &destName, const QString &destExt, diff --git a/app/scanner/dialog_log.cpp b/app/scanner/dialog_log.cpp deleted file mode 100644 index f1c3885d..00000000 --- a/app/scanner/dialog_log.cpp +++ /dev/null @@ -1,179 +0,0 @@ -#include "dialog_log.h" -#include "ui_dialog_log.h" -#include -#include "app_cfg.h" - -dialog_log::dialog_log(QWidget *parent) - : QDialog(parent) - , ui(new Ui::dialog_log), ind_scanning_(-1), img_received_(0), msg_fixed_scanning_("") -{ - ui->setupUi(this); - setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint); - - QHBoxLayout *bottom = new QHBoxLayout(); - - pbtn_clear = new QPushButton(this); - cBox_autoScroll = new QCheckBox(this); - pbtn_stop = new QPushButton(this); - pbtn_export = new QPushButton(this); - pbtn_continueScan = new QPushButton(this); - pbtn_finishScan = new QPushButton(this); - - pbtn_stop->setVisible(false); - pbtn_continueScan->setVisible(false); - pbtn_finishScan->setVisible(false); - - pbtn_stop->setText(tr("cancel scan")); - cBox_autoScroll->setText(tr("auto scroll")); - pbtn_clear->setText(tr("clear")); - pbtn_export->setText(tr("export images")); - pbtn_continueScan->setText(tr("continue scan")); - pbtn_finishScan->setText(tr("finish scan")); - - bottom->addWidget(pbtn_clear); - bottom->addWidget(cBox_autoScroll); - bottom->addStretch(); - bottom->addWidget(pbtn_stop); - bottom->addWidget(pbtn_export); - bottom->addWidget(pbtn_continueScan); - bottom->addWidget(pbtn_finishScan); - - ui->verticalLayout->addItem(bottom); - - cBox_autoScroll->setChecked(getCfgValue("log", "autoScroll", true)); - - connect(cBox_autoScroll, SIGNAL(stateChanged(int)), this, SLOT(on_cbox_autoScroll_stateChanged(int))); - connect(pbtn_stop, SIGNAL(clicked(bool)), this, SLOT(on_pbtn_stop_clicked())); - connect(pbtn_clear, SIGNAL(clicked(bool)), this, SLOT(on_pbtn_clear_clicked())); - connect(pbtn_export, SIGNAL(clicked(bool)), this, SLOT(on_pbtn_export_clicked())); - connect(pbtn_continueScan, SIGNAL(clicked(bool)), this, SLOT(on_pbtn_continuScan_cliked())); - connect(pbtn_finishScan, SIGNAL(clicked(bool)), this, SLOT(on_pbtn_finishScan_cliked())); -} - -dialog_log::~dialog_log() -{ - delete ui; -} - -void dialog_log::addLog(const QString &log, bool err, int log_event) -{ - if (ui->listWidget->count() > 1000) - { - for(int i = 0; i < 100; ++i) - { - QListWidgetItem *item = ui->listWidget->takeItem(0); - delete item; - } - } - - QDateTime timeCurrent = QDateTime::currentDateTime(); - QString time = timeCurrent.toString("[yy-MM-dd hh:mm:ss]"); - ui->listWidget->addItem(time + " " + log); - - int idx = ui->listWidget->count() - 1; - if(log_event == LOG_EVENT_SCAN_BEGINNING) - { - msg_fixed_scanning_ = (time + " " + log).toStdString(); - ind_scanning_ = idx; - img_received_ = 0; - } - else if(log_event == LOG_EVENT_SCAN_STOPPED) - { - char utf8[128] = {0}; - sprintf(utf8, tr("(epicycle scanning images %u picture)").toStdString().c_str(), img_received_); - if(ind_scanning_ >= 0 && ind_scanning_ < idx) - ui->listWidget->item(ind_scanning_)->setText(QString::fromStdString(msg_fixed_scanning_)); - if (idx >= 0) - ui->listWidget->item(idx)->setText(time + " " + log + QString::fromStdString(utf8)); - ind_scanning_ = -1; - msg_fixed_scanning_ = ""; - } - if (idx >= 0) - ui->listWidget->item(idx)->setTextColor(err ? Qt::red : Qt::black); - - if (cBox_autoScroll->isChecked()) - { - ui->listWidget->scrollToItem(ui->listWidget->item(idx)); - } -} - -void dialog_log::updateStatus(bool online, bool isScanning) -{ - if (!online) - { - pbtn_stop->hide(); - pbtn_export->hide(); - pbtn_continueScan->hide(); - pbtn_finishScan->hide(); - } - else - { - if (isScanning) - { - pbtn_stop->show(); - pbtn_export->hide(); - pbtn_continueScan->hide(); - pbtn_finishScan->hide(); - } - else - { - pbtn_stop->hide(); - if(img_received_) - pbtn_export->show(); - pbtn_continueScan->show(); - pbtn_finishScan->show(); - } - } -} - -void dialog_log::image_received_from_scanner(void) -{ - img_received_++; - if(ind_scanning_ >= 0 && ind_scanning_ < ui->listWidget->count()) - { - char count[20]; - sprintf(count, "(%d)", img_received_); - ui->listWidget->item(ind_scanning_)->setText(QString::fromStdString(msg_fixed_scanning_ + count)); - } -} - -void dialog_log::closeEvent(QCloseEvent *event) -{ - (void)event; - on_pbtn_stop_clicked(); -} - -void dialog_log::on_pbtn_export_clicked() -{ - emit exportScanned(); -} - -void dialog_log::on_pbtn_continuScan_cliked() -{ - img_received_ = 0; - emit continueScan(); -} - -void dialog_log::on_pbtn_finishScan_cliked() -{ - close(); -} - -void dialog_log::on_cbox_autoScroll_stateChanged(int state) -{ - (void)state; - saveCfgValue("log", "autoScroll", cBox_autoScroll->isChecked()); -} - -void dialog_log::on_pbtn_stop_clicked(void) -{ - emit stopScan(); -} - -void dialog_log::on_pbtn_clear_clicked() -{ - ui->listWidget->clear(); - ind_scanning_ = -1; -} - - diff --git a/app/scanner/dialog_log.h b/app/scanner/dialog_log.h deleted file mode 100644 index ffb936ea..00000000 --- a/app/scanner/dialog_log.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef DIALOG_SCANNERLOG_H -#define DIALOG_SCANNERLOG_H - -#include -#include -#include -class QLabel; - -namespace Ui { -class dialog_log; -} - -enum -{ - INFO_DLG_FLAG_INFO_LIST = 1 << 1, - INFO_DLG_FLAG_PROGRESS = 1 << 2 -}; -enum -{ - LOG_EVENT_DONT_CARE = 0, - LOG_EVENT_SCAN_BEGINNING, - LOG_EVENT_SCAN_STOPPED, -}; -class QListWidgetItem; -class dialog_log : public QDialog -{ - Q_OBJECT - - int ind_scanning_; - int img_received_; - std::string msg_fixed_scanning_; - -public: - explicit dialog_log(QWidget *parent = nullptr); - ~dialog_log(); - - void addLog(const QString &log, bool err, int log_event = LOG_EVENT_DONT_CARE); - void updateStatus(bool online, bool isScanning); - void image_received_from_scanner(void); - -public: - QPushButton *pbtn_export; - -signals: - void stopScan(); - void continueScan(); - void exportScanned(); - -private: - void closeEvent(QCloseEvent *event); - -private slots: - void on_cbox_autoScroll_stateChanged(int state); - void on_pbtn_stop_clicked(void); - void on_pbtn_clear_clicked(); - void on_pbtn_export_clicked(); - void on_pbtn_continuScan_cliked(); - void on_pbtn_finishScan_cliked(); - -private: - Ui::dialog_log *ui; - QPushButton *pbtn_stop; - QCheckBox *cBox_autoScroll; - QPushButton *pbtn_clear; - QPushButton *pbtn_continueScan; - QPushButton *pbtn_finishScan; -}; - -#endif // DIALOG_SCANNERLOG_H diff --git a/app/scanner/dialog_log.ui b/app/scanner/dialog_log.ui deleted file mode 100644 index d67bc19c..00000000 --- a/app/scanner/dialog_log.ui +++ /dev/null @@ -1,31 +0,0 @@ - - - dialog_log - - - - 0 - 0 - 531 - 161 - - - - 日志 - - - - - - - - - - - - - - - - - diff --git a/app/scanner/dialog_saveas.cpp b/app/scanner/dialog_saveas.cpp index 79d79882..bc3ebeb4 100644 --- a/app/scanner/dialog_saveas.cpp +++ b/app/scanner/dialog_saveas.cpp @@ -4,7 +4,6 @@ #include "base/HGBase.h" #include "HGUIGlobal.h" #include "app_cfg.h" -#include "ocrPdf.h" #include #include #include diff --git a/app/scanner/dialog_upgradefirmware.cpp b/app/scanner/dialog_upgradefirmware.cpp deleted file mode 100644 index 3517d7dd..00000000 --- a/app/scanner/dialog_upgradefirmware.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include "dialog_upgradefirmware.h" -#include "ui_dialog_upgradefirmware.h" -#include - -Dialog_upgradeFirmware::Dialog_upgradeFirmware(SANE_Handle handle, const std::string &upgradePath, QWidget *parent) : - QDialog(parent) - , m_handle(handle) - , m_upgradePath(upgradePath) - , m_status(SANE_STATUS_INVAL) - , ui(new Ui::Dialog_upgradeFirmware) -{ - ui->setupUi(this); - - setWindowTitle(tr("upgrade")); - setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint); - - ui->label_text->setText(tr("firmware upgrade in progress, please wait...")); - - QMovie *movie = new QMovie(":images/image_rsc/logo/waiting.gif"); - ui->label_gif->setMovie(movie); - movie->setCacheMode(QMovie::CacheAll); - movie->setScaledSize(QSize(ui->label_gif->width(), ui->label_gif->height())); - movie->start(); - ui->label_gif->show(); - - connect(this, SIGNAL(finish()), this, SLOT(on_finish()), Qt::QueuedConnection); - - HGBase_OpenThread(ThreadFunc, this, &m_thread); -} - -Dialog_upgradeFirmware::~Dialog_upgradeFirmware() -{ - if (nullptr != m_thread) - { - HGBase_CloseThread(m_thread); - m_thread = nullptr; - } - - delete ui; -} - -void HGAPI Dialog_upgradeFirmware::ThreadFunc(HGThread thread, HGPointer param) -{ - (void)thread; - Dialog_upgradeFirmware *p = (Dialog_upgradeFirmware *)param; - - SANE_Status rc = sane_io_control(p->m_handle, IO_CTRL_CODE_SET_FIRMWARE_UPGRADE, (void*)p->m_upgradePath.c_str(), NULL); - p->m_status = rc; - - emit p->finish(); -} - -SANE_Status Dialog_upgradeFirmware::getUpgradeStatus() -{ - return m_status; -} - -void Dialog_upgradeFirmware::on_finish() -{ - accept(); -} - diff --git a/app/scanner/dialog_upgradefirmware.h b/app/scanner/dialog_upgradefirmware.h deleted file mode 100644 index fd1afa7b..00000000 --- a/app/scanner/dialog_upgradefirmware.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef DIALOG_UPGRADEFIRMWARE_H -#define DIALOG_UPGRADEFIRMWARE_H - -#include -#include "base/HGThread.h" -#include "sane/sane_ex.h" - -namespace Ui { -class Dialog_upgradeFirmware; -} - -class Dialog_upgradeFirmware : public QDialog -{ - Q_OBJECT - -public: - explicit Dialog_upgradeFirmware(SANE_Handle handle, const std::string &upgradePath, QWidget *parent = nullptr); - ~Dialog_upgradeFirmware(); - -private: - static void HGAPI ThreadFunc(HGThread thread, HGPointer param); - -public: - SANE_Status getUpgradeStatus(); - -signals: - void finish(); - -private slots: - void on_finish(); - -private: - SANE_Handle m_handle; - std::string m_upgradePath; - SANE_Status m_status; - - HGThread m_thread; - -private: - Ui::Dialog_upgradeFirmware *ui; -}; - -#endif // DIALOG_UPGRADEFIRMWARE_H diff --git a/app/scanner/dialog_upgradefirmware.ui b/app/scanner/dialog_upgradefirmware.ui deleted file mode 100644 index df195eaa..00000000 --- a/app/scanner/dialog_upgradefirmware.ui +++ /dev/null @@ -1,127 +0,0 @@ - - - Dialog_upgradeFirmware - - - - 0 - 0 - 435 - 125 - - - - Dialog - - - - - - Qt::Vertical - - - - 20 - 19 - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 40 - 60 - - - - gif - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - text - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Qt::Vertical - - - - 20 - 20 - - - - - - - - - diff --git a/app/scanner/gaosixy.cpp b/app/scanner/gaosixy.cpp deleted file mode 100644 index 15de754a..00000000 --- a/app/scanner/gaosixy.cpp +++ /dev/null @@ -1,54 +0,0 @@ -#include "gaosixy.h" -#include -#include -#include - -GaoSiXY::GaoSiXY() -{ -} - -void GaoSiXY::solve(double**a,int n,double *recv) -{ - int m = 0; - int i,j; - - for(j = 0; j < n; j++){ - double max = 0; - double imax = 0; - for(i = j; i < n; i++){ - if(imax < fabs(a[i][j])){ - imax = fabs(a[i][j]); - max = a[i][j];//得到各行中所在列最大元素 - m = i; - } - } - if(fabs(a[j][j]) != max) { - double b = 0; - for(int k = j;k < n + 1; k++){ - b = a[j][k]; - a[j][k] = a[m][k]; - a[m][k] = b; } - } - for(int r = j;r < n + 1;r++){ - a[j][r] = a[j][r] / max;//让该行的所在列除以所在列的第一个元素,目的是让首元素为1 - } - for(i = j + 1;i < n; i++){ - double c = a[i][j]; - if(c == 0) continue; - for(int s = j;s < n + 1;s++){ - //double tempdata = a[i][s]; - a[i][s] = a[i][s] - a[j][s] * c;//前后行数相减,使下一行或者上一行的首元素为0 - } - } - } - for(i = n - 2; i >= 0; i--){ - for(j = i + 1;j < n; j++){ - a[i][n] = a[i][n] - a[j][n] * a[i][j]; - } - } - - for(int k = 0; k < n; k++){ - recv[k] = a[k][n]; - } - -} diff --git a/app/scanner/gaosixy.h b/app/scanner/gaosixy.h deleted file mode 100644 index 4b446756..00000000 --- a/app/scanner/gaosixy.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef GAOSIXY_H -#define GAOSIXY_H - -#include -#include - -class GaoSiXY -{ -public: - GaoSiXY(); - void solve(double **a,int n,double *recv);//用于计算曲线方程 - -private: - -}; - -#endif // GAOSIXY_H diff --git a/app/scanner/hg_settingdialog.cpp b/app/scanner/hg_settingdialog.cpp deleted file mode 100644 index 93fb8440..00000000 --- a/app/scanner/hg_settingdialog.cpp +++ /dev/null @@ -1,1965 +0,0 @@ -#include "hg_settingdialog.h" - -#include -#include -#include "cutpapertool.h" -#include "setpicclrtool.h" -#include "base/HGDef.h" -#include "HGString.h" -#include "sane/sane_option_definitions.h" -#include "lang/app_language.h" -#include "dialog_input.h" -#include -#include "device_menu.h" - -std::string hg_settingdialog::property_combox_data_type_ = "combox_value_type"; - -hg_settingdialog::hg_settingdialog(void *handle, QWidget *parent - , dev_que* dev) - : QDialog(parent) - , dev_que_(dev), save_(false) - , btn_cut_area_(nullptr), btn_gamma_(nullptr), clicked_gamma_(false) - , custom_area_lable_(nullptr), comb_(nullptr) -{ - std::string n(dev->opened_scanner_name()); - for(int i = 0; i < dev->scanners(); ++i) - { - SCANNER s = dev->get_at(i); - if(s.name == n) - { - cur_cfg_ = s.cfg; - break; - } - } - cur_scheme_ = cur_cfg_->get_scheme(); - if(!cur_scheme_) - cur_scheme_ = new gb::sane_config_schm(); - cur_scheme_->begin_setting(); - - m_dpiId = -1; - m_dpiValue = 200; - m_paperSizeId = -1; - m_paperSizeValue.clear(); - m_cutLeftId = -1; - m_cutTopId = -1; - m_cutRightId = -1; - m_cutBottomId = -1; - m_cutWidth = 210; - m_cutHeight = 297; - m_cutLeftValue = 0; - m_cutTopValue = 0; - m_cutRightValue = 210; - m_cutBottomValue = 297; - - m_colorModeId = -1; - m_colorModeValue.clear(); - memset(&m_gammaData, 0, sizeof(m_gammaData)); - for(int i = 0; i < sizeof(m_gammaData.table) / sizeof(m_gammaData.table[0]); ++i) - m_gammaData.table[i] = i & 0x0ff; - - m_handle = handle; - initUi(); - on_current_scheme_changed(); - getAppVersion(); -} - -hg_settingdialog::~hg_settingdialog() -{ - cur_scheme_->release(); - cur_cfg_->release(); -} - -void hg_settingdialog::initUi() -{ - updateOpt(); - createUI(); - -#if defined(OEM_ZHONGJING) - setWindowTitle("Microtek DocWizard EX TWAIN"); -#else - setWindowTitle(QString::fromStdString(dev_que_->opened_scanner_name())); -#endif - - setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint); - resize(740, height()); -} - -void hg_settingdialog::updateOpt() -{ - bool first = true; - - m_list_defaultOptions.clear(); - - SANE_Int dev_options = 0; - sane_control_option(m_handle, 0, SANE_ACTION_GET_VALUE, &dev_options, nullptr); - for (int i = 1, j= dev_options; i < j; i++) - { - const SANE_Option_Descriptor* opt = sane_get_option_descriptor(m_handle, i); - SANE_Int method = 0; - if (opt == nullptr) - { - m_list_defaultOptions.append(QPair(opt, QVariant(0))); - } - else - { - if(opt->type == SANE_TYPE_INT) - { - SANE_Int init = 0; - - sane_control_option(m_handle, i, SANE_ACTION_GET_VALUE, &init, &method); - m_list_defaultOptions.append(QPair(opt, QVariant(init))); - - if(first) - { - unsigned int n = i; - sane_io_control(m_handle, IO_CTRL_CODE_GET_DEFAULT_VALUE, &init, &n); - cur_scheme_->set_default_value(i, opt->name, (char*)&init, sizeof(init)); - } - } - else if(opt->type == SANE_TYPE_FIXED) - { - SANE_Fixed init = 0; - - sane_control_option(m_handle, i, SANE_ACTION_GET_VALUE, &init, &method); - m_list_defaultOptions.append(QPair(opt, QVariant(init))); - - if(first) - { - unsigned int n = i; - sane_io_control(m_handle, IO_CTRL_CODE_GET_DEFAULT_VALUE, &init, &n); - cur_scheme_->set_default_value(i, opt->name, (char*)&init, sizeof(init)); - } - } - else if(opt->type == SANE_TYPE_BOOL) - { - SANE_Bool init = 0; - - sane_control_option(m_handle, i, SANE_ACTION_GET_VALUE, &init, &method); - m_list_defaultOptions.append(QPair(opt, QVariant(init))); - - if(first) - { - unsigned int n = i; - sane_io_control(m_handle, IO_CTRL_CODE_GET_DEFAULT_VALUE, &init, &n); - cur_scheme_->set_default_value(i, opt->name, (char*)&init, sizeof(init)); - } - } - else if(opt->type == SANE_TYPE_STRING) - { - char *init = (char*)malloc(opt->size * 2 + 4); - - sane_control_option(m_handle, i, SANE_ACTION_GET_VALUE, init, &method); - m_list_defaultOptions.append(QPair(opt, QVariant(QString::fromStdString(init)))); - - if(first) - { - unsigned int n = i; - int err = sane_io_control(m_handle, IO_CTRL_CODE_GET_DEFAULT_VALUE, init, &n); - (void)err; - std::string langCN(to_default_language(init, nullptr)); - cur_scheme_->set_default_value(i, opt->name, &langCN[0], langCN.length()); - } - free(init); - } - else - { - m_list_defaultOptions.append(QPair(opt, QVariant(0))); - } - } - } -} - -QString hg_settingdialog::find_current_scheme_menu(int *scheme_id) -{ - QString text(comb_->currentText()); - - if(scheme_id) - { - if(comb_->currentIndex() >= 0 && comb_->currentIndex() < comb_->count()) - *scheme_id = comb_->currentIndex(); - else { - *scheme_id = -1; - } - } - - return text; -} -void hg_settingdialog::create_scheme_management_ui(QVBoxLayout* layout) -{ - QLabel *title = new QLabel(this); - bool enabled = false; - QHBoxLayout *hbox = new QHBoxLayout(); - int width = 180; - std::vector schemes; - std::string cur_schm(cur_cfg_->get_current_scheme_name()); - - cur_cfg_->get_all_schemes(schemes); - comb_ = new QComboBox(this); - layout->addSpacing(30); - for(int i = 1; i < (int)schemes.size(); ++i) - { - comb_->addItem(QString::fromStdString(schemes[i])); - if(cur_schm == schemes[i]) - { - enabled = true; - comb_->setCurrentText(QString::fromStdString(schemes[i])); - } - } - - if(!enabled) - comb_->setCurrentIndex(-1); - - title->setFixedWidth(width); - comb_->setFixedWidth(width); - - title->setText(tr("existing configuration scheme")); - layout->addWidget(title); - layout->addWidget(comb_); - - rename_ = new QPushButton(this); - rename_->setText(tr("change name")); - rename_->setEnabled(enabled); - rename_->setFixedWidth(width/3); - hbox->addWidget(rename_); - connect(rename_, SIGNAL(clicked(bool)), this, SLOT(slot_pushButton_scheme_management())); - - del_this_ = new QPushButton(this); - del_this_->setText(tr("delete")); - del_this_->setEnabled(enabled); - del_this_->setFixedWidth(width / 3); - hbox->addWidget(del_this_); - connect(del_this_, SIGNAL(clicked(bool)), this, SLOT(slot_pushButton_scheme_management())); - - apply_ = new QPushButton(this); - apply_->setText(tr("apply")); - apply_->setEnabled(enabled); - apply_->setFixedWidth(width / 3); - hbox->addWidget(apply_); - connect(apply_, SIGNAL(clicked(bool)), this, SLOT(slot_pushButton_scheme_management())); - hbox->setSizeConstraint(QLayout::SetFixedSize); - - layout->addLayout(hbox); - layout->addSpacing(10); - - del_all_ = new QPushButton(this); - del_all_->setText(tr("delete all configurations")); - del_all_->setEnabled(enabled); - del_all_->setFixedWidth(width); - layout->addWidget(del_all_); - connect(del_all_, SIGNAL(clicked(bool)), this, SLOT(slot_pushButton_scheme_management())); - - layout->addStretch(); - - title = new QLabel(this); - title->setText(tr("confgiuration information:")); - layout->addWidget(title); - - sketch_ = new QTextEdit(this); - sketch_->setReadOnly(true); - sketch_->setFixedSize(width, 200); - layout->addWidget(sketch_); - - connect(comb_, SIGNAL(currentTextChanged(const QString)), this, SLOT(on_current_scheme_changed())); - on_current_scheme_changed(); -} -void hg_settingdialog::createUI() -{ - QTabWidget *tabWidgetCreation = new QTabWidget(this); - - QPushButton *buttonOk = new QPushButton(this); - buttonOk->setText(tr("ok")); - QPushButton *buttonCancel = new QPushButton(this); - buttonCancel->setText(tr("cancel")); - QHBoxLayout *hlayoutOkAndCancel = new QHBoxLayout; - hlayoutOkAndCancel->addStretch(); - hlayoutOkAndCancel->addWidget(buttonOk); - hlayoutOkAndCancel->addWidget(buttonCancel); - QWidget *widgetOkAndCancel = new QWidget(); - widgetOkAndCancel->setLayout(hlayoutOkAndCancel); - connect(buttonOk, SIGNAL(clicked(bool)), this, SLOT(slot_buttonOkClicked())); - connect(buttonCancel, SIGNAL(clicked(bool)), this, SLOT(slot_buttonCancelClicked())); - - - QHBoxLayout *h = new QHBoxLayout(); - QVBoxLayout *v1 = new QVBoxLayout(), - *v2 = new QVBoxLayout(); - create_scheme_management_ui(v1); - v2->addWidget(tabWidgetCreation); - - QGroupBox *grp = new QGroupBox(tr("configuration scheme management"), this); - grp->setLayout(v1); - grp->setFixedSize(195, 500); - - h->addWidget(grp); - h->addLayout(v2); - - QVBoxLayout* mainVerticalLayout = new QVBoxLayout(this); - mainVerticalLayout->addLayout(h); -// mainVerticalLayout->addWidget(tabWidgetCreation); - mainVerticalLayout->addWidget(widgetOkAndCancel); - this->setLayout(mainVerticalLayout); - - QScrollArea* scrollArea = new QScrollArea; - scrollArea->setWidgetResizable(true); - scrollArea->setAlignment(Qt::AlignCenter); - QFormLayout* layout = new QFormLayout; - - QWidget* widget = new QWidget; - widget->setLayout(layout); - - bool isBegin = true; - std::string cur_val(""); - for (int i = 0; i < m_list_defaultOptions.size(); i++) - { - const SANE_Option_Descriptor* opt = reinterpret_cast(m_list_defaultOptions.at(i).first); - int ind = -1; - - if(opt == nullptr) continue; - h = nullptr; - cur_scheme_->get_config(opt->name, cur_val); - switch (opt->type) - { - case SANE_TYPE_BOOL: - { - QCheckBox *checkBoxCreation = new QCheckBox; - - if (strcmp(opt->name, SANE_STD_OPT_NAME_CUSTOM_AREA) == 0) - { - QWidget* widget_cbtn_pbtn = new QWidget; - widget_cbtn_pbtn->setMaximumWidth(200); - - QLabel *label = new QLabel; - label->setText(QString::fromStdString(opt->title) + QString(" : ")); - - btn_cut_area_ = new QPushButton; - btn_cut_area_->setText(tr("regional crop")); - btn_cut_area_->setFixedWidth(150); - - QHBoxLayout *hLayout = new QHBoxLayout; - hLayout->addWidget(checkBoxCreation); - hLayout->addWidget(btn_cut_area_); - widget_cbtn_pbtn->setLayout(hLayout); - - custom_area_lable_ = label; - - reinterpret_cast(widget->layout())->addRow(label, widget_cbtn_pbtn); - - connect(btn_cut_area_, SIGNAL(clicked(bool)), this, SLOT(slot_cutButtonClicked())); - } - else if (strcmp(opt->name, SANE_STD_OPT_NAME_IS_CUSTOM_GAMMA) == 0) - { - QWidget* widget_cbtn_pbtn = new QWidget(scrollArea); - widget_cbtn_pbtn->setMaximumWidth(200); - btn_gamma_ = new QPushButton(widget_cbtn_pbtn); - btn_gamma_->setText(tr("custom tone curve")); - btn_gamma_->setFixedWidth(150); - - QHBoxLayout *hLayout = new QHBoxLayout; - hLayout->addWidget(checkBoxCreation); - hLayout->addWidget(btn_gamma_); - widget_cbtn_pbtn->setLayout(hLayout); - - reinterpret_cast(widget->layout())->addRow(opt->title + QString(" : "), widget_cbtn_pbtn); - connect(btn_gamma_, SIGNAL(clicked(bool)), this, SLOT(slot_gammaButtonClicked())); - } - else - reinterpret_cast(widget->layout())->addRow(opt->title + QString(" : "), checkBoxCreation); - - checkBoxCreation->setToolTip(opt->desc); - int id = i + 1; - bool enable = *(bool*)&cur_val[0]; - checkBoxCreation->setProperty("controls_id", id); - checkBoxCreation->setChecked(enable); - if (strcmp(opt->name, SANE_STD_OPT_NAME_CUSTOM_AREA) == 0) - btn_cut_area_->setEnabled(enable); - else if (strcmp(opt->name, SANE_STD_OPT_NAME_IS_CUSTOM_GAMMA) == 0) - btn_gamma_->setEnabled(enable); - connect(checkBoxCreation, SIGNAL(stateChanged(int)), this, SLOT(slot_checkedClicked())); - m_list_widgets.append(checkBoxCreation); - - m_list_getOpt.append(QPair(id, opt)); - break; - } - - case SANE_TYPE_INT: - { - switch(opt->constraint_type) - { - case SANE_CONSTRAINT_NONE: - { - QSpinBox* spinBox = new QSpinBox(scrollArea); - spinBox->setMinimumWidth(150); - spinBox->setToolTip(opt->desc); - spinBox->setRange(1, 1000); - int id = i + 1; - spinBox->setProperty("controls_id", id); - - QHBoxLayout* hLayout = new QHBoxLayout; - hLayout->addWidget(spinBox); - hLayout->addStretch(); - reinterpret_cast(widget->layout())->addRow(opt->title + QString(" : "), spinBox); - - m_list_widgets.append(spinBox); - m_list_getOpt.append(QPair(id, opt)); - - spinBox->setValue(*(int*)&cur_val[0]); - connect(spinBox, SIGNAL(valueChanged(int)), this, SLOT(slot_spinBoxClicked(int))); - break; - } - - case SANE_CONSTRAINT_RANGE: - { - QWidget* widget_slider_spin = new QWidget(scrollArea); - widget_slider_spin->setMinimumWidth(300); - - QSlider* sliderCreation = new QSlider(widget_slider_spin); - sliderCreation->setOrientation(Qt::Horizontal); - sliderCreation->setMinimumWidth(120); - sliderCreation->setRange(opt->constraint.range->min, opt->constraint.range->max); - sliderCreation->setToolTip(opt->desc); - sliderCreation->setProperty("controls_id", i+1); - sliderCreation->setValue(m_list_defaultOptions.at(i).second.toInt()); - - QSpinBox* spinBox = new QSpinBox(widget_slider_spin); - spinBox->setMinimumWidth(150); - spinBox->setToolTip(opt->desc); - spinBox->setRange(opt->constraint.range->min, opt->constraint.range->max); - - spinBox->setSingleStep(1); - spinBox->setValue(m_list_defaultOptions.at(i).second.toInt()); - int id = i + 1; - spinBox->setProperty("controls_id", id); - m_list_sliderSpinbox.append(QPair(sliderCreation, spinBox)); - - QHBoxLayout* hLayout = new QHBoxLayout; - hLayout->addWidget(sliderCreation); - hLayout->addWidget(spinBox); -// hLayout->addStretch(); - widget_slider_spin->setLayout(hLayout); - reinterpret_cast(widget->layout())->addRow(opt->title + QString(" : "), widget_slider_spin); - - m_list_widgets.append(sliderCreation); - m_list_widgets.append(spinBox); - m_list_getOpt.append(QPair(id, opt)); - - int cur = *(int*)&cur_val[0]; - spinBox->setValue(cur); - sliderCreation->setValue(cur); - - connect(spinBox, SIGNAL(valueChanged(int)), this, SLOT(slot_spinBoxClicked(int))); - connect(sliderCreation, SIGNAL(valueChanged(int)), this, SLOT(slot_sliderClicked(int))); - - break; - } - - case SANE_CONSTRAINT_WORD_LIST: - { - QComboBox* comboBoxCreation = new QComboBox(scrollArea); - comboBoxCreation->setToolTip(opt->desc); - int id = i + 1; - comboBoxCreation->setProperty("controls_id", id); - reinterpret_cast(widget->layout())->addRow(opt->title + QString(" : "), comboBoxCreation); - - auto p_str = opt->constraint.word_list; - char buf[20]; - for(SANE_Int i = 0; i < p_str[0]; ++i) - { - sprintf(buf, "%d", p_str[i + 1]); - comboBoxCreation->addItem(QString::fromStdString(buf)); - } - sprintf(buf, "%d", m_list_defaultOptions.at(i).second.toInt()); - comboBoxCreation->setProperty(hg_settingdialog::property_combox_data_type_.c_str(), COMBO_VAL_INT); - m_list_widgets.append(comboBoxCreation); - m_list_getOpt.append(QPair(id, opt)); - - char nstr[40] = {0}; - sprintf(nstr, "%d", *(int*)&cur_val[0]); - comboBoxCreation->setCurrentText(QString::fromStdString(nstr)); - connect(comboBoxCreation, SIGNAL(currentTextChanged(const QString)), this, SLOT(slot_string_list_comboBoxClicked())); - break; - } - - case SANE_CONSTRAINT_STRING_LIST: - break; - } - break; - } - - case SANE_TYPE_FIXED: - { - QWidget* widget_slider_spin = new QWidget(scrollArea); - widget_slider_spin->setMinimumWidth(300); - QSlider* sliderCreation = new QSlider(widget_slider_spin); - sliderCreation->setOrientation(Qt::Horizontal); - sliderCreation->setMinimumWidth(120); - sliderCreation->setToolTip(opt->desc); - int id = i + 1; - sliderCreation->setProperty("controls_id", id); - sliderCreation->setRange(SANE_UNFIX(opt->constraint.range->min) * 100, SANE_UNFIX(opt->constraint.range->max) * 100); - sliderCreation->setValue(SANE_UNFIX(m_list_defaultOptions.at(i).second.toDouble()) * 100); - - QDoubleSpinBox* spinBox = new QDoubleSpinBox(widget_slider_spin); - spinBox->setMinimumWidth(150); - spinBox->setToolTip(opt->desc); - spinBox->setDecimals(2); - spinBox->setSingleStep(0.01); - spinBox->setRange(SANE_UNFIX(opt->constraint.range->min), SANE_UNFIX(opt->constraint.range->max)); - spinBox->setValue(sliderCreation->value() * spinBox->singleStep()); - spinBox->setProperty("controls_id", id); - - m_list_sliderSpinbox.append(QPair(sliderCreation, spinBox)); - - QHBoxLayout* hLayout = new QHBoxLayout; - hLayout->addWidget(sliderCreation); - hLayout->addWidget(spinBox); -// hLayout->addStretch(); - widget_slider_spin->setLayout(hLayout); - reinterpret_cast(widget->layout())->addRow(opt->title + QString(" : "), widget_slider_spin); - - m_list_widgets.append(sliderCreation); - m_list_widgets.append(spinBox); - - m_list_getOpt.append(QPair(id, opt)); -// iniRead(md5(opt->title), id, sliderCreation); -// iniRead(md5(opt->title), id, spinBox); - - float v = SANE_UNFIX(*(SANE_Fixed*)&cur_val[0]); - sliderCreation->setValue(v * 100); - spinBox->setValue(sliderCreation->value() * spinBox->singleStep()); - connect(spinBox, SIGNAL(valueChanged(double)), this, SLOT(slot_doubleSpinboxClicked(double))); - connect(sliderCreation, SIGNAL(valueChanged(int)), this, SLOT(slot_sliderClicked(int))); - break; - } - - case SANE_TYPE_STRING: - { - switch(opt->constraint_type) - { - case SANE_CONSTRAINT_NONE: - { - QLineEdit *lineEdit = new QLineEdit(scrollArea); - lineEdit->setToolTip(opt->desc); - int id = i + 1; - lineEdit->setProperty("controls_id", id); - reinterpret_cast(widget->layout())->addRow(opt->title + QString(" : "), lineEdit); - - m_list_widgets.append(lineEdit); - m_list_getOpt.append(QPair(id, opt)); -// iniRead(md5(opt->title), id, lineEdit); - - lineEdit->setText(QString::fromStdString(cur_val)); - connect(lineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slot_lineEditInput())); - break; - } - - case SANE_CONSTRAINT_RANGE: - break; - case SANE_CONSTRAINT_WORD_LIST: - break; - - case SANE_CONSTRAINT_STRING_LIST: - { - QComboBox* comboBoxCreation = new QComboBox(scrollArea); - comboBoxCreation->setToolTip(opt->desc); - int id = i + 1; - comboBoxCreation->setProperty("controls_id", id); - reinterpret_cast(widget->layout())->addRow(opt->title + QString(" : "), comboBoxCreation); - - auto p_str = opt->constraint.string_list; - QStringList stringList; - while(*p_str) - { - stringList.append(*p_str); - p_str++; - } - - if(stringList.isEmpty() != true) - { - for(int i = 0; i < (stringList.size()); i++) - comboBoxCreation->addItem(stringList.at(i)); - } - comboBoxCreation->setCurrentText(m_list_defaultOptions.at(i).second.toString()); - comboBoxCreation->setProperty(hg_settingdialog::property_combox_data_type_.c_str(), COMBO_VAL_STRING); - //printf("Option %02d default value is: %s\n", i + 1, m_list_defaultOptions.at(i).second.toString().data()); - - m_list_widgets.append(comboBoxCreation); - - m_list_getOpt.append(QPair(id, opt)); -// iniRead(md5(opt->title), id, comboBoxCreation); - - comboBoxCreation->setCurrentText(QString::fromStdString(cur_val)); - connect(comboBoxCreation, SIGNAL(currentTextChanged(const QString)), this, SLOT(slot_string_list_comboBoxClicked())); - break; - } - } - break; - } - - case SANE_TYPE_BUTTON: - { - QPushButton* pushButton = new QPushButton(this); - pushButton->setText(opt->title); - pushButton->setToolTip(opt->desc); - int id = i + 1; - pushButton->setProperty("controls_id", id); - hlayoutOkAndCancel->insertWidget(0, pushButton, 0, Qt::AlignRight); - - connect(pushButton, SIGNAL(clicked(bool)), this, SLOT(slot_pushButtonClicked())); - break; - } - - case SANE_TYPE_GROUP: - { - if (isBegin) - { - scrollArea->setWindowTitle(opt->title); - isBegin = false; - }else{ - scrollArea->setWidget(widget); - tabWidgetCreation->addTab(scrollArea, scrollArea->windowTitle()); - scrollArea = new QScrollArea; - scrollArea->setWidgetResizable(true); - scrollArea->setWindowTitle(opt->title); - layout = new QFormLayout; - widget = new QWidget; - widget->setLayout(layout); - } - - m_list_widgets.append(nullptr); - break; - } - } //switch(opt->type) - -// if (Utf8ToStdString(opt->title) == "分辨率") - if (strcmp(opt->name, SANE_STD_OPT_NAME_RESOLUTION) == 0) - { - m_dpiId = i + 1; - m_dpiValue = m_list_defaultOptions.at(i).second.toInt(); - } -// else if (Utf8ToStdString(opt->title) == "纸张尺寸") - else if (strcmp(opt->name, SANE_STD_OPT_NAME_PAPER) == 0) - { - m_paperSizeId = i + 1; - m_paperSizeValue = m_list_defaultOptions.at(i).second.toString(); - } - - if (0 == strcmp(opt->name, SANE_STD_OPT_NAME_CUSTOM_AREA_LEFT)) - { - m_cutLeftId = i + 1; - m_cutLeftValue = SANE_UNFIX(m_list_defaultOptions.at(i).second.toInt()); - if (opt->constraint_type == SANE_CONSTRAINT_RANGE) - m_cutWidth = SANE_UNFIX(opt->constraint.range->max); - } - else if (0 == strcmp(opt->name, SANE_STD_OPT_NAME_CUSTOM_AREA_TOP)) - { - m_cutTopId = i + 1; - m_cutTopValue = SANE_UNFIX(m_list_defaultOptions.at(i).second.toInt()); - if (opt->constraint_type == SANE_CONSTRAINT_RANGE) - m_cutHeight = SANE_UNFIX(opt->constraint.range->max); - } - else if (0 == strcmp(opt->name, SANE_STD_OPT_NAME_CUSTOM_AREA_RIGHT)) - { - m_cutRightId = i + 1; - m_cutRightValue = SANE_UNFIX(m_list_defaultOptions.at(i).second.toInt()); - } - else if (0 == strcmp(opt->name, SANE_STD_OPT_NAME_CUSTOM_AREA_BOTTOM)) - { - m_cutBottomId = i + 1; - m_cutBottomValue = SANE_UNFIX(m_list_defaultOptions.at(i).second.toInt()); - } - -// else if (Utf8ToStdString(opt->title) == "颜色模式") - if (strcmp(opt->name, SANE_STD_OPT_NAME_COLOR_MODE) == 0) - { - m_colorModeId = i + 1; - m_colorModeValue = m_list_defaultOptions.at(i).second.toString(); - } -// else if (Utf8ToStdString(opt->title) == "伽玛" || Utf8ToStdString(opt->title) == "伽玛值") - - } //for - - updateUIStatus(); - - scrollArea->setWidget(widget); - tabWidgetCreation->addTab(scrollArea, scrollArea->windowTitle()); -} - -void hg_settingdialog::refresh_control_value(int op_id) -{ - QVector ctrls = find_control(op_id); - - if(ctrls.empty()) - return; - - const SANE_Option_Descriptor* opt = (const SANE_Option_Descriptor*)m_list_defaultOptions.at(op_id - 1).first; - if(opt->type == SANE_TYPE_BOOL) - { - for(size_t i = 0; i < (size_t)ctrls.size(); ++i) - { - QCheckBox* cb = qobject_cast(ctrls[i]); - if(cb) - { - disconnect(cb, SIGNAL(stateChanged(int)), this, SLOT(slot_checkedClicked())); - cb->setChecked(m_list_defaultOptions.at(op_id - 1).second.toBool()); - connect(cb, SIGNAL(stateChanged(int)), this, SLOT(slot_checkedClicked())); - break; - } - } - } - else if(opt->type == SANE_TYPE_INT) - { - for(size_t i = 0; i < (size_t)ctrls.size(); ++i) - { - QComboBox* comb = qobject_cast(ctrls[i]); - if(comb) - { - char buf[40] = {0}; - sprintf(buf, "%d", m_list_defaultOptions.at(op_id - 1).second.toInt()); - comb->disconnect(comb, SIGNAL(currentTextChanged(const QString)), this, SLOT(slot_string_list_comboBoxClicked())); - comb->setCurrentText(QString::fromStdString(buf)); - connect(comb, SIGNAL(currentTextChanged(const QString)), this, SLOT(slot_string_list_comboBoxClicked())); - } - else - { - QSlider* slider = qobject_cast(ctrls[i]); - if(slider) - { - disconnect(slider, SIGNAL(valueChanged(int)), this, SLOT(slot_sliderClicked(int))); - slider->setValue(m_list_defaultOptions.at(op_id - 1).second.toInt()); - connect(slider, SIGNAL(valueChanged(int)), this, SLOT(slot_sliderClicked(int))); - } - else - { - QSpinBox* spin = qobject_cast(ctrls[i]); - if(spin) - { - disconnect(spin, SIGNAL(valueChanged(int)), this, SLOT(slot_spinBoxClicked(int))); - spin->setValue(m_list_defaultOptions.at(op_id - 1).second.toInt()); - connect(spin, SIGNAL(valueChanged(int)), this, SLOT(slot_spinBoxClicked(int))); - } - } - } - } - } - else if(opt->type == SANE_TYPE_FIXED) - { - double val = SANE_UNFIX(m_list_defaultOptions.at(op_id - 1).second.toInt()); - QSlider *slider = NULL; - QDoubleSpinBox* spin = NULL; - for(size_t i = 0; i < (size_t)ctrls.size(); ++i) - { - QComboBox* comb = qobject_cast(ctrls[i]); - if(comb) - { - char buf[40] = {0}; - sprintf(buf, "%f", val); - comb->disconnect(comb, SIGNAL(currentTextChanged(const QString)), this, SLOT(slot_string_list_comboBoxClicked())); - comb->setCurrentText(QString::fromStdString(buf)); - connect(comb, SIGNAL(currentTextChanged(const QString)), this, SLOT(slot_string_list_comboBoxClicked())); - } - else if(!slider) - { - slider = qobject_cast(ctrls[i]); - if(slider) - disconnect(slider, SIGNAL(valueChanged(int)), this, SLOT(slot_sliderClicked(int))); - } - else if(!spin) - { - spin = qobject_cast(ctrls[i]); - if(spin) - disconnect(spin, SIGNAL(valueChanged(double)), this, SLOT(slot_spinBoxClicked(double))); - } - } - if(slider) - slider->setValue(val * 100); - if(spin) - spin->setValue(val); - if(slider) - connect(slider, SIGNAL(valueChanged(int)), this, SLOT(slot_sliderClicked(int))); - if(spin) - connect(spin, SIGNAL(valueChanged(double)), this, SLOT(slot_spinBoxClicked(double))); - } - else if(opt->type == SANE_TYPE_STRING) - { - for(size_t i = 0; i < (size_t)ctrls.size(); ++i) - { - QComboBox* comb = qobject_cast(ctrls[i]); - if(comb) - { - disconnect(comb, SIGNAL(currentTextChanged(const QString)), this, SLOT(slot_string_list_comboBoxClicked())); - comb->setCurrentText(m_list_defaultOptions.at(op_id - 1).second.toString()); - // comb->setProperty(hg_settingdialog::property_combox_data_type_.c_str(), COMBO_VAL_STRING); - connect(comb, SIGNAL(currentTextChanged(const QString)), this, SLOT(slot_string_list_comboBoxClicked())); - } - else - { - QLineEdit* edit = qobject_cast(ctrls[i]); - if(edit) - { - disconnect(edit, SIGNAL(textChanged(const QString&)), this, SLOT(slot_lineEditInput())); - edit->setText(m_list_defaultOptions.at(op_id - 1).second.toString()); - connect(edit, SIGNAL(textChanged(const QString&)), this, SLOT(slot_lineEditInput())); - } - } - } - } -} -QVector hg_settingdialog::find_control(int opt_num) -{ - QVector list_w; - for(int i = 0; i< m_list_widgets.size(); i++) - { - if (m_list_widgets.at(i) == nullptr) continue; - QWidget* w = m_list_widgets.at(i); - int id = w->property("controls_id").toInt(); - if(opt_num == id) - list_w.append(w); - } - return list_w; -} - -void hg_settingdialog::updateUIStatus() -{ - updateOpt(); - - SANE_Int dev_options = 0; - sane_control_option(m_handle, 0, SANE_ACTION_GET_VALUE, &dev_options, nullptr); - for(int id = 1, optons = dev_options; id < optons; id++) - { - QVector list_widgets = find_control(id); - if (list_widgets.empty()) continue; - QWidget* widget = list_widgets.first(); - if (widget == nullptr) continue; - QWidget* parentWidget = widget->parentWidget(); - - while (parentWidget->layout() && - typeid(*(parentWidget->layout())) != typeid(QFormLayout)) - { - widget = parentWidget; - parentWidget = widget->parentWidget(); - } - - QFormLayout* layout = reinterpret_cast(parentWidget->layout()); - const SANE_Option_Descriptor* opt = reinterpret_cast(m_list_defaultOptions.at(id - 1).first); - bool hide = (opt->cap & SANE_CAP_INACTIVE) == SANE_CAP_INACTIVE; - QWidget* w_label = layout ? layout->labelForField(widget) : nullptr; - - if( strcmp(opt->name, SANE_STD_OPT_NAME_CUSTOM_AREA_LEFT) == 0 || - strcmp(opt->name, SANE_STD_OPT_NAME_CUSTOM_AREA_TOP) == 0 || - strcmp(opt->name, SANE_STD_OPT_NAME_CUSTOM_AREA_RIGHT) == 0 || - strcmp(opt->name, SANE_STD_OPT_NAME_CUSTOM_AREA_BOTTOM) == 0 ) - hide = true; - - refresh_control_value(id); - if(w_label) - hide ? w_label->hide() : w_label->show(); - widget->setVisible(!hide); - if(strcmp(opt->name, SANE_STD_OPT_NAME_CUSTOM_AREA) == 0) - { - if(hide) - { - custom_area_lable_->hide(); - btn_cut_area_->hide(); - } - else - { - custom_area_lable_->show(); - btn_cut_area_->show(); - } - } - } -} - -void hg_settingdialog::slot_checkedClicked() -{ - QCheckBox *checkBox = qobject_cast(sender()); - SANE_Int id = checkBox->property("controls_id").toInt(); - SANE_Bool checkBoxcurrentState = checkBox->isChecked(); - - const SANE_Option_Descriptor* opt = nullptr; - for(int i = 0; i < m_list_getOpt.size(); i++) - if (m_list_getOpt.at(i).first == id) - { - opt = reinterpret_cast(m_list_getOpt.at(i).second); - break; - } - - m_list_IdValueTitle.append(QPair, QString>(QPair(id, checkBoxcurrentState), md5(opt->title))); - - SANE_Int method = 0; - sane_control_option(m_handle, id, SANE_ACTION_SET_VALUE, &checkBoxcurrentState, &method); - if((method & SANE_INFO_RELOAD_OPTIONS) == SANE_INFO_RELOAD_OPTIONS) - updateUIStatus(); - else if(method & SANE_INFO_INEXACT) - checkBox->setCheckState(checkBoxcurrentState ? Qt::CheckState::Checked : Qt::CheckState::Unchecked); - - if(strcmp(opt->name, SANE_STD_OPT_NAME_CUSTOM_AREA) == 0) - btn_cut_area_->setEnabled(checkBoxcurrentState); - else if (strcmp(opt->name, SANE_STD_OPT_NAME_IS_CUSTOM_GAMMA) == 0) - btn_gamma_->setEnabled(checkBoxcurrentState); - cur_scheme_->config_changed(id, (char*)&checkBoxcurrentState, sizeof(checkBoxcurrentState)); -} - -void hg_settingdialog::slot_string_list_comboBoxClicked() -{ - QComboBox *comboBox = qobject_cast(sender()); - SANE_Int id = comboBox->property("controls_id").toInt(); - std::string comboBoxcurrentItem(comboBox->currentText().toUtf8()); - int type = comboBox->property(hg_settingdialog::property_combox_data_type_.c_str()).toInt(); - - if (id == m_dpiId) - { - m_dpiValue = atoi(comboBoxcurrentItem.c_str()); - qDebug("dpi=%d", m_dpiValue); - } - else if (id == m_paperSizeId) - { - m_paperSizeValue = comboBoxcurrentItem.c_str(); - qDebug("paperSize=%s", comboBoxcurrentItem.c_str()); - } - else if (id == m_colorModeId) - { - m_colorModeValue = comboBoxcurrentItem.c_str(); - qDebug("colorMode=%s", comboBoxcurrentItem.c_str()); - } - - const SANE_Option_Descriptor* opt = nullptr; - for(int i = 0; i < m_list_getOpt.size(); i++) - if (m_list_getOpt.at(i).first == id) - { - opt = reinterpret_cast(m_list_getOpt.at(i).second); - break; - } - - m_list_IdValueTitle.append(QPair, QString>(QPair(id, &comboBoxcurrentItem.at(0)), md5(opt->title))); - - SANE_Int method = 0; - SANE_String buf = (SANE_String)malloc(opt->size * 2 + 4); - if(type == COMBO_VAL_INT) - *((SANE_Int*)buf) = atoi(comboBoxcurrentItem.c_str()); - else if(type == COMBO_VAL_FLOAT) - *((SANE_Fixed*)buf) = SANE_FIX(atof(comboBoxcurrentItem.c_str())); - else - strcpy(buf, comboBoxcurrentItem.c_str()); - sane_control_option(m_handle, id, SANE_ACTION_SET_VALUE, buf, &method); - if((method & SANE_INFO_RELOAD_OPTIONS) == SANE_INFO_RELOAD_OPTIONS) - updateUIStatus(); - else if(method & SANE_INFO_INEXACT) - comboBox->setCurrentText(QString::fromStdString(buf)); - - if(type == COMBO_VAL_INT) - cur_scheme_->config_changed(id, buf, sizeof(SANE_Int)); - else if(type == COMBO_VAL_FLOAT) - cur_scheme_->config_changed(id, buf, sizeof(SANE_Fixed)); - else - { - std::string langCN(to_default_language(buf, nullptr)); - cur_scheme_->config_changed(id, &langCN[0], langCN.length()); - } - free(buf); -} - -void hg_settingdialog::slot_pushButtonClicked() -{ - QPushButton *pushButton = qobject_cast(sender()); - SANE_Int id = pushButton->property("controls_id").toInt(), - after = 0; - - // restore to default setting ? - sane_control_option(m_handle, id, SANE_ACTION_SET_VALUE, NULL, &after); - if((after & SANE_INFO_RELOAD_OPTIONS) == SANE_INFO_RELOAD_OPTIONS) - updateUIStatus(); - - const SANE_Option_Descriptor* opt = sane_get_option_descriptor(m_handle, id); - if(opt && strcmp(opt->name, SANE_STD_OPT_NAME_RESTORE) == 0) - { - restore_2_default_settings(); - } -} - -void hg_settingdialog::slot_cutButtonClicked() -{ - //int width = 0.03937 * m_cutWidth * m_dpiValue; - //int height = 0.03937 * m_cutHeight * m_dpiValue; - int left = 0.03937 * m_cutLeftValue * m_dpiValue; - int top = 0.03937 * m_cutTopValue * m_dpiValue; - int right = 0.03937 * m_cutRightValue * m_dpiValue; - int bottom = 0.03937 * m_cutBottomValue * m_dpiValue; - - CutPaperTool dlg(this); - dlg.setPaperType(m_dpiValue, m_paperSizeValue, 300); - QRectF rc(left, top, right - left, bottom - top); - dlg.setCutRect(rc); - if (dlg.exec()) - { - QRectF rcRet = dlg.getCutRectPixel(); - - m_cutLeftValue = rcRet.left() / (0.03937 * m_dpiValue); - m_cutTopValue = rcRet.top() / (0.03937 * m_dpiValue); - m_cutRightValue = rcRet.right() / (0.03937 * m_dpiValue); - m_cutBottomValue = rcRet.bottom() / (0.03937 * m_dpiValue); - - SANE_Int info; - SANE_Word value = SANE_FIX(m_cutLeftValue); - sane_control_option(m_handle, m_cutLeftId, SANE_ACTION_SET_VALUE, &value, &info); - cur_scheme_->config_changed(m_cutLeftId, (char*)&value, sizeof(value)); - value = SANE_FIX(m_cutTopValue); - sane_control_option(m_handle, m_cutTopId, SANE_ACTION_SET_VALUE, &value, &info); - cur_scheme_->config_changed(m_cutTopId, (char*)&value, sizeof(value)); - value = SANE_FIX(m_cutRightValue); - sane_control_option(m_handle, m_cutRightId, SANE_ACTION_SET_VALUE, &value, &info); - cur_scheme_->config_changed(m_cutRightId, (char*)&value, sizeof(value)); - value = SANE_FIX(m_cutBottomValue); - sane_control_option(m_handle, m_cutBottomId, SANE_ACTION_SET_VALUE, &value, &info); - cur_scheme_->config_changed(m_cutBottomId, (char*)&value, sizeof(value)); - } -} - -void hg_settingdialog::slot_gammaButtonClicked() -{ - setPicClrTool dlg(this); - - int colorMode; // 0-彩色, 1-灰度 - if (m_colorModeValue.toStdString() == OPTION_VALUE_YSMS_256JHD - || m_colorModeValue.toStdString() == OPTION_VALUE_YSMS_HB) - { - colorMode = 1; - - QList keyTable; - for (int i = 0; i < m_gammaData.pt_count; ++i) - { - QPoint pt(m_gammaData.keypoint[i].x, m_gammaData.keypoint[i].y); - keyTable.append(pt); - } - - if (!keyTable.empty()) - { - dlg.setGrayKeyTable(keyTable); - } - } - else - { - colorMode = 0; - - QList keyTable; - for (int i = 0; i < m_gammaData.pt_count; ++i) - { - QPoint pt(m_gammaData.keypoint[i].x, m_gammaData.keypoint[i].y); - keyTable.append(pt); - } - - QList rKeyTable; - for (int i = 0; i < m_gammaData.pt_count_r; ++i) - { - QPoint pt(m_gammaData.keypoint_r[i].x, m_gammaData.keypoint_r[i].y); - rKeyTable.append(pt); - } - - QList gKeyTable; - for (int i = 0; i < m_gammaData.pt_count_g; ++i) - { - QPoint pt(m_gammaData.keypoint_g[i].x, m_gammaData.keypoint_g[i].y); - gKeyTable.append(pt); - } - - QList bKeyTable; - for (int i = 0; i < m_gammaData.pt_count_b; ++i) - { - QPoint pt(m_gammaData.keypoint_b[i].x, m_gammaData.keypoint_b[i].y); - bKeyTable.append(pt); - } - - QVector> keyTableList; - if (!keyTable.empty() && !rKeyTable.empty() && !gKeyTable.empty() && !bKeyTable.empty()) - { - keyTableList.append(keyTable); - keyTableList.append(rKeyTable); - keyTableList.append(gKeyTable); - keyTableList.append(bKeyTable); - dlg.setRGBKeyTable(keyTableList); - } - } - - dlg.setColorMode(colorMode); - if (dlg.exec()) - { - memset(&m_gammaData, 0, sizeof(m_gammaData)); - clicked_gamma_ = true; - - if (1 == colorMode) - { - QList keyTable = dlg.getGrayKeyTable(); - - m_gammaData.pt_count = HGMIN(4, keyTable.size()); - int i = 0; - for (QPoint pt : keyTable) - { - if (i >= 4) - break; - - m_gammaData.keypoint[i].x = pt.x(); - m_gammaData.keypoint[i].y = pt.y(); - ++i; - } - - uchar data[256]; - dlg.getGrayTable(data, 256); - for (int i = 0; i < 256; ++i) - { - m_gammaData.table[i] = data[i]; - } - } - else - { - QVector> keyTableList = dlg.getRGBKeyTable(); - - m_gammaData.pt_count = HGMIN(4, keyTableList[0].size()); - int i = 0; - for (QPoint pt : keyTableList[0]) - { - if (i >= 4) - break; - - m_gammaData.keypoint[i].x = pt.x(); - m_gammaData.keypoint[i].y = pt.y(); - ++i; - } - - m_gammaData.pt_count_r = HGMIN(4, keyTableList[1].size()); - i = 0; - for (QPoint pt : keyTableList[1]) - { - if (i >= 4) - break; - - m_gammaData.keypoint_r[i].x = pt.x(); - m_gammaData.keypoint_r[i].y = pt.y(); - ++i; - } - - m_gammaData.pt_count_g = HGMIN(4, keyTableList[2].size()); - i = 0; - for (QPoint pt : keyTableList[2]) - { - if (i >= 4) - break; - - m_gammaData.keypoint_g[i].x = pt.x(); - m_gammaData.keypoint_g[i].y = pt.y(); - ++i; - } - - m_gammaData.pt_count_b = HGMIN(4, keyTableList[3].size()); - i = 0; - for (QPoint pt : keyTableList[3]) - { - if (i >= 4) - break; - - m_gammaData.keypoint_b[i].x = pt.x(); - m_gammaData.keypoint_b[i].y = pt.y(); - ++i; - } - - uchar data[256 * 3]; - dlg.getRGBTable(data, 256 * 3); - for (int i = 0; i < 256; ++i) - { - m_gammaData.table[i] = data[i * 3 + 2]; - m_gammaData.table[i + 256] = data[i * 3 + 1]; - m_gammaData.table[i + 512] = data[i * 3 + 0]; - } - } - - unsigned int len = sizeof(SANE_Gamma); - sane_io_control(m_handle, IO_CTRL_CODE_SET_CUSTOM_GAMMA, &m_gammaData, &len); - cur_scheme_->config_changed(SANE_STD_OPT_NAME_IS_CUSTOM_GAMMA, (char*)&m_gammaData, sizeof(m_gammaData), true); - } -} - -void hg_settingdialog::slot_word_list_comboBoxClicked(int value) -{ - QComboBox *comboBox = qobject_cast(sender()); - SANE_Int id = comboBox->property("controls_id").toInt(); - SANE_Int temp = value; - - const SANE_Option_Descriptor* opt = nullptr; - for(int i = 0; i < m_list_getOpt.size(); i++) - if (m_list_getOpt.at(i).first == id) - { - opt = reinterpret_cast(m_list_getOpt.at(i).second); - break; - } - m_list_IdValueTitle.append(QPair, QString>(QPair(id, temp), md5(opt->title))); - - - SANE_Int method = 0; - sane_control_option(m_handle, id, SANE_ACTION_SET_VALUE, &temp, &method); - if((method & SANE_INFO_RELOAD_OPTIONS) == SANE_INFO_RELOAD_OPTIONS) - updateUIStatus(); - else if(method & SANE_INFO_INEXACT) - { - char buf[20]; - sprintf(buf, "%d", temp); - comboBox->setCurrentText(QString::fromStdString(buf)); - } - cur_scheme_->config_changed(id, (char*)&temp, sizeof(temp)); -} - -void hg_settingdialog::slot_sliderClicked(int value) -{ - QSlider *slider = qobject_cast(sender()); - SANE_Int id = slider->property("controls_id").toInt(); - - const SANE_Option_Descriptor* opt = nullptr; - for(int i = 0; i < m_list_getOpt.size(); i++) - if (m_list_getOpt.at(i).first == id) - { - opt = reinterpret_cast(m_list_getOpt.at(i).second); - break; - } - - QAbstractSpinBox* spin = nullptr; - for(int i = 0; i < m_list_sliderSpinbox.size(); i++) - if (m_list_sliderSpinbox.at(i).first == slider) - { - spin = reinterpret_cast(m_list_sliderSpinbox.at(i).second); - break; - } - - if (spin != nullptr) - { - SANE_Int val = value, method = 0; - bool db_val = false; - if (typeid(*spin) == typeid(QSpinBox)) - { - QSpinBox* spin_ = reinterpret_cast(spin); - spin_->setValue(value); - - m_list_IdValueTitle.append(QPair, QString>(QPair(id, val), md5(opt->title))); - } - else - { - QDoubleSpinBox* spin_ = reinterpret_cast(spin); - double temp = value * spin_->singleStep(); - if(temp != spin_->value()) - spin_->setValue(temp); - - val = SANE_FIX(temp); - db_val = true; - - m_list_IdValueTitle.append(QPair, QString>(QPair(id, temp), md5(opt->title))); - } - sane_control_option(m_handle, id, SANE_ACTION_SET_VALUE, &val, &method); - if((method & SANE_INFO_RELOAD_OPTIONS) == SANE_INFO_RELOAD_OPTIONS) - updateUIStatus(); - else if(method & SANE_INFO_INEXACT) - { - if(db_val) - { - QDoubleSpinBox* spin_ = reinterpret_cast(spin); - double v = SANE_UNFIX(val); - spin_->setValue(v); - slider->setValue(spin_->value() / spin_->singleStep()); - } - else { - QSpinBox* spin_ = reinterpret_cast(spin); - spin_->setValue(val); - slider->setValue(spin_->value() / spin_->singleStep()); - } - } - cur_scheme_->config_changed(id, (char*)&val, sizeof(val)); - } -} - -void hg_settingdialog::slot_doubleSpinboxClicked(double value) -{ - QDoubleSpinBox* spinBox = qobject_cast(sender()); - QAbstractSlider* slider = nullptr; - int id = spinBox->property("controls_id").toInt(); - for (int i = 0; i < m_list_sliderSpinbox.size(); i++) - if (m_list_sliderSpinbox.at(i).second == spinBox) - { - slider = reinterpret_cast(m_list_sliderSpinbox.at(i).first); - break; - } - if(slider != nullptr) - { - int temp = static_cast(value / spinBox->singleStep() + 0.5); - QSlider* slider_ = reinterpret_cast(slider); - if (slider_->value() != temp) - slider_->setValue(temp); - } -} - -void hg_settingdialog::slot_spinBoxClicked(int value) -{ - QSpinBox* spinBox = qobject_cast(sender()); - int id = spinBox->property("controls_id").toInt(); - - const SANE_Option_Descriptor* opt = nullptr; - for(int i = 0; i < m_list_getOpt.size(); i++) - if (m_list_getOpt.at(i).first == id) - { - opt = reinterpret_cast(m_list_getOpt.at(i).second); - break; - } - - QAbstractSlider* slider = nullptr; - for (int i = 0; i < m_list_sliderSpinbox.size(); i++) - if (m_list_sliderSpinbox.at(i).second == spinBox) - { - slider = reinterpret_cast(m_list_sliderSpinbox.at(i).first); - break; - } - if(slider == nullptr) - { - SANE_Int temp = value; - - m_list_IdValueTitle.append(QPair, QString>(QPair(id, temp), md5(opt->title))); - - SANE_Int method = 0; - sane_control_option(m_handle, id, SANE_ACTION_SET_VALUE, &temp, &method); - if((method & SANE_INFO_RELOAD_OPTIONS) == SANE_INFO_RELOAD_OPTIONS) - updateUIStatus(); - else if(value != temp) - { - disconnect(spinBox, SIGNAL(valueChanged(int)), this, SLOT(slot_spinBoxClicked(int))); - spinBox->setValue(temp); - connect(spinBox, SIGNAL(valueChanged(int)), this, SLOT(slot_spinBoxClicked(int))); - } - cur_scheme_->config_changed(id, (char*)&temp, sizeof(temp)); - }else - { - QSlider* slider_ = reinterpret_cast(slider); - slider_->setValue(spinBox->value()); - } -} - -void hg_settingdialog::slot_lineEditInput() -{ - QLineEdit* lineEdit = qobject_cast(sender()); - int id = lineEdit->property("controls_id").toInt(); - std::string lineEditCurrentText(lineEdit->text().toUtf8()); - - const SANE_Option_Descriptor* opt = nullptr; - for(int i = 0; i < m_list_getOpt.size(); i++) - if (m_list_getOpt.at(i).first == id) - { - opt = reinterpret_cast(m_list_getOpt.at(i).second); - break; - } - - m_list_IdValueTitle.append(QPair, QString>(QPair(id, &lineEditCurrentText.at(0)), md5(opt->title))); - - SANE_Int method = 0; - void *buf = NULL; - SANE_Int nv = 0; - if(opt->type == SANE_TYPE_INT) - { - nv = atoi(lineEditCurrentText.c_str()); - buf = &nv; - } - else if(opt->type == SANE_TYPE_FIXED) - { - nv = SANE_FIX(atof(lineEditCurrentText.c_str())); - buf = &nv; - } - else - { - buf = malloc(opt->size * 2 + 4); - strcpy((char*)buf, lineEditCurrentText.c_str()); - } - sane_control_option(m_handle, id, SANE_ACTION_SET_VALUE, buf, &method); - if((method & SANE_INFO_RELOAD_OPTIONS) == SANE_INFO_RELOAD_OPTIONS) - updateUIStatus(); - else if(method & SANE_INFO_INEXACT) - { - char mem[20], *v = mem; - if(opt->type == SANE_TYPE_INT) - sprintf(mem, "%d", nv); - else if(opt->type == SANE_TYPE_FIXED) - sprintf(mem, "%f", SANE_UNFIX(nv)); - else - v = (char*)buf; - lineEdit->setText(QString::fromStdString(v)); - } - - if(opt->type == SANE_TYPE_INT || opt->type == SANE_TYPE_FIXED) - { - cur_scheme_->config_changed(id, (char*)buf, sizeof(SANE_Int)); - } - else - { - std::string langCN(to_default_language((char*)buf, nullptr)); - cur_scheme_->config_changed(id, &langCN[0], langCN.length()); - free(buf); - } -} - -void hg_settingdialog::slot_buttonOkClicked() -{ - save_ = true; - close(); -} - -void hg_settingdialog::slot_buttonCancelClicked() -{ - close(); -} - -void hg_settingdialog::keyPressEvent(QKeyEvent *e) -{ - if (e->key() == Qt::Key_Escape) { - e->ignore(); - } - else { - QDialog::keyPressEvent(e); - } -} - -int hg_settingdialog::get_changed_items(void) -{ - return changed_count_; -} - -void hg_settingdialog::iniWrite(QString title, int id, QVariant value) -{ - (void)title; - (void)id; - (void)value; -// m_qstrFileName = QCoreApplication::applicationDirPath() + "/config.ini"; -// m_configIniWrite = new QSettings(m_qstrFileName, QSettings::IniFormat); -// m_configIniWrite->setIniCodec(QTextCodec::codecForName("UTF-8")); -// m_configIniWrite->setValue(title + "/id", id); -// m_configIniWrite->setValue(title + "/value", value); - -// delete m_configIniWrite; -// m_configIniWrite = nullptr; -} - -void hg_settingdialog::iniRead(QString title, int id, QWidget *w) -{ - (void)title; - (void)id; - (void)w; -// m_configIniRead = new QSettings("config.ini", QSettings::IniFormat); -// m_configIniRead->setIniCodec(QTextCodec::codecForName("UTF-8")); -// int id_ini = m_configIniRead->value(title + "/id").toInt(); -// QVariant value = m_configIniRead->value(title + "/value"); - -// if(id_ini == id) -// { -// if(typeid(*w) == typeid(QCheckBox)) -// reinterpret_cast(w)->setChecked(value.toBool()); - -// else if(typeid(*w) == typeid(QSlider)) -// reinterpret_cast(w)->setValue(value.toInt()); - -// else if(typeid(*w) == typeid(QSpinBox)) -// reinterpret_cast(w)->setValue(value.toInt()); - -// else if(typeid(*w) == typeid(QDoubleSpinBox)) -// reinterpret_cast(w)->setValue(value.toDouble()); - -// else if(typeid(*w) == typeid(QComboBox)) -// reinterpret_cast(w)->setCurrentText(value.toString()); -// } - -// delete m_configIniRead; -// m_configIniRead = nullptr; -} - -//生成UTF-8编码的MD5值 -QString hg_settingdialog::md5(QString key) -{ - QCryptographicHash md5(QCryptographicHash::Md5); - md5.addData(key.toUtf8()); - return QString(md5.result().toHex()); -} -const void* hg_settingdialog::find_option_description(int id) -{ - for(int i = 0; i < m_list_getOpt.size(); i++) - { - if (m_list_getOpt.at(i).first == id) - return reinterpret_cast(m_list_getOpt.at(i).second); - } - - return nullptr; -} -const void* hg_settingdialog::find_option_description(const std::string& title, int* id) -{ - for(int i = 0; i < m_list_getOpt.size(); i++) - { - std::string t((reinterpret_cast(m_list_getOpt.at(i).second))->name); - - if (title == t) - { - if(id) - *id = m_list_getOpt.at(i).first; - return reinterpret_cast(m_list_getOpt.at(i).second); - } - } - - return nullptr; -} - - -void hg_settingdialog::closeEvent(QCloseEvent* e) -{ - if(e->type() == QEvent::Close) // consider as cancel ... - { - if(save_) - save_scheme(); - else - cancel_setting(); - } - - e->accept(); -} - -bool hg_settingdialog::createMsgBoxUi(bool add, std::string &name) -{ - QString text(tr("Please select to overwrite the original configuration:")); - text += QString::fromStdString(name); - text += tr(",or add a new configuration"); - - QDialog *dlg = new QDialog(this); - dlg->setWindowTitle(tr("save the configuration")); - QLabel *label_question = new QLabel; - label_question->setText(text); - - QRadioButton *radioButtonCover = new QRadioButton; - radioButtonCover->setText(tr("cover original configuration:") + QString::fromStdString(name)); - radioButtonCover->setChecked(true); - add = false; - QRadioButton *radioButtonNew = new QRadioButton; - radioButtonNew->setText(tr("add new configuration")); - - QHBoxLayout *hLayoutName = new QHBoxLayout; - QLabel *label_name = new QLabel; - label_name->setText(tr("rename:")); - m_lineEdit_name = new QLineEdit; - std::string name2; - m_lineEdit_name->setText(QString::fromStdString(getCurUiShemeName(name2))); - - QSpacerItem *spacer1 = new QSpacerItem(20, 20, QSizePolicy::Expanding); - hLayoutName->addWidget(label_name); - hLayoutName->addWidget(m_lineEdit_name); - hLayoutName->addSpacerItem(spacer1); - label_name->setVisible(false); - m_lineEdit_name->setVisible(false); - - bool cover = true; - connect(radioButtonCover, &QRadioButton::clicked, this, [=, &add, &cover](){ - cover = true; - add = false; - label_name->setVisible(false); - m_lineEdit_name->setVisible(false); - }); - connect(radioButtonNew, &QRadioButton::clicked, this, [=, &add, &cover](){ - cover = false; - add = true; - label_name->setVisible(true); - m_lineEdit_name->setVisible(true); - - m_lineEdit_name->setFocus(); - QTimer::singleShot(0, m_lineEdit_name, &QLineEdit::selectAll); - }); - - QSpacerItem *spacer2 = new QSpacerItem(20, 20, QSizePolicy::Expanding); - QPushButton *pbtnOk = new QPushButton; - pbtnOk->setText(tr("ok")); - connect(pbtnOk, &QPushButton::clicked, this, [=, &name, &cover](){ - - QString text = m_lineEdit_name->text(); - static QRegularExpression re("\\s"); - text.remove(re);//Remove space - - name = text.toStdString(); - - if(name.empty()) - { - QMessageBox::information(this, tr("tips"), tr("scheme name cannot be empty")); - m_lineEdit_name->setText(QString::fromStdString(getCurUiShemeName(name))); - return; - } - - if (!cover) - { - std::vector now; - cur_cfg_->get_all_schemes(now); - for(auto& v: now) - { - if(v == name) - { - - QMessageBox::information(this, tr("tips"), tr("scheme name: ") + QString::fromStdString(name) + tr(" already exists")); - m_lineEdit_name->setText(QString::fromStdString(getCurUiShemeName(name))); - return; - } - } - } - - dlg->close(); - }); - - QHBoxLayout *hLayout_pbtnOk = new QHBoxLayout; - hLayout_pbtnOk->addSpacerItem(spacer2); - hLayout_pbtnOk->addWidget(pbtnOk); - - QVBoxLayout *vLayout = new QVBoxLayout; - vLayout->addWidget(label_question); - vLayout->addWidget(radioButtonCover); - vLayout->addWidget(radioButtonNew); - vLayout->addLayout(hLayoutName); - vLayout->addLayout(hLayout_pbtnOk); - dlg->setLayout(vLayout); - - dlg->exec(); - - return add; -} - -std::string hg_settingdialog::getCurUiShemeName(std::string name) -{ - std::string k(""), val(""); - int id = 0; - const SANE_Option_Descriptor* opt = nullptr; - - if (cur_scheme_->first_config(k, val)) - { - int count = 0; - do - { - id = cur_scheme_->id_from_name(k.c_str()); - opt = id == -1 ? nullptr : sane_get_option_descriptor(m_handle, id); - if (opt) - { - if (count++) - name += " + "; - - if (opt->type == SANE_TYPE_STRING) - name += from_default_language(val.c_str(), nullptr); - else - { - name += opt->title; - if (opt->type == SANE_TYPE_BOOL) - { - name += std::string("("); - if (*(SANE_Bool*)&val[0] == SANE_TRUE) - name += "true)"; - else - name += "false)"; - } - else if (opt->type == SANE_TYPE_INT) - { - char buf[128] = { 0 }; - sprintf(buf, "(%d)", *(int*)&val[0]); - name += buf; - } - else if (opt->type == SANE_TYPE_FIXED) - { - char buf[128] = { 0 }; - sprintf(buf, "(%.4f)", SANE_UNFIX(*(SANE_Fixed*)&val[0])); - name += buf; - } - } - } - } while (count < 3 && cur_scheme_->next_config(k, val)); - } - return name; -} - -void hg_settingdialog::save_scheme(void) -{ - std::string name(cur_scheme_->get_scheme_name()); - - bool add = name.empty(); - - if(add) - { - name = getCurUiShemeName(name); - } - else - { - int items = 0; - add = cur_scheme_->has_changed(&items); - if(add) - { - if(items == 0) // while shemes is default - { - cur_cfg_->select_scheme(nullptr); - return; - } - else - add = createMsgBoxUi(add, name); - } - } - if(add) - { - if(name.empty() && cur_scheme_->get_scheme_name().empty()) - { - cur_scheme_->end_setting(true); - return; - } - - gb::sane_config_schm* cp = cur_scheme_->copy(); - - cur_scheme_->end_setting(true); - cur_scheme_->release(); - cur_scheme_ = cp; - - size_t pos = name.rfind('-'); - int ind = 0; - char append[20] = {0}; - - if(pos != std::string::npos) - { - ind = atoi(name.c_str() + pos + 1); - if(ind > 0) - { - name.erase(pos); - sprintf(append, "-%d", ++ind); - } - } - while(!cur_cfg_->add_scheme(cur_scheme_, (name + append).c_str())) - { - sprintf(append, "-%d", ++ind); - } - } - else - { - cur_scheme_->end_setting(false); - } - - cur_cfg_->select_scheme(cur_scheme_->get_scheme_name().c_str()); - - cur_cfg_->save(); -} -void hg_settingdialog::cancel_setting(void) -{ - // restore changed value ... - cur_scheme_->end_setting(true); - dev_que::apply_scheme(m_handle, cur_scheme_); -} - -void hg_settingdialog::getAppVersion() -{ - SANE_About *about = nullptr; - unsigned int len = 0; - std::string versionNum; - if (sane_io_control(m_handle, IO_CTRL_CODE_ABOUT_INFO, about, &len) == SANE_STATUS_NO_MEM) - { - about = (SANE_About*)malloc(len + 128); - if (about) - { - memset(about, 0, len + 128); - if (sane_io_control(m_handle, IO_CTRL_CODE_ABOUT_INFO, about, &len) == SANE_STATUS_GOOD) - { - versionNum = about->version; - } - } - } -} -void hg_settingdialog::apply_current_scheme(void) -{ - dev_que::apply_scheme(m_handle, cur_scheme_); -} -std::string sane_val_to_string(const char* val, SANE_Value_Type type) -{ - char buf[128] = {0}; - std::string ret(""); - - switch(type) - { - case SANE_TYPE_BOOL: - ret = *(SANE_Bool*)val == SANE_TRUE ? "true" : "false"; - break; - case SANE_TYPE_INT: - sprintf(buf, "%d", *(int*)val); - ret = buf; - break; - case SANE_TYPE_FIXED: - sprintf(buf, "%.4f", SANE_UNFIX(*(SANE_Fixed*)val)); - ret = buf; - break; - default: - ret = val; - break; - } - - return ret; -} -void hg_settingdialog::on_current_scheme_changed() -{ - QString scheme(comb_->currentText()); - bool enabled = false; - gb::sane_config_schm *schm = cur_cfg_->get_scheme(scheme.toStdString().c_str()); - - if(schm) - enabled = true; - - rename_->setEnabled(enabled); - apply_->setEnabled(enabled); - del_this_->setEnabled(enabled); - del_all_->setEnabled(enabled); - memset(&m_gammaData, 0, sizeof(m_gammaData)); - for(int i = 0; i < sizeof(m_gammaData.table) / sizeof(m_gammaData.table[0]); ++i) - m_gammaData.table[i] = i & 0x0ff; - - QString info(tr("")); - std::string name(""), val(""); - if(schm && schm->first_config(name, val)) - { - do - { - QString title; - SANE_Value_Type type = SANE_TYPE_STRING; - for (int ii = 0; ii < m_list_defaultOptions.size(); ii++) - { - const SANE_Option_Descriptor* opt = reinterpret_cast(m_list_defaultOptions.at(ii).first); - if(strcmp(opt->name, name.c_str()) == 0) - { - title = QString::fromStdString(opt->title); - type = opt->type; - if(type == SANE_TYPE_STRING) - val = from_default_language(val.c_str(), nullptr); - break; - } - } - - if(title.length()) - { - info += tr("
") + title + tr(":
"); - info += tr("

") + QString::fromStdString(sane_val_to_string(val.c_str(), type)) + tr("

"); - } - else { - if(val.length() == sizeof(SANE_Gamma)) - memcpy(&m_gammaData, val.c_str(), sizeof(SANE_Gamma)); - } - }while(schm->next_config(name, val)); - } - if(schm) - schm->release(); - - sketch_->setHtml(info); -} -void hg_settingdialog::slot_pushButton_scheme_management(void) -{ - QPushButton* btn = qobject_cast(sender()); - - if(btn == rename_) - { - int id = 0; - QString text(find_current_scheme_menu(&id)); - if(!text.isEmpty() && id >= 0) - { - Dialog_Input dlg; - - dlg.init_value(text); - dlg.setWindowTitle(tr("configuration scheme name change")); - if(dlg.exec() && text != dlg.get_inputting_value()) - { - std::vector now; - std::string str = dlg.get_inputting_value().toStdString(); - - cur_cfg_->get_all_schemes(now); - for(auto& v: now) - { - if(v == str) - { - QMessageBox::information(this, tr("tips"), tr("scheme name: ") + QString::fromStdString(str) + tr(" already exists")); - return; - } - } - disconnect(comb_, SIGNAL(currentTextChanged(const QString)), this, SLOT(on_current_scheme_changed())); - comb_->removeItem(id); - comb_->insertItem(id, QString::fromStdString(str)); - comb_->setCurrentIndex(id); - connect(comb_, SIGNAL(currentTextChanged(const QString)), this, SLOT(on_current_scheme_changed())); - - cur_cfg_->rename_scheme(text.toStdString().c_str(), str.c_str()); - cur_cfg_->save(); - changed_count_++; - } - } - } - else if(btn == apply_) - { - QString text(find_current_scheme_menu()); - gb::sane_config_schm *cur = nullptr; - - cur_cfg_->select_scheme(text.toStdString().c_str()); - cur = cur_cfg_->get_scheme(); - if(!cur) - cur = new gb::sane_config_schm(); - cur->copy_default_value(cur_scheme_); - cur_scheme_->end_setting(true); - cur_scheme_->release(); - cur_scheme_ = cur; - cur_scheme_->begin_setting(); - - apply_current_scheme(); - updateUIStatus(); - changed_count_++; - } - else if(btn == del_this_) - { - int id = -1; - QString text(find_current_scheme_menu(&id)); - - if(text.isEmpty()) - return; - - QMessageBox msg(QMessageBox::Question, tr("be sure to delete the configuration"), - tr("Are you sure you want to delete the configuration \"") + text + tr("\" ?"), QMessageBox::Yes | QMessageBox::No, this); - msg.exec(); - if (msg.clickedButton() != msg.button(QMessageBox::Yes)) - return; - - gb::sane_config_schm *sch = cur_cfg_->get_scheme(text.toStdString().c_str()); - cur_cfg_->remove_scheme(text.toStdString().c_str()); - comb_->removeItem(id); - sch->release(); - if(sch == cur_scheme_) - { - restore_2_default_settings(); - updateUIStatus(); - } - - on_current_scheme_changed(); - changed_count_++; - cur_cfg_->save(); - } - else if(btn == del_all_) - { - QMessageBox msg(QMessageBox::Question, tr("be sure to delete the configuration"), - tr("Are you sure you want to delete the configuration?"), QMessageBox::Yes | QMessageBox::No, this); - msg.exec(); - if (msg.clickedButton() != msg.button(QMessageBox::Yes)) - return; - - restore_2_default_settings(); - updateUIStatus(); - comb_->clear(); - changed_count_++; - cur_cfg_->remove_all_schemes(); - cur_cfg_->save(); - } -} -void hg_settingdialog::restore_2_default_settings(void) -{ - cur_scheme_->end_setting(true); - cur_cfg_->select_scheme(nullptr); - dev_que_->apply_scheme(nullptr); - cur_cfg_->save(); - - gb::sane_config_schm *s = new gb::sane_config_schm(); - s->copy_default_value(cur_scheme_); - cur_scheme_->release(); - cur_scheme_ = s; - cur_scheme_->begin_setting(); - - on_current_scheme_changed(); -} diff --git a/app/scanner/hg_settingdialog.h b/app/scanner/hg_settingdialog.h deleted file mode 100644 index 72f71ad3..00000000 --- a/app/scanner/hg_settingdialog.h +++ /dev/null @@ -1,141 +0,0 @@ -#ifndef HG_SETTING_DIALOG_H -#define HG_SETTING_DIALOG_H - -#include -#include -#include -#include "sane/sane_ex.h" -#include "cfg/gb_json.h" -#include "device_menu.h" - -class hg_settingdialog : public QDialog -{ - Q_OBJECT - - int changed_count_; - bool save_; - bool clicked_gamma_; - dev_que *dev_que_; - gb::scanner_cfg *cur_cfg_; - gb::sane_config_schm *cur_scheme_; - - void refresh_control_value(int op_id); - void on_select_scheme(bool apply_to_dev = true); - QString gen_gamma_file_path(void); - - QMenu *top_menu_; - QLineEdit *edit_name_; - QPushButton *rename_; - QPushButton *apply_; - QPushButton *del_this_; - QPushButton *del_all_; - QLabel *custom_area_lable_; - QPushButton *btn_cut_area_; - QPushButton *btn_gamma_; - QTextEdit *sketch_; - QLineEdit *m_lineEdit_name; - void create_scheme_management_ui(QVBoxLayout* layout); - QString find_current_scheme_menu(int *scheme_id = nullptr); - - static std::string property_combox_data_type_; - enum _cbox_type - { - COMBO_VAL_STRING = 0, - COMBO_VAL_INT, - COMBO_VAL_FLOAT, - }; - -public: - explicit hg_settingdialog(void *handle, QWidget *parent = nullptr, - dev_que* dev = nullptr); - ~hg_settingdialog(); - -public: - void initUi(); - void updateOpt(); - void createUI(); - void updateUIStatus(); - QVector find_control(int opt_num); - void keyPressEvent(QKeyEvent *e); - int get_changed_items(void); - -private: - void *m_handle; - -private: - QString m_qstrFileName; - QSettings *m_configIniWrite; - QSettings *m_configIniRead; - -private: - void iniWrite(QString title, int id, QVariant value); - void iniRead(QString title, int id, QWidget *w); - QString md5(QString key); - const void* find_option_description(int id); // return const SANE_Option_Descriptor* pointer - const void* find_option_description(const std::string& title, int* id); // return const SANE_Option_Descriptor* pointer - - virtual void closeEvent(QCloseEvent* e); - bool createMsgBoxUi(bool add, std::string &name); - std::string getCurUiShemeName(std::string name); - void save_scheme(void); - void cancel_setting(void); - void getAppVersion(); - void apply_current_scheme(void); - -private: - QVector, QString>> m_list_IdValueTitle; - QVector> m_list_defaultOptions; // default values of device - QVector> m_list_sliderSpinbox; - QVector> m_list_getOpt; - QVector m_list_deviceNames; - QVector m_list_widgets; - -private slots: - void slot_checkedClicked(); - void slot_sliderClicked(int value); - void slot_spinBoxClicked(int value); - void slot_doubleSpinboxClicked(double value); - void slot_string_list_comboBoxClicked(); - void slot_pushButtonClicked(); - void slot_cutButtonClicked(); - void slot_gammaButtonClicked(); - void slot_word_list_comboBoxClicked(int value); - void slot_lineEditInput(); - void slot_buttonOkClicked(); - void slot_buttonCancelClicked(); - void slot_pushButton_scheme_management(void); - void on_current_scheme_changed(void); - void restore_2_default_settings(void); - -private: - int m_dpiId; - int m_dpiValue; - int m_paperSizeId; - QString m_paperSizeValue; - int m_cutLeftId; - int m_cutTopId; - int m_cutRightId; - int m_cutBottomId; - double m_cutWidth; // 单位是毫米 - double m_cutHeight; // 单位是毫米 - double m_cutLeftValue; // 单位是毫米 - double m_cutTopValue; // 单位是毫米 - double m_cutRightValue; // 单位是毫米 - double m_cutBottomValue; // 单位是毫米 - - int m_colorModeId; - QString m_colorModeValue; - SANE_Gamma m_gammaData; - QComboBox *comb_; -}; - -#endif // HG_SETTING_DIALOG_H - - - - - - - - - diff --git a/app/scanner/mainwindow.cpp b/app/scanner/mainwindow.cpp index b5c6d4b8..9f99775c 100644 --- a/app/scanner/mainwindow.cpp +++ b/app/scanner/mainwindow.cpp @@ -9,7 +9,6 @@ #include #include #include "widget_statusbar.h" -#include "dialog_log.h" #include "dialog_openimageindex.h" #include "dialog_saveas.h" #include "dialog_export.h" @@ -31,9 +30,7 @@ #include "dialog_updateprogress.h" #include "dialog_upgrade.h" #include "dialog_feedback.h" -#include "dialog_upgradefirmware.h" #include "dialog_savemessagebox.h" -#include "hg_settingdialog.h" #include "base/HGInfo.h" #include "huagao/hgscanner_error.h" #include "imgfmt/HGPdf.h" @@ -50,7 +47,6 @@ #include "dialog_wrong_img.h" #include "../../code_device/hgdriver/hgdev/char_const.h" #include "lang/app_language.h" -#include "ocrPdf.h" #define PASSWORD_KEY 4 #define MY_URL_SCHEME "inscanner" @@ -89,6 +85,9 @@ MainWindow::MainWindow(const QString& appLang, QWidget *parent) { ui->setupUi(this); + m_devUserMgr = new DeviceUserMgr(this); + m_devUser = nullptr; + m_versionDll = new VersionDll; HGBase_RegisterCrashFunc(CrashFunc, this); @@ -152,15 +151,6 @@ MainWindow::MainWindow(const QString& appLang, QWidget *parent) } #endif - HGChar cfgpath[512] = {0}; - QString old; - HGBase_GetConfigPath(cfgpath, _countof(cfgpath) - 1); - HGBase_CreateDir(cfgpath); - dev_que_.set_root_dir(cfgpath); - old = QString::fromStdString(cfgpath) + PATH_SYMBOL + "scanner.schm"; - if(QFile::exists(old)) - dev_que::update_old_cfg(old.toStdString().c_str()); - ui->toolBar->addAction(ui->act_scannerSettings); ui->toolBar->addAction(ui->act_acquire); m_act_acquireInto2 = new QAction(QIcon(":/images/image_rsc/actions/scanInto.png"), tr("act_acquireInto"), this); @@ -237,8 +227,6 @@ MainWindow::MainWindow(const QString& appLang, QWidget *parent) m_wndStatusBar->setStyleSheet("QStatusBar::item{border: 0px}"); ui->statusBar->setSizeGripEnabled(false); - m_dialogLog = new dialog_log(this); - connect(m_view, SIGNAL(scaleChanged(double)), this, SLOT(on_viewerScale(double))); connect(m_view, SIGNAL(mousePos(int, int)), this, SLOT(on_viewerMousePos(int, int))); connect(m_view, SIGNAL(drop(const QObject*, const QStringList &)), this, SLOT(on_viewerDrop(const QObject*, const QStringList &))); @@ -342,23 +330,11 @@ MainWindow::MainWindow(const QString& appLang, QWidget *parent) ui->act_consume->setVisible(false); - connect(this, SIGNAL(sane_dev_arrive(QString, bool)), this, SLOT(on_sane_dev_arrive(QString, bool)), Qt::QueuedConnection); - connect(this, SIGNAL(sane_dev_remove(QString)), this, SLOT(on_sane_dev_remove(QString)), Qt::QueuedConnection); connect(this, SIGNAL(pre_new_image(void*)), this, SLOT(on_pre_new_image(void*)), Qt::BlockingQueuedConnection); connect(this, SIGNAL(post_new_image(unsigned int, int)), this, SLOT(on_post_new_image(unsigned int, int)), Qt::BlockingQueuedConnection); - connect(this, SIGNAL(scan_working(QString)), this, SLOT(on_scan_working(QString)), Qt::QueuedConnection); - connect(this, SIGNAL(scan_finish(QString, int)), this, SLOT(on_scan_finish(QString, int)), Qt::QueuedConnection); - connect(this, SIGNAL(sane_dev_error(QString)), this, SLOT(on_sane_dev_error(QString)), Qt::QueuedConnection); - connect(this, SIGNAL(sane_dev_readyStatus(QString)), this, SLOT(on_sane_dev_readyStatus(QString)), Qt::QueuedConnection); - connect(m_dialogLog, SIGNAL(continueScan()), this, SLOT(on_continueScan())); - connect(m_dialogLog, SIGNAL(stopScan()), this, SLOT(on_stopScan())); - connect(m_dialogLog, SIGNAL(exportScanned()), this, SLOT(on_export_scanned_image())); - connect(m_wndStatusBar, SIGNAL(statusInfoDblClick()), this, SLOT(on_statusInfoDblClick())); m_wndStatusBar->setDeviceStatusInfo(tr("nodevice"), false); - m_dialogLog->addLog(tr("nodevice"), false); HGBase_WriteInfo(HGBASE_INFOTYPE_DESC, "%s", getStdString(tr("nodevice")).c_str()); - connect(ui->menu_device, SIGNAL(scanOptionsChanged(const QString&, const QString&, bool)), this, SLOT(on_scanOptions_changed(const QString&, const QString&, bool))); QString password = getCfgValue("login", "password", QString("")); if (password.isEmpty()) @@ -381,7 +357,6 @@ MainWindow::MainWindow(const QString& appLang, QWidget *parent) m_password = passwordDecrypt(password); m_dlgFullScreen = nullptr; - m_dialogLog->updateStatus(!dev_que_.opened_scanner_name().empty() && 0 != m_scanType, m_isScanning); ui->act_autoSave->setChecked(getCfgValue("save", "autoSave", false)); #if defined(OEM_LISICHENG) @@ -412,26 +387,28 @@ MainWindow::MainWindow(const QString& appLang, QWidget *parent) updateSideBar(); updateActionStatus(); - - SANE_Int v = 0; - sane_init_ex(&v, sane_ex_callback, this); } MainWindow::~MainWindow() { + if (nullptr != m_devUser) + { + disconnect(m_devUser, SIGNAL(newImage(void*)), this, SLOT(on_newImage(void*))); + disconnect(m_devUser, SIGNAL(finishScan()), this, SLOT(on_finishScan())); + delete m_devUser; + m_devUser = nullptr; + } + + delete m_devUserMgr; + m_devUserMgr = nullptr; + if (nullptr != m_dlgFullScreen) { delete m_dlgFullScreen; m_dlgFullScreen = nullptr; } - if (nullptr != dev_que_.handle()) - { - dev_que_.close_scanner(); - m_versionDll->PostDeviceCloseInfo(m_currDeviceName.toStdString().c_str(), m_devSerialNum.toStdString().c_str(), "", m_devVersionNum.toStdString().c_str()); - } - - sane_exit(); +// m_versionDll->PostDeviceCloseInfo(m_currDeviceName.toStdString().c_str(), m_devSerialNum.toStdString().c_str(), "", m_devVersionNum.toStdString().c_str()); delete m_versionDll; m_versionDll = nullptr; @@ -469,7 +446,6 @@ HGResult MainWindow::saveImage(HGImage image, const HGImgFmtSaveInfo* info, bool QFile::remove(tmpFileName); return (result) ? HGBASE_ERR_OK : HGIMGPROC_ERR_OCR; #else - // 韫囩晫鏆恑nfo HGOCRMgr ocrMgr = nullptr; ret = HGImgProc_CreateOCRMgr(0, &ocrMgr); if (HGBASE_ERR_OK == ret) @@ -631,7 +607,7 @@ void MainWindow::on_act_autoSave_triggered() void MainWindow::on_AcquireInto2() { - if (!dev_que_.is_online() || m_isScanning) + if (m_isScanning) { return; } @@ -662,66 +638,35 @@ void MainWindow::on_AcquireInto2() m_aquireIntoSaveParam.m_savePath = getStdFileName(m_aquireIntoSaveParam.m_savePath + dateTime.toString("yyyy-MM-dd") + "/"); } -// m_aquireIntoSaveParam.m_savePath = getStdFileName(m_aquireIntoSaveParam.m_savePath + dateTime.toString("yyyyMMddhhmmss") + "/"); - - if(!isLimitAccessFolder(2)) { return; } + if (!judgeDiskSpace(m_aquireIntoSaveParam.m_savePath)) + { + return; + } + startSaveMessageBox(this); - m_dpi = getDpi(); - SANE_Status ret = sane_start(dev_que_.handle()); - if (ret != SANE_STATUS_GOOD) + HGResult ret = HGBASE_ERR_FAIL; + if (nullptr != m_devUser) + { + ret = m_devUser->StartScan(); + } + + if (ret != HGBASE_ERR_OK) { - m_dialogLog->updateStatus(dev_que_.is_online() && 0 != m_scanType, m_isScanning); m_wndStatusBar->setDeviceStatusInfo(tr("start failed"), true); - m_dialogLog->addLog(tr("start failed") + "(" + QString(sane_err_desc(ret)) + ")", true); HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "%s", getStdString(tr("start failed")).c_str()); - - if(ret == SCANNER_ERR_DEVICE_SLEEPING) - { - ui->menu_scan->setEnabled(false); - ui->act_acquire->setEnabled(false); - ui->act_scannerSettings->setEnabled(false); - m_dialogLog->updateStatus(false, false); - m_dialogLog->show(); - - if (m_devVersionNum < "G4393B1001" - && ("439" == m_devPid || "9220" == m_devPid || "8529" == m_devPid)) - { - m_dialogLog->addLog(tr("Please wake up the device manually"), true); - m_wndStatusBar->setDeviceStatusInfo(tr("Please wake up the device manually"), true); - } - else - { - QTime curTimer = QTime::currentTime().addMSecs(10000); - while (QTime::currentTime() < curTimer) - { - QCoreApplication::processEvents(QEventLoop::AllEvents, 100); - } - - m_dialogLog->addLog(tr("already waked up device"), false); - m_wndStatusBar->setDeviceStatusInfo(tr("already waked up device"), false); - } - - ui->menu_scan->setEnabled(true); - ui->act_acquire->setEnabled(true); - ui->act_scannerSettings->setEnabled(true); - m_dialogLog->updateStatus(true, false); - } } else { m_isScanning = true; m_thumb->setAcceptDrops(false); - m_dialogLog->updateStatus(dev_que_.is_online() && 0 != m_scanType, m_isScanning); updateActionStatus(); } - - m_dialogLog->show(); } } @@ -1025,162 +970,44 @@ void MainWindow::on_clearCache() m_thumb->removeItems(removeItems, HGImgThumb::ThumbRemoveFlag_NULL); } -void MainWindow::on_sane_dev_arrive(QString devName, bool opened) +void MainWindow::on_newImage(void *image) { - bool reconnected = false; - std::vector now; - std::string stdn(devName.toStdString()); + HGImage img = (HGImage)image; - dev_que_.get_scanners(now); - if(std::find(now.begin(), now.end(), stdn) == now.end()) - { - // initializing the device configuration ... - dev_que_.add_scanner(stdn.c_str()); - - // statu info ... - QString info = tr("found device : %1").arg(devName); - m_wndStatusBar->setDeviceStatusInfo(info, false); - m_dialogLog->addLog(info, false); - HGBase_WriteInfo(HGBASE_INFOTYPE_DESC, "%s", getStdString(info).c_str()); - } - else - { - // re-connected statu ... - QString info(devName); - if(!opened && devName.toStdString() != dev_que_.opened_scanner_name()) - opened = true; - if(opened) - info += tr(" reconnected"); - else - info += tr("already connected, but open faild"); - m_wndStatusBar->setDeviceStatusInfo(info, !opened); - m_dialogLog->addLog(info, !opened); - HGBase_WriteInfo(!opened ? HGBASE_INFOTYPE_ERROR : HGBASE_INFOTYPE_DESC, "%s", getStdString(info).c_str()); - reconnected = true; - dev_que_.set_online(true, stdn.c_str()); - } - - // enable the device menu item ... - ui->menu_device->connectedDevice(devName); - - // open it if no device has been opened ... - if (dev_que_.opened_scanner_name().empty()) - { - //dev_que_.open_scanner(stdn.c_str()); - open_scanner(devName, ""); - } - - ui->menu_device->deviceMenuUpdate(&dev_que_); - - m_dialogLog->updateStatus(!dev_que_.opened_scanner_name().empty() && 0 != m_scanType, m_isScanning); - updateActionStatus(); -} - -void MainWindow::on_sane_dev_remove(QString devName) -{ - // statu info ... - QString info(devName + tr(" disconnected")); - - m_wndStatusBar->setDeviceStatusInfo(info, true); - m_dialogLog->addLog(info, true); - HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "%s", getStdString(info).c_str()); - - // enable the device menu item ... - ui->menu_device->disconnectedDevice(devName); - - // set openning device offline ... - dev_que_.set_online(false, devName.toStdString().c_str()); - - m_dialogLog->updateStatus(dev_que_.is_online() && 0 != m_scanType, m_isScanning); - updateActionStatus(); -} - -void MainWindow::on_sane_dev_error(QString errorInfo) -{ - //Error codes operate in slot function: on_scan_finish(QString finishInfo, int err). - - m_wndStatusBar->setDeviceStatusInfo(errorInfo, true); - m_dialogLog->addLog(errorInfo, true); - HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "%s", getStdString(errorInfo).c_str()); -} - -void MainWindow::on_sane_dev_readyStatus(QString promptInfo) -{ - if (STATU_DESC_SCANNER_ERR_DEVICE_DEVS_BOOTING == promptInfo) - { - m_wndStatusBar->setDeviceStatusInfo(promptInfo, true); - m_dialogLog->addLog(promptInfo, true); - //Enable ui... - } - else if (STATU_DESC_SCANNER_ERR_DEVICE_DEVS_START_SUCCES == promptInfo) - { - m_devSerialNum = getDevSerialNum(); - m_devVersionNum = getDevFwVersionNum(); - m_devPid = getDevPid(); - - if (!m_currDeviceName.isEmpty()) - m_versionDll->PostDeviceOpenInfo(m_currDeviceName.toStdString().c_str(), m_devSerialNum.toStdString().c_str(), "", m_devVersionNum.toStdString().c_str()); - - m_wndStatusBar->setDeviceStatusInfo(promptInfo, true); - m_dialogLog->addLog(promptInfo, true); - } -} - -void MainWindow::on_pre_new_image(void *img) -{ - m_saveType = 0; - - HGImage image = (HGImage)img; - HGBase_SetImageDpi(image, m_dpi, m_dpi); + HGUInt xDpi = 0; + HGUInt yDpi = 0; + HGBase_GetImageDpi(img, &xDpi, &yDpi); + HGBase_SetImageDpi(img, xDpi, yDpi); if (1 == m_scanType) { - if (m_cacheDirNotify) + QString fileName = getCacheFileName(img); + + HGImgFmtSaveInfo info; + info.jpegQuality = 100; + info.tiffCompression = HGIMGFMT_TIFFCOMP_LZW; + info.tiffJpegQuality = 0; + HGResult ret = HGImgFmt_SaveImage(img, 0, &info, getStdString(fileName).c_str()); + + if(ret == HGBASE_ERR_OK) { - return; + if (-1 == m_scanInsertPos) + { + m_thumb->addItem(fileName); + } + else + { + m_thumb->insertItem(fileName, m_scanInsertPos); + ++m_scanInsertPos; + } } else { - if (!judgeDiskSpace(Dialog_ClrCache::getCachePath(), false)) - { - m_cacheDirNotify = true; - on_stopScan(); - - QString info = tr("the disk space in the current path is unsufficient, please select a new path or clear the disk space in time."); - m_wndStatusBar->setDeviceStatusInfo(info, true); - m_dialogLog->addLog(info, true); - HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "disk space is unsufficient!"); - QMessageBox::warning(this, tr("warning"), info); - return; - } + m_wndStatusBar->setDeviceStatusInfo(tr("save image failed: ") + getLogInfo(ret), true); } - - m_scanFileName = getCacheFileName(image); - m_saveType = 1; - return; } else if (2 == m_scanType) { - if (m_AquirePathNotify) - { - return; - } - else - { - if (!judgeDiskSpace(m_aquireIntoSaveParam.m_savePath, false)) - { - m_AquirePathNotify = true; - on_stopScan(); - - QString info = tr("the disk space in the current path is unsufficient, please select a new path or clear the disk space in time."); - m_wndStatusBar->setDeviceStatusInfo(info, true); - m_dialogLog->addLog(info, true); - HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "disk space is unsufficient!"); - QMessageBox::warning(this, tr("warning"), info); - return; - } - } - ++m_aquireIntoPageIndex; if ((1 == m_aquireIntoSaveParam.m_fileNameOddEventType && 1 != m_aquireIntoPageIndex % 2) || (2 == m_aquireIntoSaveParam.m_fileNameOddEventType && 0 != m_aquireIntoPageIndex % 2)) @@ -1209,7 +1036,6 @@ void MainWindow::on_pre_new_image(void *img) HGResult ret = HGBase_CreateDir(getStdString(m_aquireIntoSaveParam.m_savePath).c_str()); if (ret != HGBASE_ERR_OK) { - m_dialogLog->addLog(tr("create savepath failed: ") + getLogInfo(ret), true); m_wndStatusBar->setDeviceStatusInfo(tr("create savepath failed: ") + getLogInfo(ret), true); } @@ -1233,7 +1059,6 @@ void MainWindow::on_pre_new_image(void *img) ret = HGImgFmt_OpenImageWriter(getStdString(getStdFileName(scanFileName)).c_str(), 0, &m_scanImgFmtWriter); if(ret != HGBASE_ERR_OK) { - m_dialogLog->addLog(tr("create image doc failed: ") + getLogInfo(ret), true); m_wndStatusBar->setDeviceStatusInfo(tr("create image doc failed: ") + getLogInfo(ret), true); } @@ -1254,7 +1079,7 @@ void MainWindow::on_pre_new_image(void *img) if (m_aquireIntoSaveParam.m_isUseSubfolderByBlankPages) { HGBool isBlank = HGFALSE; - HGImgProc_ImageBlankCheck(image, nullptr, &isBlank); + HGImgProc_ImageBlankCheck(img, nullptr, &isBlank); if (isBlank) { m_aquireIntoInBlank = true; @@ -1278,7 +1103,7 @@ void MainWindow::on_pre_new_image(void *img) { QString colorModeName; HGImageInfo imgInfo; - HGBase_GetImageInfo(image, &imgInfo); + HGBase_GetImageInfo(img, &imgInfo); if (HGBASE_IMGTYPE_BINARY == imgInfo.type) colorModeName = tr("binary"); else if (HGBASE_IMGTYPE_GRAY == imgInfo.type) @@ -1292,7 +1117,6 @@ void MainWindow::on_pre_new_image(void *img) HGResult ret = HGBase_CreateDir(getStdString(savePath).c_str()); if(ret != HGBASE_ERR_OK) { - m_dialogLog->addLog(tr("create savepath failed: ") + getLogInfo(ret), true); m_wndStatusBar->setDeviceStatusInfo(tr("create savepath failed: ") + getLogInfo(ret), true); } @@ -1317,229 +1141,12 @@ void MainWindow::on_pre_new_image(void *img) } } -void MainWindow::on_post_new_image(unsigned int ret, int statu) +void MainWindow::on_finishScan() { - if (1 == m_scanType && 1 == m_saveType) - { - if (ret == HGBASE_ERR_OK) - { - if(statu != SANE_Image_Statu_OK) - { - int ind = 0; - if(m_scanInsertPos == -1) - m_thumb->getItemCount(&ind); - else - ind = m_scanInsertPos; - - dialog_wrong_img *wi = new dialog_wrong_img(this, m_scanFileName, ind, statu); - connect(wi, SIGNAL(handle_wrong_img(dialog_wrong_img*, bool)), this, SLOT(on_wrong_image_decide(dialog_wrong_img*, bool))); - wrong_imgs_.push_back(wi); - wi->show(); - } - else if (-1 == m_scanInsertPos) - { - m_thumb->addItem(m_scanFileName); - } - else - { - m_thumb->insertItem(m_scanFileName, m_scanInsertPos); - ++m_scanInsertPos; - } - } - else - { - m_dialogLog->addLog(tr("save image failed: ") + getLogInfo(ret), true); - m_wndStatusBar->setDeviceStatusInfo(tr("save image failed: ") + getLogInfo(ret), true); - } - } - else if (2 == m_scanType) - { - if (m_aquireIntoSaveParam.m_isSaveAsMultiPage && 2 == m_saveType) - { - if (ret != HGBASE_ERR_OK) - { - m_dialogLog->addLog(tr("save image doc failed: ") + getLogInfo(ret), true); - m_wndStatusBar->setDeviceStatusInfo(tr("save image doc failed: ") + getLogInfo(ret), true); - } - - ++m_aquireIntoMultiPageCount; - } - else if (3 == m_saveType) - { - if (ret == HGBASE_ERR_OK) - { - m_thumb->addItem(m_scanFileName); - ++m_aquireIntoSaveParam.m_fileNameStartIndex; - } - else - { - m_dialogLog->addLog(tr("save image doc failed: ") + getLogInfo(ret), true); - m_wndStatusBar->setDeviceStatusInfo(tr("save image doc failed: ") + getLogInfo(ret), true); - } - } - } - - m_currScanCount++; - if(statu == SANE_Image_Statu_OK) - m_dialogLog->image_received_from_scanner(); -} - -void MainWindow::on_scan_working(QString workingInfo) -{ - m_wndStatusBar->setDeviceStatusInfo(workingInfo, false); - m_dialogLog->addLog(workingInfo, false, LOG_EVENT_SCAN_BEGINNING); - HGBase_WriteInfo(HGBASE_INFOTYPE_DESC, "%s", getStdString(workingInfo).c_str()); -} - -void MainWindow::on_scan_finish(QString finishInfo, int err) -{ - if (0 == m_scanType) - { - if (nullptr != m_scanImgFmtWriter) - { - HGImgFmt_CloseImageWriter(m_scanImgFmtWriter); - m_scanImgFmtWriter = nullptr; - m_thumb->addItem(m_scanFileName); - m_scanFileName.clear(); - ++m_aquireIntoSaveParam.m_fileNameStartIndex; - } - } - - if(err == SCANNER_ERR_DEVICE_PAPER_JAMMED) - { - m_versionDll->PostDevicePaperJamInfo(m_currDeviceName.toStdString().c_str(), - m_devSerialNum.toStdString().c_str(), "", m_devVersionNum.toStdString().c_str()); - } - - m_versionDll->PostDeviceScanCountInfo(m_currDeviceName.toStdString().c_str(), m_devSerialNum.toStdString().c_str(), "", m_devVersionNum.toStdString().c_str(), m_currScanCount); - m_currScanCount = 0; m_isScanning = false; - m_thumb->setAcceptDrops(true); - m_dialogLog->updateStatus(dev_que_.is_online() && 0 != m_scanType, m_isScanning); updateActionStatus(); - m_wndStatusBar->setDeviceStatusInfo(finishInfo, (err != SANE_STATUS_GOOD)); - m_dialogLog->addLog(finishInfo, (err != SANE_STATUS_GOOD), LOG_EVENT_SCAN_STOPPED); - HGBase_WriteInfo((err != SANE_STATUS_GOOD) ? HGBASE_INFOTYPE_ERROR : HGBASE_INFOTYPE_DESC, - "%s", getStdString(finishInfo).c_str()); - - m_cacheDirNotify = false; - m_AquirePathNotify = false; } -void MainWindow::on_export_scanned_image(void) -{ - m_dialogLog->hide(); - on_act_Export_triggered(); -} - -void MainWindow::on_continueScan() -{ - if (1 == m_scanType) - { - if(!isLimitAccessFolder(1)) - { - return; - } - } - else if (2 == m_scanType) - { - if(!isLimitAccessFolder(2)) - { - return; - } - } - - if (!dev_que_.is_online() || m_isScanning || 0 == m_scanType) - { - return; - } - - startSaveMessageBox(m_dialogLog); - - SANE_Status ret; - - m_dpi = getDpi(); - if (m_singleScan) - ret = sane_io_control(dev_que_.handle(), IO_CTRL_CODE_TEST_SINGLE, nullptr, nullptr); - else - ret = sane_start(dev_que_.handle()); - if (ret != SANE_STATUS_GOOD) - { - m_wndStatusBar->setDeviceStatusInfo(tr("start failed"), true); - m_dialogLog->addLog(tr("start failed") + "(" + QString(sane_err_desc(ret)) + ")", true); - HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "%s", getStdString(tr("start failed")).c_str()); - - if(ret == SCANNER_ERR_DEVICE_SLEEPING) - { - ui->menu_scan->setEnabled(false); - ui->act_acquire->setEnabled(false); - ui->act_scannerSettings->setEnabled(false); - m_dialogLog->updateStatus(false, false); - m_dialogLog->show(); - - if (m_devVersionNum < "G4393B1001" - && ("439" == m_devPid || "9220" == m_devPid || "8529" == m_devPid)) - { - m_dialogLog->addLog(tr("Please wake up the device manually"), true); - m_wndStatusBar->setDeviceStatusInfo(tr("Please wake up the device manually"), true); - } - else - { - QTime curTimer = QTime::currentTime().addMSecs(10000); - while (QTime::currentTime() < curTimer) - { - QCoreApplication::processEvents(QEventLoop::AllEvents, 100); - } - - m_dialogLog->addLog(tr("already waked up device"), false); - m_wndStatusBar->setDeviceStatusInfo(tr("already waked up device"), false); - } - - ui->menu_scan->setEnabled(true); - ui->act_acquire->setEnabled(true); - ui->act_scannerSettings->setEnabled(true); - m_dialogLog->updateStatus(true, false); - } - } - else - { - m_isScanning = true; - m_thumb->setAcceptDrops(false); - m_dialogLog->updateStatus(dev_que_.is_online() && 0 != m_scanType, m_isScanning); - updateActionStatus(); - } - - m_dialogLog->show(); -} - -void MainWindow::on_stopScan() -{ - m_dialogLog->updateStatus(dev_que_.is_online(), m_isScanning); - - if (!m_isScanning) - { - if (nullptr != m_scanImgFmtWriter) - { - HGImgFmt_CloseImageWriter(m_scanImgFmtWriter); - m_scanImgFmtWriter = nullptr; - m_thumb->addItem(m_scanFileName); - m_scanFileName.clear(); - ++m_aquireIntoSaveParam.m_fileNameStartIndex; - } - } - else - { - if (dev_que_.is_online()) - { - sane_cancel(dev_que_.handle()); - } - } -} - -void MainWindow::on_statusInfoDblClick() -{ - m_dialogLog->show(); -} void MainWindow::on_wrong_image_decide(dialog_wrong_img* dlg, bool save) { int i = 0; @@ -1564,7 +1171,6 @@ void MainWindow::on_wrong_image_decide(dialog_wrong_img* dlg, bool save) { ++m_scanInsertPos; } - m_dialogLog->image_received_from_scanner(); } else { remove(dlg->image_file().toStdString().c_str()); @@ -1694,31 +1300,6 @@ void MainWindow::on_act_last_triggered() } } -HGUInt MainWindow::getDpi() -{ - HGUInt dpi = 200; - SANE_Int num_dev_options = 0; - sane_control_option(dev_que_.handle(), 0, SANE_ACTION_GET_VALUE, &num_dev_options, nullptr); - for (int i = 1; i < num_dev_options; ++i) - { - const SANE_Option_Descriptor* desp = sane_get_option_descriptor(dev_que_.handle(), i); - if (nullptr == desp) - continue; - - if (SANE_TYPE_INT == desp->type) - { - SANE_Int value = 0; - sane_control_option(dev_que_.handle(), i, SANE_ACTION_GET_VALUE, &value, nullptr); - if (0 == strcmp(desp->name, SANE_STD_OPT_NAME_RESOLUTION)) - { - dpi = (HGUInt)value; - } - } - } - - return dpi; -} - QString MainWindow::getCacheFileName(HGImage img) { assert(nullptr != img); @@ -1828,42 +1409,42 @@ void MainWindow::updateActionStatus() selectIndexs.push_back(i); } - ui->act_open->setEnabled(!dev_que_.is_online() || !m_isScanning); - ui->act_insert->setEnabled(!dev_que_.is_online() || !m_isScanning); + ui->act_open->setEnabled(!m_isScanning); + ui->act_insert->setEnabled(!m_isScanning); ui->act_save->setEnabled(nullptr != img && -1 != m_currIndex && m_multiPageCount == 1 - && (!dev_que_.is_online() || !m_isScanning)); + && (!m_isScanning)); ui->act_saveAs->setEnabled(nullptr != img); - ui->act_Export->setEnabled(0 != count && (!dev_que_.is_online() || !m_isScanning)); - ui->act_deleteFile->setEnabled(!selectIndexs.empty() && (!dev_que_.is_online() || !m_isScanning)); - ui->act_closeFile->setEnabled(!selectIndexs.empty() && (!dev_que_.is_online() || !m_isScanning)); - ui->act_closeAll->setEnabled(0 != count && (!dev_que_.is_online() || !m_isScanning)); - ui->act_imageInfo->setEnabled(-1 != m_currIndex && (!dev_que_.is_online() || !m_isScanning)); - ui->menu_multiPages->setEnabled(m_multiPageCount > 1 && (!dev_que_.is_online() || !m_isScanning)); + ui->act_Export->setEnabled(0 != count && (!m_isScanning)); + ui->act_deleteFile->setEnabled(!selectIndexs.empty() && (!m_isScanning)); + ui->act_closeFile->setEnabled(!selectIndexs.empty() && (!m_isScanning)); + ui->act_closeAll->setEnabled(0 != count && (!m_isScanning)); + ui->act_imageInfo->setEnabled(-1 != m_currIndex && (!m_isScanning)); + ui->menu_multiPages->setEnabled(m_multiPageCount > 1 && (!m_isScanning)); ui->act_previous->setEnabled(count > 0 && (-1 == m_currIndex || m_currIndex > 0) - && (!dev_que_.is_online() || !m_isScanning)); + && (!m_isScanning)); ui->act_next->setEnabled(count > 0 && (-1 == m_currIndex || m_currIndex < count - 1) - && (!dev_que_.is_online() || !m_isScanning)); - ui->act_first->setEnabled(count > 0 && 0 != m_currIndex && (!dev_que_.is_online() || !m_isScanning)); - ui->act_last->setEnabled(count > 0 && count - 1 != m_currIndex && (!dev_que_.is_online() || !m_isScanning)); - ui->act_openPageNum->setEnabled(count > 0 && (!dev_que_.is_online() || !m_isScanning)); + && (!m_isScanning)); + ui->act_first->setEnabled(count > 0 && 0 != m_currIndex && (!m_isScanning)); + ui->act_last->setEnabled(count > 0 && count - 1 != m_currIndex && (!m_isScanning)); + ui->act_openPageNum->setEnabled(count > 0 && (!m_isScanning)); ui->act_previousPage->setEnabled(-1 != m_currIndex && m_multiPageCount > 0 && m_multiIndex > 0 - && (!dev_que_.is_online() || !m_isScanning)); + && (!m_isScanning)); ui->act_nextPage->setEnabled(-1 != m_currIndex && m_multiPageCount > 0 && -1 != m_multiIndex && m_multiIndex < m_multiPageCount - 1 - && (!dev_que_.is_online() || !m_isScanning)); + && (!m_isScanning)); ui->act_firstPage->setEnabled(-1 != m_currIndex && m_multiPageCount > 0 && 0 != m_multiIndex - && (!dev_que_.is_online() || !m_isScanning)); + && (!m_isScanning)); ui->act_lastPage->setEnabled(-1 != m_currIndex && m_multiPageCount > 0 && m_multiIndex != m_multiPageCount - 1 - && (!dev_que_.is_online() || !m_isScanning)); + && (!m_isScanning)); m_multiPageLineEdit->setText(QString("%1/%2").arg(m_multiIndex + 1).arg(m_multiPageCount)); ui->toolBar->actions().at(18)->setVisible(-1 != m_currIndex && m_multiPageCount > 1 && -1 != m_multiIndex - && (!dev_que_.is_online() || !m_isScanning)); - ui->act_sortPages->setEnabled(0 != count && (!dev_que_.is_online() || !m_isScanning)); + && (!m_isScanning)); + ui->act_sortPages->setEnabled(0 != count && (!m_isScanning)); ui->act_imageEdit->setEnabled(nullptr != img); ui->act_zoomIn->setEnabled(nullptr != img); ui->act_zoomOut->setEnabled(nullptr != img); ui->act_fullscreen->setEnabled(count > 0 && -1 != m_currIndex && -1 != m_multiIndex - && (!dev_que_.is_online() || !m_isScanning)); + && (!m_isScanning)); ui->act_fitWindowSize->setEnabled(nullptr != img); ui->act_fitWindowWidth->setEnabled(nullptr != img); ui->act_realSize->setEnabled(nullptr != img); @@ -1871,8 +1452,8 @@ void MainWindow::updateActionStatus() ui->act_90Right->setEnabled(nullptr != img); ui->act_180->setEnabled(nullptr != img); ui->menu_Auto_Image_Size->setEnabled(nullptr != img); - ui->act_multiRotate->setEnabled(0 != count && (!dev_que_.is_online() || !m_isScanning)); - ui->menu_Rotate->setEnabled((0 != count || nullptr != img) && (!dev_que_.is_online() || !m_isScanning)); + ui->act_multiRotate->setEnabled(0 != count && (!m_isScanning)); + ui->menu_Rotate->setEnabled((0 != count || nullptr != img) && (!m_isScanning)); ui->act_autoCrop->setEnabled(nullptr != img); ui->act_signIn->setEnabled(!m_admin_loggedIn); @@ -1883,20 +1464,19 @@ void MainWindow::updateActionStatus() ui->act_consume->setEnabled(m_admin_loggedIn); ui->act_clearRoller->setEnabled(m_admin_loggedIn); - ui->act_acquireInto->setEnabled(dev_que_.is_online() && !m_isScanning); - m_act_acquireInto2->setEnabled(dev_que_.is_online() && !m_isScanning); - ui->act_acquireSingle->setEnabled(dev_que_.is_online() && !m_isScanning); - ui->act_acquire->setEnabled(dev_que_.is_online() && !m_isScanning); - ui->act_scannerSettings->setEnabled(dev_que_.is_online() && !m_isScanning); - ui->act_insertFromScanner->setEnabled(dev_que_.is_online() && !m_isScanning); - ui->menu_scan->setEnabled(dev_que_.is_online() && !m_isScanning); - ui->menu_device->setEnabled(!dev_que_.is_online() || !m_isScanning); - ui->act_device_log->setEnabled(m_admin_loggedIn && !m_isScanning && dev_que_.is_online()); + ui->act_acquireInto->setEnabled(!m_isScanning); + m_act_acquireInto2->setEnabled(!m_isScanning); + ui->act_acquireSingle->setEnabled(!m_isScanning); + ui->act_acquire->setEnabled(!m_isScanning); + ui->act_scannerSettings->setEnabled(!m_isScanning); + ui->act_insertFromScanner->setEnabled(!m_isScanning); + ui->menu_scan->setEnabled(!m_isScanning); + ui->act_device_log->setEnabled(m_admin_loggedIn && !m_isScanning); ui->act_driver_log->setEnabled(m_admin_loggedIn); - if(m_dialogLog != nullptr) - m_dialogLog->pbtn_export->setEnabled(ui->act_Export->isEnabled()); +// if(m_dialogLog != nullptr) +// m_dialogLog->pbtn_export->setEnabled(ui->act_Export->isEnabled()); - m_moveToAction->setEnabled(!selectIndexs.empty() && (!dev_que_.is_online() || !m_isScanning)); + m_moveToAction->setEnabled(!selectIndexs.empty() && (!m_isScanning)); #if !defined(OEM_HANWANG) && !defined(OEM_LISICHENG) && !defined(OEM_CANGTIAN) && !defined(OEM_ZHONGJING) && !defined(OEM_ZIGUANG) if (m_pbtn_push != nullptr && m_widget_sideBar!= nullptr) @@ -1904,7 +1484,7 @@ void MainWindow::updateActionStatus() m_pbtn_push->setVisible(nullptr != img); m_widget_sideBar->setVisible(nullptr != img); } - m_cbtn_acquireIntoCfg->setEnabled(dev_que_.is_online() && !m_isScanning); + m_cbtn_acquireIntoCfg->setEnabled(!m_isScanning); #endif ui->act_adjust->setEnabled(!m_bSideEditing && nullptr != img); @@ -2279,7 +1859,7 @@ void MainWindow::on_act_save_triggered() bool find = false; int count = 0; - if(!auto_save_changes_ || auto_save_info_.path.isEmpty() || !judgeDiskSpace(savePath)) + if(!auto_save_changes_ || auto_save_info_.path.isEmpty()) { Dialog_SaveAs dlg(this); if(savePath.length()) @@ -2299,12 +1879,6 @@ void MainWindow::on_act_save_triggered() else savePath = m_currFilePath; - if (!judgeDiskSpace(savePath)) - { - m_dialogLog->updateStatus(dev_que_.is_online() && 0 != m_scanType, m_isScanning); - return; - } - if (!auto_save_changes_) { savePath = auto_save_info_.path = dlg.getSavePath(); @@ -2393,7 +1967,6 @@ void MainWindow::on_act_save_triggered() else { QMessageBox::critical(this, tr("tips"), tr("save image doc failed: ") + getLogInfo(ret)); - m_dialogLog->addLog(tr("save image doc failed: ") + getLogInfo(ret), true); m_wndStatusBar->setDeviceStatusInfo(tr("save image doc failed: ") + getLogInfo(ret), true); } } @@ -2458,7 +2031,6 @@ void MainWindow::on_act_save_triggered() else { QMessageBox::critical(this, tr("tips"), tr("save image doc failed: ") + getLogInfo(ret)); - m_dialogLog->addLog(tr("save image doc failed: ") + getLogInfo(ret), true); m_wndStatusBar->setDeviceStatusInfo(tr("save image doc failed: ") + getLogInfo(ret), true); } } @@ -2477,12 +2049,6 @@ void MainWindow::on_act_saveAs_triggered() { QString savePath = dlg.getSavePath(); - if(!judgeDiskSpace(savePath)) - { - m_dialogLog->updateStatus(dev_que_.is_online() && 0 != m_scanType, m_isScanning); - return; - } - bool find = false; int count = 0; m_thumb->getItemCount(&count); @@ -2541,7 +2107,6 @@ void MainWindow::on_act_saveAs_triggered() else { QMessageBox::critical(this, tr("tips"), tr("save image doc failed: ") + getLogInfo(ret)); - m_dialogLog->addLog(tr("save image doc failed: ") + getLogInfo(ret), true); m_wndStatusBar->setDeviceStatusInfo(tr("save image doc failed: ") + getLogInfo(ret), true); } } @@ -2587,12 +2152,6 @@ void MainWindow::on_act_Export_triggered() QString fileName; m_thumb->getItemFileName(saveIndexs[i], fileName); srcFiles.append(fileName); - - if(!judgeDiskSpace(fileName)) - { - m_dialogLog->updateStatus(dev_que_.is_online() && 0 != m_scanType, m_isScanning); - return; - } } if (!srcFiles.isEmpty()) @@ -2803,149 +2362,6 @@ void MainWindow::resizeEvent(QResizeEvent *e) } } -int MainWindow::sane_ex_callback(SANE_Handle hdev, int code, void *data, unsigned int* len, void *param) -{ - (void)hdev; - (void)len; - MainWindow *p = (MainWindow *)param; - switch (code) - { - case SANE_EVENT_DEVICE_ARRIVED: - { - SANE_Device_Ex* sane_dev = (SANE_Device_Ex*)data; - emit p->sane_dev_arrive(sane_dev->name, sane_dev->openned == SANE_TRUE); - } - break; - case SANE_EVENT_DEVICE_LEFT: - { - SANE_Device* sane_dev = (SANE_Device*)data; - emit p->sane_dev_remove(sane_dev->name); - } - break; - case SANE_EVENT_STATUS: - { - QString promptInfo((char*)data); - emit p->sane_dev_readyStatus(promptInfo); - } - break; - case SANE_EVENT_ERROR: - { - QString errorInfo((char*)data); - emit p->sane_dev_error(errorInfo); - } - break; - case SANE_EVENT_WORKING: - { - QString workingInfo((char*)data); - emit p->scan_working(workingInfo); - } - break; - case SANE_EVENT_IMAGE_OK: - { - SANE_Image *sane_img = (SANE_Image *)data; - - HGUInt imgType = 0; - if (sane_img->header.format == SANE_FRAME_GRAY) - { - if (1 == sane_img->header.depth) - imgType = HGBASE_IMGTYPE_BINARY; - else if (8 == sane_img->header.depth) - imgType = HGBASE_IMGTYPE_GRAY; - } - else if (sane_img->header.format == SANE_FRAME_RGB) - { - imgType = HGBASE_IMGTYPE_RGB; - } - - HGByte *imgData = sane_img->data; - HGImageInfo imgInfo = {(HGUInt)sane_img->header.pixels_per_line, (HGUInt)sane_img->header.lines, - imgType, (HGUInt)sane_img->header.bytes_per_line, HGBASE_IMGORIGIN_TOP}; - - HGImage img = nullptr; - HGBase_CreateImageWithData(imgData, &imgInfo, &img); - if (nullptr != img) - { - emit p->pre_new_image(img); - - HGResult ret = HGBASE_ERR_FAIL; - if (1 == p->m_saveType) - { - HGImgFmtSaveInfo info; - info.jpegQuality = 100; - info.tiffCompression = HGIMGFMT_TIFFCOMP_LZW; - info.tiffJpegQuality = 0; - ret = HGImgFmt_SaveImage(img, 0, &info, getStdString(p->m_scanFileName).c_str()); - } - else if (2 == p->m_saveType) - { - HGImgFmtSaveInfo saveInfo; - saveInfo.jpegQuality = (HGUInt)p->m_aquireIntoSaveParam.m_jpegQuality; - saveInfo.tiffCompression = HGIMGFMT_TIFFCOMP_NONE; - saveInfo.tiffJpegQuality = (HGUInt)p->m_aquireIntoSaveParam.m_tiffQuality; - - HGImageInfo imgInfo; - HGBase_GetImageInfo(img, &imgInfo); - if (HGBASE_IMGTYPE_BINARY == imgInfo.type) - { - if (1 == p->m_aquireIntoSaveParam.m_tiffCompressionBW) - saveInfo.tiffCompression = HGIMGFMT_TIFFCOMP_LZW; - else if (2 == p->m_aquireIntoSaveParam.m_tiffCompressionBW) - saveInfo.tiffCompression = HGIMGFMT_TIFFCOMP_CCITTFAX4; - } - else - { - if (1 == p->m_aquireIntoSaveParam.m_tiffCompression) - saveInfo.tiffCompression = HGIMGFMT_TIFFCOMP_LZW; - else if (2 == p->m_aquireIntoSaveParam.m_tiffCompression) - saveInfo.tiffCompression = HGIMGFMT_TIFFCOMP_JPEG; - } - - ret = HGImgFmt_SaveImageToWriter(p->m_scanImgFmtWriter, img, &saveInfo); - } - else if (3 == p->m_saveType) - { - HGImgFmtSaveInfo saveInfo; - saveInfo.jpegQuality = (HGUInt)p->m_aquireIntoSaveParam.m_jpegQuality; - saveInfo.tiffCompression = HGIMGFMT_TIFFCOMP_NONE; - saveInfo.tiffJpegQuality = (HGUInt)p->m_aquireIntoSaveParam.m_tiffQuality; - - HGImageInfo imgInfo; - HGBase_GetImageInfo(img, &imgInfo); - if (HGBASE_IMGTYPE_BINARY == imgInfo.type) - { - if (1 == p->m_aquireIntoSaveParam.m_tiffCompressionBW) - saveInfo.tiffCompression = HGIMGFMT_TIFFCOMP_LZW; - else if (2 == p->m_aquireIntoSaveParam.m_tiffCompressionBW) - saveInfo.tiffCompression = HGIMGFMT_TIFFCOMP_CCITTFAX4; - } - else - { - if (1 == p->m_aquireIntoSaveParam.m_tiffCompression) - saveInfo.tiffCompression = HGIMGFMT_TIFFCOMP_LZW; - else if (2 == p->m_aquireIntoSaveParam.m_tiffCompression) - saveInfo.tiffCompression = HGIMGFMT_TIFFCOMP_JPEG; - } - - ret = saveImage(img, &saveInfo, p->m_aquireIntoSaveParam.m_isOcr, 0, getStdString(p->m_scanFileName).c_str()); - } - - emit p->post_new_image(ret, sane_img->flag.statu); - HGBase_DestroyImage(img); - } - } - break; - case SANE_EVENT_SCAN_FINISHED: - { - int err = len ? (int)(*len) : 0; - QString finishInfo((char*)data); - emit p->scan_finish(finishInfo, err); - } - break; - } - - return 0; -} - void HGAPI MainWindow::CrashFunc(HGPointer crashAddr, HGPointer param) { MainWindow *p = (MainWindow *)param; @@ -3232,23 +2648,23 @@ void MainWindow::on_act_clearRoller_triggered() return; } - QMessageBox msg(QMessageBox::Question, tr("confirm operation"), - tr("are you sure to clear the roller count?"), - QMessageBox::Yes | QMessageBox::No, this); - msg.exec(); - if(msg.clickedButton() != msg.button(QMessageBox::Yes)) - return; +// QMessageBox msg(QMessageBox::Question, tr("confirm operation"), +// tr("are you sure to clear the roller count?"), +// QMessageBox::Yes | QMessageBox::No, this); +// msg.exec(); +// if(msg.clickedButton() != msg.button(QMessageBox::Yes)) +// return; - unsigned int count = 0; - int ret = sane_io_control(dev_que_.handle(), IO_CTRL_CODE_SET_CLEAR_ROLLER_COUNT, nullptr, &count); +// unsigned int count = 0; +// int ret = sane_io_control(dev_que_.handle(), IO_CTRL_CODE_SET_CLEAR_ROLLER_COUNT, nullptr, &count); - if(ret == SANE_STATUS_GOOD) - { - QMessageBox::information(this, tr("hint"), tr("Roller scanned count has been set to 0.")); - m_versionDll->PostDeviceClearRollerInfo(m_currDeviceName.toStdString().c_str(), m_devSerialNum.toStdString().c_str(), "", m_devVersionNum.toStdString().c_str()); - } - else - QMessageBox::information(this, tr("hint"), tr("Roller scanned count reset failed.")); +// if(ret == SANE_STATUS_GOOD) +// { +// QMessageBox::information(this, tr("hint"), tr("Roller scanned count has been set to 0.")); +// m_versionDll->PostDeviceClearRollerInfo(m_currDeviceName.toStdString().c_str(), m_devSerialNum.toStdString().c_str(), "", m_devVersionNum.toStdString().c_str()); +// } +// else +// QMessageBox::information(this, tr("hint"), tr("Roller scanned count reset failed.")); } void MainWindow::on_act_help_triggered() @@ -3328,147 +2744,40 @@ void MainWindow::on_act_help_triggered() QDesktopServices::openUrl(QUrl::fromLocalFile(filename)); } -void MainWindow::my_url_handler(const QUrl& url) -{ - std::string to(url.url().toStdString()); - - if(to.find("://clear-roller") != std::string::npos) - { - QMessageBox msg(QMessageBox::Question, tr("confirm the operation"), - tr("Are you sure to clear the rollor acount?"), - QMessageBox::Yes | QMessageBox::No, this); - msg.exec(); - if(msg.clickedButton() == msg.button(QMessageBox::Yes)) - { - unsigned int count = 0; - int ret = sane_io_control(dev_que_.handle(), IO_CTRL_CODE_SET_CLEAR_ROLLER_COUNT, nullptr, &count); - - QString info; - if(ret == SANE_STATUS_GOOD) - { - info = tr("Roller scanned count has been set to 0."); - - // +鐠囩兘鍣搁弬鎷岀箻閸忋儱鍙ф禍搴f櫕闂堫澀浜掗懢宄板絿閺堚偓閺傛澘鈧? info += tr("Please re-enter the Abount screen to obtain the latest value"); - } - else - info = tr("Roller scanned count reset failed."); - - QMessageBox::information(this, tr("hint"), info); - } - } -} void MainWindow::on_act_about_triggered() { - SANE_About *about = nullptr; - unsigned int len = 0; - QString title; - QString content; - std::list info; - QDesktopServices::setUrlHandler(MY_URL_SCHEME, this, "my_url_handler"); - if (sane_io_control(dev_que_.handle(), IO_CTRL_CODE_ABOUT_INFO, about, &len) == SANE_STATUS_NO_MEM) - { - about = (SANE_About*)malloc(len + 128); - if (about) - { - memset(about, 0, len + 128); - if (sane_io_control(dev_que_.handle(), IO_CTRL_CODE_ABOUT_INFO, about, &len) == SANE_STATUS_GOOD) - { -#if defined(OEM_ZHONGJING) - title = tr("about %1").arg(QString::fromStdString(about->title)); - info.push_back(tr("

Version: %1

").arg(QString::fromStdString(about->version))); - for (int i = 0; about->appendix[i].key; ++i) - { - if(about->appendix[i].url) - info.push_back(tr("

%1: %3").arg(about->appendix[i].key).arg(about->appendix[i].url).arg(about->appendix[i].content) + "

"); - else - info.push_back(tr("

%1: %2").arg(about->appendix[i].key).arg(about->appendix[i].content) + "

"); - } - info.push_back(tr("

CopyRight: © %1

").arg(QString::fromStdString(about->copyright))); - - const char* cmp[] = { - BRAND_TITLE_DEVICE_MODEL, - about->version, - BRAND_TITLE_FIRM_VERSION, - BRAND_TITLE_SERIAL_NUM, - BRAND_TITLE_ROLLER_COUNT, - BRAND_TITLE_HISTORY_COUNT, - BRAND_TITLE_IP, - BRAND_TITE_MANUFACTOR, - BRAND_COMPANY_ADDRESS, - BRAND_TITLE_TEL, - BRAND_TITLE_URL, - BRAND_TITLE_GPS, - about->copyright - }; - for (int i = 0; i < sizeof(cmp) / sizeof(const char *); ++i) - { - std::list::iterator iter = info.begin(); - while (iter != info.end()) - { - if (iter->contains(from_default_language(cmp[i], nullptr))) - { - content += *iter; - info.erase(iter); - break; - } - else - { - ++iter; - } - } - } - - std::list::iterator iter = info.begin(); - while (iter != info.end()) - { - content += *iter; - ++iter; - } -#else -#ifdef OEM_NEUTRAL - title = tr("about"); - content = tr("

Version: %1

").arg(QString::fromStdString(about->version)); -#else - title = tr("about %1").arg(QString::fromStdString(about->title)); - content = tr("

Version: %1

").arg(QString::fromStdString(about->version)); - content += tr("

CopyRight: © %1

").arg(QString::fromStdString(about->copyright)); - for (int i = 0; about->appendix[i].key; ++i) - { - if(about->appendix[i].url) - content += tr("

%1: %3").arg(about->appendix[i].key).arg(about->appendix[i].url).arg(about->appendix[i].content); - else - content += tr("

%1: %2").arg(about->appendix[i].key).arg(about->appendix[i].content); - if(m_admin_loggedIn - && strcmp(about->appendix[i].key, tr("roller number").toLatin1().data()) == 0 - && atoi(about->appendix[i].content) > 0) - { - char url[128] = {0}; - sprintf(url, "        \346\270\205\351\231\244", MY_URL_SCHEME); - content += QString::fromStdString(url); - } - content += "

"; - } -#endif -#endif - } - free(about); - } - } - - QMessageBox::about(this, title, content); - QDesktopServices::unsetUrlHandler(MY_URL_SCHEME); -} - -void MainWindow::on_act_scannerSettings_triggered() -{ - if (!dev_que_.is_online() || m_isScanning) + if (m_devUser == nullptr) { return; } - hg_settingdialog dlg(dev_que_.handle(), this, &dev_que_); - dlg.exec(); - ui->menu_device->deviceMenuUpdate(&dev_que_); +#if defined(HG_CMP_MSC) + HGTwainDeviceCustomInfo info; + m_devUser->GetDeviceCustomInfo(&info); +#else + HGSaneCustomInfo info; + m_devUser->GetDeviceCustomInfo(&info); +#endif + + QString title = tr("about %1").arg(windowTitle()); + QString content; + QString wrap("\n\n"); + content = tr("model: %1").arg(QString(info.model)) + wrap; + content += tr("type: %1").arg(QString(info.type)) + wrap; + content += tr("fwVer: %1").arg(QString(info.fwVer)) + wrap; + content += tr("sn: %1").arg(QString(info.sn)) + wrap; + content += tr("ip: %1").arg(QString(info.ip)) + wrap; + content += tr("mac: %1").arg(QString(info.mac)) + wrap; + content += tr("rollerCount: %1").arg(QString::number(info.rollerCount)) + wrap; + content += tr("totalCount: %1").arg(QString::number(info.totalCount)); + + QMessageBox::about(this, title, content); +} + +void MainWindow::on_act_scannerSettings_triggered() +{ + if (nullptr != m_devUser) + m_devUser->ShowSettingDlg(); } void MainWindow::on_act_acquire_triggered() @@ -3478,7 +2787,12 @@ void MainWindow::on_act_acquire_triggered() return; } - if (!dev_que_.is_online() || m_isScanning) + if (!judgeDiskSpace(Dialog_ClrCache::getCachePath())) + { + return; + } + + if (m_isScanning) { return; } @@ -3498,56 +2812,23 @@ void MainWindow::on_act_acquire_triggered() startSaveMessageBox(this); - m_dpi = getDpi(); - SANE_Status ret = sane_start(dev_que_.handle()); - if (ret != SANE_STATUS_GOOD) + HGResult ret = HGBASE_ERR_FAIL; + if (nullptr != m_devUser) + { + ret = m_devUser->StartScan(); + } + + if (ret != HGBASE_ERR_OK) { - m_dialogLog->updateStatus(dev_que_.is_online() && 0 != m_scanType, m_isScanning); m_wndStatusBar->setDeviceStatusInfo(tr("start failed"), true); - m_dialogLog->addLog(tr("start failed") + "(" + QString(sane_err_desc(ret)) + ")", true); HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "%s", getStdString(tr("start failed")).c_str()); - - if(ret == SCANNER_ERR_DEVICE_SLEEPING) - { - ui->menu_scan->setEnabled(false); - ui->act_acquire->setEnabled(false); - ui->act_scannerSettings->setEnabled(false); - m_dialogLog->updateStatus(false, false); - m_dialogLog->show(); - - if (m_devVersionNum < "G4393B1001" - && ("439" == m_devPid || "9220" == m_devPid || "8529" == m_devPid || "7039" == m_devPid))//Previous versions of this firmware number and 439 device can only be manually awakened. - { - m_dialogLog->addLog(tr("Please wake up the device manually"), true); - m_wndStatusBar->setDeviceStatusInfo(tr("Please wake up the device manually"), true); - } - else - { - QTime curTimer = QTime::currentTime().addMSecs(10000); - while (QTime::currentTime() < curTimer) - { - QCoreApplication::processEvents(QEventLoop::AllEvents, 100); - } - - m_dialogLog->addLog(tr("already waked up device"), false); - m_wndStatusBar->setDeviceStatusInfo(tr("already waked up device"), false); - } - - ui->menu_scan->setEnabled(true); - ui->act_acquire->setEnabled(true); - ui->act_scannerSettings->setEnabled(true); - m_dialogLog->updateStatus(true, false); - } } else { m_isScanning = true; m_thumb->setAcceptDrops(false); - m_dialogLog->updateStatus(dev_que_.is_online() && 0 != m_scanType, m_isScanning); updateActionStatus(); } - - m_dialogLog->show(); } void MainWindow::on_act_acquireSingle_triggered() @@ -3557,7 +2838,7 @@ void MainWindow::on_act_acquireSingle_triggered() return; } - if (!dev_que_.is_online() || m_isScanning) + if (m_isScanning) { return; } @@ -3577,61 +2858,28 @@ void MainWindow::on_act_acquireSingle_triggered() startSaveMessageBox(this); - m_dpi = getDpi(); - SANE_Status ret = sane_io_control(dev_que_.handle(), IO_CTRL_CODE_TEST_SINGLE, nullptr, nullptr); - if (ret != SANE_STATUS_GOOD) + HGResult ret = HGBASE_ERR_FAIL; + if (nullptr != m_devUser) + { + ret = m_devUser->StartScan(); + } + + if (ret != HGBASE_ERR_OK) { - m_dialogLog->updateStatus(dev_que_.is_online() && 0 != m_scanType, m_isScanning); m_wndStatusBar->setDeviceStatusInfo(tr("start failed"), true); - m_dialogLog->addLog(tr("start failed") + "(" + QString(sane_err_desc(ret)) + ")", true); HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "%s", getStdString(tr("start failed")).c_str()); - - if(ret == SCANNER_ERR_DEVICE_SLEEPING) - { - ui->menu_scan->setEnabled(false); - ui->act_acquire->setEnabled(false); - ui->act_scannerSettings->setEnabled(false); - m_dialogLog->updateStatus(false, false); - m_dialogLog->show(); - - if (m_devVersionNum < "G4393B1001" - && ("439" == m_devPid || "9220" == m_devPid || "8529" == m_devPid)) - { - m_dialogLog->addLog(tr("Please wake up the device manually"), true); - m_wndStatusBar->setDeviceStatusInfo(tr("Please wake up the device manually"), true); - } - else - { - QTime curTimer = QTime::currentTime().addMSecs(10000); - while (QTime::currentTime() < curTimer) - { - QCoreApplication::processEvents(QEventLoop::AllEvents, 100); - } - - m_dialogLog->addLog(tr("already waked up device"), false); - m_wndStatusBar->setDeviceStatusInfo(tr("already waked up device"), false); - } - - ui->menu_scan->setEnabled(true); - ui->act_acquire->setEnabled(true); - ui->act_scannerSettings->setEnabled(true); - m_dialogLog->updateStatus(true, false); - } } else { m_isScanning = true; m_thumb->setAcceptDrops(false); - m_dialogLog->updateStatus(dev_que_.is_online() && 0 != m_scanType, m_isScanning); updateActionStatus(); } - - m_dialogLog->show(); } void MainWindow::on_act_acquireInto_triggered() { - if (!dev_que_.is_online() || m_isScanning) + if (m_isScanning) { return; } @@ -3675,56 +2923,23 @@ void MainWindow::on_act_acquireInto_triggered() startSaveMessageBox(this); - m_dpi = getDpi(); - SANE_Status ret = sane_start(dev_que_.handle()); - if (ret != SANE_STATUS_GOOD) + HGResult ret = HGBASE_ERR_FAIL; + if (nullptr != m_devUser) + { + ret = m_devUser->StartScan(); + } + + if (ret != HGBASE_ERR_OK) { - m_dialogLog->updateStatus(dev_que_.is_online() && 0 != m_scanType, m_isScanning); m_wndStatusBar->setDeviceStatusInfo(tr("start failed"), true); - m_dialogLog->addLog(tr("start failed") + "(" + QString(sane_err_desc(ret)) + ")", true); HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "%s", getStdString(tr("start failed")).c_str()); - - if(ret == SCANNER_ERR_DEVICE_SLEEPING) - { - ui->menu_scan->setEnabled(false); - ui->act_acquire->setEnabled(false); - ui->act_scannerSettings->setEnabled(false); - m_dialogLog->updateStatus(false, false); - m_dialogLog->show(); - - if (m_devVersionNum < "G4393B1001" - && ("439" == m_devPid || "9220" == m_devPid || "8529" == m_devPid)) - { - m_dialogLog->addLog(tr("Please wake up the device manually"), true); - m_wndStatusBar->setDeviceStatusInfo(tr("Please wake up the device manually"), true); - } - else - { - QTime curTimer = QTime::currentTime().addMSecs(10000); - while (QTime::currentTime() < curTimer) - { - QCoreApplication::processEvents(QEventLoop::AllEvents, 100); - } - - m_dialogLog->addLog(tr("already waked up device"), false); - m_wndStatusBar->setDeviceStatusInfo(tr("already waked up device"), false); - } - - ui->menu_scan->setEnabled(true); - ui->act_acquire->setEnabled(true); - ui->act_scannerSettings->setEnabled(true); - m_dialogLog->updateStatus(true, false); - } } else { m_isScanning = true; m_thumb->setAcceptDrops(false); - m_dialogLog->updateStatus(dev_que_.is_online() && 0 != m_scanType, m_isScanning); updateActionStatus(); } - - m_dialogLog->show(); } } @@ -3735,7 +2950,7 @@ void MainWindow::on_act_insertFromScanner_triggered() return; } - if (!dev_que_.is_online() || m_isScanning) + if (m_isScanning) { return; } @@ -3769,56 +2984,23 @@ void MainWindow::on_act_insertFromScanner_triggered() startSaveMessageBox(this); - m_dpi = getDpi(); - SANE_Status ret = sane_start(dev_que_.handle()); - if (ret != SANE_STATUS_GOOD) + HGResult ret = HGBASE_ERR_FAIL; + if (nullptr != m_devUser) + { + ret = m_devUser->StartScan(); + } + + if (ret != HGBASE_ERR_OK) { - m_dialogLog->updateStatus(dev_que_.is_online() && 0 != m_scanType, m_isScanning); m_wndStatusBar->setDeviceStatusInfo(tr("start failed"), true); - m_dialogLog->addLog(tr("start failed") + "(" + QString(sane_err_desc(ret)) + ")", true); HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "%s", getStdString(tr("start failed")).c_str()); - - if(ret == SCANNER_ERR_DEVICE_SLEEPING) - { - ui->menu_scan->setEnabled(false); - ui->act_acquire->setEnabled(false); - ui->act_scannerSettings->setEnabled(false); - m_dialogLog->updateStatus(false, false); - m_dialogLog->show(); - - if (m_devVersionNum < "G4393B1001" - && ("439" == m_devPid || "9220" == m_devPid || "8529" == m_devPid)) - { - m_dialogLog->addLog(tr("Please wake up the device manually"), true); - m_wndStatusBar->setDeviceStatusInfo(tr("Please wake up the device manually"), true); - } - else - { - QTime curTimer = QTime::currentTime().addMSecs(10000); - while (QTime::currentTime() < curTimer) - { - QCoreApplication::processEvents(QEventLoop::AllEvents, 100); - } - - m_dialogLog->addLog(tr("already waked up device"), false); - m_wndStatusBar->setDeviceStatusInfo(tr("already waked up device"), false); - } - - ui->menu_scan->setEnabled(true); - ui->act_acquire->setEnabled(true); - ui->act_scannerSettings->setEnabled(true); - m_dialogLog->updateStatus(true, false); - } } else { m_isScanning = true; m_thumb->setAcceptDrops(false); - m_dialogLog->updateStatus(dev_que_.is_online() && 0 != m_scanType, m_isScanning); updateActionStatus(); } - - m_dialogLog->show(); } } @@ -3906,35 +3088,7 @@ void MainWindow::on_act_imageEdit_triggered() } } -bool MainWindow::open_scanner(const QString& name, const QString& scheme) -{ - bool ret = dev_que_.open_scanner(name.toStdString().c_str(), scheme.toStdString().c_str()) == SANE_STATUS_GOOD; - QString info(tr("open scanner ") + " " + name + " "); - - if(ret) - { - m_currDeviceName = name; - info += tr("success"); - m_wndStatusBar->setDeviceStatusInfo(info, false); - m_dialogLog->addLog(info, false); - HGBase_WriteInfo(HGBASE_INFOTYPE_DESC, "%s", getStdString(info).c_str()); - - m_wndStatusBar->setDeviceStatusInfo(tr("be ready"), false); - } - else - { - info += tr("failed"); - m_wndStatusBar->setDeviceStatusInfo(info, true); - m_dialogLog->addLog(info, true); - HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "%s", getStdString(info).c_str()); - } - - m_dialogLog->updateStatus(dev_que_.is_online() && 0 != m_scanType, m_isScanning); - updateActionStatus(); - return ret; -} - -bool MainWindow::judgeDiskSpace(QString currentPath, bool showDlg) +bool MainWindow::judgeDiskSpace(QString currentPath) { QStorageInfo storage = QStorageInfo::root(); storage.refresh(); @@ -3943,18 +3097,20 @@ bool MainWindow::judgeDiskSpace(QString currentPath, bool showDlg) qint64 available_size = 0; available_size = storage.bytesAvailable()/1024/1024; - if(available_size < 64) + if(available_size < 1024) { - if (showDlg) + HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "disk space is unsufficient!"); + QMessageBox msg(QMessageBox::Warning, tr("tips"), tr("Detected that there is less than 1GB of disk space. Do you want to continue?"), + QMessageBox::Yes | QMessageBox::No, this); + msg.exec(); + if (msg.clickedButton() == msg.button(QMessageBox::Yes)) { - QString info = tr("the disk space in the current path is unsufficient, please select a new path or clear the disk space in time."); - m_wndStatusBar->setDeviceStatusInfo(info, true); - m_dialogLog->addLog(info, true); - HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "disk space is unsufficient!"); - QMessageBox::warning(this, tr("warning"), info); + return true; + } + else + { + return false; } - - return false; } return true; } @@ -4168,7 +3324,6 @@ bool MainWindow::isLimitAccessFolder(int type) } QMessageBox::critical(this, tr("error"), info); - m_dialogLog->addLog(info, true); m_wndStatusBar->setDeviceStatusInfo(info, true); return false; } @@ -4347,48 +3502,6 @@ void MainWindow::deleteUpgradePkg(const QString &cfgFilePath) } } -QString MainWindow::getDevPid() -{ - VIDPID vidpid; - int vidpid_val; - unsigned int len = sizeof(int); - sane_io_control(dev_que_.handle(), IO_CTRL_CODE_GET_VIDPID, &vidpid_val, &len); - vidpid.Value = vidpid_val; - int vid = vidpid.VID; - int pid = vidpid.PID; - char buf[10]; - char buf2[10]; - sprintf(buf, "%x", vid); - sprintf(buf2, "%x", pid); - return QString::fromStdString(buf2); -} - -QString MainWindow::getDevSerialNum() -{ - std::string serialNum; - unsigned int serialNumLen = 0; - if(SANE_STATUS_NO_MEM == sane_io_control(dev_que_.handle(), IO_CTRL_CODE_GET_SERIAL, nullptr, &serialNumLen) - && serialNumLen) - { - serialNum.resize(serialNumLen); - sane_io_control(dev_que_.handle(), IO_CTRL_CODE_GET_SERIAL, &serialNum[0], &serialNumLen); - } - return QString::fromStdString(serialNum.c_str()); -} - -QString MainWindow::getDevFwVersionNum() -{ - std::string versionNum; - unsigned int versionNumLen = 0; - if(SANE_STATUS_NO_MEM == sane_io_control(dev_que_.handle(), IO_CTRL_CODE_GET_HARDWARE_VERSION, nullptr, &versionNumLen) - && versionNumLen) - { - versionNum.resize(versionNumLen); - sane_io_control(dev_que_.handle(), IO_CTRL_CODE_GET_HARDWARE_VERSION, &versionNum[0], &versionNumLen); - } - return QString::fromStdString(versionNum.c_str()); -} - void MainWindow::initAcquireIntoComboBox() { m_cbtn_acquireIntoCfg = new QComboBox; @@ -4433,67 +3546,9 @@ void MainWindow::updateSideBar() m_propertyAnimation2->setDuration(600); } -void MainWindow::on_scanOptions_changed(const QString &device, const QString &option, bool checked_now) -{ - QString title(tr("app name")); - if(checked_now) - { - std::string curdev(dev_que_.opened_scanner_name()); - int ret = 0; - if(curdev != device.toStdString()) - { - //ret = dev_que_.open_scanner(device.toStdString().c_str(), option.toStdString().c_str()); - open_scanner(device, option); - return; - } - else { - ret = dev_que_.apply_scheme(option.toStdString().c_str()); - } - - QString info(tr("apply setting") + " '" + option + "' "); - if(ret == 0) - { - info += tr("success"); - } - else - { - ui->menu_device->setOptionChecked(device, option, false); - info += tr("failed"); - } - - m_wndStatusBar->setDeviceStatusInfo(info, ret != 0); - m_dialogLog->addLog(info, ret != 0); - HGBase_WriteInfo(ret != 0 ? HGBASE_INFOTYPE_ERROR : HGBASE_INFOTYPE_DESC, "%s", getStdString(info).c_str()); - title = device + "(" + option + ")"; - } - else - { - QMessageBox msg(QMessageBox::Question, title, - tr("Are you sure to close ") + device + tr(" ?"), - QMessageBox::Yes | QMessageBox::No, this); - msg.exec(); - if(msg.clickedButton() == msg.button(QMessageBox::Yes)) - { - dev_que_.close_scanner(); - m_versionDll->PostDeviceCloseInfo(device.toStdString().c_str(), m_devSerialNum.toStdString().c_str(), "", m_devVersionNum.toStdString().c_str()); - - m_dialogLog->addLog(tr("close ") + device, false); - m_wndStatusBar->setDeviceStatusInfo(tr("close ") + device, false); - } - else { - ui->menu_device->setOptionChecked(device, option, true); - return; - } - } - - m_dialogLog->updateStatus(dev_que_.is_online() && 0 != m_scanType, m_isScanning); - updateActionStatus(); - // setWindowTitle(title); -} - void MainWindow::on_act_sortPages_triggered() { - if (dev_que_.is_online() && m_isScanning) + if (m_isScanning) { return; } @@ -4586,38 +3641,38 @@ void MainWindow::on_act_feedback_triggered() void MainWindow::on_act_driver_log_triggered() { - char log_file_path[260] = {0}; - unsigned int type = SANE_LogFileType::LOG_FILE_DRIVER; - SANE_Status statu = sane_io_control(dev_que_.handle(), IO_CTRL_CODE_GET_LOG_FILE, log_file_path, &type); - if(statu == SANE_STATUS_GOOD) - { - if(log_file_path[0]) - QDesktopServices::openUrl(QUrl::fromLocalFile(log_file_path)); - } - else { - if(statu == SANE_STATUS_UNSUPPORTED) // 鐠佹儳顦稉宥嗘暜閹镐浇顕氶幙宥勭稊 - QMessageBox::information(this, windowTitle(), tr("The device does not support this operation")); - else - QMessageBox::information(this, windowTitle(), tr("IO error")); // IO闁挎瑨顕? - } +// char log_file_path[260] = {0}; +// unsigned int type = SANE_LogFileType::LOG_FILE_DRIVER; +// SANE_Status statu = sane_io_control(dev_que_.handle(), IO_CTRL_CODE_GET_LOG_FILE, log_file_path, &type); +// if(statu == SANE_STATUS_GOOD) +// { +// if(log_file_path[0]) +// QDesktopServices::openUrl(QUrl::fromLocalFile(log_file_path)); +// } +// else { +// if(statu == SANE_STATUS_UNSUPPORTED) // 鐠佹儳顦稉宥嗘暜閹镐浇顕氶幙宥勭稊 +// QMessageBox::information(this, windowTitle(), tr("The device does not support this operation")); +// else +// QMessageBox::information(this, windowTitle(), tr("IO error")); // IO闁挎瑨顕? +// } } void MainWindow::on_act_device_log_triggered() { - char log_file_path[260] = {0}; - unsigned int type = SANE_LogFileType::LOG_FILE_DEVICE; - SANE_Status statu = sane_io_control(dev_que_.handle(), IO_CTRL_CODE_GET_LOG_FILE, log_file_path, &type); - if(statu == SANE_STATUS_GOOD) - { - if(log_file_path[0]) - QDesktopServices::openUrl(QUrl::fromLocalFile(log_file_path)); - } - else { - if(statu == SANE_STATUS_UNSUPPORTED) - QMessageBox::information(this, windowTitle(), tr("The device does not support this operation")); - else - QMessageBox::information(this, windowTitle(), tr("IO error")); - } +// char log_file_path[260] = {0}; +// unsigned int type = SANE_LogFileType::LOG_FILE_DEVICE; +// SANE_Status statu = sane_io_control(dev_que_.handle(), IO_CTRL_CODE_GET_LOG_FILE, log_file_path, &type); +// if(statu == SANE_STATUS_GOOD) +// { +// if(log_file_path[0]) +// QDesktopServices::openUrl(QUrl::fromLocalFile(log_file_path)); +// } +// else { +// if(statu == SANE_STATUS_UNSUPPORTED) +// QMessageBox::information(this, windowTitle(), tr("The device does not support this operation")); +// else +// QMessageBox::information(this, windowTitle(), tr("IO error")); +// } } @@ -4700,3 +3755,23 @@ void MainWindow::on_act_deleteFile_triggered() m_thumb->removeItems(selectIndexs, HGImgThumb::ThumbRemoveFlag_Delete); } } + +void MainWindow::on_act_selectDevice_triggered() +{ + if (nullptr != m_devUser) + { + disconnect(m_devUser, SIGNAL(newImage(void*)), this, SLOT(on_newImage(void*))); + disconnect(m_devUser, SIGNAL(finishScan()), this, SLOT(on_finishScan())); + delete m_devUser; + m_devUser = nullptr; + } + + DeviceUser *devUser = m_devUserMgr->OpenDeviceUser(); + if (devUser != nullptr) + { + m_devUser = devUser; + m_wndStatusBar->setDeviceStatusInfo(tr("Device %1 is open").arg(m_devUser->GetName()), false); + connect(m_devUser, SIGNAL(newImage(void*)), this, SLOT(on_newImage(void*))); + connect(m_devUser, SIGNAL(finishScan()), this, SLOT(on_finishScan())); + } +} diff --git a/app/scanner/mainwindow.h b/app/scanner/mainwindow.h index 17730ac1..aebb6f22 100644 --- a/app/scanner/mainwindow.h +++ b/app/scanner/mainwindow.h @@ -9,14 +9,12 @@ #include #include "HGImgView.h" #include "HGImgThumb.h" -#include "sane/sane_ex.h" #include "dialog_aquireinto.h" #include "widget_imgproc_base.h" #include "widget_imgproc_sidebar.h" #include "imgfmt/HGImgFmt.h" #include "VersionDll.h" -#include "device_menu.h" -#include "sane_device.h" +#include "device_user.h" QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; } @@ -95,16 +93,6 @@ private slots: void on_act_autoSave_triggered(); -signals: - void sane_dev_arrive(QString devName, bool opened); - void sane_dev_remove(QString devName); - void sane_dev_error(QString errorInfo); - void sane_dev_readyStatus(QString promptInfo); - void pre_new_image(void *img); - void post_new_image(unsigned int ret, int statu); - void scan_working(QString workingInfo); - void scan_finish(QString finishInfo, int err); - private slots: void on_AcquireInto2(); void on_reloadAcquireIntoCfg(); @@ -125,18 +113,8 @@ private slots: void on_dialog_multirotate_refreshImgFile(const QString &fileName); void on_multiPageLineEditFinished(); void on_clearCache(); - void on_sane_dev_arrive(QString devName, bool opened); - void on_sane_dev_remove(QString devName); - void on_sane_dev_error(QString errorInfo); - void on_sane_dev_readyStatus(QString promptInfo); - void on_pre_new_image(void *img); - void on_post_new_image(unsigned int ret, int statu); - void on_scan_working(QString workingInfo); - void on_scan_finish(QString finishInfo, int err); - void on_export_scanned_image(void); - void on_continueScan(); - void on_stopScan(); - void on_statusInfoDblClick(); + void on_newImage(void *image); + void on_finishScan(); void on_wrong_image_decide(dialog_wrong_img* dlg, bool save); void on_m_pbtn_push_clicked(); void on_dialog_sideBar_applyToImage(HGImage img, int brightness, int contrast, double gamma, bool enhanceText); @@ -216,8 +194,6 @@ private slots: void on_act_imageEdit_triggered(); - void on_scanOptions_changed(const QString &device, const QString &option, bool checked_now); - void on_act_sortPages_triggered(); void on_actionact_update_triggered(); @@ -234,18 +210,15 @@ private slots: void on_act_deleteFile_triggered(); -public slots: - void my_url_handler(const QUrl& url); + void on_act_selectDevice_triggered(); protected: virtual void closeEvent(QCloseEvent *e) override; virtual void resizeEvent(QResizeEvent *e) override; private: - static int sane_ex_callback(SANE_Handle hdev, int code, void *data, unsigned int* len, void *param); static void HGAPI CrashFunc(HGPointer crashAddr, HGPointer param); - HGUInt getDpi(); QString getCacheFileName(HGImage img); HGImage createImage(); int getMultiPageCount(); @@ -255,21 +228,19 @@ private: askIfClear startScanMessageBox(QWidget* parent); QString passwordEncrypt(const QString& password); QString passwordDecrypt(const QString& transcode); - bool open_scanner(const QString& name, const QString& scheme); - bool judgeDiskSpace(QString currentPath, bool showDlg = true); + bool judgeDiskSpace(QString currentPath); void upgradeApp(QString pkgPath); bool isLimitAccessFolder(int type); //type:1-aquire,2-aquireInto static QString GetDevType(const QString& fwVersion, bool &canLock); void deleteOverdueLogFile(const QString& logFilePath); void deleteUpgradePkg(const QString& cfgFilePath); - QString getDevPid(); - QString getDevSerialNum(); - QString getDevFwVersionNum(); void initAcquireIntoComboBox(); void updateSideBar(); private: Ui::MainWindow *ui; + DeviceUserMgr *m_devUserMgr; + DeviceUser *m_devUser; QAction *m_act_acquireInto2; QComboBox *m_cbtn_acquireIntoCfg; QString m_currLang; @@ -291,10 +262,8 @@ private: QPropertyAnimation *m_propertyAnimation; QPropertyAnimation *m_propertyAnimation2; - dev_que dev_que_; - - bool auto_save_changes_; - bool save_from_changed_; + bool auto_save_changes_; + bool save_from_changed_; typedef struct _save_opt { QString path; @@ -349,7 +318,6 @@ private: class HGLineEdit* m_multiPageLineEdit; class Widget_StatusBar *m_wndStatusBar; - class dialog_log *m_dialogLog; class Dialog_AquireInto *m_dialogAcquireinto; class Dialog_FullScreen *m_dlgFullScreen; }; diff --git a/app/scanner/mainwindow.ui b/app/scanner/mainwindow.ui index 30aa63f4..3fc4ab3e 100644 --- a/app/scanner/mainwindow.ui +++ b/app/scanner/mainwindow.ui @@ -69,6 +69,7 @@ menu_scan + @@ -168,13 +169,7 @@ - - - menu_device - - - @@ -630,14 +625,12 @@ act_enhanceText + + + act_selectDevice + + - - - device_menu - QMenu -
device_menu.h
-
-
diff --git a/app/scanner/ocrPdf.cpp b/app/scanner/ocrPdf.cpp deleted file mode 100644 index ffd511c8..00000000 --- a/app/scanner/ocrPdf.cpp +++ /dev/null @@ -1,148 +0,0 @@ -#include -#include "base/HGBase.h" -#ifdef HG_CMP_MSC -#include -#endif -#include -#include "base/HGUtility.h" - -std::string getOcrPath() -{ - std::string ocrPath; -#ifdef HG_CMP_MSC - HKEY hKey = NULL; -#ifdef _WIN64 - RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\WOW6432Node\\Microtek\\Microtek OCR Engine V1", 0, KEY_QUERY_VALUE, &hKey); -#else - RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microtek\\Microtek OCR Engine V1", 0, KEY_QUERY_VALUE, &hKey); -#endif - if (NULL != hKey) - { - CHAR szData[MAX_PATH] = { 0 }; - DWORD cbData = MAX_PATH; - if (ERROR_SUCCESS == RegQueryValueExA(hKey, "InstallPath_Fast", NULL, NULL, (LPBYTE)szData, &cbData)) - { - ocrPath = szData; - } - - RegCloseKey(hKey); - } -#endif - return ocrPath; -} - -bool createOcrPdf(const std::string &imgPath, const std::string &dstFile, int languageType) -{ -#ifdef HG_CMP_MSC - std::string ocrPath = getOcrPath(); - if (ocrPath.empty()) - return false; - - DWORD len1 = GetEnvironmentVariableA("Path", NULL, 0); - char* env1 = (char *)malloc((size_t)len1 + 256); - if (NULL != env1) - { - memset(env1, 0, (size_t)len1 + 256); - GetEnvironmentVariableA("Path", env1, len1 + 256); - std::string ss(env1); - if (ss.find(ocrPath) == std::string::npos) - { - strcat(env1, ";"); - strcat(env1, ocrPath.c_str()); - SetEnvironmentVariableA("Path", env1); - } - - free(env1); - } - - char env2[256] = {0}; - strcat(env2, ocrPath.c_str()); - strcat(env2, "\\"); - strcat(env2, "tessdata_f"); - SetEnvironmentVariableA("TESSDATA_PREFIX", env2); - - - DeleteFileA(dstFile.c_str()); - - - const int MY_PIPE_BUFFER_SIZE = 1024; - //初始化管道 - HANDLE hPipeRead = NULL; - HANDLE hPipeWrite = NULL; - SECURITY_ATTRIBUTES saOutPipe; - ::ZeroMemory(&saOutPipe, sizeof(saOutPipe)); - saOutPipe.nLength = sizeof(SECURITY_ATTRIBUTES); - saOutPipe.lpSecurityDescriptor = NULL; - saOutPipe.bInheritHandle = TRUE; - CreatePipe(&hPipeRead, &hPipeWrite, &saOutPipe, MY_PIPE_BUFFER_SIZE); - - - PROCESS_INFORMATION ProcessInfo; - ::ZeroMemory(&ProcessInfo, sizeof(ProcessInfo)); - STARTUPINFOA StartupInfo; - ZeroMemory(&StartupInfo, sizeof(StartupInfo)); - StartupInfo.cb = sizeof(StartupInfo); - StartupInfo.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; - StartupInfo.hStdOutput = hPipeWrite; - StartupInfo.hStdError = hPipeWrite; - StartupInfo.wShowWindow = SW_HIDE; - - HGChar prefix[256]; - HGBase_GetFilePrefix(dstFile.c_str(), prefix, 256); - - bool ret = false; - char cmd[1024] = {0}; - - if (0 == languageType) - { - sprintf(cmd, "tesseract.exe \"%s\" \"%s\" -l %s --psm %d --oem %d %s", imgPath.c_str(), prefix, "eng", 3, 3, "pdf"); - } - else if (1 == languageType) - { - sprintf(cmd, "tesseract.exe \"%s\" \"%s\" -l %s --psm %d --oem %d %s", imgPath.c_str(), prefix, "chi_sim", 3, 3, "pdf"); - } - else if (2 == languageType) - { - sprintf(cmd, "tesseract.exe \"%s\" \"%s\" -l %s --psm %d --oem %d %s", imgPath.c_str(), prefix, "chi_tra", 3, 3, "pdf"); - } - else if (3 == languageType) - { - sprintf(cmd, "tesseract.exe \"%s\" \"%s\" -l %s --psm %d --oem %d %s", imgPath.c_str(), prefix, "jpn", 3, 3, "pdf"); - } - else if (4 == languageType) - { - sprintf(cmd, "tesseract.exe \"%s\" \"%s\" -l %s --psm %d --oem %d %s", imgPath.c_str(), prefix, "kor", 3, 3, "pdf"); - } - - BOOL b = CreateProcessA(NULL, cmd, NULL, NULL, TRUE, CREATE_NO_WINDOW, NULL, NULL, &StartupInfo, &ProcessInfo); - if (b) - { - WaitForSingleObject(ProcessInfo.hProcess, INFINITE); - DWORD exitCode; - GetExitCodeProcess(ProcessInfo.hProcess, &exitCode); - if (0 == exitCode) - ret = true; - - DWORD dwReadLen = 0; - DWORD dwStdLen = 0; - if (PeekNamedPipe(hPipeRead, NULL, 0, NULL, &dwReadLen, NULL) && dwReadLen > 0) - { - char szPipeOut[MY_PIPE_BUFFER_SIZE]; - ::ZeroMemory(szPipeOut, sizeof(szPipeOut)); - if (ReadFile(hPipeRead, szPipeOut, dwReadLen, &dwStdLen, NULL)) - { - - } - } - - CloseHandle(ProcessInfo.hProcess); - CloseHandle(ProcessInfo.hThread); - } - - CloseHandle(hPipeRead); - CloseHandle(hPipeWrite); - return ret; -#else - return false; -#endif -} diff --git a/app/scanner/ocrPdf.h b/app/scanner/ocrPdf.h deleted file mode 100644 index e500ee45..00000000 --- a/app/scanner/ocrPdf.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef __OCRPDF_H__ -#define __OCRPDF_H__ - -#include - -std::string getOcrPath(); -bool createOcrPdf(const std::string &imgPath, const std::string &dstFile, int languageType);//languageType is the index of the comboBox on export and save_as ui. - -#endif /* __OCRPDF_H__ */ diff --git a/app/scanner/sane_device.cpp b/app/scanner/sane_device.cpp deleted file mode 100644 index c47dd61d..00000000 --- a/app/scanner/sane_device.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include "sane_device.h" - - -sane_dev::sane_dev() : hdev_(nullptr), offline_(true), name_(""), cfg_name_("") -{} -sane_dev::~sane_dev() -{ - close(); -} - -bool sane_dev::apply(gb::sane_config_schm* schm) -{ - SANE_Int count = 0, - afterdo = 0; - bool ret = false; - - return ret; -} - -std::string sane_dev::name(void) -{ - return name_; -} -std::string sane_dev::current_configuration_name(void) -{ - return cfg_name_; -} -bool sane_dev::is_online(void) -{ - return !offline_; -} -SANE_Handle sane_dev::handle(void) -{ - return hdev_; -} - -bool sane_dev::open(const std::string& name) -{ - if(name_ == name) - return true; - - close(); - - SANE_Status statu = sane_open(name.c_str(), &hdev_); - if(statu == SANE_STATUS_GOOD) - { - } - - return statu == SANE_STATUS_GOOD; -} -void sane_dev::set_online(bool online) -{ - offline_ = !online; -} -void sane_dev::close(void) -{ - if(hdev_) - { - sane_close(hdev_); - hdev_ = nullptr; - } - offline_ = true; - name_ = ""; - cfg_name_ = ""; -} diff --git a/app/scanner/sane_device.h b/app/scanner/sane_device.h deleted file mode 100644 index f6071060..00000000 --- a/app/scanner/sane_device.h +++ /dev/null @@ -1,38 +0,0 @@ -#pragma once - -#include -#include "sane/sane_ex.h" -#include "cfg/gb_json.h" - - - -class sane_dev -{ - SANE_Handle hdev_; - bool offline_; - std::string name_; - std::string cfg_name_; - - enum act_result - { - ACT_RESULT_NO_NEED = 0, - ACT_RESULT_FAILED, - ACT_RESULT_SUCCESS, - }; - - bool apply(gb::sane_config_schm* schm); - -public: - sane_dev(); - ~sane_dev(); - -public: - std::string name(void); - std::string current_configuration_name(void); - bool is_online(void); - SANE_Handle handle(void); - - bool open(const std::string& name); - void set_online(bool online); - void close(void); -}; diff --git a/app/scanner/setpicclrtool.cpp b/app/scanner/setpicclrtool.cpp deleted file mode 100644 index 78597d89..00000000 --- a/app/scanner/setpicclrtool.cpp +++ /dev/null @@ -1,315 +0,0 @@ -#include "setpicclrtool.h" -#include "ui_setpicclrtool.h" -#include "widget.h" -#include -#include - -setPicClrTool::setPicClrTool(QWidget *parent) : - QDialog(parent), - ui(new Ui::setPicClrTool) -{ - ui->setupUi(this); - setMouseTracking(true); - ui->inputEdt->setEnabled(false); - ui->outputEdt->setEnabled(false); - ui->inputEdt->setValidator(new QIntValidator(0, 255, this)); - ui->outputEdt->setValidator(new QIntValidator(0, 255, this)); - ui->widget->setFocus(Qt::MouseFocusReason); - connect(ui->widget,SIGNAL(mouseCoordSig(QPoint)),this,SLOT(mouseCoordSlot(QPoint))); - connect(ui->widget,SIGNAL(dragPointChecked(bool)),this,SLOT(lineEditEnable(bool))); - connect(ui->widget,SIGNAL(lineChangeSig()),this,SLOT(lineChangeSlot())); -} - -setPicClrTool::~setPicClrTool() -{ - delete ui; -} - -void setPicClrTool::getGrayTable(uchar *table, size_t length) -{ - QVector gray = getGrayALLPoint(); - for (size_t i = 0; i < length; i++) - table[i] = static_cast(gray[static_cast(i)]); -} - -void setPicClrTool::getRGBTable(uchar *table, size_t length) -{ - if (length != 768) - throw "length is not 768."; - - QVector rgb = getRgbALLPoint(); - QVector red = getRedALLPoint(); - QVector green = getGreenALLPoint(); - QVector blue = getBlueALLPoint(); - - - for (size_t i = 0; i < 256; i++) - { - //if (i == 255) - // int a = 0; - //table member order is B\G\R - table[i * 3 + 0] = static_cast(blue[rgb[static_cast(i)]]); - table[i * 3 + 1] = static_cast(green[rgb[static_cast(i)]]); - table[i * 3 + 2] = static_cast(red[rgb[static_cast(i)]]); - } -} - -//void setPicClrTool::setGrayTable(const uchar *table, size_t length) -//{ -// QVector gray; -// for (size_t i = 0; i < length; i++) -// gray[static_cast(i)] = int(table[i]); -// //ui->widget->setGrayALLPoint(gray); -//} - -//void setPicClrTool::setRGBTable(const uchar *table, size_t length) -//{ -// QVector rgb; -// QVector red; -// QVector green; -// QVector blue; -// for(int i = 0; i < 256; i++){ -// rgb.append(i); -// } -// for (size_t i = 0; i < length; i++){ -// red.append(int(table[i * 3 + 0])); -// green.append(int(table[i * 3 + 1])); -// blue.append(int(table[i * 3 + 2])); -// } - -//} - -void setPicClrTool::setColorMode(int colorMode) -{ - QVariant v(6); - if(colorMode == 0) - { - ui->colorSetCmb->setItemData(1,v,Qt::UserRole - 1); - } - else - { - ui->comboBox->setItemData(2,v,Qt::UserRole - 1); - ui->colorSetCmb->setItemData(0,v,Qt::UserRole - 1); - ui->colorSetCmb->setItemData(2,v,Qt::UserRole - 1); - ui->colorSetCmb->setItemData(3,v,Qt::UserRole - 1); - ui->colorSetCmb->setItemData(4,v,Qt::UserRole - 1); - ui->colorSetCmb->setCurrentIndex(1); - } -} - -QVector > setPicClrTool::getRGBKeyTable() -{ - QVector> plv; - plv.append(getRgbKeyPoint()); - plv.append(getRedKeyPoint()); - plv.append(getGreenKeyPoint()); - plv.append(getBlueKeyPoint()); - return plv; -} - -void setPicClrTool::setRGBKeyTable(QVector > &plv) -{ - setRgbKeyPoint(plv[0]); - setRedKeyPoint(plv[1]); - setGreenKeyPoint(plv[2]); - setBlueKeyPoint(plv[3]); -} - -QList setPicClrTool::getGrayKeyTable() -{ - return getGrayKeyPoint(); -} - -void setPicClrTool::setGrayKeyTable(QList &plv) -{ - setGrayKeyPoint(plv); -} - -QVector setPicClrTool::getRgbALLPoint() -{ - return ui->widget->getRgbALLPoint(); -} - -QList setPicClrTool::getRgbKeyPoint() const -{ - qDebug() << "setRgb" << ui->widget->getRgbKeyPoint(); - return ui->widget->getRgbKeyPoint(); -} - -void setPicClrTool::setRgbKeyPoint(const QList &pVec) -{ - qDebug() << "setRgb" << pVec; - ui->widget->setRgbKeyPoint(pVec); -} - -QList setPicClrTool::getRedKeyPoint() const -{ - return ui->widget->getRedKeyPoint(); -} - -void setPicClrTool::setRedKeyPoint(const QList &pVec) -{ - ui->widget->setRedKeyPoint(pVec); -} - -QList setPicClrTool::getBlueKeyPoint() const -{ - return ui->widget->getBlueKeyPoint(); -} - -void setPicClrTool::setBlueKeyPoint(const QList &pVec) -{ - ui->widget->setBlueKeyPoint(pVec); -} - -QList setPicClrTool::getGreenKeyPoint() const -{ - return ui->widget->getGreenKeyPoint(); -} - -void setPicClrTool::setGreenKeyPoint(const QList &pVec) -{ - ui->widget->setGreenKeyPoint(pVec); -} - -QList setPicClrTool::getGrayKeyPoint() const -{ - return ui->widget->getGrayKeyPoint(); -} - -void setPicClrTool::setGrayKeyPoint(const QList &pVec) -{ - ui->widget->setGrayKeyPoint(pVec); -} - -QVector setPicClrTool::getRedALLPoint() -{ - return ui->widget->getRedALLPoint(); -} - -QVector setPicClrTool::getBlueALLPoint() -{ - return ui->widget->getBlueALLPoint(); -} - -QVector setPicClrTool::getGreenALLPoint() -{ - return ui->widget->getGreenALLPoint(); -} - -QVector setPicClrTool::getGrayALLPoint() -{ - return ui->widget->getGrayALLPoint(); -} - -void setPicClrTool::mouseCoordSlot(QPoint pos) -{ - ui->inputEdt->setText(QString::number(pos.x())); - ui->outputEdt->setText(QString::number(pos.y())); -} - -void setPicClrTool::lineEditEnable(bool a) -{ - ui->inputEdt->setEnabled(a); - ui->outputEdt->setEnabled(a); -} - -void setPicClrTool::lineChangeSlot() -{ - ui->comboBox->setCurrentIndex(0); -} - -void setPicClrTool::on_colorSetCmb_currentIndexChanged(int index) -{ - (void)index; - /* switch(index){ - case RED: - ui->widget->updateCurLinePnt(RED); - break; - case GREEN: - ui->widget->updateCurLinePnt(GREEN); - break; - case BLUE: - ui->widget->updateCurLinePnt(BLUE); - break; - case RGB: - ui->widget->updateCurLinePnt(RGB); - break; - case GRAY: - ui->widget->updateCurLinePnt(GRAY); - break; - }*/ -} - -void setPicClrTool::on_comboBox_currentIndexChanged(int index) -{ - if(index == 0){ - ui->widget->initAllLstPnt(); - ui->widget->updateCurLinePnt(ui->colorSetCmb->currentIndex()); - return ; - } - ui->widget->initAllLstPnt(); - if(index == 1){ - rgbLine.clear(); - rgbLine.append(QPoint(0,255)); - rgbLine.append(QPoint(255,0)); - ui->widget->setLstPnt_RGB(rgbLine); - }else if(index == 2){ - redLine.clear(); - redLine.append(QPoint(33,255)); - redLine.append(QPoint(185,0)); - redLine.append(QPoint(119,127)); - greenLine.clear(); - greenLine.append(QPoint(28,255)); - greenLine.append(QPoint(132,0)); - greenLine.append(QPoint(77,127)); - blueLine.clear(); - blueLine.append(QPoint(25,255)); - blueLine.append(QPoint(108,0)); - blueLine.append(QPoint(60,127)); - ui->widget->setLstPnt_RED(redLine); - ui->widget->setLstPnt_GREEN(greenLine); - ui->widget->setLstPnt_BLUE(blueLine); - }else if(index == 4){ - rgbLine.clear(); - rgbLine.append(QPoint(0,0)); - rgbLine.append(QPoint(255,255)); - rgbLine.append(QPoint(103,125)); - ui->widget->setLstPnt_RGB(rgbLine); - }else if(index == 3){ - rgbLine.clear(); - rgbLine.append(QPoint(0,0)); - rgbLine.append(QPoint(255,255)); - rgbLine.append(QPoint(130,101)); - ui->widget->setLstPnt_RGB(rgbLine); - } - ui->widget->updateCurLinePnt(ui->colorSetCmb->currentIndex()); -} - -void setPicClrTool::on_inputEdt_textChanged(const QString &arg1) -{ - ui->widget->setXCoorVal(arg1.toInt()); -} - -void setPicClrTool::on_outputEdt_textChanged(const QString &arg1) -{ - ui->widget->setYCoorVal(arg1.toInt()); -} - -void setPicClrTool::on_pushButton_clicked() -{ - ui->widget->initSelectColLine(ui->colorSetCmb->currentIndex()); -} - -void setPicClrTool::on_buttonBox_accepted() -{ - //close(); - accept(); -} - -void setPicClrTool::on_buttonBox_rejected() -{ - ui->widget->initAllLstPnt(); - //close(); - reject(); -} diff --git a/app/scanner/setpicclrtool.h b/app/scanner/setpicclrtool.h deleted file mode 100644 index 59c4c25b..00000000 --- a/app/scanner/setpicclrtool.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef SETPICCLRTOOL_H -#define SETPICCLRTOOL_H - -//#include "colorlinesetdef.h" -#include - -namespace Ui { -class setPicClrTool; -} - -class setPicClrTool : public QDialog -{ - Q_OBJECT - -public: - explicit setPicClrTool(QWidget *parent = nullptr); - ~setPicClrTool(); - - void getGrayTable(uchar* table, size_t length = 256); - - void getRGBTable(uchar* table, size_t length = 768); - -// void setGrayTable(const uchar* table, size_t length = 256); - -// void setRGBTable(const uchar* table, size_t length = 768); - - void setColorMode(int colorMode); - - QVector> getRGBKeyTable(); - void setRGBKeyTable(QVector>& plv); - QList getGrayKeyTable(); - void setGrayKeyTable(QList &plv); - - -private: - QVector getRgbALLPoint(); - QVector getRedALLPoint(); - QVector getBlueALLPoint(); - QVector getGreenALLPoint(); - QVector getGrayALLPoint(); - - QList getRgbKeyPoint()const; - void setRgbKeyPoint(const QList& pVec); - QList getRedKeyPoint()const; - void setRedKeyPoint(const QList& pVec); - QList getBlueKeyPoint()const; - void setBlueKeyPoint(const QList& pVec); - QList getGreenKeyPoint()const; - void setGreenKeyPoint(const QList& pVec); - QList getGrayKeyPoint()const; - void setGrayKeyPoint(const QList& pVec); - -private slots: - void mouseCoordSlot(QPoint);//set QLineEdit value by QPoint setting - void lineEditEnable(bool);//set 2 LineEdit enable status - void lineChangeSlot(); - - void on_colorSetCmb_currentIndexChanged(int index); - - void on_comboBox_currentIndexChanged(int index); - - void on_inputEdt_textChanged(const QString &arg1); - - void on_outputEdt_textChanged(const QString &arg1); - - void on_pushButton_clicked(); - - void on_buttonBox_accepted(); - - void on_buttonBox_rejected(); - -private: - Ui::setPicClrTool *ui; - QList linePoint; - QList greenLine; - QList redLine; - QList blueLine; - QList rgbLine; - QList grayLine; -}; - -#endif // SETPICCLRTOOL_H diff --git a/app/scanner/setpicclrtool.ui b/app/scanner/setpicclrtool.ui deleted file mode 100644 index 5ba412a6..00000000 --- a/app/scanner/setpicclrtool.ui +++ /dev/null @@ -1,167 +0,0 @@ - - - setPicClrTool - - - - 0 - 0 - 259 - 341 - - - - 自定义色调曲线 - - - - - - - - - 自定义 - - - - - 负片(RGB) - - - - - 彩色负片(RGB) - - - - - 较暗(RGB) - - - - - 较亮(RGB) - - - - - - - - - - - - false - - - - RGB - - - - - - - - - - - - - - - - - - - - 绿 - - - - - - - - 初始化 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - true - - - Qt::StrongFocus - - - - - - - - - 输入: - - - - - - - true - - - - - - - 输出: - - - - - - - true - - - - - - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - Widget - QWidget -
widget.h
- 1 -
-
- - -
diff --git a/app/scanner/widget.cpp b/app/scanner/widget.cpp deleted file mode 100644 index 71c943bf..00000000 --- a/app/scanner/widget.cpp +++ /dev/null @@ -1,855 +0,0 @@ -#include "widget.h" -#include "ui_widget.h" -#include "gaosixy.h" -#include -#include -#include -#include -using namespace std; - - -enum COLOR_TPYE -{ - RGB, - GRAY, - RED, - BLUE, - GREEN -}; - -Widget::Widget(QWidget *parent) : - QWidget(parent), - ui(new Ui::Widget) -{ - ui->setupUi(this); - setWindowTitle(tr("zuobiaozhou")); //设置标题栏标题 - //resize(300,300); //设置窗口初始大小 - //ui->table->setWindowFlags(Qt::WindowStaysOnTopHint); - initAllLstPnt(); - initInterface(); -} - -Widget::~Widget() -{ - delete ui; -} - -void Widget::setLstPnt_RGB(const QList &plst) -{ - rgbLine = QList(plst); -} - -QList Widget::getLstPnt_RGB() const -{ - return rgbLine; -} - -void Widget::setLstPnt_RED(const QList &plst) -{ - redLine = QList(plst); -} - -void Widget::setLstPnt_BLUE(const QList &plst) -{ - blueLine = QList(plst); -} - -QList Widget::getLstPnt_BLUE() const -{ - return blueLine; -} - -void Widget::setLstPnt_GREEN(const QList &plst) -{ - greenLine = QList(plst); -} - -QList Widget::getLstPnt_GREEN() const -{ - return greenLine; -} - -void Widget::setLstPnt_GRAY(const QList &plst) -{ - grayLine = QList(plst); -} - -QList Widget::getLstPnt_GRAY() const -{ - return grayLine; -} - -QVector Widget::getRgbALLPoint() -{ - return rgbALLPoint; -} - -QList Widget::getRgbKeyPoint() const -{ - return rgbLine; -} - -void Widget::setRgbKeyPoint(const QList &pLst) -{ - if(pLst.size() > 4) return; - rgbLine = QList(pLst); - pointLst.clear(); - pointLst = QList(rgbLine); - drawLineFromPoint(rgbLine, RGB); - update(); -} - -QVector Widget::getRedALLPoint() -{ - return redALLPoint; -} - -QList Widget::getRedKeyPoint() const -{ - return redLine; -} - -void Widget::setRedKeyPoint(const QList &pLst) -{ - if(pLst.size() > 4) return; - redLine = QList(pLst); - drawLineFromPoint(redLine, RED); - update(); -} - -QVector Widget::getBlueALLPoint() -{ - return blueALLPoint; -} - -QList Widget::getBlueKeyPoint() const -{ - return blueLine; -} - -void Widget::setBlueKeyPoint(const QList &pLst) -{ - if(pLst.size() > 4) return; - blueLine = QList(pLst); - drawLineFromPoint(blueLine, BLUE); - update(); -} - -QVector Widget::getGreenALLPoint() -{ - return greenALLPoint; -} - -QList Widget::getGreenKeyPoint() const -{ - return greenLine; -} - -void Widget::setGreenKeyPoint(const QList &pLst) -{ - if(pLst.size() > 4) return; - greenLine = QList(pLst); - drawLineFromPoint(greenLine, GREEN); - update(); -} - -QVector Widget::getGrayALLPoint() -{ - return grayALLPoint; -} - -QList Widget::getGrayKeyPoint() const -{ - return grayLine; -} - -void Widget::setGrayKeyPoint(const QList &pLst) -{ - if(pLst.size() > 4) return; - grayLine = QList(pLst); - pointLst.clear(); - pointLst = QList(grayLine); - drawLineFromPoint(grayLine, GRAY); - update(); -} - -void Widget::initAllLstPnt() -{ - pointLst.clear(); - pointLst.append(QPoint(0,0)); - pointLst.append(QPoint(255,255)); - redLine.clear(); - redLine.append(QPoint(0,0)); - redLine.append(QPoint(255,255)); - blueLine.clear(); - blueLine.append(QPoint(0,0)); - blueLine.append(QPoint(255,255)); - greenLine.clear(); - greenLine.append(QPoint(0,0)); - greenLine.append(QPoint(255,255)); - rgbLine.clear(); - rgbLine.append(QPoint(0,0)); - rgbLine.append(QPoint(255,255)); - grayLine.clear(); - grayLine.append(QPoint(0,0)); - grayLine.append(QPoint(255,255)); - drawLineFromPoint(redLine, RED); - drawLineFromPoint(rgbLine, RGB); - drawLineFromPoint(greenLine, GREEN); - drawLineFromPoint(blueLine, BLUE); - drawLineFromPoint(grayLine, GRAY); -} - -void Widget::initInterface() -{ - color = Qt::gray; - selectCol = RGB; - leftMouseMv = false; - newPoint = false; - clickLine = false; - dragPoint = -1; - setMouseTracking(true); - ui->widget_2->setStyleSheet("QWidget{background-color:qlineargradient(" - "spread:pad, x1:0, y1:0, x2:1, y2:0, " - "stop:0 rgba(0, 0, 0, 255), stop:1 rgba(255, 255, 255, 255))}"); - ui->widget->setStyleSheet("QWidget{background-color:qlineargradient(" - "spread:pad, x1:0, y1:1, x2:0, y2:0, " - "stop:0 rgba(0, 0, 0, 255), stop:1 rgba(255, 255, 255, 255))}"); -} - -void Widget::paintEvent(QPaintEvent *) -{ - QPainter painter(this); - painter.setRenderHint(QPainter::Antialiasing,true); //开启抗锯齿 - painter.translate(ui->widget->width(),ui->widget->height()); //坐标系统平移变换,把原点平移 - painter.scale(ui->table->width() / 258.0,ui->table->height() / 258.0); //坐标系统比例变换,使绘制的图形随窗口的放大而放大 - painter.scale(1,-1); - - drawCoordinate(painter); - drawBackColorBySlc(painter); - drawCoorScale(painter); - drawCurveByColor(painter); - drawAllPoint(painter); - - if(dragPoint < 0){ - setMouseTracking(true); - emit dragPointChecked(false); - } - painter.end(); -} - -void Widget::mousePressEvent(QMouseEvent *event) -{ - int x = (event->x() - ui->widget->width())*258/ui->table->width(); - int y = (height() - event->y()-ui->widget_2->height())*258/ui->table->height(); - //qDebug() << x << y; - if(event->button() == Qt::LeftButton){ - newPoint = false; - dragPoint = -1; - clickLine = false; - for(int i = 0; i < linePoint.size();i++){ - int px = linePoint.at(i).x(); - int py = linePoint.at(i).y(); - if(qAbs(x-px) <= 6 && qAbs(y-py) <= 6) - { - newPoint = true; - for(int j = 0; j < pointLst.size(); j++){ - int lx = pointLst.at(j).x(); - int ly = pointLst.at(j).y(); - if(qAbs(x-lx) <= 6 && qAbs(y-ly) <= 6){ - dragPoint = j; - clickLine = true; - leftMouseMv = true; - newPoint = false; - emit dragPointChecked(true); - setMouseTracking(false); - update(); - break; - } - } - if(newPoint && pointLst.size() < 4 && x > pointLst.at(0).x() && x < pointLst.at(1).x()){ - pointLst.append(QPoint(x,y)); - dragPoint = pointLst.size()-1; - leftMouseMv = true; - clickLine = true; - emit dragPointChecked(true); - setMouseTracking(false); - update(); - } - } - } - } - else if(event->button() == Qt::RightButton){ - for(int j = 0; j < pointLst.size(); j++){ - int lx = pointLst.at(j).x(); - int ly = pointLst.at(j).y(); - if(qAbs(x-lx) <= 7 && qAbs(y-ly) <= 5){ - if(j > 1) - pointLst.removeAt(j); - if(j == dragPoint){ - dragPoint = -1; - emit dragPointChecked(false); - }else if(j > dragPoint){ - dragPoint = dragPoint; - }else { - dragPoint = dragPoint-1; - } - update(); - break; - } - } - } - if(!clickLine){ - dragPoint = -1; - emit dragPointChecked(false); - setMouseTracking(true); - update(); - } - emit mouseCoordSig(QPoint(x,y)); -} - -void Widget::mouseMoveEvent(QMouseEvent *event) -{ - int x = (event->x() - ui->widget->width())*258/ui->table->width(); - int y = (height() - event->y()-ui->widget_2->height())*258/ui->table->height(); - if(x < 0) x = 0; - if(y < 0) y = 0; - if(x >= 255) x = 255; - if(y >= 255) y = 255; - //qDebug() << x << y; - if(leftMouseMv && dragPoint >= 0) - { - if(pointLst[dragPoint] != pointLst.at(0) && pointLst[dragPoint] != pointLst.at(1)){ - if(x <= pointLst.at(0).x()) x = pointLst.at(0).x() + 1; - if(x >= pointLst.at(1).x()) x = pointLst.at(1).x() - 1; - - if(pointLst.size() == 4){ - if(dragPoint == 2){ - if(pointLst[2].x() > pointLst[3].x() && x <= pointLst[3].x()) - x = pointLst[3].x() + 1; - if(pointLst[2].x() < pointLst[3].x() && x >= pointLst[3].x()) - x = pointLst[3].x() - 1; - } - else if(dragPoint == 3){ - if(pointLst[2].x() < pointLst[3].x() && x <= pointLst[2].x()) - x = pointLst[2].x() + 1; - if(pointLst[2].x() > pointLst[3].x() && x >= pointLst[2].x()) - x = pointLst[2].x() - 1; - } - } - } - else if(pointLst[dragPoint] == pointLst.at(0)){ - int min = 999; - for(int i = 1; i < pointLst.size(); i++){ - if(min > pointLst[i].x()) min = pointLst[i].x(); - } - if(x >= min) x = min-1; - } - else if(pointLst[dragPoint] == pointLst.at(1)){ - if(pointLst.size() > 2){ - int max = 0; - for(int i = 2; i < pointLst.size(); i++){ - if(max < pointLst[i].x()) max = pointLst[i].x(); - } - if(x <= max) x = max+1; - } - else if(pointLst.size() <= 2) - if(x <= pointLst.at(0).x()) x = pointLst.at(0).x()+1; - } - pointLst[dragPoint].setX(x); - pointLst[dragPoint].setY(y); - emit lineChangeSig(); - update(); - } - emit mouseCoordSig(QPoint(x,y)); -} - -void Widget::mouseReleaseEvent(QMouseEvent *) -{ - leftMouseMv = false; -} - -void Widget::enterEvent(QEvent *) -{ - setFocus(Qt::MouseFocusReason); -} - -void Widget::leaveEvent(QEvent *) -{ - if(dragPoint < 0) - emit mouseLeaveSig(); -} - -void Widget::setHist_RGB(const QVector &hist) -{ - rgbBackColor = QVector(hist); -} - -QVector Widget::getHist_RED() const -{ - return redBackColor; -} - -void Widget::setHist_RED(const QVector &hist) -{ - redBackColor = QVector(hist); -} - -QVector Widget::getHist_RGB() const -{ - return rgbBackColor; -} - -void Widget::setHist_GREEN(const QVector &hist) -{ - greenBackColor = QVector(hist); -} - -QVector Widget::getHist_GREEN() const -{ - return greenBackColor; -} - -void Widget::setHist_BLUE(const QVector &hist) -{ - blueBackColor = QVector(hist); -} - -QVector Widget::getHist_BLUE() const -{ - return blueBackColor; -} - -void Widget::setHist_GRAY(const QVector &hist) -{ - grayBackColor = QVector(hist); -} - -QVector Widget::getHist_GRAY() const -{ - return grayBackColor; -} - -void Widget::drawCoordinate(QPainter &painter) -{ - painter.setBrush(QColor(79,79,79)); - painter.drawRect(0, 0, 260, 260); - painter.drawLine(-2000,0,2000,0); - painter.drawLine(0,1500,0,-1500); -} - -void Widget::drawBackgroudColor(QPainter &painter,QVector &curCol) -{ - painter.setPen(QPen(color,1)); - painter.setBrush(color); - int max = 0; - for(int i = 0; i < curCol.size(); i++) - { - if(curCol.at(i) > max) - { - max = curCol.at(i); - } - } - for(int i = 0; i < curCol.size(); i++) - { - painter.drawRect(i, 0, 1, curCol.at(i)*255/max); - } - -} - -void Widget::drawBackColorBySlc(QPainter &painter) -{ - switch(selectCol){ - case RGB: - drawBackgroudColor(painter,rgbBackColor); - break; - case GREEN: - drawBackgroudColor(painter,greenBackColor); - break; - case BLUE: - drawBackgroudColor(painter,blueBackColor); - break; - case RED: - drawBackgroudColor(painter,redBackColor); - break; - case GRAY: - drawBackgroudColor(painter,grayBackColor); - break; - } -} - -void Widget::drawCoorScale(QPainter &painter) -{ - painter.setPen(QPen(Qt::gray,1)); - for(int i = 0; i < 260 ; i+=50) - { - if(i%50 == 0 && i >=50) - { - QVector dashes; - qreal space = 3; - dashes << 5 << space << 5 < &plst, const int& col) -{ - double **a; - int len = plst.size(); - a = new double *[len]; - for(int i = 0; i < len; i++){ - a[i] = new double[len+1]; - } - /*******通过pointLst的所有点给二维数组赋值生成行列式*******/ - for(int i = 0; i < len; i++){ - for(int j = 0;j < len + 1; j++){ - if(j < len) - a[i][j] = caculateAllMi(plst.at(i).x(),len-j-1); - if(j == len) - a[i][j] = plst.at(i).y(); - } - } - - /*******调用高斯消元法计算曲线方程的系数值********/ - GaoSiXY gaoSi; - double *result = new double[len] ; - gaoSi.solve(a,len,result); - - /********保存曲线方程 x 的系数(a,b,c,d....)********/ - QList xiNum; - for(int i = 0; i < len; i++){ - xiNum.append(*(result+i)); - } - - linePoint.clear(); - linePoints.clear(); - for(int i = 0; i < 256; i++){ - int x = i; - double yVal = 0; - for(int j = 0; j < len; j++){ - yVal += xiNum.at(j)*caculateAllMi(x,len-j-1); - } - int y = (int)yVal; - if(y > 255) y = 255; - if(y < 0) y = 0; - if(x < plst.at(0).x()) y = plst.at(0).y(); - if(x > plst.at(1).x()) y = plst.at(1).y(); - allLinePoints[x] = y; - linePoints.append(y); - linePoint.append(QPoint(x,y)); - } - - - if(col == RED){ - redALLPoint.clear(); - for(int i = 0; i < linePoint.size(); i++) - redALLPoint.append(linePoint.at(i).y()); - } - if(col == GREEN){ - greenALLPoint.clear(); - for(int i = 0; i < linePoint.size(); i++) - greenALLPoint.append(linePoint.at(i).y()); - } - if(col == BLUE){ - blueALLPoint.clear(); - for(int i = 0; i < linePoint.size(); i++) - blueALLPoint.append(linePoint.at(i).y()); - } - if(col == GRAY){ - grayALLPoint.clear(); - for(int i = 0; i < linePoint.size(); i++) - grayALLPoint.append(linePoint.at(i).y()); - } - if(col == RGB){ - rgbALLPoint.clear(); - for(int i = 0; i < linePoint.size(); i++) - { - rgbALLPoint.append(linePoint.at(i).y()); - } - } - - - for(int i = 0;i < len; i++){ - delete[] a[i]; - } - delete []a; -} - -void Widget::drawAllPoint(QPainter &painter) -{ - if(pointLst.size() > 0) - { - painter.setPen(QPen(Qt::white,1)); - painter.setBrush(Qt::white); - for(int i = 0; i < pointLst.size(); i++){ - painter.drawEllipse(pointLst.at(i),3,3); - } - if(dragPoint >= 0){ - painter.setPen(QPen(QColor(0, 245, 255),2)); - painter.drawEllipse(pointLst[dragPoint],4,4); - } - } - - if(selectCol == GREEN){ - greenLine.clear(); - greenLine = QList(pointLst); - } - else if(selectCol == RED){ - redLine.clear(); - redLine = QList(pointLst); - }else if(selectCol == BLUE){ - blueLine.clear(); - blueLine = QList(pointLst); - }else if(selectCol == RGB){ - rgbLine.clear(); - rgbLine = QList(pointLst); - }else if(selectCol == GRAY){ - grayLine.clear(); - grayLine = QList(pointLst); - } -} - -void Widget::drawCurveByColor(QPainter &painter) -{ - qDebug() << selectCol; - switch (selectCol) { - case RGB: - painter.setPen(QPen(Qt::white,1)); - drawLineFromPoint(rgbLine, RGB); - drawLineByVector(painter,rgbALLPoint); - if(redLine.size()>2 || redLine.at(0)!= QPoint(0,0) || redLine.at(1)!= QPoint(255,255)){ - painter.setPen(QPen(Qt::red,1)); - drawLineFromPoint(redLine,RED); - drawLineByVector(painter,redALLPoint); - } - if(blueLine.size()>2 || blueLine.at(0)!= QPoint(0,0) || blueLine.at(1)!= QPoint(255,255)){ - painter.setPen(QPen(Qt::blue,1)); - drawLineFromPoint(blueLine, BLUE); - drawLineByVector(painter,blueALLPoint); - } - if(greenLine.size()>2 || greenLine.at(0)!= QPoint(0,0) || greenLine.at(1)!= QPoint(255,255)){ - painter.setPen(QPen(Qt::green,1)); - drawLineFromPoint(greenLine, BLUE); - drawLineByVector(painter,greenALLPoint); - } - break; - case RED: - painter.setPen(QPen(Qt::red,1)); - drawLineFromPoint(redLine,RED); - drawLineByVector(painter,redALLPoint); - break; - case BLUE: - painter.setPen(QPen(Qt::blue,1)); - drawLineFromPoint(blueLine, BLUE); - drawLineByVector(painter,blueALLPoint); - break; - case GREEN: - painter.setPen(QPen(Qt::green,1)); - drawLineFromPoint(greenLine, GREEN); - drawLineByVector(painter,greenALLPoint); - break; - case GRAY: - painter.setPen(QPen(Qt::white,1)); - drawLineFromPoint(grayLine, GRAY); - drawLineByVector(painter,grayALLPoint); - break; - default: - break; - } - drawLineFromPoint(pointLst, -1); -} - -void Widget::drawLineByVector(QPainter &painter,QVector &pVec) -{ - for(int i = 0; i < pVec.size()-1; i++){ - painter.drawLine(QPoint(i,pVec.at(i)),QPoint(i+1,pVec.at(i+1))); - } - update(); -} - -int Widget::caculateAllMi(int num, int n) -{ - int val = 1; - if(n == 0) return 1; - for(int i = 0; i < n; i++){ - val *= num; - } - return val; -} - -void Widget::getCurLineLUT(uchar *table, size_t length) -{ - for(size_t i = 0; i < length; i++) - { - table[i] = allLinePoints[i]; - } -} - -QVector Widget::getCurLinePntVec() -{ - return linePoints; -} - -void Widget::updateCurLinePnt(const int& colType) -{ - dragPoint = -1; - selectCol = colType; - if(selectCol == GREEN){ - color = QColor(202, 255, 112); - pointLst.clear(); - pointLst = QList(greenLine); - ui->widget_2->setStyleSheet("QWidget{background-color:qlineargradient(" - "spread:pad, x1:0, y1:0, x2:1, y2:0, " - "stop:0 rgba(0, 0, 0, 255), stop:1 rgba(0, 255, 0, 255))}"); - ui->widget->setStyleSheet("QWidget{background-color:qlineargradient(" - "spread:pad, x1:0, y1:1, x2:0, y2:0, " - "stop:0 rgba(0, 0, 0, 255), stop:1 rgba(0, 255, 0, 255))}"); - }else if(selectCol == BLUE){ - color = QColor(131, 111, 255); - pointLst.clear(); - pointLst = QList(blueLine); - ui->widget_2->setStyleSheet("QWidget{background-color:qlineargradient(" - "spread:pad, x1:0, y1:0, x2:1, y2:0, " - "stop:0 rgba(0, 0, 0, 255), stop:1 rgba(0, 0, 255, 255))}"); - ui->widget->setStyleSheet("QWidget{background-color:qlineargradient(" - "spread:pad, x1:0, y1:1, x2:0, y2:0, " - "stop:0 rgba(0, 0, 0, 255), stop:1 rgba(0, 0, 255, 255))}"); - }else if(selectCol == RED){ - color = QColor(255, 160, 122); - pointLst.clear(); - pointLst = QList(redLine); - ui->widget_2->setStyleSheet("QWidget{background-color:qlineargradient(" - "spread:pad, x1:0, y1:0, x2:1, y2:0, " - "stop:0 rgba(0, 0, 0, 255), stop:1 rgba(255, 0, 0, 255))}"); - ui->widget->setStyleSheet("QWidget{background-color:qlineargradient(" - "spread:pad, x1:0, y1:1, x2:0, y2:0, " - "stop:0 rgba(0, 0, 0, 255), stop:1 rgba(255, 0, 0, 255))}"); - }else if(selectCol == GRAY){ - color = Qt::gray; - pointLst.clear(); - pointLst = QList(grayLine); - ui->widget_2->setStyleSheet("QWidget{background-color:qlineargradient(" - "spread:pad, x1:0, y1:0, x2:1, y2:0, " - "stop:0 rgba(0, 0, 0, 255), stop:1 rgba(255, 255, 255, 255))}"); - ui->widget->setStyleSheet("QWidget{background-color:qlineargradient(" - "spread:pad, x1:0, y1:1, x2:0, y2:0, " - "stop:0 rgba(0, 0, 0, 255), stop:1 rgba(255, 255, 255, 255))}"); - }else if(selectCol == RGB){ - color = Qt::gray; - pointLst.clear(); - pointLst = QList(rgbLine); - ui->widget_2->setStyleSheet("QWidget{background-color:qlineargradient(" - "spread:pad, x1:0, y1:0, x2:1, y2:0, " - "stop:0 rgba(0, 0, 0, 255), stop:1 rgba(255, 255, 255, 255))}"); - ui->widget->setStyleSheet("QWidget{background-color:qlineargradient(" - "spread:pad, x1:0, y1:1, x2:0, y2:0, " - "stop:0 rgba(0, 0, 0, 255), stop:1 rgba(255, 255, 255, 255))}"); - } - update(); -} - -void Widget::setXCoorVal(const int &xVal) -{ - if(dragPoint >= 0){ - int x = xVal; - if(pointLst[dragPoint] != pointLst.at(0) && pointLst[dragPoint] != pointLst.at(1)){ - if(pointLst.size() == 3 && x > pointLst.at(0).x() && x < pointLst.at(1).x()) - pointLst[dragPoint].setX(x); - - if(pointLst.size() == 4){ - if(dragPoint == 2){ - if(pointLst[2].x() > pointLst[3].x() && x > pointLst[3].x() && x < pointLst[1].x()) - pointLst[dragPoint].setX(x); - if(pointLst[2].x() < pointLst[3].x() && x < pointLst[3].x() && x > pointLst[0].x()) - pointLst[dragPoint].setX(x); - } - else if(dragPoint == 3){ - if(pointLst[2].x() < pointLst[3].x() && x > pointLst[2].x() && x < pointLst[1].x()) - pointLst[dragPoint].setX(x); - if(pointLst[2].x() > pointLst[3].x() && x < pointLst[2].x() && x > pointLst[0].x()) - pointLst[dragPoint].setX(x); - } - } - } - else if(pointLst[dragPoint] == pointLst.at(0)){ - int min = 999; - for(int i = 1; i < pointLst.size(); i++){ - if(min > pointLst[i].x()) min = pointLst[i].x(); - } - if(x < min) pointLst[dragPoint].setX(x); - } - else if(pointLst[dragPoint] == pointLst.at(1)){ - if(pointLst.size() > 2){ - int max = 0; - for(int i = 2; i < pointLst.size(); i++){ - if(max < pointLst[i].x()) max = pointLst[i].x(); - } - if(x > max) pointLst[dragPoint].setX(x); - } - else if(pointLst.size() <= 2) - if(x > pointLst.at(0).x()) pointLst[dragPoint].setX(x); - } - update(); - } -} - -void Widget::setYCoorVal(const int &yVal) -{ - if(dragPoint >= 0){ - pointLst[dragPoint].setY(yVal); - update(); - } -} - -void Widget::initSelectColLine(const int& colType) -{ - pointLst.clear(); - pointLst.append(QPoint(0,0)); - pointLst.append(QPoint(255,255)); - switch(colType){ - case RED: - redLine.clear(); - redLine.append(QPoint(0,0)); - redLine.append(QPoint(255,255)); - break; - case BLUE: - blueLine.clear(); - blueLine.append(QPoint(0,0)); - blueLine.append(QPoint(255,255)); - break; - case GREEN: - greenLine.clear(); - greenLine.append(QPoint(0,0)); - greenLine.append(QPoint(255,255)); - break; - case GRAY: - grayLine.clear(); - grayLine.append(QPoint(0,0)); - grayLine.append(QPoint(255,255)); - break; - case RGB: - initAllLstPnt(); - break; - } - dragPoint = -1; - leftMouseMv = false; - newPoint = false; - clickLine = false; - setMouseTracking(true); - qDebug() << "init"; - updateCurLinePnt(colType); -} - -void Widget::SetAllLinePnt(QVector &all) -{ - allLinePntSet = QVector(all); -} - diff --git a/app/scanner/widget.h b/app/scanner/widget.h deleted file mode 100644 index 0ff62115..00000000 --- a/app/scanner/widget.h +++ /dev/null @@ -1,132 +0,0 @@ -#ifndef WIDGET_H -#define WIDGET_H - -#include -#include -//#include "colorlinesetdef.h" - -namespace Ui { -class Widget; -} -// -//enum COLOR_TPYE -//{ -// RGB, -// GRAY, -// RED, -// BLUE, -// GREEN -//}; - -class Widget : public QWidget -{ - Q_OBJECT - -public: - explicit Widget(QWidget *parent = nullptr); - ~Widget(); - void initAllLstPnt(); //初始化所有颜色曲线 - void setLstPnt_RGB(const QList& plst); //设置生成RGB曲线的关键点(<=4) - QList getLstPnt_RGB()const; //获取生成RGB曲线的关键点 - void setLstPnt_RED(const QList& plst); - QList getLstPnt_RED()const; - void setLstPnt_BLUE(const QList& plst); - QList getLstPnt_BLUE()const; - void setLstPnt_GREEN(const QList& plst); - QList getLstPnt_GREEN()const; - void setLstPnt_GRAY(const QList& plst); - QList getLstPnt_GRAY()const; - - QVector getRgbALLPoint(); - QList getRgbKeyPoint()const; - void setRgbKeyPoint(const QList& pVec); - QVector getRedALLPoint(); - QList getRedKeyPoint()const; - void setRedKeyPoint(const QList& pVec); - QVector getBlueALLPoint(); - QList getBlueKeyPoint()const; - void setBlueKeyPoint(const QList& pVec); - QVector getGreenALLPoint(); - QList getGreenKeyPoint()const; - void setGreenKeyPoint(const QList& pVec); - QVector getGrayALLPoint(); - QList getGrayKeyPoint()const; - void setGrayKeyPoint(const QList& pVec); - - void setHist_RGB(const QVector& hist);//设置RGB的背景直方图 - QVector getHist_RGB()const;//获取RGB的背景直方图 - void setHist_RED(const QVector& hist); - QVector getHist_RED()const; - void setHist_BLUE(const QVector& hist); - QVector getHist_BLUE()const; - void setHist_GREEN(const QVector& hist); - QVector getHist_GREEN()const; - void setHist_GRAY(const QVector& hist); - QVector getHist_GRAY()const; - - void getCurLineLUT(uchar* table, size_t length = 256);//获取当前曲线上的所有点并存入table - QVector getCurLinePntVec();//获取当前曲线上的所有点 - void setXCoorVal(const int &xVal);//设置被选中的点的X坐标 - void setYCoorVal(const int &yVal);//设置被选中的点的Y坐标 - void updateCurLinePnt(const int& colType);//根据当前所选颜色(colType)重绘界面 - void initSelectColLine(const int& colType);//初始化当前所选颜色(colType)界面的曲线 - void SetAllLinePnt(QVector& all);//设置自定义曲线的所有点 - -signals: - void dragPointChecked(bool);//曲线上的点被选中的信号 - void mouseLeaveSig();//鼠标离开控件的信号 - void mouseCoordSig(QPoint pos);//鼠标的坐标信号 - void lineChangeSig(); - -private: - void initInterface();//初始化界面 - void paintEvent(QPaintEvent *); - void mousePressEvent(QMouseEvent*); - void mouseMoveEvent(QMouseEvent*); - void mouseReleaseEvent(QMouseEvent*); - void enterEvent(QEvent*); - void leaveEvent(QEvent*); - void drawCoordinate(QPainter&);//画直角坐标 - void drawBackgroudColor(QPainter&,QVector&);//画背景直方图 - void drawBackColorBySlc(QPainter&);//画不同的背景直方图 - void drawCoorScale(QPainter&);//画虚线刻度 - void drawLineFromPoint(QList &plst, const int &col);//根据多点求出曲线方程,并画出曲线 - void drawAllPoint(QPainter&);//画出生成曲线的关键点 - void drawCurveByColor(QPainter&);//画不同的颜色曲线 - void drawLineByVector(QPainter&,QVector&);//将数组的所有点连接绘制曲线 - int caculateAllMi(int num,int n);//计算num的n次方的值 - -private: - Ui::Widget *ui; - QVector rgbBackColor; - QVector redBackColor; - QVector blueBackColor; - QVector greenBackColor; - QVector grayBackColor; - QVector rgbALLPoint; - QVector redALLPoint; - QVector blueALLPoint; - QVector greenALLPoint; - QVector grayALLPoint; - QVector allLinePntSet; - QVector linePoints; - - //QList points; - QList pointLst; - QList linePoint; - QList greenLine; - QList redLine; - QList blueLine; - QList rgbLine; - QList grayLine; - QColor color; - - unsigned char allLinePoints[256]; - bool leftMouseMv; - bool newPoint; - bool clickLine; - int dragPoint; - int selectCol; -}; - -#endif // WIDGET_H diff --git a/app/scanner/widget.ui b/app/scanner/widget.ui deleted file mode 100644 index aaf5af1c..00000000 --- a/app/scanner/widget.ui +++ /dev/null @@ -1,91 +0,0 @@ - - - Widget - - - - 0 - 0 - 556 - 484 - - - - Widget - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - 0 - 0 - - - - true - - - Qt::WheelFocus - - - QWidget{background-color:qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(255, 255, 255, 255))} - - - - - - - - 0 - 20 - - - - true - - - Qt::NoFocus - - - - - - - - 0 - 0 - - - - QWidget{background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(255, 255, 255, 255))} - - - - - - - - - diff --git a/build2/qt/HGScanner/HGScanner.pro b/build2/qt/HGScanner/HGScanner.pro index db6b1a2f..fb93ccec 100644 --- a/build2/qt/HGScanner/HGScanner.pro +++ b/build2/qt/HGScanner/HGScanner.pro @@ -79,9 +79,9 @@ win32 { } LIBS += -lgdi32 -lgdiplus -ldbghelp -luser32 -ladvapi32 - LIBS += -L$$PWD/../../build/$${MY_OS}/$${OEM_NAME}/$${MY_ARCH}/$${MY_CONFIGURE} -l$${OEM_PREFIX}Base -l$${OEM_PREFIX}ImgFmt \ - -l$${OEM_PREFIX}ImgProc - LIBS += -L$$PWD/../../../../sdk/lib/win/$${MY_ARCH}/OEM/$${OEM_NAME} -lsane -llang + LIBS += -L$$PWD/../../build/$${MY_OS}/$${OEM_NAME}/$${MY_ARCH}/$${MY_CONFIGURE} -l$${OEM_PREFIX}Base -l$${OEM_PREFIX}ImgFmt -l$${OEM_PREFIX}ImgProc\ + -l$${OEM_PREFIX}TwainUI -l$${OEM_PREFIX}TwainUser + LIBS += -L$$PWD/../../../../sdk/lib/win/$${MY_ARCH}/OEM/$${OEM_NAME} -llang # sane.dll LIBS += -L$$PWD/../../../../release/win/$${MY_ARCH}/OEM/$${OEM_NAME} @@ -112,7 +112,7 @@ unix { MY_ARCH = loongarch64 MY_ARCH2 = loongarch64 } - +s CONFIG += unversioned_libname unversioned_soname QMAKE_CXXFLAGS += -fvisibility=hidden QMAKE_LFLAGS += -static-libstdc++ -static-libgcc @@ -120,9 +120,10 @@ unix { QMAKE_LFLAGS += -z defs -B direct LIBS += -lpthread -ldl - LIBS += -L$$PWD/../../build/$${MY_OS}/$${OEM_NAME}/$${MY_ARCH}/$${MY_CONFIGURE} -l$${OEM_PREFIX2}Base -l$${OEM_PREFIX2}ImgFmt \ - -l$${OEM_PREFIX2}ImgProc - LIBS += -L$$PWD/../../../../release/$${MY_OS}/$${MY_ARCH2} -lsane-$${OEM_PREFIX3}sane -llang + LIBS += -L$$PWD/../../build/$${MY_OS}/$${OEM_NAME}/$${MY_ARCH}/$${MY_CONFIGURE} -l$${OEM_PREFIX2}Base -l$${OEM_PREFIX2}ImgFmt -l$${OEM_PREFIX2}ImgProc\ + -l$${OEM_PREFIX2}SaneUI -l$${OEM_PREFIX2}SaneUser + + LIBS += -L$$PWD/../../../../release/$${MY_OS}/$${MY_ARCH2} -llang } INCLUDEPATH += $$PWD/../../../app/scanner @@ -186,11 +187,6 @@ SOURCES += \ ../../../app/scanner/HGUIGlobal.cpp \ ../../../app/scanner/VersionDll.cpp \ ../../../app/scanner/app_cfg.cpp \ - ../../../app/scanner/cfg/cJSON.c \ - ../../../app/scanner/cfg/gb_json.cpp \ - ../../../app/scanner/cutdialog.cpp \ - ../../../app/scanner/cutpapertool.cpp \ - ../../../app/scanner/device_menu.cpp \ ../../../app/scanner/dialog_admin.cpp \ ../../../app/scanner/dialog_aquireinto.cpp \ ../../../app/scanner/dialog_clrcache.cpp \ @@ -204,7 +200,6 @@ SOURCES += \ ../../../app/scanner/dialog_imgproc_autocrop.cpp \ ../../../app/scanner/dialog_input.cpp \ ../../../app/scanner/dialog_insertindex.cpp \ - ../../../app/scanner/dialog_log.cpp \ ../../../app/scanner/dialog_logmanager.cpp \ ../../../app/scanner/dialog_moveto.cpp \ ../../../app/scanner/dialog_multirotate.cpp \ @@ -215,18 +210,12 @@ SOURCES += \ ../../../app/scanner/dialog_savemessagebox.cpp \ ../../../app/scanner/dialog_updateprogress.cpp \ ../../../app/scanner/dialog_upgrade.cpp \ - ../../../app/scanner/dialog_upgradefirmware.cpp \ ../../../app/scanner/dialog_writesettings.cpp \ ../../../app/scanner/dialog_wrong_img.cpp \ - ../../../app/scanner/gaosixy.cpp \ + ../../../app/scanner/device_user.cpp \ ../../../app/scanner/graphicsscene.cpp \ - ../../../app/scanner/hg_settingdialog.cpp \ ../../../app/scanner/main.cpp \ ../../../app/scanner/mainwindow.cpp \ - ../../../app/scanner/ocrPdf.cpp \ - ../../../app/scanner/sane_device.cpp \ - ../../../app/scanner/setpicclrtool.cpp \ - ../../../app/scanner/widget.cpp \ ../../../app/scanner/widget_imgproc_base.cpp \ ../../../app/scanner/widget_statusbar.cpp \ ../../../app/scanner/widget_imgproc_sidebar.cpp \ @@ -238,12 +227,6 @@ HEADERS += \ ../../../app/scanner/HGUIGlobal.h \ ../../../app/scanner/VersionDll.h \ ../../../app/scanner/app_cfg.h \ - ../../../app/scanner/cfg/cJSON.h \ - ../../../app/scanner/cfg/gb_json.h \ - ../../../app/scanner/custom_file_dialog.h \ - ../../../app/scanner/cutdialog.h \ - ../../../app/scanner/cutpapertool.h \ - ../../../app/scanner/device_menu.h \ ../../../app/scanner/dialog_admin.h \ ../../../app/scanner/dialog_aquireinto.h \ ../../../app/scanner/dialog_clrcache.h \ @@ -257,7 +240,6 @@ HEADERS += \ ../../../app/scanner/dialog_imgproc_autocrop.h \ ../../../app/scanner/dialog_input.h \ ../../../app/scanner/dialog_insertindex.h \ - ../../../app/scanner/dialog_log.h \ ../../../app/scanner/dialog_logmanager.h \ ../../../app/scanner/dialog_moveto.h \ ../../../app/scanner/dialog_multirotate.h \ @@ -268,25 +250,17 @@ HEADERS += \ ../../../app/scanner/dialog_savemessagebox.h \ ../../../app/scanner/dialog_updateprogress.h \ ../../../app/scanner/dialog_upgrade.h \ - ../../../app/scanner/dialog_upgradefirmware.h \ ../../../app/scanner/dialog_writesettings.h \ - ../../../app/scanner/dialog_wrong_img.h \ - ../../../app/scanner/gaosixy.h \ + ../../../app/scanner/dialog_wrong_img.h \ \ + ../../../app/scanner/device_user.h \ ../../../app/scanner/graphicsscene.h \ - ../../../app/scanner/hg_settingdialog.h \ ../../../app/scanner/mainwindow.h \ - ../../../app/scanner/ocrPdf.h \ - ../../../app/scanner/sane_device.h \ - ../../../app/scanner/setpicclrtool.h \ - ../../../app/scanner/widget.h \ ../../../app/scanner/widget_imgproc_base.h \ ../../../app/scanner/widget_statusbar.h \ ../../../app/scanner/widget_imgproc_sidebar.h \ ../../../utility/HGString.h FORMS += \ - ../../../app/scanner/cutdialog.ui \ - ../../../app/scanner/cutpapertool.ui \ ../../../app/scanner/dialog_admin.ui \ ../../../app/scanner/dialog_aquireinto.ui \ ../../../app/scanner/dialog_clrcache.ui \ @@ -300,7 +274,6 @@ FORMS += \ ../../../app/scanner/dialog_imgproc_autocrop.ui \ ../../../app/scanner/dialog_input.ui \ ../../../app/scanner/dialog_insertindex.ui \ - ../../../app/scanner/dialog_log.ui \ ../../../app/scanner/dialog_logmanager.ui \ ../../../app/scanner/dialog_moveto.ui \ ../../../app/scanner/dialog_multirotate.ui \ @@ -311,12 +284,9 @@ FORMS += \ ../../../app/scanner/dialog_savemessagebox.ui \ ../../../app/scanner/dialog_updateprogress.ui \ ../../../app/scanner/dialog_upgrade.ui \ - ../../../app/scanner/dialog_upgradefirmware.ui \ ../../../app/scanner/dialog_writesettings.ui \ ../../../app/scanner/dialog_wrong_img.ui \ ../../../app/scanner/mainwindow.ui \ - ../../../app/scanner/setpicclrtool.ui \ - ../../../app/scanner/widget.ui \ ../../../app/scanner/widget_imgproc_base.ui \ ../../../app/scanner/widget_statusbar.ui \ ../../../app/scanner/widget_imgproc_sidebar.ui