scantool按键数量设置为4个,将硬件按键与之对应
This commit is contained in:
parent
c2b94fcdae
commit
787464e84d
Binary file not shown.
|
@ -40,28 +40,28 @@
|
|||
</message>
|
||||
<message>
|
||||
<location filename="dialog_add.cpp" line="16"/>
|
||||
<location filename="dialog_add.cpp" line="45"/>
|
||||
<location filename="dialog_add.cpp" line="48"/>
|
||||
<source>Manual</source>
|
||||
<translation>手动</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="dialog_add.cpp" line="20"/>
|
||||
<location filename="dialog_add.cpp" line="49"/>
|
||||
<location filename="dialog_add.cpp" line="52"/>
|
||||
<source>Button </source>
|
||||
<translation>按键 </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="dialog_add.cpp" line="43"/>
|
||||
<location filename="dialog_add.cpp" line="46"/>
|
||||
<source>Modify</source>
|
||||
<translation>修改</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="dialog_add.cpp" line="103"/>
|
||||
<location filename="dialog_add.cpp" line="106"/>
|
||||
<source>Tips</source>
|
||||
<translation>提示</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="dialog_add.cpp" line="103"/>
|
||||
<location filename="dialog_add.cpp" line="106"/>
|
||||
<source>Item find in list</source>
|
||||
<translation>配置已存在</translation>
|
||||
</message>
|
||||
|
@ -406,7 +406,7 @@
|
|||
<name>MainWindow</name>
|
||||
<message>
|
||||
<location filename="mainwindow.ui" line="14"/>
|
||||
<location filename="mainwindow.cpp" line="37"/>
|
||||
<location filename="mainwindow.cpp" line="38"/>
|
||||
<source>Scan Tool</source>
|
||||
<translation>扫描工具</translation>
|
||||
</message>
|
||||
|
@ -436,123 +436,131 @@
|
|||
<translation>选择设备</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="42"/>
|
||||
<location filename="mainwindow.cpp" line="43"/>
|
||||
<source>Show</source>
|
||||
<translation>打开</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="44"/>
|
||||
<location filename="mainwindow.cpp" line="45"/>
|
||||
<source>Exit</source>
|
||||
<translation>退出</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="61"/>
|
||||
<location filename="mainwindow.cpp" line="62"/>
|
||||
<source>Device Type</source>
|
||||
<translation>设备类型</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="62"/>
|
||||
<location filename="mainwindow.cpp" line="63"/>
|
||||
<source>Button Id</source>
|
||||
<translation>按键ID</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="63"/>
|
||||
<location filename="mainwindow.cpp" line="64"/>
|
||||
<source>Device Config</source>
|
||||
<translation>设备配置</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="64"/>
|
||||
<location filename="mainwindow.cpp" line="65"/>
|
||||
<source>Save Param</source>
|
||||
<translation>保存参数</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="81"/>
|
||||
<location filename="mainwindow.cpp" line="811"/>
|
||||
<location filename="mainwindow.cpp" line="1372"/>
|
||||
<location filename="mainwindow.cpp" line="1433"/>
|
||||
<location filename="mainwindow.cpp" line="82"/>
|
||||
<location filename="mainwindow.cpp" line="812"/>
|
||||
<location filename="mainwindow.cpp" line="1384"/>
|
||||
<location filename="mainwindow.cpp" line="1445"/>
|
||||
<source>Manual</source>
|
||||
<translation>手动</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="81"/>
|
||||
<location filename="mainwindow.cpp" line="811"/>
|
||||
<location filename="mainwindow.cpp" line="1372"/>
|
||||
<location filename="mainwindow.cpp" line="1433"/>
|
||||
<location filename="mainwindow.cpp" line="82"/>
|
||||
<location filename="mainwindow.cpp" line="812"/>
|
||||
<location filename="mainwindow.cpp" line="1384"/>
|
||||
<location filename="mainwindow.cpp" line="1445"/>
|
||||
<source>Button 1</source>
|
||||
<translation>按键 1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="81"/>
|
||||
<location filename="mainwindow.cpp" line="811"/>
|
||||
<location filename="mainwindow.cpp" line="1372"/>
|
||||
<location filename="mainwindow.cpp" line="1433"/>
|
||||
<location filename="mainwindow.cpp" line="82"/>
|
||||
<location filename="mainwindow.cpp" line="812"/>
|
||||
<location filename="mainwindow.cpp" line="1384"/>
|
||||
<location filename="mainwindow.cpp" line="1445"/>
|
||||
<source>Button 2</source>
|
||||
<translation>按键 2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="81"/>
|
||||
<location filename="mainwindow.cpp" line="811"/>
|
||||
<location filename="mainwindow.cpp" line="1372"/>
|
||||
<location filename="mainwindow.cpp" line="1433"/>
|
||||
<location filename="mainwindow.cpp" line="82"/>
|
||||
<location filename="mainwindow.cpp" line="812"/>
|
||||
<location filename="mainwindow.cpp" line="1384"/>
|
||||
<location filename="mainwindow.cpp" line="1445"/>
|
||||
<source>Button 3</source>
|
||||
<translation>按键 3</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="602"/>
|
||||
<location filename="mainwindow.cpp" line="1342"/>
|
||||
<location filename="mainwindow.cpp" line="1398"/>
|
||||
<location filename="mainwindow.cpp" line="1404"/>
|
||||
<location filename="mainwindow.cpp" line="1418"/>
|
||||
<location filename="mainwindow.cpp" line="1450"/>
|
||||
<location filename="mainwindow.cpp" line="1456"/>
|
||||
<location filename="mainwindow.cpp" line="82"/>
|
||||
<location filename="mainwindow.cpp" line="812"/>
|
||||
<location filename="mainwindow.cpp" line="1384"/>
|
||||
<location filename="mainwindow.cpp" line="1445"/>
|
||||
<source>Button 4</source>
|
||||
<translation>按键 4</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="603"/>
|
||||
<location filename="mainwindow.cpp" line="1354"/>
|
||||
<location filename="mainwindow.cpp" line="1410"/>
|
||||
<location filename="mainwindow.cpp" line="1416"/>
|
||||
<location filename="mainwindow.cpp" line="1430"/>
|
||||
<location filename="mainwindow.cpp" line="1462"/>
|
||||
<location filename="mainwindow.cpp" line="1468"/>
|
||||
<source>Tips</source>
|
||||
<translation>提示</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="602"/>
|
||||
<location filename="mainwindow.cpp" line="1342"/>
|
||||
<location filename="mainwindow.cpp" line="1404"/>
|
||||
<location filename="mainwindow.cpp" line="603"/>
|
||||
<location filename="mainwindow.cpp" line="1354"/>
|
||||
<location filename="mainwindow.cpp" line="1416"/>
|
||||
<source>Device is offline</source>
|
||||
<translation>设备已断开</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="962"/>
|
||||
<location filename="mainwindow.cpp" line="963"/>
|
||||
<source>binary</source>
|
||||
<translation>黑白</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="964"/>
|
||||
<location filename="mainwindow.cpp" line="965"/>
|
||||
<source>gray</source>
|
||||
<translation>256级灰度</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="966"/>
|
||||
<location filename="mainwindow.cpp" line="967"/>
|
||||
<source>rgb</source>
|
||||
<translation>24位彩色</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="1398"/>
|
||||
<location filename="mainwindow.cpp" line="1450"/>
|
||||
<location filename="mainwindow.cpp" line="1410"/>
|
||||
<location filename="mainwindow.cpp" line="1462"/>
|
||||
<source>No item selected</source>
|
||||
<translation>请选择配置项</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="1418"/>
|
||||
<location filename="mainwindow.cpp" line="1430"/>
|
||||
<source>Device type mismatch</source>
|
||||
<translation>设备类型不匹配</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="1456"/>
|
||||
<location filename="mainwindow.cpp" line="1468"/>
|
||||
<source>Manual configuration items cannot be deleted</source>
|
||||
<translation>手动扫描配置不可被删除</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="1460"/>
|
||||
<location filename="mainwindow.cpp" line="1472"/>
|
||||
<source>Question</source>
|
||||
<translation>询问</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="1461"/>
|
||||
<location filename="mainwindow.cpp" line="1473"/>
|
||||
<source>Are you sure you want to remove the item?</source>
|
||||
<translation>确认删除配置项?</translation>
|
||||
</message>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include "mainwindow.h"
|
||||
#include <QMessageBox>
|
||||
|
||||
Dialog_Add::Dialog_Add(SANE_Handle devHandle, class MainWindow *mainWnd, const std::string &deviceType)
|
||||
Dialog_Add::Dialog_Add(SANE_Handle devHandle, class MainWindow *mainWnd, const std::string &deviceType, int curButtonId)
|
||||
: QDialog(mainWnd)
|
||||
, ui(new Ui::Dialog_Add)
|
||||
, m_mainWnd(mainWnd)
|
||||
|
@ -19,6 +19,9 @@ Dialog_Add::Dialog_Add(SANE_Handle devHandle, class MainWindow *mainWnd, const s
|
|||
for (SANE_Int i = 0; i < buttonCount; ++i)
|
||||
ui->comboBoxButtonId->addItem(tr("Button ") + QString::number(i + 1));
|
||||
|
||||
if (buttonCount >= curButtonId)
|
||||
ui->comboBoxButtonId->setCurrentIndex(curButtonId);
|
||||
|
||||
m_scanParam.deviceType = deviceType;
|
||||
m_scanParam.buttonId = ui->comboBoxButtonId->currentIndex();
|
||||
m_scanParam.deviceConfigs.clear();
|
||||
|
@ -93,7 +96,8 @@ void Dialog_Add::on_pushButtonSaveParam_clicked()
|
|||
|
||||
void Dialog_Add::on_comboBoxButtonId_currentIndexChanged(int index)
|
||||
{
|
||||
m_scanParam.buttonId = index;
|
||||
if (index >= 0)
|
||||
m_scanParam.buttonId = index;
|
||||
}
|
||||
|
||||
void Dialog_Add::on_pushButtonOK_clicked()
|
||||
|
|
|
@ -23,7 +23,7 @@ class Dialog_Add : public QDialog
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Dialog_Add(SANE_Handle devHandle, class MainWindow *mainWnd, const std::string &deviceType);
|
||||
explicit Dialog_Add(SANE_Handle devHandle, class MainWindow *mainWnd, const std::string &deviceType, int curButtonId);
|
||||
Dialog_Add(SANE_Handle devHandle, class MainWindow *mainWnd, const ScanParam &scanParam, int index);
|
||||
~Dialog_Add();
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
, m_devHandle(nullptr)
|
||||
, m_scanning(false)
|
||||
, m_dpi(200)
|
||||
, m_currentButtonClicked(0)
|
||||
, m_scanFileName("")
|
||||
, m_scanImgFmtWriter(nullptr)
|
||||
, m_ocrMsgPump(nullptr)
|
||||
|
@ -78,7 +79,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
ui->tableWidget->item(index, 0)->setTextAlignment(Qt::AlignCenter);
|
||||
ui->tableWidget->item(index, 0)->setFlags(ui->tableWidget->item(index, 0)->flags() & ~Qt::ItemIsEditable);
|
||||
|
||||
QStringList btnTypeStr = {tr("Manual"), tr("Button 1"), tr("Button 2"), tr("Button 3")};
|
||||
QStringList btnTypeStr = {tr("Manual"), tr("Button 1"), tr("Button 2"), tr("Button 3"), tr("Button 4")};
|
||||
ui->tableWidget->setItem(index, 1, new QTableWidgetItem(btnTypeStr[m_vScanParams[index].buttonId]));
|
||||
ui->tableWidget->item(index, 1)->setTextAlignment(Qt::AlignCenter);
|
||||
ui->tableWidget->item(index, 1)->setFlags(ui->tableWidget->item(index, 1)->flags() & ~Qt::ItemIsEditable);
|
||||
|
@ -808,7 +809,7 @@ void MainWindow::AddManualScanParam()
|
|||
ui->tableWidget->item(index, 0)->setTextAlignment(Qt::AlignCenter);
|
||||
ui->tableWidget->item(index, 0)->setFlags(ui->tableWidget->item(index, 0)->flags() & ~Qt::ItemIsEditable);
|
||||
|
||||
QStringList btnTypeStr = {tr("Manual"), tr("Button 1"), tr("Button 2"), tr("Button 3")};
|
||||
QStringList btnTypeStr = {tr("Manual"), tr("Button 1"), tr("Button 2"), tr("Button 3"), tr("Button 4")};
|
||||
ui->tableWidget->setItem(index, 1, new QTableWidgetItem(btnTypeStr[m_vScanParams[index].buttonId]));
|
||||
ui->tableWidget->item(index, 1)->setTextAlignment(Qt::AlignCenter);
|
||||
ui->tableWidget->item(index, 1)->setFlags(ui->tableWidget->item(index, 1)->flags() & ~Qt::ItemIsEditable);
|
||||
|
@ -1234,6 +1235,7 @@ void MainWindow::on_deviceRemove(QString devName)
|
|||
void MainWindow::on_keyPress(unsigned int buttonId)
|
||||
{
|
||||
assert(nullptr != m_devHandle);
|
||||
m_currentButtonClicked = buttonId;
|
||||
StartScan(buttonId);
|
||||
}
|
||||
|
||||
|
@ -1352,7 +1354,7 @@ void MainWindow::on_pushButtonAdd_clicked()
|
|||
}
|
||||
|
||||
assert(nullptr == m_dlgAdd);
|
||||
m_dlgAdd = new Dialog_Add(m_devHandle, this, deviceType);
|
||||
m_dlgAdd = new Dialog_Add(m_devHandle, this, deviceType, m_currentButtonClicked);
|
||||
connect(this, SIGNAL(closeDevice()), m_dlgAdd, SLOT(on_closeDevice()));
|
||||
if (m_dlgAdd->exec())
|
||||
{
|
||||
|
@ -1369,7 +1371,7 @@ void MainWindow::on_pushButtonAdd_clicked()
|
|||
ui->tableWidget->item(index, 0)->setTextAlignment(Qt::AlignCenter);
|
||||
ui->tableWidget->item(index, 0)->setFlags(ui->tableWidget->item(index, 0)->flags() & ~Qt::ItemIsEditable);
|
||||
|
||||
QStringList btnTypeStr = {tr("Manual"), tr("Button 1"), tr("Button 2"), tr("Button 3")};
|
||||
QStringList btnTypeStr = {tr("Manual"), tr("Button 1"), tr("Button 2"), tr("Button 3"), tr("Button 4")};
|
||||
ui->tableWidget->setItem(index, 1, new QTableWidgetItem(btnTypeStr[m_vScanParams[index].buttonId]));
|
||||
ui->tableWidget->item(index, 1)->setTextAlignment(Qt::AlignCenter);
|
||||
ui->tableWidget->item(index, 1)->setFlags(ui->tableWidget->item(index, 1)->flags() & ~Qt::ItemIsEditable);
|
||||
|
@ -1430,7 +1432,7 @@ void MainWindow::on_pushButtonModify_clicked()
|
|||
|
||||
ui->tableWidget->item(index, 0)->setText(QString::fromStdString(m_vScanParams[index].deviceType));
|
||||
|
||||
QStringList btnTypeStr = {tr("Manual"), tr("Button 1"), tr("Button 2"), tr("Button 3")};
|
||||
QStringList btnTypeStr = {tr("Manual"), tr("Button 1"), tr("Button 2"), tr("Button 3"), tr("Button 4")};
|
||||
ui->tableWidget->item(index, 1)->setText(btnTypeStr[m_vScanParams[index].buttonId]);
|
||||
|
||||
ui->tableWidget->item(index, 2)->setText(GetDesc(m_vScanParams[index].deviceConfigs));
|
||||
|
|
|
@ -98,6 +98,7 @@ private:
|
|||
int m_aquireIntoBatchStartIndex;
|
||||
int m_aquireIntoPageIndex;
|
||||
int m_aquireIntoMultiPageCount;
|
||||
int m_currentButtonClicked;
|
||||
HGMsgPump m_ocrMsgPump;
|
||||
HGThread m_ocrThread;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue