This commit is contained in:
13038267101 2023-01-06 14:24:03 +08:00
commit 2b5be77410
13 changed files with 397 additions and 216 deletions

View File

@ -74,6 +74,11 @@
<source>serialNum:</source>
<translation></translation>
</message>
<message>
<location filename="dialog_inputserialnum.ui" line="130"/>
<source>Set Sn</source>
<translation></translation>
</message>
<message>
<location filename="dialog_inputserialnum.ui" line="26"/>
<source>OK</source>
@ -85,27 +90,45 @@
<translation></translation>
</message>
<message>
<location filename="dialog_inputserialnum.cpp" line="55"/>
<location filename="dialog_inputserialnum.cpp" line="64"/>
<location filename="dialog_inputserialnum.cpp" line="71"/>
<location filename="dialog_inputserialnum.cpp" line="70"/>
<location filename="dialog_inputserialnum.cpp" line="77"/>
<location filename="dialog_inputserialnum.cpp" line="86"/>
<location filename="dialog_inputserialnum.cpp" line="93"/>
<location filename="dialog_inputserialnum.cpp" line="110"/>
<location filename="dialog_inputserialnum.cpp" line="115"/>
<source>tips</source>
<translation></translation>
</message>
<message>
<location filename="dialog_inputserialnum.cpp" line="55"/>
<location filename="dialog_inputserialnum.cpp" line="70"/>
<source>device is lost</source>
<translation></translation>
</message>
<message>
<location filename="dialog_inputserialnum.cpp" line="77"/>
<source>Serial num is empty</source>
<translation></translation>
</message>
<message>
<location filename="dialog_inputserialnum.cpp" line="64"/>
<location filename="dialog_inputserialnum.cpp" line="86"/>
<source>sn is illegal</source>
<translation></translation>
</message>
<message>
<location filename="dialog_inputserialnum.cpp" line="71"/>
<location filename="dialog_inputserialnum.cpp" line="93"/>
<source>The device is testing</source>
<translation></translation>
</message>
<message>
<location filename="dialog_inputserialnum.cpp" line="110"/>
<source>set sn failed</source>
<translation></translation>
</message>
<message>
<location filename="dialog_inputserialnum.cpp" line="115"/>
<source>set sn succeed</source>
<translation></translation>
</message>
</context>
<context>
<name>Dialog_SetBurnSn</name>
@ -582,12 +605,11 @@
<translation></translation>
</message>
<message>
<location filename="form_burnmode.ui" line="51"/>
<source>Set sn</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="form_burnmode.ui" line="64"/>
<location filename="form_burnmode.ui" line="51"/>
<source>Close</source>
<translation></translation>
</message>
@ -613,8 +635,6 @@
</message>
<message>
<location filename="form_burnmode.cpp" line="155"/>
<location filename="form_burnmode.cpp" line="184"/>
<location filename="form_burnmode.cpp" line="189"/>
<location filename="form_burnmode.cpp" line="340"/>
<source>tips</source>
<translation></translation>
@ -626,14 +646,12 @@
<translation></translation>
</message>
<message>
<location filename="form_burnmode.cpp" line="189"/>
<source>Please check single devices to set sn</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="form_burnmode.cpp" line="184"/>
<source>Please check a devices to set sn at least</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
</context>
<context>
@ -654,104 +672,124 @@
<translation></translation>
</message>
<message>
<location filename="form_maininterface.ui" line="87"/>
<location filename="form_maininterface.ui" line="36"/>
<source>SpeedMode:</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.ui" line="43"/>
<source>SleepTime:</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.ui" line="101"/>
<source>Privious Step</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.ui" line="101"/>
<location filename="form_maininterface.ui" line="115"/>
<source>PASS</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.ui" line="108"/>
<location filename="form_maininterface.ui" line="122"/>
<source>FAIL</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.ui" line="115"/>
<location filename="form_maininterface.ui" line="129"/>
<source>START</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.ui" line="129"/>
<location filename="form_maininterface.ui" line="143"/>
<source>PrePage</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.ui" line="136"/>
<location filename="form_maininterface.ui" line="150"/>
<source>NextPage</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.ui" line="143"/>
<location filename="form_maininterface.ui" line="157"/>
<source>LeftRotate</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.ui" line="150"/>
<location filename="form_maininterface.ui" line="164"/>
<source>RightRotate</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.ui" line="49"/>
<location filename="form_maininterface.ui" line="63"/>
<source>STOP</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.ui" line="122"/>
<location filename="form_maininterface.ui" line="136"/>
<source>SHOWIMG</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.ui" line="94"/>
<location filename="form_maininterface.ui" line="108"/>
<source>Next Step</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="49"/>
<location filename="form_maininterface.cpp" line="51"/>
<source>Device has connected</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="53"/>
<location filename="form_maininterface.cpp" line="55"/>
<source>Device hasnot connected</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="54"/>
<location filename="form_maininterface.cpp" line="56"/>
<source>Device type:</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="54"/>
<location filename="form_maininterface.cpp" line="56"/>
<source> SerialNum:</source>
<translation> </translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="55"/>
<location filename="form_maininterface.cpp" line="126"/>
<location filename="form_maininterface.cpp" line="57"/>
<location filename="form_maininterface.cpp" line="140"/>
<source> connect status:</source>
<translation> </translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="62"/>
<source> speed mode: </source>
<translation> </translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="67"/>
<source> sleep time: </source>
<translation> </translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="79"/>
<source>load last image which uploaded last time</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="125"/>
<location filename="form_maininterface.cpp" line="139"/>
<source>Device has disconnected</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="142"/>
<location filename="form_maininterface.cpp" line="511"/>
<location filename="form_maininterface.cpp" line="156"/>
<location filename="form_maininterface.cpp" line="589"/>
<source>tips</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="175"/>
<location filename="form_maininterface.cpp" line="190"/>
<source>destortion value: </source>
<translation> </translation>
</message>
@ -764,47 +802,52 @@
<translation type="vanished"></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="288"/>
<location filename="form_maininterface.cpp" line="323"/>
<source>ID</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="288"/>
<location filename="form_maininterface.cpp" line="323"/>
<source>Test items</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="288"/>
<location filename="form_maininterface.cpp" line="323"/>
<source>status</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="370"/>
<location filename="form_maininterface.cpp" line="405"/>
<source>not test</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="370"/>
<location filename="form_maininterface.cpp" line="405"/>
<source>not pass</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="370"/>
<location filename="form_maininterface.cpp" line="405"/>
<source>not support</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="370"/>
<location filename="form_maininterface.cpp" line="405"/>
<source>pass</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="422"/>
<location filename="form_maininterface.cpp" line="460"/>
<source>image pixel: </source>
<translation> </translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="511"/>
<location filename="form_maininterface.cpp" line="489"/>
<source> minute</source>
<translation> </translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="589"/>
<source>no image</source>
<translation></translation>
</message>
@ -875,7 +918,7 @@
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="476"/>
<location filename="mainwindow.cpp" line="485"/>
<source>Account login elsewhere</source>
<translation></translation>
</message>
@ -884,56 +927,56 @@
<translation type="vanished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="479"/>
<location filename="mainwindow.cpp" line="488"/>
<source>You have been forced offline by the administrator account</source>
<translation>线</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="482"/>
<location filename="mainwindow.cpp" line="491"/>
<source>Data base error</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="298"/>
<location filename="mainwindow.cpp" line="408"/>
<location filename="mainwindow.cpp" line="430"/>
<location filename="mainwindow.cpp" line="441"/>
<location filename="mainwindow.cpp" line="492"/>
<location filename="mainwindow.cpp" line="510"/>
<location filename="mainwindow.cpp" line="535"/>
<location filename="mainwindow.cpp" line="539"/>
<location filename="mainwindow.cpp" line="548"/>
<location filename="mainwindow.cpp" line="299"/>
<location filename="mainwindow.cpp" line="409"/>
<location filename="mainwindow.cpp" line="431"/>
<location filename="mainwindow.cpp" line="445"/>
<location filename="mainwindow.cpp" line="501"/>
<location filename="mainwindow.cpp" line="520"/>
<location filename="mainwindow.cpp" line="547"/>
<location filename="mainwindow.cpp" line="551"/>
<location filename="mainwindow.cpp" line="560"/>
<location filename="mainwindow.cpp" line="620"/>
<location filename="mainwindow.cpp" line="572"/>
<location filename="mainwindow.cpp" line="632"/>
<source>tips</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="298"/>
<location filename="mainwindow.cpp" line="548"/>
<location filename="mainwindow.cpp" line="299"/>
<location filename="mainwindow.cpp" line="560"/>
<location filename="mainwindow.cpp" line="572"/>
<source>Is testing, do not close!</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="409"/>
<location filename="mainwindow.cpp" line="410"/>
<source>Are you sure to connect the new device</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="411"/>
<location filename="mainwindow.cpp" line="412"/>
<source>yes</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="412"/>
<location filename="mainwindow.cpp" line="413"/>
<source>no</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="430"/>
<location filename="mainwindow.cpp" line="510"/>
<location filename="mainwindow.cpp" line="620"/>
<location filename="mainwindow.cpp" line="431"/>
<location filename="mainwindow.cpp" line="520"/>
<location filename="mainwindow.cpp" line="632"/>
<source>cannot create more table</source>
<translation></translation>
</message>
@ -942,52 +985,52 @@
<translation type="vanished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="441"/>
<location filename="mainwindow.cpp" line="445"/>
<source>Open device failed</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="530"/>
<location filename="mainwindow.cpp" line="542"/>
<source>save</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="530"/>
<location filename="mainwindow.cpp" line="542"/>
<source>xls(*.xls)</source>
<translation>xls表格(*.xls)</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="535"/>
<location filename="mainwindow.cpp" line="547"/>
<source>export succeed</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="539"/>
<location filename="mainwindow.cpp" line="551"/>
<source>export failed</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="572"/>
<location filename="mainwindow.cpp" line="584"/>
<source>Illegal user</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="576"/>
<location filename="mainwindow.cpp" line="588"/>
<source>Wrong password</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="580"/>
<location filename="mainwindow.cpp" line="592"/>
<source>Database error</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="584"/>
<location filename="mainwindow.cpp" line="596"/>
<source>connect error</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="588"/>
<location filename="mainwindow.cpp" line="600"/>
<source>Failed</source>
<translation></translation>
</message>

