diff --git a/modules/twainui/TwainUI_zh_CN.qm b/modules/twainui/TwainUI_zh_CN.qm index 5b3ae495..df1f7049 100644 Binary files a/modules/twainui/TwainUI_zh_CN.qm and b/modules/twainui/TwainUI_zh_CN.qm differ diff --git a/modules/twainui/TwainUI_zh_CN.ts b/modules/twainui/TwainUI_zh_CN.ts index fb3c2bb7..53646b07 100644 --- a/modules/twainui/TwainUI_zh_CN.ts +++ b/modules/twainui/TwainUI_zh_CN.ts @@ -1513,21 +1513,46 @@ Please make sure the two passwords are the same. Dialog_progress_ui - + Dialog 扫描状态 - + + image recived: + 接收图片: + + + + total image recived: + 总计图片接收数: + + + + image uploaded: + 上传图片: + + + + total image uploaded: + 总计图片上传数: + + + Cancel Scan 取消扫描 - + Close close 关闭 + + + Total scanned images: %1 + 总计图片扫描数:%1 + Dialog_updateProgress @@ -2618,7 +2643,7 @@ Are you sure to close? Manager - + Prompt 提示 @@ -2794,130 +2819,130 @@ Are you sure to close? 删除配置 - + existing configuration scheme 现有配置方案: - + change name 改名 - + delete 删除 - + apply 应用 - + delete all configurations 删除所有配置 - + confgiuration information: 配置信息: - + about... 关于... - + scan 扫描 - - + + ok 确定 - + cancel 取消 - + configuration scheme management 配置方案管理 - + regional crop 区域裁剪 - + custom tone curve 自定义色调曲线 - + about 关于 - - - - + + - + + + Not supported 不支持 - + <p>Device model: %1</p> <p>设备型号: %1</p> - + <p>Driver version: %1</p> <p>驱动版本号: %1</p> - + <p>Firmware number: %1</p> <p>设备固件版本号: %1</p> - + <p>Serial number: %1</p> <p>设备序列号: %1</p> - - - + + + <p>Roller count: %1</p> <p>设备滚轴计数: %1</p> - + <p>History count: %1</p> <p>设备历史扫描张数: %1</p> - + Please select to overwrite the original configuration: 请选择覆盖原来的配置: - + ,or add a new configuration ,或者新增配置 - + save the configuration 保存配置 @@ -2951,82 +2976,82 @@ No: add new configuration - + <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> - + <p> <p> - + </p> </p> - + configuration scheme name change 配置改名 - - + + be sure to delete the configuration 确认删除配置 - + Are you sure you want to delete the configuration " 您确认要删除配置 - + " ? @@ -3039,7 +3064,7 @@ No: add new configuration ’ 吗? - + Are you sure you want to delete the configuration? 您确认要删除所有配置吗? diff --git a/modules/twainui/TwainUI_zh_EN.qm b/modules/twainui/TwainUI_zh_EN.qm index 453d99ba..35cffade 100644 Binary files a/modules/twainui/TwainUI_zh_EN.qm and b/modules/twainui/TwainUI_zh_EN.qm differ diff --git a/modules/twainui/TwainUI_zh_EN.ts b/modules/twainui/TwainUI_zh_EN.ts index 4ff9e0bd..570769d5 100644 --- a/modules/twainui/TwainUI_zh_EN.ts +++ b/modules/twainui/TwainUI_zh_EN.ts @@ -1390,21 +1390,46 @@ Please make sure the two passwords are the same. Dialog_progress_ui - + Dialog Scan status - + + image recived: + Image recived: + + + + total image recived: + Total image recived: + + + + image uploaded: + Image uploaded: + + + + total image uploaded: + Total image uploaded: + + + Cancel Scan 取消扫描 - + Close close Close + + + Total scanned images: %1 + Total scanned images: %1 + Dialog_updateProgress @@ -2322,7 +2347,7 @@ Please go to “Scan to” and change the accessible scan folder and then perfor Manager - + Prompt Prompt @@ -2453,210 +2478,210 @@ Please go to “Scan to” and change the accessible scan folder and then perfor hg_settingdialog - + existing configuration scheme Existing configuration plan: - + change name Rename - + delete Delete - + apply Apply - + delete all configurations Delete all configurations - + confgiuration information: Configuration information: - + about... About... - + scan Scan - - + + ok OK - + cancel Cancel - + configuration scheme management Configuration plan management - + regional crop Regional crop - + custom tone curve Custom tone curve - + about About - - - - + + - + + + Not supported Not supported - + <p>Device model: %1</p> <p>Device model: %1</p> - + <p>Driver version: %1</p> <p>Driver version: %1</p> - + <p>Firmware number: %1</p> <p>Firmware number: %1</p> - + <p>Serial number: %1</p> <p>Serial number: %1</p> - - - + + + <p>Roller count: %1</p> <p>Roller count: %1</p> - + <p>History count: %1</p> <p>History count: %1</p> - + Please select to overwrite the original configuration: Please select overwrite original configuration: - + ,or add a new configuration , or add new configuration - + save the configuration Save configuration - + cover original configuration: Overwrite original configuration: - + add new configuration Add new configuration - + rename: Rename: - - - + + + tips Prompt - + scheme name cannot be empty Configuration name cannot be blank - - + + scheme name: Configuration name: - - + + already exists already exists - + <h6><b> <h6><b> - + :</b></h6> :</b></h6> - + <p> <p> - + </p> </p> - + configuration scheme name change Rename configuration - - + + be sure to delete the configuration Delete configuration - + Are you sure you want to delete the configuration " Are you sure you want to delete configuration - + " ? ? @@ -2669,7 +2694,7 @@ 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? diff --git a/modules/twainui/dialog_progress_ui.cpp b/modules/twainui/dialog_progress_ui.cpp index 4c17d74e..24c19cf5 100644 --- a/modules/twainui/dialog_progress_ui.cpp +++ b/modules/twainui/dialog_progress_ui.cpp @@ -8,6 +8,9 @@ Dialog_progress_ui *Dialog_progress_ui::m_param = nullptr; +static int imageRecivedCount = 0; +static int imageUploadedCount = 0; + Dialog_progress_ui::Dialog_progress_ui(std::function callback, std::function *notify, QWidget *parent) : QDialog(parent), ui(new Ui::Dialog_progress_ui) @@ -17,11 +20,21 @@ Dialog_progress_ui::Dialog_progress_ui(std::function callback, ui->setupUi(this); - setWindowFlags(Qt::SubWindow | Qt::Popup); + setWindowFlags(Qt::SubWindow | Qt::Popup | Qt::WindowStaysOnTopHint); ui->pbtn_cancelScan->setVisible(false); ui->pbtn_close->setVisible(false); + ui->label_imgRecived->setVisible(false); + ui->lineEdit_imgRecived->setVisible(false); + ui->label_totalImgRecived->setVisible(false); + ui->lineEdit_imgRecived->setText(QString::number(imageRecivedCount)); + + ui->label_imgUploaded->setVisible(false); + ui->lineEdit_imgUploaded->setVisible(false); + ui->label_totalImgUploaded->setVisible(false); + ui->lineEdit_imgUploaded->setText(QString::number(imageUploadedCount)); + m_callback = callback; *notify = FuncNotify; @@ -31,12 +44,17 @@ Dialog_progress_ui::Dialog_progress_ui(std::function callback, connect(this, SIGNAL(scan_status(QString,bool)), this, SLOT(on_scan_status(QString,bool)), Qt::QueuedConnection); connect(this, SIGNAL(scan_finish(int, QString)), this, SLOT(on_scan_finish(int, QString)), Qt::QueuedConnection); + connect(this, SIGNAL(image_uploaded()), this, SLOT(on_image_uploaded()), Qt::QueuedConnection); + connect(this, SIGNAL(image_recived()), this, SLOT(on_image_recived()), Qt::QueuedConnection); } Dialog_progress_ui::~Dialog_progress_ui() { m_param = nullptr; + imageRecivedCount = 0; + imageUploadedCount = 0; + delete ui; } @@ -69,6 +87,12 @@ void Dialog_progress_ui::on_pbtn_close_clicked() void Dialog_progress_ui::on_scan_status(QString finishInfo, bool isScanning) { m_isScanning = isScanning; + + ui->label_imgRecived->setVisible(isScanning); + ui->lineEdit_imgRecived->setVisible(isScanning); + ui->label_imgUploaded->setVisible(isScanning); + ui->lineEdit_imgUploaded->setVisible(isScanning); + ui->label->setText(finishInfo); ui->pbtn_cancelScan->setVisible(isScanning); ui->pbtn_close->setVisible(!isScanning); @@ -77,6 +101,10 @@ void Dialog_progress_ui::on_scan_status(QString finishInfo, bool isScanning) void Dialog_progress_ui::on_scan_finish(int flag, QString finishInfo) { on_scan_status(finishInfo, false); + + ui->label_totalImgUploaded->setVisible(true); + ui->label_totalImgUploaded->setText(tr("Total scanned images: %1").arg(QString::number(imageRecivedCount))); + if (SCANNER_ERR_OK == flag || SCANNER_ERR_USER_CANCELED == flag) { m_timer->start(2000); @@ -84,6 +112,16 @@ void Dialog_progress_ui::on_scan_finish(int flag, QString finishInfo) } } +void Dialog_progress_ui::on_image_recived() +{ + ui->lineEdit_imgRecived->setText(QString::number(imageRecivedCount++)); +} + +void Dialog_progress_ui::on_image_uploaded() +{ + ui->lineEdit_imgUploaded->setText(QString::number(imageUploadedCount++)); +} + void Dialog_progress_ui::FuncNotify(int event, void *msg, int flag) { Dialog_progress_ui *p = (Dialog_progress_ui *)m_param; @@ -105,7 +143,18 @@ void Dialog_progress_ui::FuncNotify(int event, void *msg, int flag) { QString finishInfo((char*)msg); emit p->scan_finish(flag, finishInfo); - // emit p->scan_status(finishInfo, false); + } + break; + + case SANE_EVENT_IMAGE_OK: + { + emit p->image_recived(); + } + break; + + case SANE_EVENT_IMG_UPLOADED: + { + emit p->image_uploaded(); } break; } diff --git a/modules/twainui/dialog_progress_ui.h b/modules/twainui/dialog_progress_ui.h index e1629cac..71a42b5b 100644 --- a/modules/twainui/dialog_progress_ui.h +++ b/modules/twainui/dialog_progress_ui.h @@ -24,6 +24,8 @@ private: signals: void scan_status(QString finishInfo, bool isScanning); void scan_finish(int flag, QString finishInfo); + void image_recived(); + void image_uploaded(); private slots: void on_pbtn_cancelScan_clicked(); @@ -31,6 +33,8 @@ private slots: void on_scan_status(QString finishInfo, bool isScanning); void on_scan_finish(int flag, QString finishInfo); + void on_image_recived(); + void on_image_uploaded(); public: static void FuncNotify(int event, void *msg, int flag); diff --git a/modules/twainui/dialog_progress_ui.ui b/modules/twainui/dialog_progress_ui.ui index 625bf3a7..724f5a71 100644 --- a/modules/twainui/dialog_progress_ui.ui +++ b/modules/twainui/dialog_progress_ui.ui @@ -6,10 +6,16 @@ 0 0 - 324 + 353 156 + + + 0 + 0 + + 324 @@ -18,8 +24,8 @@ - 324 - 156 + 99999 + 999999 @@ -63,6 +69,158 @@ + + + + Qt::Vertical + + + + 20 + 14 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + image recived: + + + + + + + + 61 + 20 + + + + + 61 + 20 + + + + true + + + + + + + total image recived: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + image uploaded: + + + + + + + + 61 + 20 + + + + + 61 + 20 + + + + true + + + + + + + total image uploaded: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 11 + + + + diff --git a/modules/twainui/hg_settingdialog.cpp b/modules/twainui/hg_settingdialog.cpp index 4c3cacfe..0cec6976 100644 --- a/modules/twainui/hg_settingdialog.cpp +++ b/modules/twainui/hg_settingdialog.cpp @@ -108,7 +108,7 @@ hg_settingdialog::hg_settingdialog(SANE_Handle handle, const SANEAPI* saneApi, b initUi(); on_current_scheme_changed(); - getAppVersion(); + //getAppVersion(); } hg_settingdialog::~hg_settingdialog() diff --git a/modules/twainui/twainui.cpp b/modules/twainui/twainui.cpp index 6755168b..ae36dff7 100644 --- a/modules/twainui/twainui.cpp +++ b/modules/twainui/twainui.cpp @@ -94,14 +94,16 @@ char *apply_current_config(const char *dev_name, SANE_Handle device, LPSANEAPI a std::string name = curScheme->get_scheme_name(); char *str = const_cast(name.c_str()); - return str; + char *buf2 = new char[strlen(str) + 4]; + memcpy(buf2, str, sizeof(str)); + return buf2; } void twain_ui_free(void *buf) { if (buf != nullptr) { - delete buf; + delete[] buf; buf = nullptr; } }