This commit is contained in:
luoliangyi 2023-03-31 16:39:38 +08:00
commit 0fbce97e57
14 changed files with 1593 additions and 902 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -8,9 +8,13 @@
#include "base/HGDef.h"
#include "base/HGInc.h"
#include "base/HGUtility.h"
#include "base/HGIni.h"
#include "HGUIGlobal.h"
#include "HGString.h"
#include "app_cfg.h"
#include "dialog_input.h"
#include <QDebug>
#include <QMessageBox>
Dialog_AquireInto::Dialog_AquireInto(QWidget* parent) :
QDialog(parent),
@ -23,43 +27,22 @@ Dialog_AquireInto::Dialog_AquireInto(QWidget* parent) :
QRegExp rx("[^\\\\/:*?\"<>|]+$");
ui->lineEdit_fileName->setValidator(new QRegExpValidator(rx, this));
HGChar aquireIntoPath[512];
HGBase_GetDocumentsPath(aquireIntoPath, 512);
HGChar procName[512];
HGBase_GetProcessName(procName, 512);
strcat(aquireIntoPath, procName);
strcat(aquireIntoPath, "/AquireInto/");
QString filePath = getStdFileName(StdStringToUtf8(aquireIntoPath).c_str());
ui->comboBox_cfgScheme->addItem(tr("default scheme"));
ui->lineEdit_directory->setText(getCfgValue("aquire", "aquireIntoPath", filePath));
ui->cbtn_subFolder->setChecked(getCfgValue("aquire", "subFolderByTime", false));
ui->cbtn_subFolderByBlank->setChecked(getCfgValue("aquire", "subFolderByBlank", false));
ui->cbtn_subFolderByColor->setChecked(getCfgValue("aquire", "subFolderByColor", false));
#if defined(OEM_HANWANG)
ui->lineEdit_fileName->setText(getCfgValue("aquire", "namePrefix", QString("HWScan")));
#elif defined(OEM_LISICHENG)
ui->lineEdit_fileName->setText(getCfgValue("aquire", "namePrefix", QString("LXScan")));
#elif defined(OEM_CANGTIAN)
ui->lineEdit_fileName->setText(getCfgValue("aquire", "namePrefix", QString("CTSScan")));
#elif defined(OEM_ZHONGJING)
ui->lineEdit_fileName->setText(getCfgValue("aquire", "namePrefix", QString("ZJScan")));
#elif defined(OEM_ZIGUANG)
ui->lineEdit_fileName->setText(getCfgValue("aquire", "namePrefix", QString("ZGScan")));
#else
ui->lineEdit_fileName->setText(getCfgValue("aquire", "namePrefix", QString("HGScan")));
#endif
QString allCfgName = getCfgValue("aquire", "cfgNameList", QString(""));
QStringList allCfgNameList = allCfgName.split(",");
if (!allCfgNameList.contains(QString("")))
{
ui->comboBox_cfgScheme->addItems(allCfgNameList);
ui->comboBox_cfgScheme->setCurrentText(getCurrentCfgName());
}
else
{
allCfgNameList.removeOne(QString(""));
ui->comboBox_cfgScheme->setCurrentIndex(0);
}
ui->spin_index->setValue(getCfgValue("aquire", "startIndex", 1));
ui->cbox_digit->setCurrentIndex(getCfgValue("aquire", "digit", 2));
ui->cbox_evenOdd->setCurrentIndex(getCfgValue("aquire", "evenOdd", 0));
int format = getCfgValue("aquire", "format", 0);
if (format > 9)
format = 0;
ui->cbox_format->setCurrentIndex(format);
ui->cbtn_multiFile->setChecked(format > 5 ? getCfgValue("aquire", "multiFile", false) : false);
ui->radio_multiAll->setChecked(getCfgValue("aquire", "multiAll", true));
ui->radio_multiCustom->setChecked(getCfgValue("aquire", "multiCustom", false));
ui->spinBox_multiPages->setValue(getCfgValue("aquire", "multiPages", 1));
setCfgBaseOnSection(getCurrentCfgName());
ui->lab_digitExp->setText(QString(tr("e.g. '%1%2'")).arg(ui->lineEdit_fileName->text())
.arg(ui->spin_index->value(), ui->cbox_digit->currentIndex() + 1, 10, QLatin1Char('0')));
@ -146,6 +129,134 @@ AquireIntoSaveParam Dialog_AquireInto::getSaveParam()
return param;
}
void Dialog_AquireInto::setConfig(QString schemeName)
{
for (int i = 0; i < ui->comboBox_cfgScheme->count(); ++i)
{
if (ui->comboBox_cfgScheme->itemText(i) == schemeName)
{
setCfgBaseOnSection(schemeName);
saveCfgValue("aquire", "currentKeyName", schemeName);
if (ui->comboBox_cfgScheme->itemText(0) != schemeName)
{
saveCfgBaseOnSection(schemeName);
}
break;
}
}
}
QString Dialog_AquireInto::getCurrentCfgName()
{
return getCfgValue("aquire", "currentKeyName", QString("aquire"));
}
void Dialog_AquireInto::replaceCfgName(QString originName, QString newName)
{
HGChar cfgPath[512];
HGBase_GetConfigPath(cfgPath, 512);
strcat(cfgPath, "config.ini");
QString currentKeyName = getCurrentCfgName();
if (currentKeyName == originName)
{
saveCfgValue("aquire", "currentKeyName", newName);
}
QString allCfgName = getCfgValue("aquire", "cfgNameList", QString(""));
QStringList allCfgNameList = allCfgName.split(",");
for (int i = 0; i < allCfgNameList.size(); ++i)
{
if (allCfgNameList[i] == originName)
{
allCfgNameList.replace(i, newName);
HGBase_RenameProfileSection(cfgPath, originName.toLocal8Bit().toStdString().c_str(), newName.toLocal8Bit().toStdString().c_str());
break;
}
}
QString cfgNameList;
saveCfgValue("aquire", "cfgNameList", QString(""));
for (int j = 0; j < allCfgNameList.size(); ++j)
{
if (getCfgValue("aquire", "cfgNameList", QString("")).isEmpty())
{
saveCfgValue("aquire", "cfgNameList", allCfgNameList[j]);
}
else
{
cfgNameList = getCfgValue("aquire", "cfgNameList", QString(""));
cfgNameList.append(",").append(allCfgNameList[j]);
saveCfgValue("aquire", "cfgNameList", cfgNameList);
}
}
}
void Dialog_AquireInto::saveCfgBaseOnSection(QString section)
{
std::string section2 = section.toLocal8Bit().toStdString();
saveCfgValue(section2.c_str(), "aquireIntoPath", ui->lineEdit_directory->text());
qDebug() << ui->lineEdit_directory->text();
saveCfgValue(section2.c_str(), "namePrefix", ui->lineEdit_fileName->text());
saveCfgValue(section2.c_str(), "subFolderByTime", ui->cbtn_subFolder->isChecked());
saveCfgValue(section2.c_str(), "subFolderByBlank", ui->cbtn_subFolderByBlank->isChecked());
saveCfgValue(section2.c_str(), "subFolderByColor", ui->cbtn_subFolderByColor->isChecked());
saveCfgValue(section2.c_str(), "startIndex", ui->spin_index->value());
saveCfgValue(section2.c_str(), "digit", ui->cbox_digit->currentIndex());
saveCfgValue(section2.c_str(), "evenOdd", ui->cbox_evenOdd->currentIndex());
saveCfgValue(section2.c_str(), "format", ui->cbox_format->currentIndex());
saveCfgValue(section2.c_str(), "multiFile", ui->cbtn_multiFile->isChecked());
saveCfgValue(section2.c_str(), "multiAll", ui->radio_multiAll->isChecked());
saveCfgValue(section2.c_str(), "multiPages", ui->spinBox_multiPages->value());
saveCfgValue(section2.c_str(), "multiCustom", ui->radio_multiCustom->isChecked());
}
void Dialog_AquireInto::setCfgBaseOnSection(QString section)
{
HGChar aquireIntoPath[512];
HGBase_GetDocumentsPath(aquireIntoPath, 512);
HGChar procName[512];
HGBase_GetProcessName(procName, 512);
strcat(aquireIntoPath, procName);
strcat(aquireIntoPath, "/AquireInto/");
QString filePath = getStdFileName(StdStringToUtf8(aquireIntoPath).c_str());
std::string section2 = section.toLocal8Bit().toStdString();
ui->lineEdit_directory->setText(getCfgValue(section2.c_str(), "aquireIntoPath", filePath));
ui->cbtn_subFolder->setChecked(getCfgValue(section2.c_str(), "subFolderByTime", false));
ui->cbtn_subFolderByBlank->setChecked(getCfgValue(section2.c_str(), "subFolderByBlank", false));
ui->cbtn_subFolderByColor->setChecked(getCfgValue(section2.c_str(), "subFolderByColor", false));
#if defined(OEM_HANWANG)
ui->lineEdit_fileName->setText(getCfgValue(section2.c_str(), "namePrefix", QString("HWScan")));
#elif defined(OEM_LISICHENG)
ui->lineEdit_fileName->setText(getCfgValue(section2.c_str(), "namePrefix", QString("LXScan")));
#elif defined(OEM_CANGTIAN)
ui->lineEdit_fileName->setText(getCfgValue(section2.c_str(), "namePrefix", QString("CTSScan")));
#elif defined(OEM_ZHONGJING)
ui->lineEdit_fileName->setText(getCfgValue(section2.c_str(), "namePrefix", QString("ZJScan")));
#elif defined(OEM_ZIGUANG)
ui->lineEdit_fileName->setText(getCfgValue(section2.c_str(), "namePrefix", QString("ZGScan")));
#else
ui->lineEdit_fileName->setText(getCfgValue(section2.c_str(), "namePrefix", QString("HGScan")));
#endif
ui->spin_index->setValue(getCfgValue(section2.c_str(), "startIndex", 1));
ui->cbox_digit->setCurrentIndex(getCfgValue(section2.c_str(), "digit", 2));
ui->cbox_evenOdd->setCurrentIndex(getCfgValue(section2.c_str(), "evenOdd", 0));
int format = getCfgValue(section2.c_str(), "format", 0);
if (format > 9)
format = 0;
ui->cbox_format->setCurrentIndex(format);
ui->cbtn_multiFile->setChecked(format > 5 ? getCfgValue(section2.c_str(), "multiFile", false) : false);
ui->radio_multiAll->setChecked(getCfgValue(section2.c_str(), "multiAll", true));
ui->radio_multiCustom->setChecked(getCfgValue(section2.c_str(), "multiCustom", false));
ui->spinBox_multiPages->setValue(getCfgValue(section2.c_str(), "multiPages", 1));
}
void Dialog_AquireInto::on_btn_directory_clicked()
{
QString save_dir = QFileDialog::getExistingDirectory(this, tr("Browse directory"), "");
@ -179,19 +290,34 @@ void Dialog_AquireInto::on_lineEdit_directory_textChanged(const QString& arg1)
void Dialog_AquireInto::on_buttonBox_accepted()
{
saveCfgValue("aquire", "aquireIntoPath", ui->lineEdit_directory->text());
saveCfgValue("aquire", "namePrefix", ui->lineEdit_fileName->text());
saveCfgValue("aquire", "subFolderByTime", ui->cbtn_subFolder->isChecked());
saveCfgValue("aquire", "subFolderByBlank", ui->cbtn_subFolderByBlank->isChecked());
saveCfgValue("aquire", "subFolderByColor", ui->cbtn_subFolderByColor->isChecked());
saveCfgValue("aquire", "startIndex", ui->spin_index->value());
saveCfgValue("aquire", "digit", ui->cbox_digit->currentIndex());
saveCfgValue("aquire", "evenOdd", ui->cbox_evenOdd->currentIndex());
saveCfgValue("aquire", "format", ui->cbox_format->currentIndex());
saveCfgValue("aquire", "multiFile", ui->cbtn_multiFile->isChecked());
saveCfgValue("aquire", "multiAll", ui->radio_multiAll->isChecked());
saveCfgValue("aquire", "multiPages", ui->spinBox_multiPages->value());
saveCfgValue("aquire", "multiCustom", ui->radio_multiCustom->isChecked());
QString currentCfgName = ui->comboBox_cfgScheme->currentText();
if (ui->comboBox_cfgScheme->currentIndex() != 0)
{
if (getCfgValue("aquire", "cfgNameList", QString("")).isEmpty())
{
saveCfgValue("aquire", "cfgNameList", currentCfgName);
}
else
{
QString allCfgName = getCfgValue("aquire", "cfgNameList", QString(""));
QStringList allCfgNameList = allCfgName.split(",");
if (!allCfgNameList.contains(currentCfgName))
{
allCfgName.append(",").append(currentCfgName);
saveCfgValue("aquire", "cfgNameList", allCfgName);
}
}
if (ui->comboBox_cfgScheme->currentIndex() != 0)
{
saveCfgBaseOnSection(currentCfgName);
}
}
saveCfgValue("aquire", "currentKeyName", currentCfgName);
emit reloadAcquireIntoCfg();
}
void Dialog_AquireInto::on_cbox_digit_currentIndexChanged(int index)
@ -234,3 +360,165 @@ void Dialog_AquireInto::on_spin_index_valueChanged(int arg1)
ui->lab_digitExp->setText(QString(tr("e.g. '%1%2'")).arg(ui->lineEdit_fileName->text()).
arg(ui->spin_index->value(), ui->cbox_digit->currentIndex() + 1, 10, QLatin1Char('0')));
}
void Dialog_AquireInto::on_pbtn_changeName_clicked()
{
QString curCfgName = ui->comboBox_cfgScheme->currentText();
Dialog_Input dlg;
dlg.setEditText(curCfgName);
if (dlg.exec())
{
QString newCfgName = dlg.getText();
for (int i = 0; i < ui->comboBox_cfgScheme->count(); ++i)
{
if (newCfgName == ui->comboBox_cfgScheme->itemText(i))
{
QMessageBox::information(this, tr("tips"), tr("The configuration scheme already exists"));
return;
}
}
int count = ui->comboBox_cfgScheme->count();
for (int i = 0; i < count; ++i)
{
if (ui->comboBox_cfgScheme->itemText(i) == curCfgName)
{
ui->comboBox_cfgScheme->removeItem(i);
ui->comboBox_cfgScheme->insertItem(i, newCfgName);
ui->comboBox_cfgScheme->setCurrentText(newCfgName);
replaceCfgName(curCfgName, newCfgName);
setCfgBaseOnSection(newCfgName);
emit reloadAcquireIntoCfg();
break;
}
}
}
}
void Dialog_AquireInto::on_pbtn_delete_clicked()
{
HGChar cfgPath[512];
HGBase_GetConfigPath(cfgPath, 512);
strcat(cfgPath, "config.ini");
QString selectedCfgName = ui->comboBox_cfgScheme->currentText();
int count = ui->comboBox_cfgScheme->count();
for (int i = 0; i < count; ++i)
{
if (ui->comboBox_cfgScheme->itemText(i) == selectedCfgName)
{
ui->comboBox_cfgScheme->removeItem(i);
QString allCfgName = getCfgValue("aquire", "cfgNameList", QString(""));
QStringList allCfgNameList = allCfgName.split(",");
allCfgNameList.removeOne(selectedCfgName);
QString cfgNameList;
saveCfgValue("aquire", "cfgNameList", QString(""));
for (int j = 0; j < allCfgNameList.size(); ++j)
{
if (getCfgValue("aquire", "cfgNameList", QString("")).isEmpty())
{
saveCfgValue("aquire", "cfgNameList", allCfgNameList[j]);
}
else
{
cfgNameList = getCfgValue("aquire", "cfgNameList", QString(""));
cfgNameList.append(",").append(allCfgNameList[j]);
saveCfgValue("aquire", "cfgNameList", cfgNameList);
}
}
HGBase_RemoveProfileSection(cfgPath, selectedCfgName.toLocal8Bit().toStdString().c_str());
setCfgBaseOnSection(getCurrentCfgName());
emit reloadAcquireIntoCfg();
break;
}
}
}
void Dialog_AquireInto::on_pbtn_deleteAll_clicked()
{
HGChar cfgPath[512];
HGBase_GetConfigPath(cfgPath, 512);
strcat(cfgPath, "config.ini");
ui->comboBox_cfgScheme->clear();
ui->comboBox_cfgScheme->addItem(tr("default scheme"));
QString allCfgName = getCfgValue("aquire", "cfgNameList", QString(""));
QStringList allCfgNameList = allCfgName.split(",");
for (int i = 0; i < allCfgNameList.size(); ++i)
{
std::string section = allCfgNameList[i].toLocal8Bit().toStdString();
HGBase_RemoveProfileSection(cfgPath, section.c_str());
}
saveCfgValue("aquire", "cfgNameList", QString(""));
saveCfgValue("aquire", "currentKeyName", QString(""));
setCfgBaseOnSection(QString(""));
emit reloadAcquireIntoCfg();
}
void Dialog_AquireInto::on_comboBox_cfgScheme_currentTextChanged(const QString &arg1)
{
ui->pbtn_changeName->setEnabled(true);
ui->pbtn_delete->setEnabled(true);
if (ui->comboBox_cfgScheme->currentIndex() == 0)
{
ui->pbtn_changeName->setEnabled(false);
ui->pbtn_delete->setEnabled(false);
}
setCfgBaseOnSection(arg1);
}
void Dialog_AquireInto::on_pbtn_foundScheme_clicked()
{
QString cfgName = getCurrentCfgName();
if(cfgName.isEmpty())
{
cfgName = ui->comboBox_cfgScheme->currentText();
}
Dialog_Input dlg;
dlg.setEditText(cfgName);
if (dlg.exec())
{
cfgName = dlg.getText();
for (int i = 0; i < ui->comboBox_cfgScheme->count(); ++i)
{
if (cfgName == ui->comboBox_cfgScheme->itemText(i))
{
QMessageBox::information(this, tr("tips"), tr("The configuration scheme already exists"));
return;
}
}
ui->comboBox_cfgScheme->addItem(cfgName);
if (getCfgValue("aquire", "cfgNameList", QString("")).isEmpty())
{
saveCfgValue("aquire", "cfgNameList", cfgName);
}
else
{
QString allCfgName = getCfgValue("aquire", "cfgNameList", QString(""));
QStringList allCfgNameList = allCfgName.split(",");
if (!allCfgNameList.contains(cfgName))
{
allCfgName.append(",").append(cfgName);
saveCfgValue("aquire", "cfgNameList", allCfgName);
}
}
saveCfgBaseOnSection(cfgName);
setCfgBaseOnSection(cfgName);
ui->comboBox_cfgScheme->setCurrentText(cfgName);
emit reloadAcquireIntoCfg();
}
}

View File

@ -39,6 +39,16 @@ public:
~Dialog_AquireInto();
AquireIntoSaveParam getSaveParam();
void setConfig(QString schemeName);
private:
QString getCurrentCfgName();
void replaceCfgName(QString originName, QString newName);
void saveCfgBaseOnSection(QString section);
void setCfgBaseOnSection(QString section);
signals:
void reloadAcquireIntoCfg();
private slots:
void on_btn_directory_clicked();
@ -61,6 +71,16 @@ private slots:
void on_spin_index_valueChanged(int arg1);
void on_pbtn_changeName_clicked();
void on_pbtn_delete_clicked();
void on_pbtn_deleteAll_clicked();
void on_comboBox_cfgScheme_currentTextChanged(const QString &arg1);
void on_pbtn_foundScheme_clicked();
private:
Ui::Dialog_AquireInto* ui;
};

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>554</width>
<height>360</height>
<width>731</width>
<height>465</height>
</rect>
</property>
<property name="sizePolicy">
@ -25,361 +25,496 @@
<property name="windowTitle">
<string>Batch scanning</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="lab_directory">
<property name="text">
<string>Directory</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_directory">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="btn_directory">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="cbtn_subFolder">
<property name="text">
<string>Use subfolder based on current date</string>
<widget class="QGroupBox" name="groupBox_2">
<property name="maximumSize">
<size>
<width>211</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbtn_subFolderByBlank">
<property name="text">
<string>Use subfolder based on blank pages</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbtn_subFolderByColor">
<property name="text">
<string>Use subfolder based on image color type</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="lab_fileName">
<property name="text">
<string>File name</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_fileName"/>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>File name index</string>
<string>configuration scheme management</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<widget class="QLabel" name="label">
<property name="text">
<string>existing configuration scheme</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_cfgScheme">
<property name="minimumSize">
<size>
<width>0</width>
<height>31</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="lab_startIndex">
<property name="text">
<string>Start index</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spin_index">
<widget class="QPushButton" name="pbtn_foundScheme">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
<height>31</height>
</size>
</property>
<property name="maximum">
<number>99999</number>
</property>
<property name="value">
<number>1</number>
<property name="text">
<string>found scheme</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<widget class="QPushButton" name="pbtn_changeName">
<property name="minimumSize">
<size>
<width>40</width>
<height>20</height>
<width>0</width>
<height>31</height>
</size>
</property>
</spacer>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>change name</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
<widget class="QLabel" name="lab_digit">
<property name="text">
<string>Digit(s)</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="cbox_digit">
<property name="currentIndex">
<number>2</number>
</property>
<item>
<property name="text">
<string>1</string>
</property>
</item>
<item>
<property name="text">
<string>2</string>
</property>
</item>
<item>
<property name="text">
<string>3</string>
</property>
</item>
<item>
<property name="text">
<string>4</string>
</property>
</item>
<item>
<property name="text">
<string>5</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QLabel" name="lab_digitExp">
<property name="text">
<string>e.g. 'HGScan001'</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<widget class="QPushButton" name="pbtn_delete">
<property name="minimumSize">
<size>
<width>40</width>
<height>20</height>
<width>0</width>
<height>31</height>
</size>
</property>
</spacer>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>delete</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbtn_deleteAll">
<property name="minimumSize">
<size>
<width>0</width>
<height>31</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>delete all configurations</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QComboBox" name="cbox_evenOdd">
<item>
<property name="text">
<string>Even and odd pages</string>
</property>
</item>
<item>
<property name="text">
<string>Odd pages</string>
</property>
</item>
<item>
<property name="text">
<string>Even pages</string>
</property>
</item>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>17</width>
<height>279</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="lab_format">
<property name="text">
<string>Format</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="cbox_format">
<item>
<widget class="QWidget" name="widget" native="true">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="lab_directory">
<property name="text">
<string>Directory</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_directory">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="btn_directory">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="cbtn_subFolder">
<property name="text">
<string>JPG - JPG / JFIF(*.jpg)</string>
<string>Use subfolder based on current date</string>
</property>
</item>
<item>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbtn_subFolderByBlank">
<property name="text">
<string>BMP - Windows Bitmap(*.bmp)</string>
<string>Use subfolder based on blank pages</string>
</property>
</item>
<item>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbtn_subFolderByColor">
<property name="text">
<string>PNG - Portable Network Graphics(*.png)</string>
<string>Use subfolder based on image color type</string>
</property>
</item>
<item>
<property name="text">
<string>PPM - Portable Pixmap(*.ppm)</string>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="lab_fileName">
<property name="text">
<string>File name</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_fileName"/>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>File name index</string>
</property>
</item>
<item>
<property name="text">
<string>PGM - Portable Greymap(*.pgm)</string>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="lab_startIndex">
<property name="text">
<string>Start index</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spin_index">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximum">
<number>99999</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="lab_digit">
<property name="text">
<string>Digit(s)</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="cbox_digit">
<property name="currentIndex">
<number>2</number>
</property>
<item>
<property name="text">
<string>1</string>
</property>
</item>
<item>
<property name="text">
<string>2</string>
</property>
</item>
<item>
<property name="text">
<string>3</string>
</property>
</item>
<item>
<property name="text">
<string>4</string>
</property>
</item>
<item>
<property name="text">
<string>5</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QLabel" name="lab_digitExp">
<property name="text">
<string>e.g. 'HGScan001'</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QComboBox" name="cbox_evenOdd">
<item>
<property name="text">
<string>Even and odd pages</string>
</property>
</item>
<item>
<property name="text">
<string>Odd pages</string>
</property>
</item>
<item>
<property name="text">
<string>Even pages</string>
</property>
</item>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="lab_format">
<property name="text">
<string>Format</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="cbox_format">
<item>
<property name="text">
<string>JPG - JPG / JFIF(*.jpg)</string>
</property>
</item>
<item>
<property name="text">
<string>BMP - Windows Bitmap(*.bmp)</string>
</property>
</item>
<item>
<property name="text">
<string>PNG - Portable Network Graphics(*.png)</string>
</property>
</item>
<item>
<property name="text">
<string>PPM - Portable Pixmap(*.ppm)</string>
</property>
</item>
<item>
<property name="text">
<string>PGM - Portable Greymap(*.pgm)</string>
</property>
</item>
<item>
<property name="text">
<string>PBM - Portable Bitmap(*.pbm)</string>
</property>
</item>
<item>
<property name="text">
<string>TIF - TIFF Revision 6(*.tif)</string>
</property>
</item>
<item>
<property name="text">
<string>PDF - Portable Document Format(*.pdf)</string>
</property>
</item>
<item>
<property name="text">
<string>OFD - Open Fixed-layout Document(*.ofd)</string>
</property>
</item>
<item>
<property name="text">
<string>GIF - Graphics Interchange Format(*.gif)</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_option">
<property name="text">
<string>Compression option</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="cbtn_multiFile">
<property name="text">
<string>Save as multipages (TIFF/PDF/OFD/GIF)</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="radio_multiAll">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>所有页</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QRadioButton" name="radio_multiCustom">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>用户自定义页数</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QSpinBox" name="spinBox_multiPages">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</item>
<item>
<property name="text">
<string>PBM - Portable Bitmap(*.pbm)</string>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</item>
<item>
<property name="text">
<string>TIF - TIFF Revision 6(*.tif)</string>
</property>
</item>
<item>
<property name="text">
<string>PDF - Portable Document Format(*.pdf)</string>
</property>
</item>
<item>
<property name="text">
<string>OFD - Open Fixed-layout Document(*.ofd)</string>
</property>
</item>
<item>
<property name="text">
<string>GIF - Graphics Interchange Format(*.gif)</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_option">
<property name="text">
<string>Compression option</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="cbtn_multiFile">
<property name="text">
<string>Save as multipages (TIFF/PDF/OFD/GIF)</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="radio_multiAll">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>所有页</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QRadioButton" name="radio_multiCustom">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>用户自定义页数</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QSpinBox" name="spinBox_multiPages">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>

