调整登录界面,测试流程

This commit is contained in:
yangjiaxuan 2022-12-26 16:24:20 +08:00
parent 57d21beb27
commit f6776c4df8
12 changed files with 295 additions and 119 deletions

View File

@ -52,6 +52,7 @@ INCLUDEPATH += $$PWD/../../db/HGPdtToolDb/
INCLUDEPATH += $$PWD/../../code/base/
SOURCES += \
../../../code_app/utility/HGString.cpp \
HGImgView.cpp \
HGUIGlobal.cpp \
analysisjson.cpp \
@ -69,6 +70,7 @@ SOURCES += \
ui_helper.cpp
HEADERS += \
../../../code_app/utility/HGString.h \
HGImgView.h \
HGUIGlobal.h \
analysisjson.h \

View File

@ -215,32 +215,50 @@
<translation></translation>
</message>
<message>
<location filename="dialog_login.ui" line="172"/>
<location filename="dialog_login.ui" line="227"/>
<source>account:</source>
<translation></translation>
</message>
<message>
<location filename="dialog_login.ui" line="212"/>
<location filename="dialog_login.ui" line="267"/>
<source>password:</source>
<translation></translation>
</message>
<message>
<location filename="dialog_login.ui" line="252"/>
<location filename="dialog_login.ui" line="307"/>
<source>dbHost:</source>
<translation></translation>
</message>
<message>
<location filename="dialog_login.ui" line="347"/>
<source>dbPort:</source>
<translation></translation>
</message>
<message>
<location filename="dialog_login.ui" line="387"/>
<source>ftpHost:</source>
<translation>FTP地址</translation>
</message>
<message>
<location filename="dialog_login.ui" line="427"/>
<source>ftpPort:</source>
<translation>FTP端口</translation>
</message>
<message>
<source>host:</source>
<translation>IP地址</translation>
<translation type="vanished">IP地址</translation>
</message>
<message>
<location filename="dialog_login.ui" line="292"/>
<source>port:</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="dialog_login.ui" line="332"/>
<location filename="dialog_login.ui" line="170"/>
<source>LOG IN</source>
<translation></translation>
</message>
<message>
<location filename="dialog_login.ui" line="342"/>
<location filename="dialog_login.ui" line="180"/>
<source>EXIT</source>
<translation>退</translation>
</message>
@ -265,12 +283,12 @@
<translation></translation>
</message>
<message>
<location filename="dialog_login.cpp" line="87"/>
<location filename="dialog_login.cpp" line="92"/>
<source>tips</source>
<translation></translation>
</message>
<message>
<location filename="dialog_login.cpp" line="87"/>
<location filename="dialog_login.cpp" line="92"/>
<source>Login failed: </source>
<translation> </translation>
</message>
@ -427,6 +445,11 @@
</message>
<message>
<location filename="form_maininterface.ui" line="101"/>
<source>START</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.ui" line="108"/>
<source>STOP</source>
<translation></translation>
</message>
@ -436,62 +459,62 @@
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="75"/>
<location filename="form_maininterface.cpp" line="76"/>
<source>Device has connected</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="77"/>
<location filename="form_maininterface.cpp" line="78"/>
<source>Device hasnot connected</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="78"/>
<location filename="form_maininterface.cpp" line="79"/>
<source>Device type:</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="78"/>
<location filename="form_maininterface.cpp" line="79"/>
<source> SerialNum:</source>
<translation> </translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="78"/>
<location filename="form_maininterface.cpp" line="79"/>
<source> connect status:</source>
<translation> </translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="180"/>
<location filename="form_maininterface.cpp" line="181"/>
<source>ID</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="180"/>
<location filename="form_maininterface.cpp" line="181"/>
<source>Test items</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="180"/>
<location filename="form_maininterface.cpp" line="181"/>
<source>status</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="323"/>
<location filename="form_maininterface.cpp" line="324"/>
<source>not test</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="323"/>
<location filename="form_maininterface.cpp" line="324"/>
<source>not pass</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="323"/>
<location filename="form_maininterface.cpp" line="324"/>
<source>not support</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="323"/>
<location filename="form_maininterface.cpp" line="324"/>
<source>pass</source>
<translation></translation>
</message>
@ -576,34 +599,34 @@
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="279"/>
<location filename="mainwindow.cpp" line="276"/>
<location filename="mainwindow.cpp" line="300"/>
<location filename="mainwindow.cpp" line="316"/>
<location filename="mainwindow.cpp" line="344"/>
<location filename="mainwindow.cpp" line="362"/>
<location filename="mainwindow.cpp" line="387"/>
<location filename="mainwindow.cpp" line="391"/>
<location filename="mainwindow.cpp" line="361"/>
<location filename="mainwindow.cpp" line="386"/>
<location filename="mainwindow.cpp" line="390"/>
<source>tips</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="280"/>
<location filename="mainwindow.cpp" line="277"/>
<source>Are you sure to connect the new device</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="282"/>
<location filename="mainwindow.cpp" line="279"/>
<source>yes</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="283"/>
<location filename="mainwindow.cpp" line="280"/>
<source>no</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="300"/>
<location filename="mainwindow.cpp" line="362"/>
<location filename="mainwindow.cpp" line="361"/>
<source>cannot create more table</source>
<translation></translation>
</message>
@ -613,47 +636,47 @@
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="382"/>
<location filename="mainwindow.cpp" line="381"/>
<source>save</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="382"/>
<location filename="mainwindow.cpp" line="381"/>
<source>xls(*.xls)</source>
<translation>xls表格(*.xls)</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="387"/>
<location filename="mainwindow.cpp" line="386"/>
<source>export succeed</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="391"/>
<location filename="mainwindow.cpp" line="390"/>
<source>export failed</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="413"/>
<location filename="mainwindow.cpp" line="412"/>
<source>Illegal user</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="417"/>
<location filename="mainwindow.cpp" line="416"/>
<source>Wrong password</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="421"/>
<location filename="mainwindow.cpp" line="420"/>
<source>Database error</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="425"/>
<location filename="mainwindow.cpp" line="424"/>
<source>connect error</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="429"/>
<location filename="mainwindow.cpp" line="428"/>
<source>Failed</source>
<translation></translation>
</message>

