调整app界面与流程
This commit is contained in:
parent
86e4b458b4
commit
253892e9e3
|
@ -57,6 +57,7 @@ SOURCES += \
|
||||||
analysisjson.cpp \
|
analysisjson.cpp \
|
||||||
dialog_accountmanage.cpp \
|
dialog_accountmanage.cpp \
|
||||||
dialog_changepwd.cpp \
|
dialog_changepwd.cpp \
|
||||||
|
dialog_inputserialnum.cpp \
|
||||||
dialog_login.cpp \
|
dialog_login.cpp \
|
||||||
dialog_rootfuntion.cpp \
|
dialog_rootfuntion.cpp \
|
||||||
dialog_uploadcfgfile.cpp \
|
dialog_uploadcfgfile.cpp \
|
||||||
|
@ -73,6 +74,7 @@ HEADERS += \
|
||||||
analysisjson.h \
|
analysisjson.h \
|
||||||
dialog_accountmanage.h \
|
dialog_accountmanage.h \
|
||||||
dialog_changepwd.h \
|
dialog_changepwd.h \
|
||||||
|
dialog_inputserialnum.h \
|
||||||
dialog_login.h \
|
dialog_login.h \
|
||||||
dialog_rootfuntion.h \
|
dialog_rootfuntion.h \
|
||||||
dialog_uploadcfgfile.h \
|
dialog_uploadcfgfile.h \
|
||||||
|
@ -85,6 +87,7 @@ HEADERS += \
|
||||||
FORMS += \
|
FORMS += \
|
||||||
dialog_accountmanage.ui \
|
dialog_accountmanage.ui \
|
||||||
dialog_changepwd.ui \
|
dialog_changepwd.ui \
|
||||||
|
dialog_inputserialnum.ui \
|
||||||
dialog_login.ui \
|
dialog_login.ui \
|
||||||
dialog_rootfuntion.ui \
|
dialog_rootfuntion.ui \
|
||||||
dialog_uploadcfgfile.ui \
|
dialog_uploadcfgfile.ui \
|
||||||
|
|
Binary file not shown.
|
@ -1,6 +1,70 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!DOCTYPE TS>
|
<!DOCTYPE TS>
|
||||||
<TS version="2.1" language="zh_CN">
|
<TS version="2.1" language="zh_CN">
|
||||||
|
<context>
|
||||||
|
<name>Dialog_InputSerialNum</name>
|
||||||
|
<message>
|
||||||
|
<location filename="dialog_inputserialnum.ui" line="14"/>
|
||||||
|
<source>Dialog</source>
|
||||||
|
<translation>输入序列号</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="dialog_inputserialnum.ui" line="26"/>
|
||||||
|
<source>Input SN:</source>
|
||||||
|
<translation>输入序列号:</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="dialog_inputserialnum.ui" line="49"/>
|
||||||
|
<source>Select devType:</source>
|
||||||
|
<translation>设备型号:</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="dialog_inputserialnum.ui" line="63"/>
|
||||||
|
<source>G100</source>
|
||||||
|
<translation></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="dialog_inputserialnum.ui" line="68"/>
|
||||||
|
<source>G200</source>
|
||||||
|
<translation></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="dialog_inputserialnum.ui" line="73"/>
|
||||||
|
<source>G300</source>
|
||||||
|
<translation></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="dialog_inputserialnum.ui" line="78"/>
|
||||||
|
<source>G400</source>
|
||||||
|
<translation></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="dialog_inputserialnum.ui" line="92"/>
|
||||||
|
<source>OK</source>
|
||||||
|
<translation>确定</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="dialog_inputserialnum.ui" line="105"/>
|
||||||
|
<source>Cancel</source>
|
||||||
|
<translation>取消</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="dialog_inputserialnum.cpp" line="43"/>
|
||||||
|
<location filename="dialog_inputserialnum.cpp" line="49"/>
|
||||||
|
<source>tips</source>
|
||||||
|
<translation>提示</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="dialog_inputserialnum.cpp" line="43"/>
|
||||||
|
<source>Serial num is empty</source>
|
||||||
|
<translation>序列号为空</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="dialog_inputserialnum.cpp" line="49"/>
|
||||||
|
<source>The device is testing</source>
|
||||||
|
<translation>该设备正在进行测试</translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>Dialog_accountManage</name>
|
<name>Dialog_accountManage</name>
|
||||||
<message>
|
<message>
|
||||||
|
@ -262,10 +326,30 @@
|
||||||
<message>
|
<message>
|
||||||
<location filename="dialog_uploadcfgfile.ui" line="43"/>
|
<location filename="dialog_uploadcfgfile.ui" line="43"/>
|
||||||
<source>tag:</source>
|
<source>tag:</source>
|
||||||
<translation>标识符:</translation>
|
<translation>设备型号:</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="dialog_uploadcfgfile.ui" line="83"/>
|
<location filename="dialog_uploadcfgfile.ui" line="51"/>
|
||||||
|
<source>G100</source>
|
||||||
|
<translation></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="dialog_uploadcfgfile.ui" line="56"/>
|
||||||
|
<source>G200</source>
|
||||||
|
<translation></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="dialog_uploadcfgfile.ui" line="61"/>
|
||||||
|
<source>G300</source>
|
||||||
|
<translation></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="dialog_uploadcfgfile.ui" line="66"/>
|
||||||
|
<source>G400</source>
|
||||||
|
<translation></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="dialog_uploadcfgfile.ui" line="104"/>
|
||||||
<source>upload</source>
|
<source>upload</source>
|
||||||
<translation>上传</translation>
|
<translation>上传</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -339,16 +423,6 @@
|
||||||
<source>Next Step</source>
|
<source>Next Step</source>
|
||||||
<translation>下一步</translation>
|
<translation>下一步</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<location filename="form_maininterface.cpp" line="77"/>
|
|
||||||
<source>HGPDTTOOLDB_TITLE_DIAL_SWITCH</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="form_maininterface.cpp" line="82"/>
|
|
||||||
<source>HGPDTTOOLDB_TITLE_CIS_ORIGINAL_IMAGE</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>Form_textTips</name>
|
<name>Form_textTips</name>
|
||||||
|
@ -411,53 +485,85 @@
|
||||||
<translation>上传配置文件</translation>
|
<translation>上传配置文件</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="mainwindow.cpp" line="157"/>
|
<location filename="mainwindow.cpp" line="276"/>
|
||||||
<source>Account login elsewhere</source>
|
<source>Account login elsewhere</source>
|
||||||
<translation>账户在其他地方登录</translation>
|
<translation>账户在其他地方登录</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="mainwindow.cpp" line="160"/>
|
|
||||||
<source>Network connection lost</source>
|
<source>Network connection lost</source>
|
||||||
<translation>网络连接断开</translation>
|
<translation type="vanished">网络连接断开</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="mainwindow.cpp" line="163"/>
|
<location filename="mainwindow.cpp" line="279"/>
|
||||||
<source>You have been forced offline by the administrator account</source>
|
<source>You have been forced offline by the administrator account</source>
|
||||||
<translation>你已被管理员账户强制下线</translation>
|
<translation>你已被管理员账户强制下线</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="mainwindow.cpp" line="169"/>
|
<location filename="mainwindow.cpp" line="282"/>
|
||||||
<location filename="mainwindow.cpp" line="204"/>
|
<source>Data base error</source>
|
||||||
|
<translation>数据库错误</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="mainwindow.cpp" line="234"/>
|
||||||
|
<location filename="mainwindow.cpp" line="254"/>
|
||||||
|
<location filename="mainwindow.cpp" line="288"/>
|
||||||
|
<location filename="mainwindow.cpp" line="305"/>
|
||||||
<source>tips</source>
|
<source>tips</source>
|
||||||
<translation>提示</translation>
|
<translation>提示</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="mainwindow.cpp" line="204"/>
|
<location filename="mainwindow.cpp" line="235"/>
|
||||||
|
<source>Are you sure to connect the new device</source>
|
||||||
|
<translation>检测到设备连接,是否启动测试?</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="mainwindow.cpp" line="237"/>
|
||||||
|
<source>yes</source>
|
||||||
|
<translation>确定</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="mainwindow.cpp" line="238"/>
|
||||||
|
<source>no</source>
|
||||||
|
<translation>取消</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="mainwindow.cpp" line="254"/>
|
||||||
|
<location filename="mainwindow.cpp" line="305"/>
|
||||||
<source>cannot create more table</source>
|
<source>cannot create more table</source>
|
||||||
<translation>不能创建更多项目</translation>
|
<translation>不能创建更多项目</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="mainwindow.cpp" line="250"/>
|
<location filename="mainwindow.cpp" line="325"/>
|
||||||
|
<source>save</source>
|
||||||
|
<translation>保存</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="mainwindow.cpp" line="325"/>
|
||||||
|
<source>xls(*.xls)</source>
|
||||||
|
<translation>xls表格(*.xls)</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="mainwindow.cpp" line="349"/>
|
||||||
<source>Illegal user</source>
|
<source>Illegal user</source>
|
||||||
<translation>非法的用户</translation>
|
<translation>非法的用户</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="mainwindow.cpp" line="254"/>
|
<location filename="mainwindow.cpp" line="353"/>
|
||||||
<source>Wrong password</source>
|
<source>Wrong password</source>
|
||||||
<translation>密码错误</translation>
|
<translation>密码错误</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="mainwindow.cpp" line="258"/>
|
<location filename="mainwindow.cpp" line="357"/>
|
||||||
<source>Database error</source>
|
<source>Database error</source>
|
||||||
<translation>数据库错误</translation>
|
<translation>数据库错误</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="mainwindow.cpp" line="262"/>
|
<location filename="mainwindow.cpp" line="361"/>
|
||||||
<source>connect error</source>
|
<source>connect error</source>
|
||||||
<translation>连接错误</translation>
|
<translation>连接错误</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="mainwindow.cpp" line="266"/>
|
<location filename="mainwindow.cpp" line="365"/>
|
||||||
<source>Failed</source>
|
<source>Failed</source>
|
||||||
<translation>错误</translation>
|
<translation>错误</translation>
|
||||||
</message>
|
</message>
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
#include "dialog_inputserialnum.h"
|
||||||
|
#include "ui_dialog_inputserialnum.h"
|
||||||
|
#include "mainwindow.h"
|
||||||
|
|
||||||
|
Dialog_InputSerialNum::Dialog_InputSerialNum(class MainWindow *mainWnd, const QString &serialNum, const QString &devType) :
|
||||||
|
QDialog(mainWnd),
|
||||||
|
ui(new Ui::Dialog_InputSerialNum),
|
||||||
|
m_mainWnd(mainWnd),
|
||||||
|
m_serialNum(serialNum),
|
||||||
|
m_devType(devType)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
|
||||||
|
|
||||||
|
ui->lineEdit_sn->setValidator(new QRegExpValidator(QRegExp("[a-zA-Z0-9]+$")));
|
||||||
|
ui->lineEdit_sn->setText(serialNum);
|
||||||
|
if (devType.isEmpty())
|
||||||
|
ui->cbox_devType->setCurrentIndex(0);
|
||||||
|
else
|
||||||
|
ui->cbox_devType->setCurrentText(devType);
|
||||||
|
}
|
||||||
|
|
||||||
|
Dialog_InputSerialNum::~Dialog_InputSerialNum()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Dialog_InputSerialNum::GetSn()
|
||||||
|
{
|
||||||
|
return ui->lineEdit_sn->text();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Dialog_InputSerialNum::GetDevType()
|
||||||
|
{
|
||||||
|
return ui->cbox_devType->currentText();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Dialog_InputSerialNum::on_pbtn_ok_clicked()
|
||||||
|
{
|
||||||
|
if (ui->lineEdit_sn->text().isEmpty())
|
||||||
|
{
|
||||||
|
QMessageBox::information(this, tr("tips"), tr("Serial num is empty"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_mainWnd->FindInterface(ui->lineEdit_sn->text()) != nullptr)
|
||||||
|
{
|
||||||
|
QMessageBox::information(this, tr("tips"), tr("The device is testing"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
accept();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Dialog_InputSerialNum::on_pbtn_cancel_clicked()
|
||||||
|
{
|
||||||
|
reject();
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
#ifndef DIALOG_INPUTSERIALNUM_H
|
||||||
|
#define DIALOG_INPUTSERIALNUM_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class Dialog_InputSerialNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
class Dialog_InputSerialNum : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit Dialog_InputSerialNum(class MainWindow *mainWnd, const QString &serialNum, const QString &devType);
|
||||||
|
~Dialog_InputSerialNum();
|
||||||
|
|
||||||
|
QString GetSn();
|
||||||
|
QString GetDevType();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void on_pbtn_ok_clicked();
|
||||||
|
|
||||||
|
void on_pbtn_cancel_clicked();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::Dialog_InputSerialNum *ui;
|
||||||
|
|
||||||
|
class MainWindow *m_mainWnd;
|
||||||
|
QString m_serialNum;
|
||||||
|
QString m_devType;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // DIALOG_INPUTSERIALNUM_H
|
|
@ -0,0 +1,111 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>Dialog_InputSerialNum</class>
|
||||||
|
<widget class="QDialog" name="Dialog_InputSerialNum">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>225</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QLabel" name="label_sn">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>50</x>
|
||||||
|
<y>50</y>
|
||||||
|
<width>54</width>
|
||||||
|
<height>12</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Input SN:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLineEdit" name="lineEdit_sn">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>120</x>
|
||||||
|
<y>50</y>
|
||||||
|
<width>171</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_type">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>30</x>
|
||||||
|
<y>110</y>
|
||||||
|
<width>81</width>
|
||||||
|
<height>16</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Select devType:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QComboBox" name="cbox_devType">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>120</x>
|
||||||
|
<y>110</y>
|
||||||
|
<width>171</width>
|
||||||
|
<height>22</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>G100</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>G200</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>G300</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>G400</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="pbtn_ok">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>197</x>
|
||||||
|
<y>181</y>
|
||||||
|
<width>75</width>
|
||||||
|
<height>23</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>OK</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="pbtn_cancel">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>278</x>
|
||||||
|
<y>181</y>
|
||||||
|
<width>75</width>
|
||||||
|
<height>23</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Cancel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
|
@ -26,7 +26,7 @@ void Dialog_uploadCfgFile::on_pbtn_select_clicked()
|
||||||
if (!info.absoluteFilePath().isEmpty())
|
if (!info.absoluteFilePath().isEmpty())
|
||||||
{
|
{
|
||||||
ui->lineEdit_filename->setText(info.absoluteFilePath());
|
ui->lineEdit_filename->setText(info.absoluteFilePath());
|
||||||
ui->lineEdit_tag->setText(info.completeBaseName());
|
ui->comboBox_tag->setCurrentText(info.completeBaseName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ void Dialog_uploadCfgFile::on_pbtn_upload_clicked()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString tag = ui->lineEdit_tag->text();
|
QString tag = ui->comboBox_tag->currentText();
|
||||||
QString filename = ui->lineEdit_filename->text();
|
QString filename = ui->lineEdit_filename->text();
|
||||||
HGResult ret = HGPdtToolDb_UploadFile(m_pdtToolDbuserMgr, tag.toStdString().c_str(), getStdString(filename).c_str());
|
HGResult ret = HGPdtToolDb_UploadFile(m_pdtToolDbuserMgr, tag.toStdString().c_str(), getStdString(filename).c_str());
|
||||||
if(ret == HGBASE_ERR_OK)
|
if(ret == HGBASE_ERR_OK)
|
||||||
|
|
|
@ -45,7 +45,28 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="lineEdit_tag"/>
|
<widget class="QComboBox" name="comboBox_tag">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>G100</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>G200</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>G300</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>G400</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
|
|
|
@ -1,43 +1,57 @@
|
||||||
#include "form_maininterface.h"
|
#include "form_maininterface.h"
|
||||||
#include "ui_form_maininterface.h"
|
#include "ui_form_maininterface.h"
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QInputDialog>
|
||||||
|
#include "base/HGBase.h"
|
||||||
#include "imgfmt/HGImgFmt.h"
|
#include "imgfmt/HGImgFmt.h"
|
||||||
#include "HGUIGlobal.h"
|
#include "HGUIGlobal.h"
|
||||||
#include "form_texttips.h"
|
#include "form_texttips.h"
|
||||||
#include "test_base.h"
|
#include "test_base.h"
|
||||||
|
#include "hgscanner.h"
|
||||||
|
#include "mainwindow.h"
|
||||||
|
|
||||||
Form_mainInterface::Form_mainInterface(QWidget *parent)
|
Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, SANE_Handle handle, HGPdtToolDbDevice pdtToolDbDevice,
|
||||||
: QWidget(parent)
|
const QString &serialNum, const QString &devType)
|
||||||
|
: QWidget(mainwnd)
|
||||||
, ui(new Ui::Form_mainInterface)
|
, ui(new Ui::Form_mainInterface)
|
||||||
|
, m_mainwnd(mainwnd)
|
||||||
|
, m_handle(handle)
|
||||||
|
, m_pdtToolDbDevice(pdtToolDbDevice)
|
||||||
|
, m_serialNum(serialNum)
|
||||||
|
, m_devType(devType)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
ui->label_sn->setText(serialNum);
|
||||||
|
this->setMinimumWidth(400);
|
||||||
m_textTips = new Form_textTips();
|
m_textTips = new Form_textTips();
|
||||||
m_view = new HGImgView();
|
m_view = new HGImgView();
|
||||||
ui->stackedWidget->addWidget(m_textTips);
|
ui->stackedWidget->addWidget(m_textTips);
|
||||||
ui->stackedWidget->addWidget(m_view);
|
ui->stackedWidget->addWidget(m_view);
|
||||||
|
|
||||||
QString path("../../doc/config.json");
|
getTestItem();
|
||||||
AnalysisJson analysisJson(path);
|
|
||||||
|
|
||||||
std::vector<AnalysisJson::json_node> list_jsonNode = analysisJson.GetNode();
|
|
||||||
for(int i = 0; i < list_jsonNode.size(); ++i)
|
|
||||||
{
|
|
||||||
AnalysisJson::json_node node = list_jsonNode[i];
|
|
||||||
ui->listWidget->addItem(node.title);
|
|
||||||
}
|
|
||||||
|
|
||||||
this->setMinimumWidth(400);
|
|
||||||
ui->listWidget->setMinimumWidth(200);
|
ui->listWidget->setMinimumWidth(200);
|
||||||
ui->listWidget->setCurrentRow(0);
|
ui->listWidget->setCurrentRow(0);
|
||||||
ui->pbtn_preStep->setEnabled(false);
|
ui->pbtn_preStep->setEnabled(false);
|
||||||
|
|
||||||
|
// TODO download file
|
||||||
}
|
}
|
||||||
|
|
||||||
Form_mainInterface::~Form_mainInterface()
|
Form_mainInterface::~Form_mainInterface()
|
||||||
{
|
{
|
||||||
|
//sane_close(m_handle);
|
||||||
|
HGPdtToolDb_CloseDevice(m_pdtToolDbDevice);
|
||||||
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString Form_mainInterface::getSn()
|
||||||
|
{
|
||||||
|
return m_serialNum;
|
||||||
|
}
|
||||||
|
|
||||||
void Form_mainInterface::paintEvent(QPaintEvent *event)
|
void Form_mainInterface::paintEvent(QPaintEvent *event)
|
||||||
{
|
{
|
||||||
(void)event;
|
(void)event;
|
||||||
|
@ -46,30 +60,31 @@ void Form_mainInterface::paintEvent(QPaintEvent *event)
|
||||||
p.drawRect(0, 0, width() -1, height() -1);
|
p.drawRect(0, 0, width() -1, height() -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Form_mainInterface::on_listWidget_currentRowChanged(int currentRow)
|
void Form_mainInterface::on_listWidget_currentTextChanged(const QString ¤tText)
|
||||||
{
|
{
|
||||||
(void)currentRow;
|
|
||||||
ui->pbtn_preStep->setEnabled(ui->listWidget->currentRow() != 0);
|
ui->pbtn_preStep->setEnabled(ui->listWidget->currentRow() != 0);
|
||||||
ui->pbtn_nextStep->setEnabled(ui->listWidget->currentRow() != ui->listWidget->count() - 1);
|
ui->pbtn_nextStep->setEnabled(ui->listWidget->currentRow() != ui->listWidget->count() - 1);
|
||||||
|
|
||||||
|
QString testName;
|
||||||
QString curItemContent = ui->listWidget->currentItem()->text();
|
if (currentText == HGPDTTOOLDB_TITLE_DIAL_SWITCH)
|
||||||
|
|
||||||
if (curItemContent == HGPDTTOOLDB_TITLE_DIAL_SWITCH)
|
|
||||||
{
|
{
|
||||||
m_textTips->setViewContent(tr("HGPDTTOOLDB_TITLE_DIAL_SWITCH"));
|
m_textTips->setViewContent(m_map_title_name.value(currentText).desc);
|
||||||
|
testName = m_map_title_name.value(currentText).name;
|
||||||
ui->stackedWidget->setCurrentWidget(m_textTips);
|
ui->stackedWidget->setCurrentWidget(m_textTips);
|
||||||
}
|
}
|
||||||
else if (curItemContent == HGPDTTOOLDB_TITLE_CIS_ORIGINAL_IMAGE)
|
else if (currentText == HGPDTTOOLDB_NAME_SINGLE_PAGE_TEST_1)
|
||||||
{
|
|
||||||
m_textTips->setViewContent(tr("HGPDTTOOLDB_TITLE_CIS_ORIGINAL_IMAGE"));
|
|
||||||
ui->stackedWidget->setCurrentWidget(m_textTips);
|
|
||||||
}
|
|
||||||
else if (curItemContent == HGPDTTOOLDB_TITLE_IMAGE_QUALITY)
|
|
||||||
{
|
{
|
||||||
//addImg
|
//addImg
|
||||||
|
testName = m_map_title_name.value(currentText).name;
|
||||||
ui->stackedWidget->setCurrentWidget(m_view);
|
ui->stackedWidget->setCurrentWidget(m_view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui_helper* helper;
|
||||||
|
hgscanner* hg = new hgscanner(m_handle);
|
||||||
|
helper = dynamic_cast<hgscanner*>(hg);
|
||||||
|
|
||||||
|
QString s("test-31");
|
||||||
|
// func_test_go(s.toStdWString().c_str(), L"null", helper);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Form_mainInterface::on_pbtn_preStep_clicked()
|
void Form_mainInterface::on_pbtn_preStep_clicked()
|
||||||
|
@ -93,3 +108,21 @@ void Form_mainInterface::on_pbtn_pass_clicked()
|
||||||
on_pbtn_nextStep_clicked();
|
on_pbtn_nextStep_clicked();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Form_mainInterface::getTestItem()
|
||||||
|
{
|
||||||
|
QString path("../../doc/config.json");
|
||||||
|
AnalysisJson analysisJson(path);
|
||||||
|
|
||||||
|
std::vector<AnalysisJson::json_node> list_jsonNode = analysisJson.GetNode();
|
||||||
|
for(int i = 0; i < list_jsonNode.size(); ++i)
|
||||||
|
{
|
||||||
|
AnalysisJson::json_node node = list_jsonNode[i];
|
||||||
|
ui->listWidget->addItem(node.title);
|
||||||
|
m_map_title_name.insert(node.title, node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Form_mainInterface::on_pbtn_stop_clicked()
|
||||||
|
{
|
||||||
|
m_mainwnd->RemoveInterface(this);
|
||||||
|
}
|
||||||
|
|
|
@ -2,9 +2,12 @@
|
||||||
#define FORM_MAININTERFACE_H
|
#define FORM_MAININTERFACE_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include <QMap>
|
||||||
#include "HGImgView.h"
|
#include "HGImgView.h"
|
||||||
#include "form_texttips.h"
|
#include "form_texttips.h"
|
||||||
#include "analysisjson.h"
|
#include "analysisjson.h"
|
||||||
|
#include "sane/sane_ex.h"
|
||||||
|
#include "HGPdtToolDb.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class Form_mainInterface;
|
class Form_mainInterface;
|
||||||
|
@ -15,14 +18,17 @@ class Form_mainInterface : public QWidget
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Form_mainInterface(QWidget *parent = nullptr);
|
explicit Form_mainInterface(class MainWindow *mainwnd, SANE_Handle handle, HGPdtToolDbDevice pdtToolDbDevice,
|
||||||
|
const QString &serialNum, const QString &devType);
|
||||||
~Form_mainInterface();
|
~Form_mainInterface();
|
||||||
|
|
||||||
|
QString getSn();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *event) override;
|
void paintEvent(QPaintEvent *event) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_listWidget_currentRowChanged(int currentRow);
|
void on_listWidget_currentTextChanged(const QString ¤tText);
|
||||||
|
|
||||||
void on_pbtn_preStep_clicked();
|
void on_pbtn_preStep_clicked();
|
||||||
|
|
||||||
|
@ -32,12 +38,25 @@ private slots:
|
||||||
|
|
||||||
void on_pbtn_pass_clicked();
|
void on_pbtn_pass_clicked();
|
||||||
|
|
||||||
|
void on_pbtn_stop_clicked();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void getTestItem();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::Form_mainInterface *ui;
|
Ui::Form_mainInterface *ui;
|
||||||
|
|
||||||
AnalysisJson *m_analysisJson;
|
AnalysisJson *m_analysisJson;
|
||||||
Form_textTips *m_textTips;
|
Form_textTips *m_textTips;
|
||||||
HGImgView *m_view;
|
HGImgView *m_view;
|
||||||
|
|
||||||
|
class MainWindow *m_mainwnd;
|
||||||
|
SANE_Handle m_handle;
|
||||||
|
HGPdtToolDbDevice m_pdtToolDbDevice;
|
||||||
|
QString m_serialNum;
|
||||||
|
QString m_devType;
|
||||||
|
|
||||||
|
QMap<QString, AnalysisJson::json_node> m_map_title_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FORM_MAININTERFACE_H
|
#endif // FORM_MAININTERFACE_H
|
||||||
|
|
|
@ -20,8 +20,8 @@ int main(int argc, char *argv[])
|
||||||
Dialog_logIn login(&w);
|
Dialog_logIn login(&w);
|
||||||
if (login.exec())
|
if (login.exec())
|
||||||
{
|
{
|
||||||
w.Init();
|
|
||||||
w.showMaximized();
|
w.showMaximized();
|
||||||
|
w.Init();
|
||||||
a.exec();
|
a.exec();
|
||||||
w.Deinit();
|
w.Deinit();
|
||||||
if (w.isExitApp())
|
if (w.isExitApp())
|
||||||
|
|
|
@ -7,16 +7,14 @@
|
||||||
#include "dialog_changepwd.h"
|
#include "dialog_changepwd.h"
|
||||||
#include "dialog_accountmanage.h"
|
#include "dialog_accountmanage.h"
|
||||||
#include "dialog_uploadcfgfile.h"
|
#include "dialog_uploadcfgfile.h"
|
||||||
|
#include "dialog_inputserialnum.h"
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent)
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
: QMainWindow(parent)
|
: QMainWindow(parent)
|
||||||
, ui(new Ui::MainWindow)
|
, ui(new Ui::MainWindow)
|
||||||
, m_pdtToolDbuserMgr(nullptr)
|
, m_pdtToolDbuserMgr(nullptr)
|
||||||
, m_form_mainInterface(nullptr)
|
|
||||||
, m_top_splitter(nullptr)
|
, m_top_splitter(nullptr)
|
||||||
, m_bot_splitter(nullptr)
|
, m_bot_splitter(nullptr)
|
||||||
, m_splitterCount(1)
|
|
||||||
, m_handle(nullptr)
|
|
||||||
, m_isLogOut(false)
|
, m_isLogOut(false)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
@ -28,13 +26,11 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
|
|
||||||
m_top_splitter = new QSplitter(Qt::Horizontal);
|
m_top_splitter = new QSplitter(Qt::Horizontal);
|
||||||
m_bot_splitter = new QSplitter(Qt::Horizontal);
|
m_bot_splitter = new QSplitter(Qt::Horizontal);
|
||||||
m_form_mainInterface = new Form_mainInterface();
|
|
||||||
m_top_splitter->addWidget(m_form_mainInterface);
|
|
||||||
|
|
||||||
QVBoxLayout *vLayout = new QVBoxLayout;
|
QVBoxLayout *vLayout = new QVBoxLayout;
|
||||||
vLayout->addWidget(m_top_splitter);
|
vLayout->addWidget(m_top_splitter);
|
||||||
vLayout->addWidget(m_bot_splitter);
|
vLayout->addWidget(m_bot_splitter);
|
||||||
vLayout->setStretch(0, 1);
|
vLayout->setStretch(0, 0);
|
||||||
vLayout->setStretch(1, 0);
|
vLayout->setStretch(1, 0);
|
||||||
this->centralWidget()->setLayout(vLayout);
|
this->centralWidget()->setLayout(vLayout);
|
||||||
}
|
}
|
||||||
|
@ -59,17 +55,11 @@ void MainWindow::Init()
|
||||||
|
|
||||||
SANE_Int v = 0;
|
SANE_Int v = 0;
|
||||||
sane_init_ex(&v, sane_ex_callback, this);
|
sane_init_ex(&v, sane_ex_callback, this);
|
||||||
Sleep(500);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::Deinit()
|
void MainWindow::Deinit()
|
||||||
{
|
{
|
||||||
// if (nullptr != m_handle)
|
//sane_exit();
|
||||||
// {
|
|
||||||
// sane_close(m_handle);
|
|
||||||
// m_handle = nullptr;
|
|
||||||
// }
|
|
||||||
// sane_exit();
|
|
||||||
|
|
||||||
HGPdtToolDb_DestroyUserMgr(m_pdtToolDbuserMgr);
|
HGPdtToolDb_DestroyUserMgr(m_pdtToolDbuserMgr);
|
||||||
m_pdtToolDbuserMgr = NULL;
|
m_pdtToolDbuserMgr = NULL;
|
||||||
|
@ -80,6 +70,81 @@ bool MainWindow::isExitApp()
|
||||||
return !m_isLogOut;
|
return !m_isLogOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::updateSplitter()
|
||||||
|
{
|
||||||
|
if (0 != m_top_splitter->count() && 0 == m_bot_splitter->count())
|
||||||
|
{
|
||||||
|
reinterpret_cast<QVBoxLayout*>(this->centralWidget()->layout())->setStretch(0, 1);
|
||||||
|
reinterpret_cast<QVBoxLayout*>(this->centralWidget()->layout())->setStretch(1, 0);
|
||||||
|
}
|
||||||
|
else if (0 == m_top_splitter->count() && 0 != m_bot_splitter->count())
|
||||||
|
{
|
||||||
|
reinterpret_cast<QVBoxLayout*>(this->centralWidget()->layout())->setStretch(0, 0);
|
||||||
|
reinterpret_cast<QVBoxLayout*>(this->centralWidget()->layout())->setStretch(1, 1);
|
||||||
|
}
|
||||||
|
else if (0 != m_top_splitter->count() && 0 != m_bot_splitter->count())
|
||||||
|
{
|
||||||
|
reinterpret_cast<QVBoxLayout*>(this->centralWidget()->layout())->setStretch(0, 1);
|
||||||
|
reinterpret_cast<QVBoxLayout*>(this->centralWidget()->layout())->setStretch(1, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
reinterpret_cast<QVBoxLayout*>(this->centralWidget()->layout())->setStretch(0, 0);
|
||||||
|
reinterpret_cast<QVBoxLayout*>(this->centralWidget()->layout())->setStretch(1, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Form_mainInterface* MainWindow::FindInterface(const QString &sn)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < m_top_splitter->count(); ++i)
|
||||||
|
{
|
||||||
|
Form_mainInterface *interface = (Form_mainInterface *)m_top_splitter->widget(i);
|
||||||
|
if (sn == interface->getSn())
|
||||||
|
{
|
||||||
|
return interface;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < m_bot_splitter->count(); ++i)
|
||||||
|
{
|
||||||
|
Form_mainInterface *interface = (Form_mainInterface *)m_bot_splitter->widget(i);
|
||||||
|
if (sn == interface->getSn())
|
||||||
|
{
|
||||||
|
return interface;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MainWindow::AddInterface(Form_mainInterface *interface)
|
||||||
|
{
|
||||||
|
assert(nullptr != interface);
|
||||||
|
|
||||||
|
bool ret = false;
|
||||||
|
if (m_top_splitter->count() < 2)
|
||||||
|
{
|
||||||
|
m_top_splitter->addWidget(interface);
|
||||||
|
ret = true;
|
||||||
|
}
|
||||||
|
else if (m_bot_splitter->count() < 2)
|
||||||
|
{
|
||||||
|
m_bot_splitter->addWidget(interface);
|
||||||
|
ret = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
updateSplitter();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MainWindow::RemoveInterface(Form_mainInterface *interface)
|
||||||
|
{
|
||||||
|
assert(nullptr != interface);
|
||||||
|
delete interface;
|
||||||
|
updateSplitter();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void HGAPI MainWindow::PdtToolDbUserEventFunc(HGPdtToolDbUserMgr userMgr, HGUInt event, HGPointer param)
|
void HGAPI MainWindow::PdtToolDbUserEventFunc(HGPdtToolDbUserMgr userMgr, HGUInt event, HGPointer param)
|
||||||
{
|
{
|
||||||
MainWindow *p = (MainWindow *)param;
|
MainWindow *p = (MainWindow *)param;
|
||||||
|
@ -138,14 +203,63 @@ std::vector<std::string> MainWindow::getDevices()
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString MainWindow::getDevSn(SANE_Handle handle)
|
||||||
|
{
|
||||||
|
std::string serialNum;
|
||||||
|
unsigned int serialNumLen = 0;
|
||||||
|
if(SANE_STATUS_NO_MEM == sane_io_control(handle, IO_CTRL_CODE_GET_SERIAL, nullptr, &serialNumLen) && serialNumLen)
|
||||||
|
{
|
||||||
|
serialNum.resize(serialNumLen);
|
||||||
|
sane_io_control(handle, IO_CTRL_CODE_GET_SERIAL, &serialNum[0], &serialNumLen);
|
||||||
|
}
|
||||||
|
return QString::fromStdString(serialNum.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
QString MainWindow::getDevType(SANE_Handle handle)
|
||||||
|
{
|
||||||
|
std::string firmWareNum;
|
||||||
|
unsigned int firmWareNumLen = 0;
|
||||||
|
if(SANE_STATUS_NO_MEM == sane_io_control(handle, IO_CTRL_CODE_GET_HARDWARE_VERSION, nullptr, &firmWareNumLen) && firmWareNumLen)
|
||||||
|
{
|
||||||
|
firmWareNum.resize(firmWareNumLen);
|
||||||
|
sane_io_control(handle, IO_CTRL_CODE_GET_HARDWARE_VERSION, &firmWareNum[0], &firmWareNumLen);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString str = QString::fromStdString(firmWareNum.c_str());
|
||||||
|
return str.left(2) + "00";
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::on_sane_dev_arrive(QString devName)
|
void MainWindow::on_sane_dev_arrive(QString devName)
|
||||||
{
|
{
|
||||||
SANE_Status ret = sane_open(devName.toStdString().c_str(), &m_handle);
|
QMessageBox msg(QMessageBox::Question, tr("tips"),
|
||||||
|
tr("Are you sure to connect the new device"),
|
||||||
|
QMessageBox::Yes | QMessageBox::No, this);
|
||||||
|
msg.setButtonText(QMessageBox::Yes, tr("yes"));
|
||||||
|
msg.setButtonText(QMessageBox::No, tr("no"));
|
||||||
|
msg.exec();
|
||||||
|
if (msg.clickedButton() == msg.button(QMessageBox::Yes))
|
||||||
|
{
|
||||||
|
SANE_Handle devHandle = nullptr;
|
||||||
|
sane_open(devName.toStdString().c_str(), &devHandle);
|
||||||
|
|
||||||
ui_helper* helper;
|
Dialog_InputSerialNum dlg(this, getDevSn(devHandle), getDevType(devHandle));
|
||||||
this->hg = new hgscanner(m_handle);
|
if (dlg.exec())
|
||||||
helper = dynamic_cast<hgscanner*>(this->hg);
|
{
|
||||||
func_test_go(L"test-31", L"null", helper);
|
HGPdtToolDbDevice pdtToolDbDevice = nullptr;
|
||||||
|
HGPdtToolDb_OpenDevice(m_pdtToolDbuserMgr, dlg.GetSn().toStdString().c_str(), &pdtToolDbDevice);
|
||||||
|
|
||||||
|
Form_mainInterface *mainInterface = new Form_mainInterface(this, devHandle, pdtToolDbDevice, dlg.GetSn(), dlg.GetDevType());
|
||||||
|
if (!AddInterface(mainInterface))
|
||||||
|
{
|
||||||
|
QMessageBox::information(this, tr("tips"), tr("cannot create more table"));
|
||||||
|
delete mainInterface;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// sane_close(devHandle);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_sane_dev_remove(QString devName)
|
void MainWindow::on_sane_dev_remove(QString devName)
|
||||||
|
@ -158,15 +272,15 @@ void MainWindow::on_user_event(int event)
|
||||||
QString tips;
|
QString tips;
|
||||||
switch (event)
|
switch (event)
|
||||||
{
|
{
|
||||||
case 1:
|
case HGPDTTOOLDB_USEREVENT_CONFLICT:
|
||||||
tips = tr("Account login elsewhere");
|
tips = tr("Account login elsewhere");
|
||||||
break;
|
break;
|
||||||
case 2:
|
case HGPDTTOOLDB_USEREVENT_REFUSE:
|
||||||
tips = tr("Network connection lost");
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
tips = tr("You have been forced offline by the administrator account");
|
tips = tr("You have been forced offline by the administrator account");
|
||||||
break;
|
break;
|
||||||
|
case HGPDTTOOLDB_USEREVENT_DBERROR:
|
||||||
|
tips = tr("Data base error");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -179,39 +293,18 @@ void MainWindow::on_user_event(int event)
|
||||||
|
|
||||||
void MainWindow::on_act_newDevice_triggered()
|
void MainWindow::on_act_newDevice_triggered()
|
||||||
{
|
{
|
||||||
m_splitterCount++;
|
Dialog_InputSerialNum dlg(this, "", "");
|
||||||
switch (m_splitterCount)
|
if (dlg.exec())
|
||||||
{
|
{
|
||||||
case 2:
|
HGPdtToolDbDevice pdtToolDbDevice = nullptr;
|
||||||
{
|
HGPdtToolDb_OpenDevice(m_pdtToolDbuserMgr, dlg.GetSn().toStdString().c_str(), &pdtToolDbDevice);
|
||||||
Form_mainInterface *form_mainInterface = new Form_mainInterface();
|
|
||||||
m_top_splitter->addWidget(form_mainInterface);
|
|
||||||
|
|
||||||
break;
|
Form_mainInterface *mainInterface = new Form_mainInterface(this, nullptr, pdtToolDbDevice, dlg.GetSn(), dlg.GetDevType());
|
||||||
}
|
if (!AddInterface(mainInterface))
|
||||||
|
{
|
||||||
case 3:
|
QMessageBox::information(this, tr("tips"), tr("cannot create more table"));
|
||||||
{
|
delete mainInterface;
|
||||||
Form_mainInterface *form_mainInterface = new Form_mainInterface();
|
}
|
||||||
m_bot_splitter->addWidget(form_mainInterface);
|
|
||||||
reinterpret_cast<QVBoxLayout*>(this->centralWidget()->layout())->setStretch(1, 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 4:
|
|
||||||
{
|
|
||||||
Form_mainInterface *form_mainInterface = new Form_mainInterface();
|
|
||||||
m_bot_splitter->addWidget(form_mainInterface);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 5:
|
|
||||||
QMessageBox::information(this, tr("tips"), tr("cannot create more table"));
|
|
||||||
return;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,10 +322,11 @@ void MainWindow::on_act_changePwd_triggered()
|
||||||
|
|
||||||
void MainWindow::on_act_export_triggered()
|
void MainWindow::on_act_export_triggered()
|
||||||
{
|
{
|
||||||
HGChar cfgPath[256]= {0};
|
QString filename = QFileDialog::getSaveFileName(this, tr("save"), "test.xls", tr("xls(*.xls)"));
|
||||||
HGBase_GetConfigPath(cfgPath, 256);
|
if (!filename.isEmpty())
|
||||||
strcat(cfgPath, "1.xls");
|
{
|
||||||
HGPdtToolDb_Export(m_pdtToolDbuserMgr, getStdString(cfgPath).c_str());
|
HGPdtToolDb_Export(m_pdtToolDbuserMgr, getStdString(filename).c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_act_logOut_triggered()
|
void MainWindow::on_act_logOut_triggered()
|
||||||
|
@ -274,8 +368,8 @@ QString MainWindow::getLogInfo(HGResult ret)
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
//void MainWindow::on_act_upload_triggered()
|
void MainWindow::on_act_upload_triggered()
|
||||||
//{
|
{
|
||||||
// Dialog_uploadCfgFile dlg(m_pdtToolDbuserMgr, this);
|
Dialog_uploadCfgFile dlg(m_pdtToolDbuserMgr, this);
|
||||||
// dlg.exec();
|
dlg.exec();
|
||||||
//}
|
}
|
||||||
|
|
|
@ -28,12 +28,18 @@ public:
|
||||||
static QString getLogInfo(HGResult ret);
|
static QString getLogInfo(HGResult ret);
|
||||||
bool isExitApp();
|
bool isExitApp();
|
||||||
|
|
||||||
|
void updateSplitter();
|
||||||
|
Form_mainInterface* FindInterface(const QString &sn);
|
||||||
|
bool AddInterface(Form_mainInterface *interface);
|
||||||
|
bool RemoveInterface(Form_mainInterface *interface);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void HGAPI PdtToolDbUserEventFunc(HGPdtToolDbUserMgr userMgr, HGUInt event, HGPointer param);
|
static void HGAPI PdtToolDbUserEventFunc(HGPdtToolDbUserMgr userMgr, HGUInt event, HGPointer param);
|
||||||
static int sane_ex_callback(SANE_Handle hdev, int code, void* data, unsigned int* len, void* param);
|
static int sane_ex_callback(SANE_Handle hdev, int code, void* data, unsigned int* len, void* param);
|
||||||
|
|
||||||
std::vector<std::string> getDevices();
|
std::vector<std::string> getDevices();
|
||||||
|
QString getDevSn(SANE_Handle handle);
|
||||||
|
QString getDevType(SANE_Handle handle);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sane_dev_arrive(QString devName);
|
void sane_dev_arrive(QString devName);
|
||||||
|
@ -58,21 +64,16 @@ private slots:
|
||||||
|
|
||||||
void on_act_close_triggered();
|
void on_act_close_triggered();
|
||||||
|
|
||||||
/* void on_act_upload_triggered();*/
|
void on_act_upload_triggered();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSplitter *m_top_splitter;
|
QSplitter *m_top_splitter;
|
||||||
QSplitter *m_bot_splitter;
|
QSplitter *m_bot_splitter;
|
||||||
SANE_Handle m_handle;
|
|
||||||
|
|
||||||
int m_splitterCount;
|
|
||||||
bool m_isLogOut;
|
bool m_isLogOut;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
HGPdtToolDbUserMgr m_pdtToolDbuserMgr;
|
HGPdtToolDbUserMgr m_pdtToolDbuserMgr;
|
||||||
|
|
||||||
Form_mainInterface *m_form_mainInterface;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
|
Loading…
Reference in New Issue