View File

@ -2,12 +2,15 @@
#include "ui_dialog_inputserialnum.h"
#include "mainwindow.h"
Dialog_InputSerialNum::Dialog_InputSerialNum(class MainWindow *mainWnd, SANE_Handle handle, const QString &serialNum, const QString &devType) :
Dialog_InputSerialNum::Dialog_InputSerialNum(class MainWindow *mainWnd, const QString &devName, SANE_Handle handle, const QString &serialNum, const QString &devType) :
QDialog(mainWnd),
ui(new Ui::Dialog_InputSerialNum),
m_mainWnd(mainWnd),
m_handle(handle),
m_valid(true),
m_serialNum(serialNum),
m_devType(devType)
, m_devName(devName)
{
ui->setupUi(this);
@ -21,15 +24,16 @@ Dialog_InputSerialNum::Dialog_InputSerialNum(class MainWindow *mainWnd, SANE_Han
if (handle != nullptr)
{
ui->lineEdit_sn->setEnabled(false);
ui->cbox_devType->setEnabled(false);
ui->cbox_devType->setCurrentText(devType);
ui->lineEdit_sn->setText(serialNum);
ui->lineEdit_sn->selectAll();
}
else
{
ui->cbox_devType->setCurrentIndex(0);
ui->lineEdit_sn->setText("");
ui->pbtn_setSn->setEnabled(false);
}
}
@ -48,8 +52,26 @@ QString Dialog_InputSerialNum::GetDevType()
return ui->cbox_devType->currentText();
}
void Dialog_InputSerialNum::Invalid(const QString &devName)
{
if (devName == m_devName)
{
sane_close(m_handle);
m_handle = nullptr;
m_valid = false;
reject();
}
}
void Dialog_InputSerialNum::on_pbtn_ok_clicked()
{
if (!m_valid)
{
QMessageBox::information(this, tr("tips"), tr("device is lost"));
reject();
return;
}
if (ui->lineEdit_sn->text().isEmpty())
{
QMessageBox::information(this, tr("tips"), tr("Serial num is empty"));
@ -78,3 +100,18 @@ void Dialog_InputSerialNum::on_pbtn_cancel_clicked()
{
reject();
}
void Dialog_InputSerialNum::on_pbtn_setSn_clicked()
{
QString sn = ui->lineEdit_sn->text();
std::string serialNum = sn.toStdString();
if(SANE_STATUS_GOOD != sane_io_control(m_handle, IO_CTRL_CODE_SET_SERIAL, &serialNum[0], nullptr))
{
QMessageBox::information(this, tr("tips"), tr("set sn failed"));
}
else
{
ui->lineEdit_sn->setText(m_mainWnd->getDevSn(m_handle));
QMessageBox::information(this, tr("tips"), tr("set sn succeed"));
}
}

View File

@ -13,23 +13,29 @@ class Dialog_InputSerialNum : public QDialog
Q_OBJECT
public:
explicit Dialog_InputSerialNum(class MainWindow *mainWnd, SANE_Handle handle, const QString &serialNum, const QString &devType);
explicit Dialog_InputSerialNum(class MainWindow *mainWnd, const QString &devName, SANE_Handle handle, const QString &serialNum, const QString &devType);
~Dialog_InputSerialNum();
QString GetSn();
QString GetDevType();
void Invalid(const QString &devName);
private slots:
void on_pbtn_ok_clicked();
void on_pbtn_cancel_clicked();
void on_pbtn_setSn_clicked();
private:
Ui::Dialog_InputSerialNum *ui;
class MainWindow *m_mainWnd;
SANE_Handle m_handle;
bool m_valid;
QString m_serialNum;
QString m_devType;
QString m_devName;
};
#endif // DIALOG_INPUTSERIALNUM_H

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>511</width>
<width>536</width>
<height>206</height>
</rect>
</property>
@ -117,6 +117,19 @@
</size>
</property>
</widget>
<widget class="QPushButton" name="pbtn_setSn">
<property name="geometry">
<rect>
<x>400</x>
<y>30</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Set Sn</string>
</property>
</widget>
</widget>
<resources/>
<connections/>

View File

@ -167,49 +167,49 @@ void Form_BurnMode::on_pbtn_burn_clicked()
}
}
void Form_BurnMode::on_pbtn_setSn_clicked()
{
int select = 0;
for(int i = 0; i < ui->tableWidget->rowCount(); i++)
{
QTableWidgetItem *item = ui->tableWidget->item(i, 1);
if (item != nullptr && Qt::Checked == item->checkState())
{
select++;
}
}
//void Form_BurnMode::on_pbtn_setSn_clicked()
//{
// int select = 0;
// for(int i = 0; i < ui->tableWidget->rowCount(); i++)
// {
// QTableWidgetItem *item = ui->tableWidget->item(i, 1);
// if (item != nullptr && Qt::Checked == item->checkState())
// {
// select++;
// }
// }
if (select == 0)
{
QMessageBox::information(this, tr("tips"), tr("Please check a devices to set sn at least"));
return;
}
else if (select > 1)
{
QMessageBox::information(this, tr("tips"), tr("Please check single devices to set sn"));
return;
}
else if (select == 1)
{
for(int i = 0; i < ui->tableWidget->rowCount(); i++)
{
QTableWidgetItem *item = ui->tableWidget->item(i, 1);
QTableWidgetItem *item2 = ui->tableWidget->item(i, 3);
if (item != nullptr && Qt::Checked == item->checkState())
{
Dialog_SetBurnSn dlg(item2->text(), this);
if (dlg.exec())
{
DeviceManager *devManager = (DeviceManager*)item->data(Qt::UserRole).value<void*>();
devManager->setSn(dlg.getSn());
// if (select == 0)
// {
// QMessageBox::information(this, tr("tips"), tr("Please check a devices to set sn at least"));
// return;
// }
// else if (select > 1)
// {
// QMessageBox::information(this, tr("tips"), tr("Please check single devices to set sn"));
// return;
// }
// else if (select == 1)
// {
// for(int i = 0; i < ui->tableWidget->rowCount(); i++)
// {
// QTableWidgetItem *item = ui->tableWidget->item(i, 1);
// QTableWidgetItem *item2 = ui->tableWidget->item(i, 3);
// if (item != nullptr && Qt::Checked == item->checkState())
// {
// Dialog_SetBurnSn dlg(item2->text(), this);
// if (dlg.exec())
// {
// DeviceManager *devManager = (DeviceManager*)item->data(Qt::UserRole).value<void*>();
// devManager->setSn(dlg.getSn());
item2->setText(devManager->getUpdatedSn());
break;
}
}
}
}
}
// item2->setText(devManager->getUpdatedSn());
// break;
// }
// }
// }
// }
//}
DeviceManager::DeviceManager(class MainWindow *mainwnd, HGPdtToolDbUserMgr pdtToolDbuserMgr, class Form_BurnMode *burnMode,
SANE_Handle handle, const QString & devName, const QString & sn, const QString &devType)