View File

@ -8,6 +8,8 @@ Dialog_Input::Dialog_Input(QWidget *parent) :
ui(new Ui::Dialog_Input)
{
ui->setupUi(this);
setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
setWindowTitle(tr("configuration scheme name change"));
}
Dialog_Input::~Dialog_Input()
@ -34,23 +36,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 +72,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();
}

View File

@ -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();

View File

@ -159,6 +159,9 @@ MainWindow::MainWindow(const QString& appLang, QWidget *parent)
connect(m_act_acquireInto2, SIGNAL(triggered()), this, SLOT(on_AcquireInto2()));
ui->toolBar->addAction(m_act_acquireInto2);
ui->toolBar->addSeparator();
initAcquireIntoComboBox();
ui->toolBar->addAction(ui->act_fitWindowWidth);
ui->toolBar->addAction(ui->act_fitWindowSize);
ui->toolBar->addAction(ui->act_zoomIn);
@ -703,6 +706,33 @@ void MainWindow::on_AcquireInto2()
}
}
void MainWindow::on_reloadAcquireIntoCfg()
{
disconnect(m_cbtn_acquireIntoCfg, SIGNAL(currentTextChanged(QString)), this, SLOT(on_m_acquireIntoCfg_changed(QString)));
m_cbtn_acquireIntoCfg->clear();
m_cbtn_acquireIntoCfg->addItem(tr("default scheme"));
connect(m_cbtn_acquireIntoCfg, SIGNAL(currentTextChanged(QString)), this, SLOT(on_m_acquireIntoCfg_changed(QString)));
QString allCfgName = getCfgValue("aquire", "cfgNameList", QString(""));
QStringList allCfgNameList = allCfgName.split(",");
if (!allCfgNameList.contains(QString("")))
{
m_cbtn_acquireIntoCfg->addItems(allCfgNameList);
m_cbtn_acquireIntoCfg->setCurrentText(getCfgValue("aquire", "currentKeyName", QString("aquire")));
}
else
{
allCfgNameList.removeOne(QString(""));
m_cbtn_acquireIntoCfg->setCurrentIndex(0);
}
}
void MainWindow::on_m_acquireIntoCfg_changed(QString schemeName)
{
QString selectedCfgName = m_cbtn_acquireIntoCfg->currentText();
Dialog_AquireInto dlg;
dlg.setConfig(selectedCfgName);
}
void MainWindow::on_itemCountChanged(int count)
{
m_wndStatusBar->setPageInfo(count, m_currIndex);
@ -3545,6 +3575,9 @@ void MainWindow::on_act_acquireInto_triggered()
}
Dialog_AquireInto dlg(this);
connect(&dlg, SIGNAL(reloadAcquireIntoCfg()), this, SLOT(on_reloadAcquireIntoCfg()));
if (dlg.exec())
{
m_singleScan = false;
@ -4348,6 +4381,28 @@ QString MainWindow::getDevPid()
return QString::fromStdString(buf2);
}
void MainWindow::initAcquireIntoComboBox()
{
m_cbtn_acquireIntoCfg = new QComboBox;
m_cbtn_acquireIntoCfg->setFixedWidth(150);
ui->toolBar->addWidget(m_cbtn_acquireIntoCfg);
m_cbtn_acquireIntoCfg->addItem(tr("default scheme"));
QString allCfgName = getCfgValue("aquire", "cfgNameList", QString(""));
QStringList allCfgNameList = allCfgName.split(",");
if (!allCfgNameList.contains(QString("")))
{
m_cbtn_acquireIntoCfg->addItems(allCfgNameList);
m_cbtn_acquireIntoCfg->setCurrentText(getCfgValue("aquire", "currentKeyName", QString("aquire")));
}
else
{
allCfgNameList.removeOne(QString(""));
m_cbtn_acquireIntoCfg->setCurrentIndex(0);
}
connect(m_cbtn_acquireIntoCfg, SIGNAL(currentTextChanged(QString)), this, SLOT(on_m_acquireIntoCfg_changed(QString)));
}
void MainWindow::on_scanOptions_changed(const QString &device, const QString &option, bool checked_now)
{
QString title(tr("app name"));

View File

@ -5,6 +5,7 @@
#include <QLineEdit>
#include <QListWidgetItem>
#include <QTranslator>
#include <QtWidgets>
#include "HGImgView.h"
#include "HGImgThumb.h"
#include "sane/sane_ex.h"
@ -124,6 +125,8 @@ signals:
private slots:
void on_AcquireInto2();
void on_reloadAcquireIntoCfg();
void on_m_acquireIntoCfg_changed(QString schemeName);
void on_itemCountChanged(int count);
void on_itemSelectingChanged();
void on_currItemChanged(int index);
@ -275,10 +278,12 @@ private:
void deleteOverdueLogFile(const QString& logFilePath);
void deleteUpgradePkg(const QString& cfgFilePath);
QString getDevPid();
void initAcquireIntoComboBox();
private:
Ui::MainWindow *ui;
QAction *m_act_acquireInto2;
QComboBox *m_cbtn_acquireIntoCfg;
QString m_currLang;
VersionDll *m_versionDll;
QString m_password;
@ -353,6 +358,7 @@ 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;
};
#endif // MAINWINDOW_H

View File

@ -216,7 +216,7 @@ FORMS += \
RESOURCES += \
../../../app/fwupgrade/FWUpgrade_resource.qrc
DISTFILES += \
TRANSLATIONS += \
../../../app/fwupgrade/FWUpgrade_zh_CN.qm \
../../../app/fwupgrade/FWUpgrade_zh_CN.ts \
../../../app/fwupgrade/qt_zh_CN.qm \

View File

@ -338,7 +338,7 @@ FORMS += \
RESOURCES += \
../../../app/scanner/Scanner_resource.qrc
DISTFILES += \
TRANSLATIONS += \
../../../app/scanner/Scanner_zh_CN.qm \
../../../app/scanner/Scanner_zh_CN.ts \
../../../app/scanner/Scanner_zh_EN.qm \

View File

@ -192,6 +192,6 @@ FORMS += \
RESOURCES += \
../../../app/upgrade/Upgrade_resource.qrc
DISTFILES += \
TRANSLATIONS += \
../../../app/upgrade/Upgrade_zh_CN.qm \
../../../app/upgrade/Upgrade_zh_CN.ts