diff --git a/app/scanner/Scanner_zh_CN.qm b/app/scanner/Scanner_zh_CN.qm
index f027b2c9..bd4edd08 100644
Binary files a/app/scanner/Scanner_zh_CN.qm and b/app/scanner/Scanner_zh_CN.qm differ
diff --git a/app/scanner/Scanner_zh_CN.ts b/app/scanner/Scanner_zh_CN.ts
index 502d7d64..39a5de24 100644
--- a/app/scanner/Scanner_zh_CN.ts
+++ b/app/scanner/Scanner_zh_CN.ts
@@ -518,17 +518,17 @@ Page range will be 'Chosen Pages'.
停止导出
-
+
导出失败:
-
+
提示
-
+
导出完成
@@ -541,7 +541,7 @@ Page range will be 'Chosen Pages'.
OCR功能处理失败
-
+
确定
@@ -1080,22 +1080,22 @@ Page range will be 'Chosen Pages'.
-
+
-
+
- 确定
+ 确定
- 取消
+ 取消
@@ -1357,22 +1357,22 @@ This operation will NOT rotate the files that may contain multiple pages, such a
停止批量旋转
-
+
操作成功
-
+
多流旋转操作失败:
-
+
提示
-
+
确定
@@ -1621,7 +1621,7 @@ Please make sure the two passwords are the same.
取消
-
+
检查更新
@@ -1654,17 +1654,17 @@ bug description:
-
+
当前为最新版本!版本号为:
-
+
发现新版本:
-
+
,当前版本为:
@@ -2168,8 +2168,8 @@ bug description:
-
-
+
+
警告
@@ -2278,191 +2278,191 @@ Do you want to clear?
-
-
+
+
保存成功
-
+
图片名在列表中已存在
-
+
请至少选中一张图片再进行导出
-
+
文件名
-
+
文件路径
-
+
文件大小
-
+
创建时间
-
+
修改时间
-
+
访问时间
-
+
格式
-
+
宽度
-
+
高度
-
+
深度
-
+
色彩模式
-
+
每英寸像素点
-
+
打印尺寸
-
+
帧
-
+
无
-
+
黑白
-
+
灰度
-
+
彩色
-
+
警告
-
+
设备正在运行!
请先结束扫描。
-
+
图像处理失败
-
+
OCR初始化错误
-
+
OCR错误
-
+
文件不存在
-
+
加载动态库失败
-
+
文件数据错误
-
+
其他错误
+
-
+
-
+
-
+
-
已唤醒设备
-
+
就绪
+
-
+
-
无法访问“我的文档”,
请前往“扫描至”更换可访问的扫描目录再进行扫描。
-
+
文件访问权限不足
@@ -2475,47 +2475,47 @@ Please finish scanning first.
图像处理失败
-
+
您确定要关闭
-
+
吗?
+
-
关闭
-
+
提示
-
+
未获取到其他版本
-
-
+
+
设备不支持该操作
-
-
+
+
IO错误
-
-
-
+
+
+
错误
@@ -2530,17 +2530,17 @@ Continue to close?
是否继续关闭?
-
+
是否确定登出管理员账户?
-
+
确认操作
-
+
你确定要清除滚轴计数吗
@@ -2549,34 +2549,34 @@ Continue to close?
请重新进入关于界面以获取最新值
-
+
-
+
-
+
滚轴张数
-
+
打开扫描仪
-
-
+
+
华高扫描软件
-
-
+
+
成功
@@ -2593,22 +2593,22 @@ Continue to close?
失败
-
-
+
+
失败
-
+
警告
-
+
当前路径磁盘空间不足,
请重新选择路径或及时清理磁盘空间。
@@ -2618,7 +2618,7 @@ Continue to close?
配置丢失
-
+
应用配置
@@ -2626,18 +2626,18 @@ Continue to close?
+
-
+
-
+
-
+
-
启动失败
@@ -2716,13 +2716,13 @@ Continue to close?
-
-
-
-
-
-
-
+
+
+
+
+
+
+
确定
@@ -2735,12 +2735,12 @@ Continue to close?
-
-
-
-
-
-
+
+
+
+
+
+
取消
@@ -2771,7 +2771,7 @@ Continue to close?
- 创建文件夹失败:
+ 创建文件夹失败:
@@ -2793,22 +2793,22 @@ Continue to close?
+
-
+
-
保存图片文件失败:
-
+
启动安装程序失败!
-
+
有图像未保存,确定关闭?
@@ -2817,57 +2817,57 @@ Are you sure to close?
-
-
-
-
-
-
-
+
+
+
+
+
+
+
提示
-
+
确定关闭?
-
+
确认操作
-
+
您确定要清除滚轴计数吗
-
-
-
+
+
+
提示
-
-
+
+
辊轴计数已置零
-
-
+
+
重置滚轴计数失败
-
+
错误
-
+
文档丢失!文档可能已被删除或被重命名。
@@ -2900,28 +2900,28 @@ Are you sure to close?
<br>导航地址: <a href='https://j.map.baidu.com/7e/1TO'>百度地图访问</a>
-
+
关于 %1
-
+
<p>%1</p><p>版本: %2<br>版权: © %3</p><p>%4%5%6%7%8%9</p>
-
+
关于 %1
-
+
<p>版本: %1</p>
<p>版本: %1</p>
-
+
<p>版权: © %1</p>
<p>版权: © %1</p>
@@ -2947,7 +2947,7 @@ Are you sure to close?
-
+
@@ -3026,7 +3026,7 @@ Are you sure to close?
-
+
@@ -3160,6 +3160,7 @@ Are you sure to close?
+
确定
@@ -3184,86 +3185,130 @@ Are you sure to close?
自定义色调曲线
-
+
+
+ 请选择覆盖原来的配置:
+
+
+
+
+ ,或者新增配置
+
+
+
保存配置
-
The Settings you just set are in the original configuration “
- 您刚才的设置是在原有配置 “
+ 您刚才的设置是在原有配置 “
-
” changed on the basis,Please select overwrite this configuration or add a new one?
Yes: cover “
- ” 基础上更改的,请选择是覆盖这个配置,还是增加新的配置?
+ ” 基础上更改的,请选择是覆盖这个配置,还是增加新的配置?
是: 覆盖 “
-
”
No: add new configuration
-
+
否: 增加新的配置:
-
-
-
+
+
是
-
-
-
+
+
否
-
+
<h6><b>
-
+
+
+ 覆盖原来配置:
+
+
+
+
+ 新增配置
+
+
+
+
+ 更名:
+
+
+
+
+
+
+ 提示
+
+
+
+
+ 配置名不能为空
+
+
+
+
+
+ 配置名:
+
+
+
+
+
+ 已存在
+
+
+
:</b></h6>
-
+
<p>
-
+
</p>
-
+
配置改名
-
-
+
+
确认删除配置
-
+
您确认要删除配置
-
+
?
@@ -3276,7 +3321,7 @@ No: add new configuration
’ 吗?
-
+
您确认要删除所有配置吗?
diff --git a/app/scanner/dialog_input.cpp b/app/scanner/dialog_input.cpp
index c84f36f8..1692c79d 100644
--- a/app/scanner/dialog_input.cpp
+++ b/app/scanner/dialog_input.cpp
@@ -1,6 +1,7 @@
#include "dialog_input.h"
#include "ui_dialog_input.h"
#include
+#include
Dialog_Input::Dialog_Input(QWidget *parent) :
QDialog(parent),
@@ -16,7 +17,11 @@ Dialog_Input::~Dialog_Input()
void Dialog_Input::on_pushButton_clicked()
{
- std::string str(ui->lineEdit->text().toStdString());
+ QString text = ui->lineEdit->text();
+ static QRegularExpression re("\\s");
+ text.remove(re);//Remove space
+
+ std::string str(text.toStdString());
int pos = 0;
while(pos < str.length() && str[pos++] == ' ');
if(--pos > 0)
diff --git a/app/scanner/hg_settingdialog.cpp b/app/scanner/hg_settingdialog.cpp
index 19bb2446..5dd919c3 100644
--- a/app/scanner/hg_settingdialog.cpp
+++ b/app/scanner/hg_settingdialog.cpp
@@ -18,7 +18,7 @@ hg_settingdialog::hg_settingdialog(void *handle, QWidget *parent
: QDialog(parent)
, dev_que_(dev), save_(false)
, btn_cut_area_(nullptr), btn_gamma_(nullptr), clicked_gamma_(false)
- , custom_area_lable_(nullptr), comb_(nullptr)
+ , custom_area_lable_(nullptr), comb_(nullptr),m_cover(true)
{
std::string n(dev->opened_scanner_name());
for(int i = 0; i < dev->scanners(); ++i)
@@ -1500,6 +1500,158 @@ void hg_settingdialog::closeEvent(QCloseEvent* e)
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);
+
+ connect(radioButtonCover, &QRadioButton::clicked, this, [=, &add, this](){
+ m_cover = true;
+ add = false;
+ label_name->setVisible(false);
+ m_lineEdit_name->setVisible(false);
+ });
+ connect(radioButtonNew, &QRadioButton::clicked, this, [=, &add, this](){
+ m_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,this](){
+ 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 (!m_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 = sane_get_option_descriptor(m_handle, id);
+ if (opt)
+ {
+ if (count++)
+ name += " + ";
+
+ if (opt->type == SANE_TYPE_STRING)
+ name += val;
+ 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());
@@ -1507,68 +1659,14 @@ void hg_settingdialog::save_scheme(void)
if(add)
{
- 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 = sane_get_option_descriptor(m_handle, id);
- if(opt)
- {
- if(count++)
- name += " + ";
-
- if(opt->type == SANE_TYPE_STRING)
- name += val;
- 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));
- }
+ name = getCurUiShemeName(name);
}
else
{
add = cur_scheme_->has_changed();
if(add)
{
- QString title(tr("save the configuration"));
- QString text(tr("The Settings you just set are in the original configuration \""));
-
- text += QString::fromStdString(name);
- text += tr("\" changed on the basis,Please select overwrite this configuration or add a new one?\nYes: cover \"") + QString::fromStdString(name);
- text += tr("\"\nNo: add new configuration") + QString::fromStdString("");
-
- QMessageBox msg(QMessageBox::Question, title, text, QMessageBox::Yes | QMessageBox::No, this);
- msg.setButtonText(QMessageBox::Yes, tr("yes"));
- msg.setButtonText(QMessageBox::No, tr("no"));
- msg.exec();
- add = msg.clickedButton() != msg.button(QMessageBox::Yes);
+ add = createMsgBoxUi(add, name);
}
}
if(add)
@@ -1603,7 +1701,8 @@ void hg_settingdialog::save_scheme(void)
sprintf(append, "-%d", ++ind);
}
}
- else {
+ else
+ {
cur_scheme_->end_setting(false);
}
cur_cfg_->select_scheme(cur_scheme_->get_scheme_name().c_str());
@@ -1739,9 +1838,7 @@ void hg_settingdialog::slot_pushButton_scheme_management(void)
{
if(v == str)
{
- str.insert(0, "\351\205\215\347\275\256\345\220\215\347\247\260 \342\200\230"); // 配置名称‘’
- str += "\342\200\231 \345\267\262\347\273\217\345\255\230\345\234\250"; // 已经存在
- QMessageBox(QMessageBox::Information, QString::fromStdString("\351\224\231\350\257\257")/*错误*/, QString::fromStdString(str)).exec();
+ QMessageBox::information(this, tr("tips"), tr("scheme name: ") + QString::fromStdString(str) + tr(" already exists"));
return;
}
}
@@ -1827,8 +1924,8 @@ void hg_settingdialog::slot_pushButton_scheme_management(void)
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_->select_scheme(nullptr);
cur_cfg_->save();
gb::sane_config_schm *s = new gb::sane_config_schm();
diff --git a/app/scanner/hg_settingdialog.h b/app/scanner/hg_settingdialog.h
index f114536f..230bd0cc 100644
--- a/app/scanner/hg_settingdialog.h
+++ b/app/scanner/hg_settingdialog.h
@@ -1,4 +1,4 @@
-#ifndef HG_SETTING_DIALOG_H
+#ifndef HG_SETTING_DIALOG_H
#define HG_SETTING_DIALOG_H
#include
@@ -33,6 +33,7 @@ class hg_settingdialog : public QDialog
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);
@@ -72,9 +73,10 @@ private:
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
- QVariant find_default_value(int id);
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();
@@ -122,6 +124,7 @@ private:
double m_cutBottomValue; // 单位是毫米
int m_colorModeId;
+ volatile bool m_cover = true;
QString m_colorModeValue;
SANE_Gamma m_gammaData;
QComboBox *comb_;
diff --git a/app/scanner/qt_zh_CN.ts b/app/scanner/qt_zh_CN.ts
index 43bf5108..83dd5348 100644
--- a/app/scanner/qt_zh_CN.ts
+++ b/app/scanner/qt_zh_CN.ts
@@ -8279,20 +8279,6 @@ Please choose a different file name.
-
-
-
-
-
-
-
-
-
-
-
-
@@ -8369,6 +8355,42 @@ No: add new configuration
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
setPicClrTool