From d232bd130a731c0c9b32e7ee0d32ce33b4632354 Mon Sep 17 00:00:00 2001 From: yangjiaxuan <171295266@qq.com> Date: Wed, 31 May 2023 15:31:04 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=AE=BE=E7=BD=AE=E7=95=8C?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/twainui/TwainUI_zh_CN.qm | Bin 4879 -> 5079 bytes modules/twainui/TwainUI_zh_CN.ts | 160 ++++++++++++++----------- modules/twainui/TwainUI_zh_EN.qm | Bin 8113 -> 8407 bytes modules/twainui/TwainUI_zh_EN.ts | 168 ++++++++++++++++----------- modules/twainui/dialog_input.cpp | 36 ++++-- modules/twainui/dialog_input.h | 2 + modules/twainui/hg_settingdialog.cpp | 131 ++++++++++----------- modules/twainui/hg_settingdialog.h | 3 +- 8 files changed, 287 insertions(+), 213 deletions(-) diff --git a/modules/twainui/TwainUI_zh_CN.qm b/modules/twainui/TwainUI_zh_CN.qm index 0110b10ab7cd46e2f5dfa4556b7e7566f79e4f23..9b15427837bcf47e552318a83e9548bc50338021 100644 GIT binary patch delta 884 zcmX|8dq`7p6h8O0UAMbCm6CjR6Uj6KqwHZX4a*cw;ppaQ%VHl_(f%Qj;T1MvR%*p=v@o`??ch2`~*fjwd%4gjcJ015F}2cUlM$Jz-{H`f68w}8649J6jO2AF^y{)HSZ zkiO#@0QmvNm)-#cgn|2IECBtP2)0iEu)W085C%;duX z#9CFvxe;72NL6Laa{%bVRkiIQ=<93M$|8KIsE5<|k zh8=MJ#W;>#euhY0^0QUqqB?`$d>az$1~rDYE_5hZ;~13?$F-f|KkzGVYKPW+M+eij zv$^=)TqbASauEMYTgBZQ<`Ad3r*CmUSEqBgenjCS{$x%ETGhx~%FqGgh2GS446UBi zFE(MUue9RF)+vc(Zz}r28SAq947%E7Lt=F`iwRKS3p-vc3I%pa7A09IFiV1DmxX*$ z5KBtsDz#@U#cHCCVB9P=(^g1lINGV(XO*hvb{$Q^Z1Zg-!M~#xg0QO_V(&;jFQ^aVAq}viRCH zD@9Q-+iZ%F3sJ_o2U~d$q1ab^Bxf$$l(os%8@+m3p|z-@%q&~&l2=4jlGzx=sq0X( Sd8ZPnZ&v>3ul6tj8uCAW4(-oy>G-k|;m}%#2V;WO&Ysn>Zr#Db_lj zL?pMene){|COhkFbpYlPdvkRT{6Y3s_9F6Sb}%s8O*r%)}$`o!kQzam#&f z)Yl2x_grY}6o3!#=CoS)Equd=eE=NcZ)88keA=?~Aqqt-)4;bm>(S^V-y6)wzTSvs zh9Z`26dbdA0JvV*ogc);vqIL_^RQ=xtUuSW;X9$u4RC%y2=xpjZWbM9Ujv{+tn&j< z*(ILtOaRD15dfHPJSKLh-o^%bV)x)V6g-x?3NGMe4ykt?8VZHdaPSv4Iw_6M;l!pg z>F*QxT!O)03sB{_Vg3#V80~UiTpLc?DF;S1T&Ps(wtvB<$;u1cXXsCdiP@B4$DGw7;MA`nsMF9KI}ii#TfJ-#tFT` zd{3{kbj9*TO*P39&O{=f;Hs$b*XhqJ3A)`HwDF#d{ibD6DJgYnUXQA|bY{gWz1`Xp zBVEl6X#XXtjnQ$6<|^~3k?f^j8PQF;Y_^DQkKa@635U{*PPN%xoar@$J1mcgk7TGW bzh5mW*N*zUHI=SvU%6HlF6w_3Ewldsy}86# diff --git a/modules/twainui/TwainUI_zh_CN.ts b/modules/twainui/TwainUI_zh_CN.ts index a812d3ec..4b6f4f18 100644 --- a/modules/twainui/TwainUI_zh_CN.ts +++ b/modules/twainui/TwainUI_zh_CN.ts @@ -1001,12 +1001,14 @@ Page range will be 'Chosen Pages'. 配置改名 + tips - 提示 + 提示 + The content can not be empty - 内容不能为空 + 内容不能为空 new name can not be empty @@ -1518,22 +1520,22 @@ Please make sure the two passwords are the same. 扫描状态 - + image recived: 接收图片: - + total image recived: 总计图片接收数: - + image uploaded: 上传图片: - + total image uploaded: 总计图片上传数: @@ -1554,12 +1556,12 @@ Please make sure the two passwords are the same. 开始扫描... - + stop scanning 停止扫描... - + Total scanned images: %1 总计图片扫描数:%1 @@ -2653,7 +2655,7 @@ Are you sure to close? Manager - + Prompt 提示 @@ -2829,133 +2831,139 @@ 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 保存配置 + + + Add new scheme + 新增配置 + + + + The configuration scheme already exists + 配置方案已存在 + The Settings you just set are in the original configuration " The Settings you just set are in the original configuration “ @@ -2986,82 +2994,100 @@ No: add new configuration - + <h6><b> <h6><b> - + cover original configuration: 覆盖原来配置: - + + + Default scheme + 默认配置 + + + + Add new + 新增 + + + + Delete + 删除 + + + + Delete all + 全部删除 + + + 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 " 您确认要删除配置 - + " ? @@ -3074,7 +3100,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 b5a4662295b34ba002239897180bc065c3f7d513..32543073cc54444bab375f664104bdf693c73ea2 100644 GIT binary patch delta 1187 zcmZuveN2>f9RJ)sFZarGbQ~Oq$Mwi6hcD$H(X`N{Fb7LiB5^v)^LU7J_k!>!U4M8j zj8Oj)*E>NzXyEpVfu6Cusv?_#eV@5$uu%Nge1fh=?Mz&G5yv)1Qc#IU6q=E z?3JdQE3c4PF=vn51-O&u6%#s;mu;>-7yz;sm^<&RBi-bG;@V)sJ2>XyWw)>_7$ z&Y(1&LHV*27+b>v|CS!BO|~-O6Vj?{FVV6Oq*YUI(4rA3QO8PcebVspv)nJ11G~SY z@<-)FgcW!K^7CB<6f!EOh2+-D-2*R@N3Ta@%{xfJrZ($7J*y~0lf4Z)zRVv5ayuPkPrbs5zi~p}$%G;2xHK!r zhMu)l>~h7|C)m4vuEsA?IPAKq3knjY{E!^K(4ZoOIAYK_ zPyJKtAZIE^JiXqUj?xfCBi9LQs@F1yzotP`L-Cld#dI|kjH$7>u5Q&-E!wCjjDRKI zxZmlKL_OTt+#j$69IApc)bUGEYiOAzvXs@;sWGj^*y}2|*MEBugPW-+r8Ej{_KNb~ zm5aW){iW{hCX?R?I&%vCC$e0t5AKNQ1|yA&`Ch49i)gy>t8Y%R2j!%VaHNV?S#|`G z*%bD4pr!^Rk(99h<2jN^s!F+Lbb15I?ZS*7vgY~b{cA{l_?aC|K|LIgsm-AVEvgw) bS;a=5=O^RS+%Drt-ncR2{ki`I-+l5wz%(y! delta 978 zcmYLIYfM{Z7=F%`)1K~>Yg;;28{!XVG$Uph*+qsUE^OJ2#Er}`ZJrEsIZQF`@<)dw5H>4`R!u+_qYE2TqHJUVl11H&86cZW<}N;^$;`>g^PTs7zxR8d z_xa95#hLQ=^2;GUJ=1y~EcjXti|4&pLO9G#=`Sa~8AG^x7#ZS}v613dTz$CqQQ&&3k|>HW-?8`TF$L<||bYJ2JZdZWIT z#O0JR-Ojrtj2Ub0p6DcjLF2(|=Q!yWXU)JiG8LSW9Wi>s#o1(U-bUC42hCtKm<~x#q0%z*ONt+MFU%zU0n_x?MZ&Ly8uqsaqM=CGs&Fq&e&$`F F{s#f<{ow!r diff --git a/modules/twainui/TwainUI_zh_EN.ts b/modules/twainui/TwainUI_zh_EN.ts index 63af4891..0941376c 100644 --- a/modules/twainui/TwainUI_zh_EN.ts +++ b/modules/twainui/TwainUI_zh_EN.ts @@ -902,12 +902,14 @@ The page range will be “selected pages” Rename configuration + tips - Prompt + Prompt + The content can not be empty - The content can not be empty + The content can not be empty @@ -1395,22 +1397,22 @@ Please make sure the two passwords are the same. Scan status - + image recived: Image recived: - + total image recived: Total image recived: - + image uploaded: Image uploaded: - + total image uploaded: Total image uploaded: @@ -1431,12 +1433,12 @@ Please make sure the two passwords are the same. Start scanning... - + stop scanning Stop scanning... - + Total scanned images: %1 Total scanned images: %1 @@ -2357,7 +2359,7 @@ Please go to “Scan to” and change the accessible scan folder and then perfor Manager - + Prompt Prompt @@ -2488,210 +2490,234 @@ 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 + Rename - delete + Delete + + + apply + Apply + + + delete all configurations + Delete all configurations + + + + + Default scheme + Default scheme + + + + Add new + Add new + + + + Delete Delete - - apply - Apply + + Delete all + Delete all - - 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 + + Add new scheme + Add new scheme - - + + The configuration scheme already exists + The configuration scheme already exists + + + 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 - + " ? ? @@ -2704,7 +2730,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_input.cpp b/modules/twainui/dialog_input.cpp index 1692c79d..b1194c5e 100644 --- a/modules/twainui/dialog_input.cpp +++ b/modules/twainui/dialog_input.cpp @@ -8,6 +8,7 @@ Dialog_Input::Dialog_Input(QWidget *parent) : ui(new Ui::Dialog_Input) { ui->setupUi(this); + setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint); } Dialog_Input::~Dialog_Input() @@ -34,23 +35,30 @@ void Dialog_Input::on_pushButton_clicked() } str.erase(pos + 1); - if(str.empty()) +// if(str.empty()) +// { +// QString title(QString::fromStdString("\351\224\231\350\257\257")), +// text(QString::fromStdString("\350\276\223\345\205\245\351\235\236\346\263\225")); + +// QMessageBox::warning(this, title, text); + +// return; +// } + + if (ui->lineEdit->text().isEmpty()) { - QString title(QString::fromStdString("\351\224\231\350\257\257")), - text(QString::fromStdString("\350\276\223\345\205\245\351\235\236\346\263\225")); - - QMessageBox::warning(this, title, text); - + QMessageBox msg(QMessageBox::Information, tr("tips"), tr("The content can not be empty"), QMessageBox::Ok, this); + msg.exec(); return; } val_ = QString::fromStdString(str); - done(1); + accept(); } void Dialog_Input::on_pushButton_2_clicked() { - done(0); + reject(); } void Dialog_Input::init_value(const QString& str) @@ -63,3 +71,15 @@ QString Dialog_Input::get_inputting_value(void) { return val_; } + +QString Dialog_Input::getText() +{ + QString text = ui->lineEdit->text(); + return text.toUtf8(); +} + +void Dialog_Input::setEditText(const QString& text) +{ + ui->lineEdit->setText(text); + ui->lineEdit->selectAll(); +} diff --git a/modules/twainui/dialog_input.h b/modules/twainui/dialog_input.h index df8a9fd0..5f8bc321 100644 --- a/modules/twainui/dialog_input.h +++ b/modules/twainui/dialog_input.h @@ -20,6 +20,8 @@ public: public: void init_value(const QString& str); QString get_inputting_value(void); + QString getText(); + void setEditText(const QString& text); private slots: void on_pushButton_clicked(); diff --git a/modules/twainui/hg_settingdialog.cpp b/modules/twainui/hg_settingdialog.cpp index 3d4ffe4e..17b302c3 100644 --- a/modules/twainui/hg_settingdialog.cpp +++ b/modules/twainui/hg_settingdialog.cpp @@ -250,13 +250,14 @@ void hg_settingdialog::create_scheme_management_ui(QVBoxLayout* layout) { QLabel *title = new QLabel(this); bool enabled = false; - QHBoxLayout *hbox = new QHBoxLayout(); + QHBoxLayout *hLayout = 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); + comb_->addItem(tr("Default scheme")); layout->addSpacing(30); for(int i = 1; i < (int)schemes.size(); ++i) { @@ -269,7 +270,7 @@ void hg_settingdialog::create_scheme_management_ui(QVBoxLayout* layout) } if(!enabled) - comb_->setCurrentIndex(-1); + comb_->setCurrentIndex(0); title->setFixedWidth(width); comb_->setFixedWidth(width); @@ -278,35 +279,29 @@ void hg_settingdialog::create_scheme_management_ui(QVBoxLayout* layout) 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())); + layout->addSpacing(10); + + m_pbtn_addNew = new QPushButton(this); + m_pbtn_addNew->setText(tr("Add new")); + m_pbtn_addNew->setFixedWidth(width / 2); + layout->addWidget(m_pbtn_addNew); + connect(m_pbtn_addNew, SIGNAL(clicked(bool)), this, SLOT(slot_pushButton_scheme_management())); + + layout->addSpacing(10); del_this_ = new QPushButton(this); - del_this_->setText(tr("delete")); + del_this_->setText(tr("Delete")); del_this_->setEnabled(enabled); - del_this_->setFixedWidth(width / 3); - hbox->addWidget(del_this_); + del_this_->setFixedWidth(width / 2); + layout->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_->setText(tr("Delete all")); del_all_->setEnabled(enabled); - del_all_->setFixedWidth(width); + del_all_->setFixedWidth(width / 2); layout->addWidget(del_all_); connect(del_all_, SIGNAL(clicked(bool)), this, SLOT(slot_pushButton_scheme_management())); @@ -1818,7 +1813,7 @@ void hg_settingdialog::save_scheme(void) return; } else - add = createMsgBoxUi(add, name); + add = false; } } if(add) @@ -1848,10 +1843,7 @@ void hg_settingdialog::save_scheme(void) sprintf(append, "-%d", ++ind); } } - while(!cur_cfg_->add_scheme(cur_scheme_, (name + append).c_str())) - { - sprintf(append, "-%d", ++ind); - } + cur_cfg_->add_scheme(cur_scheme_, (name + append).c_str()); } else { @@ -1906,6 +1898,35 @@ std::string sane_val_to_string(const char* val, SANE_Value_Type type) } void hg_settingdialog::on_current_scheme_changed() { + del_this_->setEnabled(true); + del_all_->setEnabled(false); + + if (comb_->currentIndex() == 0) + { + del_this_->setEnabled(false); + } + if (comb_->count() > 1) + { + del_all_->setEnabled(true); + } + + 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_++; + QString scheme(comb_->currentText()); bool enabled = false; gb::sane_config_schm *schm = cur_cfg_->get_scheme(scheme.toStdString().c_str()); @@ -1913,10 +1934,6 @@ void hg_settingdialog::on_current_scheme_changed() 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; @@ -1962,7 +1979,7 @@ void hg_settingdialog::slot_pushButton_scheme_management(void) { QPushButton* btn = qobject_cast(sender()); - if(btn == rename_) + if(btn == m_pbtn_addNew) { int id = 0; QString text(find_current_scheme_menu(&id)); @@ -1970,53 +1987,36 @@ void hg_settingdialog::slot_pushButton_scheme_management(void) { Dialog_Input dlg; - dlg.init_value(text); - dlg.setWindowTitle(tr("configuration scheme name change")); - if(dlg.exec() && text != dlg.get_inputting_value()) + dlg.setEditText(text); + dlg.setWindowTitle(tr("Add new scheme")); + if(dlg.exec()) { - std::vector now; - std::string str = dlg.get_inputting_value().toStdString(); - - cur_cfg_->get_all_schemes(now); - for(auto& v: now) + QString newCfgName = dlg.getText(); + for (int i = 0; i < comb_->count(); ++i) { - if(v == str) + if (newCfgName == comb_->itemText(i)) { - QMessageBox::information(this, tr("tips"), tr("scheme name: ") + QString::fromStdString(str) + tr(" already exists")); + QMessageBox::information(this, tr("tips"), tr("The configuration scheme 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); + comb_->insertItem(id, newCfgName); connect(comb_, SIGNAL(currentTextChanged(const QString)), this, SLOT(on_current_scheme_changed())); - cur_cfg_->rename_scheme(text.toStdString().c_str(), str.c_str()); + gb::sane_config_schm *scheme = cur_scheme_->copy(); + cur_scheme_->end_setting(true); + cur_scheme_->release(); + cur_scheme_ = scheme; + cur_cfg_->add_scheme(cur_scheme_, newCfgName.toStdString().c_str()); + cur_cfg_->select_scheme(cur_scheme_->get_scheme_name().c_str()); cur_cfg_->save(); + comb_->setCurrentIndex(id); 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; @@ -2056,6 +2056,7 @@ void hg_settingdialog::slot_pushButton_scheme_management(void) restore_2_default_settings(); updateUIStatus(); comb_->clear(); + comb_->addItem(tr("Default scheme")); changed_count_++; cur_cfg_->remove_all_schemes(); cur_cfg_->save(); diff --git a/modules/twainui/hg_settingdialog.h b/modules/twainui/hg_settingdialog.h index 986559a0..9282ab32 100644 --- a/modules/twainui/hg_settingdialog.h +++ b/modules/twainui/hg_settingdialog.h @@ -26,8 +26,7 @@ class hg_settingdialog : public QDialog QMenu *top_menu_; QLineEdit *edit_name_; - QPushButton *rename_; - QPushButton *apply_; + QPushButton *m_pbtn_addNew; QPushButton *del_this_; QPushButton *del_all_; QLabel *custom_area_lable_;