HGGitLab

Commit 5ac244a4 authored by yangjiaxuan's avatar yangjiaxuan

增加判断清空扫描

parent bd92a624
......@@ -1272,319 +1272,337 @@ Please make sure the two passwords are the same.</source>
<translation>清除辊轴计数</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="58"/>
<location filename="mainwindow.cpp" line="1942"/>
<location filename="mainwindow.cpp" line="59"/>
<location filename="mainwindow.cpp" line="1973"/>
<source>HuaGoScan</source>
<translation>华高扫描软件</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="177"/>
<location filename="mainwindow.cpp" line="178"/>
<source>Grid</source>
<translation>多列显示</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="182"/>
<location filename="mainwindow.cpp" line="183"/>
<source>Insert files</source>
<translation>插入文件</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="220"/>
<location filename="mainwindow.cpp" line="222"/>
<source>nodevice</source>
<translation>没有发现扫描仪</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="387"/>
<location filename="mainwindow.cpp" line="1258"/>
<location filename="mainwindow.cpp" line="1293"/>
<location filename="mainwindow.cpp" line="1555"/>
<location filename="mainwindow.cpp" line="1848"/>
<location filename="mainwindow.cpp" line="389"/>
<location filename="mainwindow.cpp" line="1082"/>
<location filename="mainwindow.cpp" line="1289"/>
<location filename="mainwindow.cpp" line="1324"/>
<location filename="mainwindow.cpp" line="1586"/>
<location filename="mainwindow.cpp" line="1879"/>
<source>Question</source>
<translation>警告</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="388"/>
<location filename="mainwindow.cpp" line="1259"/>
<location filename="mainwindow.cpp" line="1294"/>
<location filename="mainwindow.cpp" line="390"/>
<location filename="mainwindow.cpp" line="1290"/>
<location filename="mainwindow.cpp" line="1325"/>
<source>modified, save it?</source>
<translation>图像已被修改。
是否保存修改?</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="673"/>
<location filename="mainwindow.cpp" line="674"/>
<location filename="mainwindow.cpp" line="675"/>
<location filename="mainwindow.cpp" line="676"/>
<source> already connected</source>
<translation> 已连接</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="716"/>
<location filename="mainwindow.cpp" line="718"/>
<source> disconnected</source>
<translation> 已断开连接</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="778"/>
<location filename="mainwindow.cpp" line="797"/>
<location filename="mainwindow.cpp" line="784"/>
<location filename="mainwindow.cpp" line="803"/>
<source>%1/%2%3.%4</source>
<translation>%1/%2%3.%4</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="817"/>
<location filename="mainwindow.cpp" line="822"/>
<location filename="mainwindow.cpp" line="823"/>
<location filename="mainwindow.cpp" line="828"/>
<source>scan starting...</source>
<translation>开始扫描...</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="832"/>
<location filename="mainwindow.cpp" line="843"/>
<location filename="mainwindow.cpp" line="838"/>
<location filename="mainwindow.cpp" line="849"/>
<source>scan finished</source>
<translation>扫描完成</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1217"/>
<location filename="mainwindow.cpp" line="1079"/>
<source>Clear, then start scan</source>
<translation>清空并启动扫描</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1080"/>
<source>Do NOT clear, then start scan</source>
<translation>不清空并启动扫描</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1083"/>
<source>Already exist images in image list.
Do you want to clear?</source>
<translation>图像列表中已存在图像。
是否清空?</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1248"/>
<source>Open images</source>
<translation>打开图片</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1223"/>
<location filename="mainwindow.cpp" line="1254"/>
<source>Insert images</source>
<translation>插入图片</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1475"/>
<location filename="mainwindow.cpp" line="1506"/>
<source>File name</source>
<translation>文件名</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1475"/>
<location filename="mainwindow.cpp" line="1506"/>
<source>File path</source>
<translation>文件路径</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1475"/>
<location filename="mainwindow.cpp" line="1506"/>
<source>File size</source>
<translation>文件大小</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1475"/>
<location filename="mainwindow.cpp" line="1506"/>
<source>Creation date/time</source>
<translation>创建时间</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1475"/>
<location filename="mainwindow.cpp" line="1506"/>
<source>Modified date/time</source>
<translation>修改时间</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1475"/>
<location filename="mainwindow.cpp" line="1506"/>
<source>Accessed date/time</source>
<translation>访问时间</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1518"/>
<location filename="mainwindow.cpp" line="1549"/>
<source>Format</source>
<translation>格式</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1518"/>
<location filename="mainwindow.cpp" line="1549"/>
<source>Width</source>
<translation>宽度</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1518"/>
<location filename="mainwindow.cpp" line="1549"/>
<source>Height</source>
<translation>高度</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1518"/>
<location filename="mainwindow.cpp" line="1549"/>
<source>depth</source>
<translation>深度</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1518"/>
<location filename="mainwindow.cpp" line="1549"/>
<source>Color model</source>
<translation>色彩模式</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1518"/>
<location filename="mainwindow.cpp" line="1549"/>
<source>DPI</source>
<translation>每英寸像素点</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1518"/>
<location filename="mainwindow.cpp" line="1549"/>
<source>Print size</source>
<translation>打印尺寸</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1518"/>
<location filename="mainwindow.cpp" line="1549"/>
<source>Frame</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1526"/>
<location filename="mainwindow.cpp" line="1557"/>
<source>None</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1526"/>
<location filename="mainwindow.cpp" line="1557"/>
<source>Mono</source>
<translation>黑白</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1526"/>
<location filename="mainwindow.cpp" line="1557"/>
<source>Gray</source>
<translation>灰度</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1526"/>
<location filename="mainwindow.cpp" line="1557"/>
<source>Color</source>
<translation>彩色</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1547"/>
<location filename="mainwindow.cpp" line="1578"/>
<source>Warning</source>
<translation>警告</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1547"/>
<location filename="mainwindow.cpp" line="1578"/>
<source>Device is Running!
Please finish scanning first.</source>
<translation>设备正在运行!
请先结束扫描。</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1556"/>
<location filename="mainwindow.cpp" line="1587"/>
<source>Application is about to close.Make sure all needed files are saved.
Continue to close?</source>
<translation>应用程序即将关闭。请确认所有需要的文件已被保存。
是否继续关闭?</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1849"/>
<location filename="mainwindow.cpp" line="1880"/>
<source>Sure to sign out administrator account?</source>
<translation>是否确定登出管理员账户?</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2055"/>
<location filename="mainwindow.cpp" line="2056"/>
<location filename="mainwindow.cpp" line="2114"/>
<location filename="mainwindow.cpp" line="2115"/>
<location filename="mainwindow.cpp" line="2098"/>
<location filename="mainwindow.cpp" line="2099"/>
<location filename="mainwindow.cpp" line="2157"/>
<location filename="mainwindow.cpp" line="2158"/>
<source>start failed</source>
<translation>启动失败</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="390"/>
<location filename="mainwindow.cpp" line="1261"/>
<location filename="mainwindow.cpp" line="1296"/>
<location filename="mainwindow.cpp" line="1558"/>
<location filename="mainwindow.cpp" line="1850"/>
<location filename="mainwindow.cpp" line="392"/>
<location filename="mainwindow.cpp" line="1292"/>
<location filename="mainwindow.cpp" line="1327"/>
<location filename="mainwindow.cpp" line="1589"/>
<location filename="mainwindow.cpp" line="1881"/>
<source>yes</source>
<translation>确定</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="391"/>
<location filename="mainwindow.cpp" line="1262"/>
<location filename="mainwindow.cpp" line="1297"/>
<location filename="mainwindow.cpp" line="1559"/>
<location filename="mainwindow.cpp" line="1851"/>
<location filename="mainwindow.cpp" line="393"/>
<location filename="mainwindow.cpp" line="1293"/>
<location filename="mainwindow.cpp" line="1328"/>
<location filename="mainwindow.cpp" line="1590"/>
<location filename="mainwindow.cpp" line="1882"/>
<source>no</source>
<translation>取消</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1908"/>
<location filename="mainwindow.cpp" line="1910"/>
<location filename="mainwindow.cpp" line="1939"/>
<location filename="mainwindow.cpp" line="1941"/>
<source>hint</source>
<translation>提示</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1908"/>
<location filename="mainwindow.cpp" line="1939"/>
<source>Roller scanned count has been set to 0.</source>
<translation>辊轴计数已置零</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1910"/>
<location filename="mainwindow.cpp" line="1941"/>
<source>Roller scanned count reset failed.</source>
<translation>重置辊轴计数失败</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1924"/>
<location filename="mainwindow.cpp" line="1955"/>
<source>Error</source>
<translation>错误</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1924"/>
<location filename="mainwindow.cpp" line="1955"/>
<source>Document missing! It would be deleted or renamed.</source>
<translation>文档丢失!文档可能已被删除或被重命名。</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1943"/>
<location filename="mainwindow.cpp" line="1974"/>
<source>HuaGoScan Application</source>
<translation>华高扫描应用程序</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1944"/>
<location filename="mainwindow.cpp" line="1975"/>
<source>2018-2022 HuaGoScan</source>
<translation>2018-2021 HUAGOSCAN</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1945"/>
<location filename="mainwindow.cpp" line="1976"/>
<source>Manufacturer/Developer: Ningbo Huagao Info&amp;Tech co.,ltd.</source>
<translation>制造商/开发商: 宁波华高信息科技有限公司</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1946"/>
<location filename="mainwindow.cpp" line="1977"/>
<source>&lt;br&gt;Company website: &lt;a href=&apos;http://www.huagaochina.com/&apos;&gt;www.huagaochina.com&lt;/a&gt;</source>
<translation>&lt;br&gt;公司网址: &lt;a href=&apos;http://www.huagaochina.com/&apos;&gt;www.huagaochina.com&lt;/a&gt;</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1947"/>
<location filename="mainwindow.cpp" line="1978"/>
<source>&lt;br&gt;Contact: +86 0574 27974866</source>
<translation>&lt;br&gt;联系电话: +86 0574 27974866</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1949"/>
<location filename="mainwindow.cpp" line="1980"/>
<source>&lt;br&gt;Company address: No.655,Xueshi Road,Yinzhou district,Ningbo,Zhejiang,China(PRC)</source>
<translation>&lt;br&gt;地址: 浙江省宁波市鄞州区学士路655 C211</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1950"/>
<location filename="mainwindow.cpp" line="1981"/>
<source>Navigation: &lt;a href=&apos;https://j.map.baidu.com/7e/1TO&apos;&gt;Visit in Baidu map.&lt;/a&gt;</source>
<translation>&lt;br&gt;导航地址: &lt;a href=&apos;https://j.map.baidu.com/7e/1TO&apos;&gt;百度地图访问&lt;/a&gt;</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1953"/>
<location filename="mainwindow.cpp" line="1972"/>
<location filename="mainwindow.cpp" line="1984"/>
<location filename="mainwindow.cpp" line="2003"/>
<source>About %1</source>
<translation>关于 %1</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1954"/>
<location filename="mainwindow.cpp" line="1973"/>
<location filename="mainwindow.cpp" line="1985"/>
<location filename="mainwindow.cpp" line="2004"/>
<source>&lt;p&gt;%1&lt;/p&gt;&lt;p&gt;Version: %2&lt;br&gt;CopyRight: &amp;#169; %3&lt;/p&gt;&lt;p&gt;%4%5%6%7%8%9&lt;/p&gt;</source>
<translation>&lt;p&gt;%1&lt;/p&gt;&lt;p&gt;版本: %2&lt;br&gt;版权: &amp;#169; %3&lt;/p&gt;&lt;p&gt;%4%5%6%7%8%9&lt;/p&gt;</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1987"/>
<location filename="mainwindow.cpp" line="2018"/>
<source>about %1</source>
<translation>关于 %1</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1988"/>
<location filename="mainwindow.cpp" line="2019"/>
<source>&lt;p&gt;Version: %1&lt;/p&gt;</source>
<oldsource>&lt;p&gt;版本: %1&lt;/p&gt;</oldsource>
<translation>&lt;p&gt;版本: %1&lt;/p&gt;</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1989"/>
<location filename="mainwindow.cpp" line="2020"/>
<source>&lt;p&gt;CopyRight: &amp;#169; %1&lt;/p&gt;</source>
<oldsource>&lt;p&gt;版权: &amp;#169; %1&lt;/p&gt;</oldsource>
<translation>&lt;p&gt;版权: &amp;#169; %1&lt;/p&gt;</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1993"/>
<location filename="mainwindow.cpp" line="2024"/>
<source>&lt;p&gt;%1: &lt;a href=&apos;%2&apos;&gt;%3&lt;/a&gt;&lt;/p&gt;</source>
<translation>&lt;p&gt;%1: &lt;a href=&apos;%2&apos;&gt;%3&lt;/a&gt;&lt;/p&gt;</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1995"/>
<location filename="mainwindow.cpp" line="2026"/>
<source>&lt;p&gt;%1: %2&lt;/p&gt;</source>
<translation>&lt;p&gt;%1: %2&lt;/p&gt;</translation>
</message>
......
......@@ -88,7 +88,8 @@ void dialog_log::closeEvent(QCloseEvent *event)
void dialog_log::on_pbtn_continuScan_cliked()
{
emit continuScan();
bool isContinuScan = true;
emit continuScan(isContinuScan);
}
void dialog_log::on_pbtn_finishScan_cliked()
......
......@@ -40,7 +40,7 @@ private slots:
signals:
void invoke_stop(void);
void continuScan(void);
void continuScan(bool isContinuScan);
private:
Ui::dialog_log *ui;
......
......@@ -49,6 +49,7 @@ MainWindow::MainWindow(QWidget *parent)
, m_scanType(1)
, m_scanInsertPos(-1)
, m_isScanning(false)
, m_isContinuScan(false)
, m_scanFileName("")
, m_scanImgFmtWriter(nullptr)
{
......@@ -214,6 +215,7 @@ MainWindow::MainWindow(QWidget *parent)
connect(this, SIGNAL(scan_working()), this, SLOT(on_scan_working()), Qt::QueuedConnection);
connect(this, SIGNAL(scan_finish()), this, SLOT(on_scan_finish()), Qt::QueuedConnection);
connect(this, SIGNAL(sane_dev_error(QString)), this, SLOT(on_sane_dev_error(QString)), Qt::QueuedConnection);
connect(m_dialog_log, SIGNAL(continuScan(bool)), this, SLOT(on_continuScan(bool)), Qt::QueuedConnection);
connect(m_dialog_log, SIGNAL(continuScan(void)), this, SLOT(on_act_acquire_triggered(void)), Qt::QueuedConnection);
connect(m_dialog_log, SIGNAL(invoke_stop(void)), this, SLOT(on_act_acquireStop_triggered(void)), Qt::QueuedConnection);
......@@ -848,6 +850,12 @@ void MainWindow::on_scan_finish()
set_actions_enabled(!m_isScanning);
}
void MainWindow::on_continuScan(bool isContinuScan)
{
m_isContinuScan = isContinuScan;
on_act_acquire_triggered();
}
void MainWindow::on_act_thumbnailBar_triggered(bool checked)
{
ui->dockWidget->setVisible(checked);
......@@ -1065,6 +1073,25 @@ void MainWindow::set_actions_enabled(bool enable)
ui->menu_device->setEnabled(enable);
}
askIfClear MainWindow::startScanMessageBox(QWidget *parent)
{
QMessageBox box(parent);
QPushButton* clearBtn = box.addButton(tr("Clear, then start scan"), QMessageBox::ActionRole);
box.addButton(tr("Do NOT clear, then start scan"), QMessageBox::ActionRole);
QPushButton* cancelBtn = box.addButton(QMessageBox::Cancel);
box.setWindowTitle(tr("Question"));
box.setText(tr("Already exist images in image list.\nDo you want to clear?"));
box.exec();
if (box.clickedButton() == cancelBtn)
return cancel;
else if (box.clickedButton() == clearBtn)
{
on_act_closeAll_triggered();
return clearAndScan;
}
return notClearAndScan;
}
void MainWindow::on_act_openPageNum_triggered()
{
int count = 0;
......@@ -2042,6 +2069,18 @@ void MainWindow::on_act_acquire_triggered()
{
m_scanType = 1;
m_scanInsertPos = -1;
int result = 0;
int count = 0;
m_thumb->getItemCount(&count);
if(!m_isContinuScan)
{
if (count != 0)
result = startScanMessageBox(this);
else
result = notClearAndScan;
if(cancel == result)
return;
}
#if defined(HG_CMP_MSC) && defined(APP_USE_TWAIN)
if (HGBASE_ERR_OK == HGTwain_OpenDS(m_twainDS))
{
......
......@@ -43,6 +43,13 @@ protected:
}
};
enum askIfClear
{
cancel = 0,
clearAndScan,
notClearAndScan
};
class MainWindow : public QMainWindow
{
Q_OBJECT
......@@ -112,6 +119,7 @@ private slots:
void on_new_image(void *img);
void on_scan_working();
void on_scan_finish();
void on_continuScan(bool isContinuScan);
void on_act_thumbnailBar_triggered(bool checked);
......@@ -203,6 +211,7 @@ private:
void updateStatusBarPixelInfo();
void updateActionStatus();
void set_actions_enabled(bool enable);
askIfClear startScanMessageBox(QWidget* parent);
private:
Ui::MainWindow *ui;
......@@ -233,6 +242,7 @@ private:
int m_scanType; // 1-扫描到缓存目录,2-扫描到本地目录
int m_scanInsertPos; // 扫描插入位置,-1表示插入到最后
bool m_isScanning;
bool m_isContinuScan;
QString m_scanFileName;
HGImgFmtWriter m_scanImgFmtWriter;
AquireIntoSaveParam m_aquireIntoSaveParam;
......
......@@ -100,8 +100,8 @@ HEADERS += \
../../../app/scanner/dialog_admin.h \
../../../app/scanner/dialog_log.h \
../../../app/scanner/config.h \
../../../third_party/json/json.h \
../../../third_party/json/cJSON.h \
../../../app/scanner/json/json.h \
../../../app/scanner/json/cJSON.h \
../../../ui/HGImgThumb.h \
../../../ui/HGImgView.h \
../../../ui/HGUIGlobal.h
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment