diff --git a/app/twaintest/TwainTest_zh_CN.qm b/app/twaintest/TwainTest_zh_CN.qm index 22a7bf43..4ed6ad93 100644 Binary files a/app/twaintest/TwainTest_zh_CN.qm and b/app/twaintest/TwainTest_zh_CN.qm differ diff --git a/app/twaintest/TwainTest_zh_CN.ts b/app/twaintest/TwainTest_zh_CN.ts index 6917aba9..fb1c41ae 100644 --- a/app/twaintest/TwainTest_zh_CN.ts +++ b/app/twaintest/TwainTest_zh_CN.ts @@ -6,7 +6,7 @@ MainWindow - Twain测试工具 + 华高Twain测试工具 @@ -54,47 +54,58 @@ 获取测试项当前值: - + + ShowUI + 设置界面 + + + menu_scan act_scan 扫描 - + act_selectDevice 选择设备源... - - + + No device connected 当前无设备连接 - + Device %1 is open 设备 %1 已连接 - - - + + + + Prompt 提示 - + Device source not found! 未找到设备源! - + + Input cannot be empty! + 输入不能为空! + + + Set successfully 设置成功 - + Set failed 设置失败 @@ -104,707 +115,937 @@ 获取失败 - + + (CAP_XFERCOUNT) + + + + + (ICAP_COMPRESSION) + + + + + (ICAP_PIXELTYPE) + + + + + (ICAP_UNITS) + + + + + (ICAP_XFERMECH) + + + + + (CAP_FEEDERENABLED) + + + + + (CAP_FEEDERLOADED) + + + + + (CAP_AUTOFEED) + + + + + (CAP_INDICATORS) + + + + + (CAP_PAPERDETECTABLE) + + + + + (CAP_UICONTROLLABLE) + + + + + (CAP_DEVICEONLINE) + + + + + (CAP_AUTOSCAN) + + + + + (CAP_DUPLEX) + + + + + (CAP_DUPLEXENABLED) + + + + + (CAP_ENABLEDSUIONLY) + + + + + (CAP_CUSTOMDSDATA) + + + + + (CAP_SERIALNUMBER) + + + + + (ICAP_BRIGHTNESS) + + + + + (ICAP_CONTRAST) + + + + + (ICAP_FILTER) + + + + + (ICAP_GAMMA) + + + + + (ICAP_IMAGEFILEFORMAT) + + + + + (ICAP_ORIENTATION) + + + + + (ICAP_PHYSICALWIDTH) + + + + + (ICAP_PHYSICALHEIGHT) + + + + + (ICAP_XNATIVERESOLUTION) + + + + + (ICAP_YNATIVERESOLUTION) + + + + + (ICAP_XRESOLUTION) + + + + + (ICAP_YRESOLUTION) + + + + + (ICAP_BITORDER) + + + + + (ICAP_PIXELFLAVOR) + + + + + (ICAP_PLANARCHUNKY) + + + + + (ICAP_ROTATION) + + + + + (ICAP_SUPPORTEDSIZES) + + + + + (ICAP_BITDEPTH) + + + + + (ICAP_AUTODISCARDBLANKPAGES) + + + + + (ICAP_AUTOMATICBORDERDETECTION) + + + + + (ICAP_AUTOMATICDESKEW) + + + + + (ICAP_AUTOMATICROTATE) + + + + + (ICAP_JpegQuality) + + + + + (ICAP_AutoSize) + + + + + (ICAP_AutomaticCropUsesFrame) + + + + + (ICAP_AutomaticColorEnabled) + + + + + (ICAP_AutomaticColorNonColorPixelType) + + + + + (ICAP_SupportedExtImageInfo) + + + + (FillBackground) (背景填充) - + (BackRotate180) (背面旋转180度) - + (ScrewDetectEnable) (歪斜检测) - + (EnhanceColor) (颜色增强) - + (DARK_SAMPLE) (深色样张) - + (FillHole) (穿孔移除) - + (ScrewLevel) (歪斜容忍度) - + (Sharpen) (锐化与模糊) - + (HardwareVersion) (硬件版本) - + (MultiOutputRed) (多流输出除红) - + (EnFold) (对折) - + (StableDetectEnable) (装订检测) - + (DiscardBlankVince) (跳过空白发票) - + (FillHoleRatio) (穿孔搜索范围) - + (SwitchFrontBack) (交换正反面) - + (HsvCorrect) (答题卡除红) - + (DogEarDelection) (折角检测) - + (FillBackgroundMode) (背景填充方式) - + (CroporDesaskewIndent) (边缘缩进) - + (CropNoise) (背景抗噪等级) - + (CroporDesaskewThreshold) (阈值) - + (DetachNoise) (黑白图像噪点优化) - + (DetachNoiseValue) (噪点优化尺寸) - + (SizeDetect) (尺寸检测) - + (LowPowerMode) (节能模式) - + (ENCODE) (编码) - + (CropModel) (裁切方式) - + (DogEarDistance) (折角大小) - + (ImageSplit) (图像拆分) - + (FadeBackground) (是否除背景色) - + (FADE_BKG_VALUE) (背景色范围) - + (TO_BE_SCAN) (待纸扫描) - + (MULTI_OUT) (是否开启多流输出) - + (MULTI_OUT_TYPE) (多流输出类型) - + (SCAN_WITH_HOLE) (是否开启带孔扫描) - + (IP) (获取设备IP) - + (is_multiout) (多流输出) - + (multiout_type) (多流输出类型) - + (color_mode) (颜色模式) - + erase_color (除色或增强) - + (erase_multiout_red) (多流输出除红) - + (erase_paper_red) (试卷除红) - + (is_erase_background) (背景移除) - + (background_color_range) (背景色彩范围) - + (sharpen) (锐化与模糊) - + (erase_morr) (除摩尔纹) - + (erase_grids) (除网纹) - + (error_extend) (错误扩散) - + (is_noise_modify) (噪点优化) - + (noise_threshold) (噪点优化尺寸) - + (paper) (纸张尺寸) - + (is_custom_area) (自定义扫描区域) - + (curstom_area_l) (自定义扫描区域 左) - + (curstom_area_r) (自定义扫描区域 右) - + (curstom_area_t) (自定义扫描区域 上) - + (curstom_area_b) (自定义扫描区域 下) - + (is_size_check) (尺寸检测) - + (page) (扫描页面) - + (blank_page_threshold) (跳过空白页灵敏度) - + (resolution) (分辨率) - + (image_quality) (图像质量) - + (is_swap) (交换正反面) - + (is_split) (图像拆分) - + (is_auto_deskew) (自动纠偏) - + (is_custom_gamma) (自定义gamma) - + (bright) (亮度) - + (contrast) (对比度) - + (gamma) (gamma) - + (is_erase_black_frame) (消除黑框) - + (deep_sample) (深色样张) - + (threshold) (阈值) - + (anti_noise) (背景抗噪等级) - + (margin) (边缘缩进) - + (fill_background) (背景填充方式) - + (is_anti_permeate) (防止渗透) - + (anti_permeate_level) (防止渗透等级) - + (is_filling_color) (色彩填充) - + (is_ultrasonic_check) (超声波检测) - + (is_check_staple) (装订检测) - + (scan_mode) (扫描张数) - + (scan_count) (扫描数量) - + (text_direction) (文稿方向) - + (is_rotate_bkg180) (背面旋转180度) - + (is_check_dogear) (折角检测) - + (dogear_size) (折角检测大小) - + (is_check_skew) (歪斜检测) - + (skew_range) (歪斜容忍度) - + (black_white_threshold) (转为黑白图像时的阈值) - + (is_photo_mode) (照片模式) - + (double_feed_handle) (双张图片处理方式) - + (scan_when_paper_on) (待纸扫描) - + (feed_strength) (分纸强度) - + (power_scheme) (休眠时间) - + (is_auto_strength) (是否自动调节搓纸强度) - + (feed_strength_value) (搓纸阈值) - + (is_reverse_bw) (黑白图像是否反色输出) - + (is_erase_hole_l) (穿孔移除—左侧) - + (search_hole_range_l) (左侧穿孔搜索范围) - + (is_erase_hole_r) (穿孔移除—右侧) - + (search_hole_range_r) (右侧穿孔搜索范围) - + (is_erase_hole_t) (穿孔移除—上侧) - + (search_hole_range_t) (上侧穿孔搜索范围) - + (is_erase_hole_b) (穿孔移除—下侧) - + (search_hole_range_b) (下侧穿孔搜索范围) - + (fold_direction) (对折模式) - + (color_correction) (色偏校正) - + (history_count) (历史张数-Get) - + (driver_version) (驱动版本-Get) - + (manufacturer) (制造商/开发商-Get) - + (copyright) (版权信息-Get) - + (company_url) (公司网址-Get) - + (company_tel) (公司电话-Get) - + (company_addr) (公司地址-Get) - + (gps) (公司地图定位-Get) - + (help) (显示帮助文档-Get) - + (dev_vid) (获取设备VID-Get) - + (dev_pid) (获取设备PID-Get) - + (dev_name) (获取设备名称-Get) - + (dev_family) (获取设备型号-Get) - + (Device_sn) (获取设备序列号-Get) - + (Firm_ver) (获取设备固件版本-Get) - + (IP_addr) (获取设备IP-Get) - + (MAC_addr) (获取设备MAC-Get) - + (CUSTOM_GAMMA) (自定义GAMMA) - + (ROLLER_LIFE) (滚轴寿命) - + (LANGUAGE) (语言环境) - + (MOTOR_VER) (电机固件版本) - + (PAPER_ON) (是否有纸张) - + (GRAY_GAMMA) (自定义GAMMA,灰度分量) - + (COLOR_GAMMA) (自定义GAMMA,彩色分量) - + (RED_GAMMA) (自定义GAMMA,红色分量) - + (GREEN_GAMMA) (自定义GAMMA,绿色分量) - + (BLUE_GAMMA) (自定义GAMMA,蓝色分量) - + (INITIAL_BOOT_TIME) (获取初始开机时间) - + (DISCARDBLANK) (跳过空白页) - + (LENS_DIRTY) (设备镜头脏污检测) - + (login) (用户登录-Set) - + (logout) (用户登出-Set) - + (roller_count) (滚轴计数-Get/Reset) - + (driver_log) (驱动日志-Get/Reset) - + (device_log) (设备日志-Get/Reset) diff --git a/app/twaintest/mainwindow.cpp b/app/twaintest/mainwindow.cpp index 05e9ec07..3c97efaf 100644 --- a/app/twaintest/mainwindow.cpp +++ b/app/twaintest/mainwindow.cpp @@ -16,7 +16,6 @@ MainWindow::MainWindow(QWidget *parent) , m_cacheUuid("") { ui->setupUi(this); - this->setWindowIcon(QIcon(":images/image_rsc/logo/logo.ico")); HGChar cacheUuid[256] = { 0 }; HGBase_GetUuid(cacheUuid, 256); @@ -26,12 +25,10 @@ MainWindow::MainWindow(QWidget *parent) initCapbility(); QStringList capTypes = { "TWTY_INT8", "TWTY_UINT8", "TWTY_INT16", "TWTY_UINT16", "TWTY_INT32", "TWTY_UINT32", "TWTY_BOOL","TWTY_FIX32", - "TWTY_STR32", "TWTY_STR64", "TWTY_STR128", "TWTY_STR255" }; + "TWTY_STR32", "TWTY_STR64", "TWTY_STR128", "TWTY_STR255", "UNSUPPORTED" }; ui->comboBox_capType->addItems(capTypes); ui->comboBox_capType->setCurrentIndex(0); - ui->comboBox_capType->setEditable(true); - ui->comboBox_setCap->setEditable(true); ui->label_deviceStatus->setText(tr("No device connected")); HGTwain_CreateDSM((HWND)this->winId(), &m_twainDSM); @@ -97,6 +94,12 @@ void MainWindow::on_act_selectDevice_triggered() void MainWindow::on_pushButton_setCap_clicked() { + if (ui->lineEdit_setCapContent->text().isEmpty()) + { + QMessageBox::information(this, tr("Prompt"), tr("Input cannot be empty!")); + return; + } + QString capCode = ui->comboBox_setCap->currentText(); bool ok = false; HGUShort cap = capCode.left(6).toInt(&ok, 16); @@ -178,11 +181,127 @@ void MainWindow::on_pushButton_getCap_clicked() } } +void MainWindow::on_pushButton_showUI_clicked() +{ + HGTwain_EnableDSUIOnly(m_twainDS, (HWND)this->winId(), DSEventFunc, this); +} + void MainWindow::on_pushButton_scan_clicked() { HGTwain_EnableDS(m_twainDS, HGFALSE, (HWND)this->winId(), DSEventFunc, this, DSImageFunc, this); } +void MainWindow::on_comboBox_setCap_currentTextChanged(const QString &arg1) +{ + bool ok = false; + HGUShort cap = arg1.left(6).toInt(&ok, 16); + + HGCapValue value; + HGResult ret = HGTwain_GetCapbility(m_twainDS, cap, &value); + if (ret != HGBASE_ERR_OK) + { + return; + } + + if (value.type == HGCAPVALUE_TYPE_CHAR) + { + for (int i = 0; i < ui->comboBox_capType->count(); i++) + { + if (ui->comboBox_capType->itemText(i) == "TWTY_INT8") + ui->comboBox_capType->setCurrentIndex(i); + } } + else if (value.type == HGCAPVALUE_TYPE_BYTE) + { + for (int i = 0; i < ui->comboBox_capType->count(); i++) + { + if (ui->comboBox_capType->itemText(i) == "TWTY_UINT8") + ui->comboBox_capType->setCurrentIndex(i); + } } + else if (value.type == HGCAPVALUE_TYPE_SHORT) + { + for (int i = 0; i < ui->comboBox_capType->count(); i++) + { + if (ui->comboBox_capType->itemText(i) == "TWTY_INT16") + ui->comboBox_capType->setCurrentIndex(i); + } } + else if (value.type == HGCAPVALUE_TYPE_USHORT) + { + for (int i = 0; i < ui->comboBox_capType->count(); i++) + { + if (ui->comboBox_capType->itemText(i) == "TWTY_UINT16") + ui->comboBox_capType->setCurrentIndex(i); + } } + else if (value.type == HGCAPVALUE_TYPE_INT) + { + for (int i = 0; i < ui->comboBox_capType->count(); i++) + { + if (ui->comboBox_capType->itemText(i) == "TWTY_INT32") + ui->comboBox_capType->setCurrentIndex(i); + } } + else if (value.type == HGCAPVALUE_TYPE_UINT) + { + for (int i = 0; i < ui->comboBox_capType->count(); i++) + { + if (ui->comboBox_capType->itemText(i) == "TWTY_UINT32") + ui->comboBox_capType->setCurrentIndex(i); + } } + else if (value.type == HGCAPVALUE_TYPE_BOOL) + { + for (int i = 0; i < ui->comboBox_capType->count(); i++) + { + if (ui->comboBox_capType->itemText(i) == "TWTY_BOOL") + ui->comboBox_capType->setCurrentIndex(i); + } } + else if (value.type == HGCAPVALUE_TYPE_FLOAT) + { + for (int i = 0; i < ui->comboBox_capType->count(); i++) + { + if (ui->comboBox_capType->itemText(i) == "TWTY_FIX32") + ui->comboBox_capType->setCurrentIndex(i); + } + } + else if (value.type == HGCAPVALUE_TYPE_STR32) + { + for (int i = 0; i < ui->comboBox_capType->count(); i++) + { + if (ui->comboBox_capType->itemText(i) == "TWTY_STR32") + ui->comboBox_capType->setCurrentIndex(i); + } + } + else if (value.type == HGCAPVALUE_TYPE_STR64) + { + for (int i = 0; i < ui->comboBox_capType->count(); i++) + { + if (ui->comboBox_capType->itemText(i) == "TWTY_STR64") + ui->comboBox_capType->setCurrentIndex(i); + } + } + else if (value.type == HGCAPVALUE_TYPE_STR128) + { + for (int i = 0; i < ui->comboBox_capType->count(); i++) + { + if (ui->comboBox_capType->itemText(i) == "TWTY_STR128") + ui->comboBox_capType->setCurrentIndex(i); + } + } + else if (value.type == HGCAPVALUE_TYPE_STR255) + { + for (int i = 0; i < ui->comboBox_capType->count(); i++) + { + if (ui->comboBox_capType->itemText(i) == "TWTY_STR255") + ui->comboBox_capType->setCurrentIndex(i); + } + } + else + { + for (int i = 0; i < ui->comboBox_capType->count(); i++) + { + if (ui->comboBox_capType->itemText(i) == "UNSOPPORTED") + ui->comboBox_capType->setCurrentIndex(i); + } + } +} + void MainWindow::on_newImage(void *image) { HGImage img = nullptr; @@ -498,6 +617,7 @@ void MainWindow::updateUiEnable(bool enable) ui->pushButton_setCap->setEnabled(enable); ui->pushButton_getCap->setEnabled(enable); ui->pushButton_scan->setEnabled(enable); + ui->pushButton_showUI->setEnabled(enable); } QString MainWindow::getDeviceName() diff --git a/app/twaintest/mainwindow.h b/app/twaintest/mainwindow.h index 5a9fc4cd..c336c57b 100644 --- a/app/twaintest/mainwindow.h +++ b/app/twaintest/mainwindow.h @@ -24,8 +24,12 @@ private slots: void on_pushButton_getCap_clicked(); + void on_pushButton_showUI_clicked(); + void on_pushButton_scan_clicked(); + void on_comboBox_setCap_currentTextChanged(const QString &arg1); + signals: void newImage(void *image); void clearRes(); diff --git a/app/twaintest/mainwindow.ui b/app/twaintest/mainwindow.ui index 9967b621..dfc74e21 100644 --- a/app/twaintest/mainwindow.ui +++ b/app/twaintest/mainwindow.ui @@ -171,6 +171,19 @@ + + + + 160 + 400 + 101 + 41 + + + + ShowUI + + diff --git a/build2/qt/HGTwainTest/HGTwainTest.pro b/build2/qt/HGTwainTest/HGTwainTest.pro index 5045630e..eeda54cc 100644 --- a/build2/qt/HGTwainTest/HGTwainTest.pro +++ b/build2/qt/HGTwainTest/HGTwainTest.pro @@ -21,6 +21,8 @@ DEFINES += QT_NO_VERSION_TAGGING include($$PWD/../HGOEM.pri) +RC_ICONS = ../../../app/twaintest/image_rsc/logo/logo.ico + CONFIG(debug, debug|release) { MY_CONFIGURE = Debug }