View File

@ -2,6 +2,10 @@
#include "ui_dialog_login.h"
#include <QMessageBox>
#include "mainwindow.h"
#include "base/HGUtility.h"
#include "base/HGIni.h"
#include "HGUIGlobal.h"
#include "HGString.h"
Dialog_logIn::Dialog_logIn(QWidget *parent) :
QDialog(parent),
@ -18,17 +22,24 @@ Dialog_logIn::Dialog_logIn(QWidget *parent) :
ui->label_title->setText(tr("LogIn"));
ui->lineEdit_account->setText("root");
ui->lineEdit_password->setText("123456");
QString account("root");
ui->lineEdit_account->setText(getCfgValue("login", "account", account));
// ui->lineEdit_password->setText("123456");
ui->lineEdit_password->setEchoMode(QLineEdit::EchoMode::Password);
ui->lineEdit_host->setText("192.168.1.70");
ui->lineEdit_port->setText("3306");
ui->lineEdit_dbHost->setText("192.168.1.70");
ui->lineEdit_dbPort->setText("3306");
ui->lineEdit_ftpHost->setText("192.168.1.70");
ui->lineEdit_ftpPort->setText("3306");
ui->label_host->setVisible(false);
ui->label_port->setVisible(false);
ui->lineEdit_host->setVisible(false);
ui->lineEdit_port->setVisible(false);
ui->label_dbHost->setVisible(false);
ui->label_dbPort->setVisible(false);
ui->lineEdit_dbHost->setVisible(false);
ui->lineEdit_dbPort->setVisible(false);
ui->label_ftpHost->setVisible(false);
ui->label_ftpPort->setVisible(false);
ui->lineEdit_ftpHost->setVisible(false);
ui->lineEdit_ftpPort->setVisible(false);
}
Dialog_logIn::~Dialog_logIn()
@ -71,8 +82,9 @@ void Dialog_logIn::on_pbtn_login_clicked()
{
QString account = ui->lineEdit_account->text();
QString password = ui->lineEdit_password->text();
QString host = ui->lineEdit_host->text();
QString port = ui->lineEdit_port->text();
QString host = ui->lineEdit_dbHost->text();
QString port = ui->lineEdit_dbPort->text();
saveCfgValue("login", "account", account);
HGPdtToolDbUserMgr pdtToolDbuserMgr = nullptr;
HGResult ret = HGPdtToolDb_CreateUserMgr(host.toStdString().c_str(), port.toInt(), account.toStdString().c_str(), password.toStdString().c_str(),
@ -101,10 +113,15 @@ void Dialog_logIn::on_pbtn_setting_clicked(bool checked)
ui->lineEdit_account->setVisible(!checked);
ui->lineEdit_password->setVisible(!checked);
ui->label_host->setVisible(checked);
ui->label_port->setVisible(checked);
ui->lineEdit_host->setVisible(checked);
ui->lineEdit_port->setVisible(checked);
ui->label_dbHost->setVisible(checked);
ui->label_dbPort->setVisible(checked);
ui->lineEdit_dbHost->setVisible(checked);
ui->lineEdit_dbPort->setVisible(checked);
ui->label_ftpHost->setVisible(checked);
ui->label_ftpPort->setVisible(checked);
ui->lineEdit_ftpHost->setVisible(checked);
ui->lineEdit_ftpPort->setVisible(checked);
}
void Dialog_logIn::on_pbtn_minum_clicked()
@ -116,3 +133,24 @@ void Dialog_logIn::on_pbtn_close_clicked()
{
close();
}
void Dialog_logIn::saveCfgValue(const char *appName, const char *key, const QString &value)
{
HGChar cfgPath[512];
HGBase_GetConfigPath(cfgPath, 512);
HGBase_CreateDir(cfgPath);
strcat(cfgPath, "config.ini");
HGBase_SetProfileString(cfgPath, appName, key, getStdString(value).c_str());
}
QString Dialog_logIn::getCfgValue(const char *appName, const char *key, const QString &def)
{
HGChar cfgPath[512];
HGBase_GetConfigPath(cfgPath, 512);
strcat(cfgPath, "config.ini");
HGChar value[512] = {0};
HGBase_GetProfileString(cfgPath, appName, key, getStdString(def).c_str(), value, 512);
return StdStringToUtf8(value).c_str();
}

View File

@ -33,6 +33,9 @@ private slots:
void on_pbtn_close_clicked();
private:
void saveCfgValue(const char *appName, const char *key, const QString &value);
QString getCfgValue(const char *appName, const char *key, const QString &def);
private:
Ui::Dialog_logIn *ui;

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>434</width>
<height>245</height>
<width>389</width>
<height>268</height>
</rect>
</property>
<property name="windowTitle">
@ -18,7 +18,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>441</width>
<width>391</width>
<height>30</height>
</rect>
</property>
@ -141,16 +141,74 @@ QPushButton#pbtn_close::hover
</item>
</layout>
</widget>
<widget class="QWidget" name="">
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>40</x>
<y>40</y>
<width>321</width>
<height>191</height>
<x>70</x>
<y>230</y>
<width>250</width>
<height>25</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pbtn_login">
<property name="text">
<string>LOG IN</string>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_exit">
<property name="text">
<string>EXIT</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>50</x>
<y>50</y>
<width>289</width>
<height>164</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0,0,0,0">
<property name="sizeConstraint">
<enum>QLayout::SetNoConstraint</enum>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
@ -247,14 +305,14 @@ QPushButton#pbtn_close::hover
</spacer>
</item>
<item>
<widget class="QLabel" name="label_host">
<widget class="QLabel" name="label_dbHost">
<property name="text">
<string>host:</string>
<string>dbHost:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_host"/>
<widget class="QLineEdit" name="lineEdit_dbHost"/>
</item>
<item>
<spacer name="horizontalSpacer_9">
@ -287,14 +345,14 @@ QPushButton#pbtn_close::hover
</spacer>
</item>
<item>
<widget class="QLabel" name="label_port">
<widget class="QLabel" name="label_dbPort">
<property name="text">
<string>port:</string>
<string>dbPort:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_port"/>
<widget class="QLineEdit" name="lineEdit_dbPort"/>
</item>
<item>
<spacer name="horizontalSpacer_11">
@ -312,9 +370,9 @@ QPushButton#pbtn_close::hover
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<spacer name="horizontalSpacer_2">
<spacer name="horizontalSpacer_12">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -327,24 +385,57 @@ QPushButton#pbtn_close::hover
</spacer>
</item>
<item>
<widget class="QPushButton" name="pbtn_login">
<widget class="QLabel" name="label_ftpHost">
<property name="text">
<string>LOG IN</string>
</property>
<property name="default">
<bool>true</bool>
<string>ftpHost:</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_exit">
<widget class="QLineEdit" name="lineEdit_ftpHost"/>
</item>
<item>
<spacer name="horizontalSpacer_13">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<spacer name="horizontalSpacer_14">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_ftpPort">
<property name="text">
<string>EXIT</string>
<string>ftpPort:</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<widget class="QLineEdit" name="lineEdit_ftpPort"/>
</item>
<item>
<spacer name="horizontalSpacer_15">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>

View File

@ -55,11 +55,12 @@ static const RELA Rela[] = {
{HGPDTTOOLDB_TITLE_CLEAR_ROLLER_COUNT, HGPDTTOOLDB_ENTRYNAME_CLEAR_ROLLER_COUNT}
};
Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, SANE_Handle handle, HGPdtToolDbUserMgr pdtToolDbuserMgr, HGPdtToolDbDevice pdtToolDbDevice,
Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, ui_helper *uiHelper, SANE_Handle handle, HGPdtToolDbUserMgr pdtToolDbuserMgr, HGPdtToolDbDevice pdtToolDbDevice,
const QString &serialNum, const QString &devType, const QString &devName, const QString &devFwNum)
: QWidget(mainwnd)
, ui(new Ui::Form_mainInterface)
, m_mainwnd(mainwnd)
, m_uiHhelper(uiHelper)
, m_handle(handle)
, m_pdtToolDbuserMgr(pdtToolDbuserMgr)
, m_pdtToolDbDevice(pdtToolDbDevice)
@ -326,6 +327,7 @@ QString Form_mainInterface::getItemStatusStr(HGUInt status)
void Form_mainInterface::on_tableWidget_currentItemChanged(QTableWidgetItem *current, QTableWidgetItem *previous)
{
(void)previous;
int row = current->row();
int count = ui->tableWidget->rowCount();
ui->pbtn_preStep->setEnabled(row != 0);
@ -334,6 +336,9 @@ void Form_mainInterface::on_tableWidget_currentItemChanged(QTableWidgetItem *cur
QTableWidgetItem *item2 = ui->tableWidget->item(row, 1);
QString title = item2->text();
bool man = m_map_title_name.value(title).is_man;
ui->pbtn_start->setEnabled(!man);
QString testName;
if (title == HGPDTTOOLDB_TITLE_DIAL_SWITCH)
{
@ -347,11 +352,12 @@ void Form_mainInterface::on_tableWidget_currentItemChanged(QTableWidgetItem *cur
testName = m_map_title_name.value(title).name;
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_start_clicked()
{
int row = ui->tableWidget->currentRow();
QTableWidgetItem *item = ui->tableWidget->item(row, 1);
QString title = item->text();
func_test_go(title.toStdWString().c_str(), L"null", m_uiHhelper);
}

View File

@ -9,6 +9,7 @@
#include "analysisjson.h"
#include "sane/sane_ex.h"
#include "HGPdtToolDb.h"
#include "ui_helper.h"
namespace Ui {
class Form_mainInterface;
@ -19,7 +20,7 @@ class Form_mainInterface : public QWidget
Q_OBJECT
public:
explicit Form_mainInterface(class MainWindow *mainwnd, SANE_Handle handle, HGPdtToolDbUserMgr pdtToolDbuserMgr, HGPdtToolDbDevice pdtToolDbDevice,
explicit Form_mainInterface(class MainWindow *mainwnd, ui_helper *uiHelper, SANE_Handle handle, HGPdtToolDbUserMgr pdtToolDbuserMgr, HGPdtToolDbDevice pdtToolDbDevice,
const QString &serialNum, const QString &devType, const QString &devName, const QString &devFwNum);
~Form_mainInterface();
@ -42,6 +43,8 @@ private slots:
void on_tableWidget_currentItemChanged(QTableWidgetItem *current, QTableWidgetItem *previous);
void on_pbtn_start_clicked();
private:
void initTableWidgetUi();
HGUInt getTestItem(const QString &title);
@ -57,6 +60,7 @@ private:
HGImgView *m_view;
class MainWindow *m_mainwnd;
ui_helper *m_uiHhelper;
SANE_Handle m_handle;
HGPdtToolDbUserMgr m_pdtToolDbuserMgr;
HGPdtToolDbDevice m_pdtToolDbDevice;

View File

@ -95,6 +95,13 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbtn_start">
<property name="text">
<string>START</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbtn_stop">
<property name="text">

View File

@ -1,4 +1,5 @@
#include "hgscanner.h"
#include <QMessageBox>
hgscanner::hgscanner(SANE_Handle h):devHandle_(h)
{
@ -16,6 +17,8 @@ parameter* hgscanner::get_user_input(data_from from, value_type type, const wcha
void hgscanner::test_callback(const wchar_t* name, test_event ev, void* data, size_t flag)
{
QString testName = QString::fromStdWString(name);
QString info = QString::fromStdWString((const wchar_t*)data);
if (ev == ui_helper::TEST_EVENT_TIPS)
{

View File

@ -23,7 +23,6 @@ MainWindow::MainWindow(HGPdtToolDbUserMgr pdtToolDbuserMgr, QWidget *parent)
connect(this, SIGNAL(sane_dev_arrive(QString)), this, SLOT(on_sane_dev_arrive(QString)), Qt::QueuedConnection);
connect(this, SIGNAL(sane_dev_remove(QString)), this, SLOT(on_sane_dev_remove(QString)), Qt::QueuedConnection);
connect(this, SIGNAL(user_event(int)), this, SLOT(on_user_event(int)), Qt::QueuedConnection);
m_top_splitter = new QSplitter(Qt::Horizontal);
m_bot_splitter = new QSplitter(Qt::Horizontal);
@ -39,7 +38,6 @@ MainWindow::MainWindow(HGPdtToolDbUserMgr pdtToolDbuserMgr, QWidget *parent)
vLayout->setStretch(1, 0);
this->centralWidget()->setLayout(vLayout);
// todo 创建定时器
QTimer *timer = new QTimer(this);
timer->start(1000);
connect(timer, SIGNAL(timeout()), this, SLOT(on_update_userStatus()));
@ -189,31 +187,30 @@ bool MainWindow::RemoveInterface(Form_mainInterface *interface)
int MainWindow::sane_ex_callback(SANE_Handle hdev, int code, void *data, unsigned int *len, void *param)
{
(void)hdev;
(void)len;
MainWindow* p = (MainWindow*)param;
switch (code)
{
case SANE_EVENT_DEVICE_ARRIVED:
{
SANE_Device_Ex* sane_dev = (SANE_Device_Ex*)data;
emit p->sane_dev_arrive(sane_dev->name);
}
break;
case SANE_EVENT_DEVICE_LEFT:
{
SANE_Device* sane_dev = (SANE_Device*)data;
emit p->sane_dev_remove(sane_dev->name);
}
break;
}
MainWindow* p = (MainWindow*)param;
switch (code)
{
case SANE_EVENT_DEVICE_ARRIVED:
{
SANE_Device_Ex* sane_dev = (SANE_Device_Ex*)data;
emit p->sane_dev_arrive(sane_dev->name);
}
break;
case SANE_EVENT_DEVICE_LEFT:
{
SANE_Device* sane_dev = (SANE_Device*)data;
emit p->sane_dev_remove(sane_dev->name);
}
break;
}
// if (!hdev)
// {
// return -1;
// }
// p->hg->cb_(hdev, code, data, len, NULL);
return 0;
if (!hdev)
{
return -1;
}
p->m_hg->cb_(hdev, code, data, len, p->m_uiHelper);
return 0;
}
std::vector<std::string> MainWindow::getDevices()
@ -293,7 +290,10 @@ void MainWindow::on_sane_dev_arrive(QString devName)
HGPdtToolDbDevice pdtToolDbDevice = nullptr;
HGPdtToolDb_OpenDevice(m_pdtToolDbuserMgr, dlg.GetSn().toStdString().c_str(), &pdtToolDbDevice);
Form_mainInterface *mainInterface = new Form_mainInterface(this, devHandle, m_pdtToolDbuserMgr, pdtToolDbDevice,
m_hg = new hgscanner(devHandle);
m_uiHelper = dynamic_cast<ui_helper*>(m_hg);
Form_mainInterface *mainInterface = new Form_mainInterface(this, m_uiHelper, devHandle, m_pdtToolDbuserMgr, pdtToolDbDevice,
dlg.GetSn(), dlg.GetDevType(), devName, getDevFwNum(devHandle));
if (!AddInterface(mainInterface))
{
@ -345,7 +345,6 @@ void MainWindow::on_update_userStatus()
m_isLogOut = true;
close();
}
}
void MainWindow::on_act_newDevice_triggered()
@ -356,7 +355,7 @@ void MainWindow::on_act_newDevice_triggered()
HGPdtToolDbDevice pdtToolDbDevice = nullptr;
HGPdtToolDb_OpenDevice(m_pdtToolDbuserMgr, dlg.GetSn().toStdString().c_str(), &pdtToolDbDevice);
Form_mainInterface *mainInterface = new Form_mainInterface(this, nullptr, m_pdtToolDbuserMgr, pdtToolDbDevice, dlg.GetSn(), dlg.GetDevType(), nullptr, nullptr);
Form_mainInterface *mainInterface = new Form_mainInterface(this, nullptr, nullptr, m_pdtToolDbuserMgr, pdtToolDbDevice, dlg.GetSn(), dlg.GetDevType(), nullptr, nullptr);
if (!AddInterface(mainInterface))
{
QMessageBox::information(this, tr("tips"), tr("cannot create more table"));

View File

@ -40,7 +40,6 @@ private:
signals:
void sane_dev_arrive(QString devName);
void sane_dev_remove(QString devName);
void user_event(int event);
private slots:
void on_sane_dev_arrive(QString devName);
@ -71,6 +70,7 @@ private:
private:
Ui::MainWindow *ui;
HGPdtToolDbUserMgr m_pdtToolDbuserMgr;
hgscanner* hg;
hgscanner *m_hg;
ui_helper *m_uiHelper;
};
#endif // MAINWINDOW_H