View File

@ -70,7 +70,7 @@ private slots:
void on_pbtn_burn_clicked();
void on_pbtn_setSn_clicked();
// void on_pbtn_setSn_clicked();
void on_tableWidget_itemDoubleClicked(QTableWidgetItem *item);

View File

@ -39,19 +39,6 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbtn_setSn">
<property name="minimumSize">
<size>
<width>91</width>
<height>31</height>
</size>
</property>
<property name="text">
<string>Set sn</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbtn_close">
<property name="minimumSize">
@ -86,17 +73,6 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>

View File

@ -34,6 +34,8 @@ Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::
{
ui->setupUi(this);
ui->pbtn_showImg->setVisible(false);
QFont ft;
ft.setPointSize(15);
this->setFont(ft);
@ -54,6 +56,16 @@ Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::
ui->label_sn->setText(tr("Device type:") + m_devType + tr(" SerialNum:") + m_serialNum);
ui->label_devStatus->setText(tr(" connect status:") + str);
SANE_Int speedMode = 0;
unsigned int len = sizeof(SANE_Int);
sane_io_control(m_handle, IO_CTRL_CODE_GET_SPEED_MODE, &speedMode, &len);
ui->label_speedMode->setText(tr(" speed mode: ") + getSpeedMode(speedMode));
int sleepTime = SANE_POWER_FIRST;
unsigned int len2 = sizeof(int);
sane_io_control(m_handle, IO_CTRL_CODE_GET_POWER_LEVEL, &sleepTime, &len2);
ui->label_sleepTime->setText(tr(" sleep time: ") + getSleepTime(sleepTime));
ui->label_imgInfo->setVisible(false);
ui->label_destortionInfo->setVisible(false);
@ -66,6 +78,8 @@ Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::
ui->stackedWidget->addWidget(m_view);
ui->pbtn_showImg->setToolTip(tr("load last image which uploaded last time"));
connect(m_view, SIGNAL(doubleClicked()), this, SLOT(on_viewerDblClick()));
initTableWidgetUi();
if(!m_devType.isEmpty())
@ -165,6 +179,8 @@ void Form_mainInterface::on_testResultImg(void *img)
m_view->addImage(image);
ui->pbtn_leftRotate->setVisible(true);
ui->pbtn_rightRotate->setVisible(true);
ui->pbtn_prePage->setVisible(true);
ui->pbtn_nextPage->setVisible(true);
HGBase_DestroyImage(image);
}
@ -189,6 +205,18 @@ void Form_mainInterface::on_testCorrectInfo(QString info)
m_textTips->addContent(info);
}
void Form_mainInterface::on_viewerDblClick()
{
if (m_multiIndex != -1)
{
QString strFileName = m_list_images[m_multiIndex];
QFileInfo fileInfo(strFileName);
auto pathDir = fileInfo.path();
QString strFilePath = "file:///" + pathDir;
QDesktopServices::openUrl(QUrl(strFilePath));
}
}
void Form_mainInterface::on_pbtn_preStep_clicked()
{
int row = ui->tableWidget->currentRow();
@ -211,6 +239,9 @@ void Form_mainInterface::on_pbtn_fail_clicked()
{
int row = ui->tableWidget->currentRow();
QTableWidgetItem *item = ui->tableWidget->item(row, 1);
if (item != nullptr)
{
QString title = item->text();
Dialog_ExcepDesc dlg(this);
@ -228,12 +259,15 @@ void Form_mainInterface::on_pbtn_fail_clicked()
QTableWidgetItem *item2 = ui->tableWidget->item(row, 2);
item2->setToolTip(str);
}
}
}
void Form_mainInterface::on_pbtn_pass_clicked()
{
int row = ui->tableWidget->currentRow();
QTableWidgetItem *item = ui->tableWidget->item(row, 1);
if (item != nullptr)
{
QString title = item->text();
std::string name = m_map_title_name.value(title).name.toStdString();
HGPdtToolDb_SetDeviceEntryStatus(m_pdtToolDbDevice, name.c_str(), HGPDTTOOLDB_ENTRYSTATUS_PASS);
@ -245,28 +279,30 @@ void Form_mainInterface::on_pbtn_pass_clicked()
QTableWidgetItem *item2 = ui->tableWidget->item(row, 2);
item2->setToolTip("");
HGImage img = nullptr;
m_view->getImage(&img);
if (img != nullptr)
{
QString fileName = getCacheFileName();
HGResult ret = HGImgFmt_SaveImage(img, 0, 0, getStdString(fileName).c_str());
if(ret == HGBASE_ERR_OK)
{
int row = ui->tableWidget->currentRow();
QTableWidgetItem *item = ui->tableWidget->item(row, 1);
QString title = item->text();
std::string name = m_map_title_name.value(title).name.toStdString();
HGPdtToolDb_ClearDeviceEntryImage(m_pdtToolDbDevice, name.c_str());
HGPdtToolDb_UploadDeviceEntryImage(m_pdtToolDbDevice, name.c_str(), m_mainwnd->m_ftpHost.toStdString().c_str(),
m_mainwnd->m_ftpPort, fileName.toStdString().c_str());
QFile file(fileName);
file.remove();
}
}
// HGImage img = nullptr;
// m_view->getImage(&img);
// if (img != nullptr)
// {
// QString fileName = getCacheFileName();
// HGResult ret = HGImgFmt_SaveImage(img, 0, 0, getStdString(fileName).c_str());
// if(ret == HGBASE_ERR_OK)
// {
// int row = ui->tableWidget->currentRow();
// QTableWidgetItem *item = ui->tableWidget->item(row, 1);
// QString title = item->text();
// std::string name = m_map_title_name.value(title).name.toStdString();
// HGPdtToolDb_ClearDeviceEntryImage(m_pdtToolDbDevice, name.c_str());
// HGPdtToolDb_UploadDeviceEntryImage(m_pdtToolDbDevice, name.c_str(), m_mainwnd->m_ftpHost.toStdString().c_str(),
// m_mainwnd->m_ftpPort, fileName.toStdString().c_str());
// QFile file(fileName);
// file.remove();
// }
// }
on_pbtn_nextStep_clicked();
}
@ -399,7 +435,7 @@ void Form_mainInterface::updateUiEnabled(bool enable)
ui->pbtn_pass->setEnabled(enable);
ui->pbtn_fail->setEnabled(enable);
ui->pbtn_start->setEnabled(enable);
ui->pbtn_showImg->setEnabled(enable);
// ui->pbtn_showImg->setEnabled(enable);
ui->pbtn_leftRotate->setEnabled(enable);
ui->pbtn_rightRotate->setEnabled(enable);
ui->pbtn_stop->setEnabled(enable);
@ -424,12 +460,41 @@ void Form_mainInterface::updateImgPixelInfo()
ui->label_imgInfo->setText(tr("image pixel: ") + QString::number(imgWidth) + " * " + QString::number(imgHeight) + " ");
}
QString Form_mainInterface::getSpeedMode(SANE_Int speedMode)
{
const wchar_t G100[6] = { 70,80,90,110 };
const wchar_t G200[6] = { 100,110,120,130 };
const wchar_t G300[6] = { 40,50,60,70 };
const wchar_t G400[6] = { 40,50,60,70,80 };
int speed = 0;
if (m_devType == "G100")
speed = G100[(int)speedMode];
else if (m_devType == "G200")
speed = G200[(int)speedMode];
else if (m_devType == "G300")
speed = G300[(int)speedMode];
else if (m_devType == "G400")
speed = G400[(int)speedMode];
return QString::number(speed) + "PPM";
}
QString Form_mainInterface::getSleepTime(int sleepTime)
{
if (sleepTime > 99999 || sleepTime == -1)
return QString::number(0);
return QString::number(sleepTime / 60) + tr(" minute");
}
void Form_mainInterface::on_tableWidget_currentItemChanged(QTableWidgetItem *current, QTableWidgetItem *previous)
{
(void)previous;
if (current != nullptr)
{
ui->pbtn_showImg->setVisible(false);
// ui->pbtn_showImg->setVisible(false);
ui->pbtn_leftRotate->setVisible(false);
ui->pbtn_rightRotate->setVisible(false);
ui->pbtn_prePage->setVisible(false);
@ -461,8 +526,14 @@ void Form_mainInterface::on_tableWidget_currentItemChanged(QTableWidgetItem *cur
HGPdtToolDb_GetDeviceEntryImageCount(m_pdtToolDbDevice, name.c_str(), &imageCount);
if (imageCount > 0)
{
ui->pbtn_showImg->setVisible(true);
// ui->pbtn_showImg->setVisible(true);
}
m_multiIndex = -1;
m_list_images.clear();
QDir dir(getCachePath());
if (dir.exists())
dir.removeRecursively();
}
}
@ -474,11 +545,10 @@ void Form_mainInterface::on_pbtn_start_clicked()
if (dir.exists())
dir.removeRecursively();
ui->label_imgInfo->setVisible(false);
ui->label_destortionInfo->setVisible(false);
int row = ui->tableWidget->currentRow();
QTableWidgetItem *item = ui->tableWidget->item(row, 1);
if (item != nullptr)
{
QString title = item->text();
QString name = m_map_title_name.value(title).name;
if (m_hg != nullptr)
@ -487,6 +557,7 @@ void Form_mainInterface::on_pbtn_start_clicked()
updateUiEnabled(false);
m_isTesting = true;
m_mainwnd->addTestingRef();
}
}
void Form_mainInterface::on_pbtn_showImg_clicked()
@ -501,6 +572,8 @@ void Form_mainInterface::on_pbtn_showImg_clicked()
m_mainwnd->m_ftpPort, 0, fileName.toStdString().c_str());
if(ret == HGBASE_ERR_OK)
{
m_list_images.push_back(fileName);
ui->pbtn_leftRotate->setVisible(true);
ui->pbtn_rightRotate->setVisible(true);
ui->pbtn_prePage->setVisible(true);
@ -509,8 +582,7 @@ void Form_mainInterface::on_pbtn_showImg_clicked()
HGImage img = nullptr;
HGImgFmt_LoadImage(fileName.toStdString().c_str(), 0, 0, 0, 0, &img);
m_view->addImage(img);
QFile file(fileName);
file.remove();
m_multiIndex++;
}
else
{

View File

@ -47,6 +47,8 @@ private slots:
void on_testDistortion(float value);
void on_testCorrectInfo(QString info);
void on_viewerDblClick();
private slots:
void on_pbtn_preStep_clicked();
@ -79,6 +81,8 @@ private:
QString getCacheFileName();
void updateUiEnabled(bool enable);
void updateImgPixelInfo();
QString getSpeedMode(SANE_Int speedMode);
QString getSleepTime(int sleepTime);
private:
Ui::Form_mainInterface *ui;

View File

@ -30,6 +30,20 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_speedMode">
<property name="text">
<string>SpeedMode:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_sleepTime">
<property name="text">
<string>SleepTime:</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">

View File

@ -23,6 +23,7 @@ MainWindow::MainWindow(HGPdtToolDbUserMgr pdtToolDbuserMgr, Dialog_logIn::LogInT
, m_top_splitter(nullptr)
, m_bot_splitter(nullptr)
, m_isLogOut(false)
, m_inputSnDlg(nullptr)
{
ui->setupUi(this);
@ -417,14 +418,14 @@ void MainWindow::on_sane_dev_arrive(QString devName)
sane_open(devName.toStdString().c_str(), &devHandle);
if (nullptr != devHandle)
{
Dialog_InputSerialNum dlg(this, devHandle, getDevSn(devHandle), getDevType(devHandle));
if (dlg.exec())
m_inputSnDlg = new Dialog_InputSerialNum(this, devName, devHandle, getDevSn(devHandle), getDevType(devHandle));
if (m_inputSnDlg->exec())
{
HGPdtToolDbDevice pdtToolDbDevice = nullptr;
HGPdtToolDb_OpenDevice(m_pdtToolDbuserMgr, dlg.GetSn().toStdString().c_str(), &pdtToolDbDevice);
HGPdtToolDb_OpenDevice(m_pdtToolDbuserMgr, m_inputSnDlg->GetSn().toStdString().c_str(), &pdtToolDbDevice);
Form_mainInterface *mainInterface = new Form_mainInterface(this, m_loginType, devHandle, m_pdtToolDbuserMgr, pdtToolDbDevice,
dlg.GetSn(), dlg.GetDevType(), devName, getDevFwNum(devHandle));
m_inputSnDlg->GetSn(), m_inputSnDlg->GetDevType(), devName, getDevFwNum(devHandle));
if (!AddInterface(mainInterface))
{
QMessageBox::information(this, tr("tips"), tr("cannot create more table"));
@ -435,6 +436,9 @@ void MainWindow::on_sane_dev_arrive(QString devName)
{
sane_close(devHandle);
}
delete m_inputSnDlg;
m_inputSnDlg = nullptr;
}
else
{
@ -452,6 +456,11 @@ void MainWindow::on_sane_dev_remove(QString devName)
}
else
{
if (nullptr != m_inputSnDlg)
{
m_inputSnDlg->Invalid(devName);
}
Form_mainInterface * mainInterface = FindInterfaceByDevName(devName);
if (mainInterface != nullptr)
{
@ -498,21 +507,24 @@ void MainWindow::on_update_userStatus()
void MainWindow::on_act_newDevice_triggered()
{
Dialog_InputSerialNum dlg(this, nullptr, "", "");
if (dlg.exec())
m_inputSnDlg = new Dialog_InputSerialNum(this, "", nullptr, "", "");
if (m_inputSnDlg->exec())
{
HGPdtToolDbDevice pdtToolDbDevice = nullptr;
HGPdtToolDb_OpenDevice(m_pdtToolDbuserMgr, dlg.GetSn().toStdString().c_str(), &pdtToolDbDevice);
HGPdtToolDb_OpenDevice(m_pdtToolDbuserMgr, m_inputSnDlg->GetSn().toStdString().c_str(), &pdtToolDbDevice);
Form_mainInterface *mainInterface = new Form_mainInterface(this, m_loginType, nullptr, m_pdtToolDbuserMgr, pdtToolDbDevice, dlg.GetSn(), dlg.GetDevType(), nullptr, nullptr);
Form_mainInterface *mainInterface = new Form_mainInterface(this, m_loginType, nullptr, m_pdtToolDbuserMgr, pdtToolDbDevice,
m_inputSnDlg->GetSn(), m_inputSnDlg->GetDevType(), nullptr, nullptr);
if (!AddInterface(mainInterface))
{
QMessageBox::information(this, tr("tips"), tr("cannot create more table"));
delete mainInterface;
}
}
}
delete m_inputSnDlg;
m_inputSnDlg = nullptr;
}
void MainWindow::on_act_manage_triggered()
{
Dialog_accountManage dlg(m_pdtToolDbuserMgr, this);
@ -607,14 +619,14 @@ void MainWindow::on_act_refreshDevice_triggered()
sane_open(name[i].c_str(), &devHandle);
if (nullptr != devHandle)
{
Dialog_InputSerialNum dlg(this, devHandle, getDevSn(devHandle), getDevType(devHandle));
if (dlg.exec())
m_inputSnDlg = new Dialog_InputSerialNum(this, name[i].c_str(), devHandle, getDevSn(devHandle), getDevType(devHandle));
if (m_inputSnDlg->exec())
{
HGPdtToolDbDevice pdtToolDbDevice = nullptr;
HGPdtToolDb_OpenDevice(m_pdtToolDbuserMgr, dlg.GetSn().toStdString().c_str(), &pdtToolDbDevice);
HGPdtToolDb_OpenDevice(m_pdtToolDbuserMgr, m_inputSnDlg->GetSn().toStdString().c_str(), &pdtToolDbDevice);
Form_mainInterface *mainInterface = new Form_mainInterface(this, m_loginType, devHandle, m_pdtToolDbuserMgr, pdtToolDbDevice,
dlg.GetSn(), dlg.GetDevType(), name[i].c_str(), getDevFwNum(devHandle));
m_inputSnDlg->GetSn(), m_inputSnDlg->GetDevType(), name[i].c_str(), getDevFwNum(devHandle));
if (!AddInterface(mainInterface))
{
QMessageBox::information(this, tr("tips"), tr("cannot create more table"));
@ -625,6 +637,9 @@ void MainWindow::on_act_refreshDevice_triggered()
{
sane_close(devHandle);
}
delete m_inputSnDlg;
m_inputSnDlg = nullptr;
}
}
}

View File

@ -84,6 +84,7 @@ private:
HGLock m_lock;
int m_testingRef;
Dialog_logIn::LogInType m_loginType;
class Dialog_InputSerialNum *m_inputSnDlg;
Form_BurnMode *m_formBurnMode;