屏蔽所有相关数据库的调用
This commit is contained in:
parent
50144af2b7
commit
e5c59261e6
|
@ -45,12 +45,12 @@ win32 {
|
||||||
# sane.dll
|
# sane.dll
|
||||||
LIBS += -L$$PWD/../../../release/win/$${MY_ARCH}/OEM/$${OEM_NAME}
|
LIBS += -L$$PWD/../../../release/win/$${MY_ARCH}/OEM/$${OEM_NAME}
|
||||||
|
|
||||||
LIBS += -L$$PWD/../../db/$${MY_CONFIGURE} -lHGPdtToolDb
|
# LIBS += -L$$PWD/../../db/$${MY_CONFIGURE} -lHGPdtToolDb
|
||||||
LIBS += -L$$PWD/../../code/base/$${MY_CONFIGURE} -ltest
|
LIBS += -L$$PWD/../../code/base/$${MY_CONFIGURE} -ltest
|
||||||
}
|
}
|
||||||
|
|
||||||
INCLUDEPATH += $$PWD/../../../sdk/include/
|
INCLUDEPATH += $$PWD/../../../sdk/include/
|
||||||
INCLUDEPATH += $$PWD/../../db/HGPdtToolDb/
|
#INCLUDEPATH += $$PWD/../../db/HGPdtToolDb/
|
||||||
INCLUDEPATH += $$PWD/../../code/base/
|
INCLUDEPATH += $$PWD/../../code/base/
|
||||||
|
|
||||||
DESTDIR = $$PWD/../../../code_app/build2/build/$${MY_OS}/$${OEM_NAME}/$${MY_ARCH}/$${MY_CONFIGURE}
|
DESTDIR = $$PWD/../../../code_app/build2/build/$${MY_OS}/$${OEM_NAME}/$${MY_ARCH}/$${MY_CONFIGURE}
|
||||||
|
@ -74,7 +74,7 @@ win32 {
|
||||||
}
|
}
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
../../../code_app/utility/HGString.cpp \
|
HGString.cpp \
|
||||||
app_cfg.cpp \
|
app_cfg.cpp \
|
||||||
HGImgView.cpp \
|
HGImgView.cpp \
|
||||||
HGUIGlobal.cpp \
|
HGUIGlobal.cpp \
|
||||||
|
@ -99,7 +99,7 @@ SOURCES += \
|
||||||
ui_helper.cpp
|
ui_helper.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
../../../code_app/utility/HGString.h \
|
HGString.h \
|
||||||
app_cfg.h \
|
app_cfg.h \
|
||||||
HGImgView.h \
|
HGImgView.h \
|
||||||
HGUIGlobal.h \
|
HGUIGlobal.h \
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
#include "HGString.h"
|
||||||
|
#include "../modules/base/HGDef.h"
|
||||||
|
#include "../modules/base/HGInc.h"
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
#if defined(HG_CMP_MSC)
|
||||||
|
static std::string AnsiToUtf8(const char* text)
|
||||||
|
{
|
||||||
|
int wlen = ::MultiByteToWideChar(CP_ACP, 0, text, -1, NULL, 0);
|
||||||
|
WCHAR* pUnicode = new WCHAR[wlen];
|
||||||
|
::MultiByteToWideChar(CP_ACP, 0, text, -1, pUnicode, wlen);
|
||||||
|
int len = ::WideCharToMultiByte(CP_UTF8, 0, pUnicode, -1, NULL, 0, NULL, NULL);
|
||||||
|
CHAR* pUTF8 = new CHAR[len];
|
||||||
|
::WideCharToMultiByte(CP_UTF8, 0, pUnicode, -1, pUTF8, len, NULL, NULL);
|
||||||
|
delete[] pUnicode;
|
||||||
|
std::string ret = pUTF8;
|
||||||
|
delete[] pUTF8;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
static std::string Utf8ToAnsi(const char* text)
|
||||||
|
{
|
||||||
|
int wlen = ::MultiByteToWideChar(CP_UTF8, 0, text, -1, NULL, 0);
|
||||||
|
WCHAR* pUnicode = new WCHAR[wlen];
|
||||||
|
::MultiByteToWideChar(CP_UTF8, 0, text, -1, pUnicode, wlen);
|
||||||
|
int len = ::WideCharToMultiByte(CP_ACP, 0, pUnicode, -1, NULL, 0, NULL, NULL);
|
||||||
|
CHAR* pAnsi = new CHAR[len];
|
||||||
|
::WideCharToMultiByte(CP_ACP, 0, pUnicode, -1, pAnsi, len, NULL, NULL);
|
||||||
|
delete[] pUnicode;
|
||||||
|
std::string ret = pAnsi;
|
||||||
|
delete[] pAnsi;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
std::string Utf8ToStdString(const std::string& utf8Str)
|
||||||
|
{
|
||||||
|
#if defined(HG_CMP_MSC)
|
||||||
|
return Utf8ToAnsi(utf8Str.c_str());
|
||||||
|
#else
|
||||||
|
return utf8Str;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string StdStringToUtf8(const std::string& stdStr)
|
||||||
|
{
|
||||||
|
#if defined(HG_CMP_MSC)
|
||||||
|
return AnsiToUtf8(stdStr.c_str());
|
||||||
|
#else
|
||||||
|
return stdStr;
|
||||||
|
#endif
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
#ifndef __HGSTRING_H__
|
||||||
|
#define __HGSTRING_H__
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
// 标准字符串:windows下为ansi编码,linux下为utf8编码
|
||||||
|
|
||||||
|
// UTF8转标准字符串
|
||||||
|
std::string Utf8ToStdString(const std::string& utf8Str);
|
||||||
|
|
||||||
|
// 标准字符串转UTF8
|
||||||
|
std::string StdStringToUtf8(const std::string& stdStr);
|
||||||
|
|
||||||
|
#endif /* __HGSTRING_H__ */
|
|
@ -5,9 +5,8 @@
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
|
||||||
Dialog_accountManage::Dialog_accountManage(HGPdtToolDbUserMgr pdtToolDbuserMgr, QWidget *parent) :
|
Dialog_accountManage::Dialog_accountManage(QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
m_pdtToolDbuserMgr(pdtToolDbuserMgr),
|
|
||||||
ui(new Ui::Dialog_accountManage)
|
ui(new Ui::Dialog_accountManage)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
@ -20,7 +19,7 @@ Dialog_accountManage::Dialog_accountManage(HGPdtToolDbUserMgr pdtToolDbuserMgr,
|
||||||
|
|
||||||
HGChar* userNameList[100];
|
HGChar* userNameList[100];
|
||||||
HGUInt count = 0;
|
HGUInt count = 0;
|
||||||
HGPdtToolDb_GetUserList(pdtToolDbuserMgr, userNameList, 100, &count);
|
//HGPdtToolDb_GetUserList(pdtToolDbuserMgr, userNameList, 100, &count);
|
||||||
|
|
||||||
for (int i = 0; i < count; ++i)
|
for (int i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
|
@ -29,7 +28,7 @@ Dialog_accountManage::Dialog_accountManage(HGPdtToolDbUserMgr pdtToolDbuserMgr,
|
||||||
|
|
||||||
ui->listWidget->setCurrentRow(0);
|
ui->listWidget->setCurrentRow(0);
|
||||||
|
|
||||||
HGPdtToolDb_ReleaseUserList(userNameList, count);
|
//HGPdtToolDb_ReleaseUserList(userNameList, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
Dialog_accountManage::~Dialog_accountManage()
|
Dialog_accountManage::~Dialog_accountManage()
|
||||||
|
@ -42,15 +41,15 @@ void Dialog_accountManage::on_pbtn_newAccount_clicked()
|
||||||
Dialog_rootFuntion dlg(false, this);
|
Dialog_rootFuntion dlg(false, this);
|
||||||
if (dlg.exec())
|
if (dlg.exec())
|
||||||
{
|
{
|
||||||
HGResult ret = HGPdtToolDb_CreateUser(m_pdtToolDbuserMgr, dlg.getAccount().toStdString().c_str(), dlg.getPassword().toStdString().c_str());
|
// HGResult ret = HGPdtToolDb_CreateUser(m_pdtToolDbuserMgr, dlg.getAccount().toStdString().c_str(), dlg.getPassword().toStdString().c_str());
|
||||||
if (ret == HGBASE_ERR_OK)
|
// if (ret == HGBASE_ERR_OK)
|
||||||
{
|
// {
|
||||||
ui->listWidget->addItem(dlg.getAccount());
|
// ui->listWidget->addItem(dlg.getAccount());
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
QMessageBox::information(this, tr("tips"), tr("create user failed: ") + MainWindow::getLogInfo(ret));
|
// QMessageBox::information(this, tr("tips"), tr("create user failed: ") + MainWindow::getLogInfo(ret));
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,15 +65,15 @@ void Dialog_accountManage::on_pbtn_destroyAccount_clicked()
|
||||||
msg.exec();
|
msg.exec();
|
||||||
if (msg.clickedButton() == msg.button(QMessageBox::Yes))
|
if (msg.clickedButton() == msg.button(QMessageBox::Yes))
|
||||||
{
|
{
|
||||||
HGResult ret = HGPdtToolDb_DestroyUser(m_pdtToolDbuserMgr, userName.toStdString().c_str());
|
// HGResult ret = HGPdtToolDb_DestroyUser(m_pdtToolDbuserMgr, userName.toStdString().c_str());
|
||||||
if(ret == HGBASE_ERR_OK)
|
// if(ret == HGBASE_ERR_OK)
|
||||||
{
|
// {
|
||||||
ui->listWidget->takeItem(ui->listWidget->currentRow());
|
// ui->listWidget->takeItem(ui->listWidget->currentRow());
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
QMessageBox::information(this, tr("tips"), tr("destroy user failed: ") + MainWindow::getLogInfo(ret));
|
// QMessageBox::information(this, tr("tips"), tr("destroy user failed: ") + MainWindow::getLogInfo(ret));
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -88,15 +87,15 @@ void Dialog_accountManage::on_pbtn_changePwd_clicked()
|
||||||
if (dlg.exec())
|
if (dlg.exec())
|
||||||
{
|
{
|
||||||
QString userName = ui->listWidget->currentItem()->text();
|
QString userName = ui->listWidget->currentItem()->text();
|
||||||
HGResult ret = HGPdtToolDb_SetPassword(m_pdtToolDbuserMgr, userName.toStdString().c_str(), dlg.getPassword().toStdString().c_str());
|
// HGResult ret = HGPdtToolDb_SetPassword(m_pdtToolDbuserMgr, userName.toStdString().c_str(), dlg.getPassword().toStdString().c_str());
|
||||||
if(ret == HGBASE_ERR_OK)
|
// if(ret == HGBASE_ERR_OK)
|
||||||
{
|
// {
|
||||||
QMessageBox::information(this, tr("tips"), tr("change password succeed"));
|
// QMessageBox::information(this, tr("tips"), tr("change password succeed"));
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
QMessageBox::information(this, tr("tips"), tr("change password failed: ") + MainWindow::getLogInfo(ret));
|
// QMessageBox::information(this, tr("tips"), tr("change password failed: ") + MainWindow::getLogInfo(ret));
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define DIALOG_ACCOUNTMANAGE_H
|
#define DIALOG_ACCOUNTMANAGE_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include "HGPdtToolDb.h"
|
//#include "HGPdtToolDb.h"
|
||||||
#include <QListWidgetItem>
|
#include <QListWidgetItem>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
@ -14,7 +14,7 @@ class Dialog_accountManage : public QDialog
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Dialog_accountManage(HGPdtToolDbUserMgr pdtToolDbuserMgr, QWidget *parent = nullptr);
|
explicit Dialog_accountManage(QWidget *parent = nullptr);
|
||||||
~Dialog_accountManage();
|
~Dialog_accountManage();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -31,7 +31,7 @@ private slots:
|
||||||
private:
|
private:
|
||||||
Ui::Dialog_accountManage *ui;
|
Ui::Dialog_accountManage *ui;
|
||||||
|
|
||||||
HGPdtToolDbUserMgr m_pdtToolDbuserMgr;
|
// HGPdtToolDbUserMgr m_pdtToolDbuserMgr;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIALOG_ACCOUNTMANAGE_H
|
#endif // DIALOG_ACCOUNTMANAGE_H
|
||||||
|
|
|
@ -6,9 +6,8 @@
|
||||||
#include "base/HGUtility.h"
|
#include "base/HGUtility.h"
|
||||||
#include "app_cfg.h"
|
#include "app_cfg.h"
|
||||||
|
|
||||||
Dialog_changePwd::Dialog_changePwd(HGPdtToolDbUserMgr pdtToolDbuserMgr, const QString& accountName, QWidget *parent) :
|
Dialog_changePwd::Dialog_changePwd(const QString& accountName, QWidget *parent) :
|
||||||
QDialog(parent)
|
QDialog(parent)
|
||||||
, m_pdtToolDbuserMgr(pdtToolDbuserMgr)
|
|
||||||
, m_accountName(accountName)
|
, m_accountName(accountName)
|
||||||
, ui(new Ui::Dialog_changePwd)
|
, ui(new Ui::Dialog_changePwd)
|
||||||
{
|
{
|
||||||
|
@ -42,12 +41,12 @@ void Dialog_changePwd::on_pbtn_ok_clicked()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
HGResult ret = HGPdtToolDb_ModifyPassword(m_pdtToolDbuserMgr, oldPwd.toStdString().c_str(), newPwd.toStdString().c_str());
|
// HGResult ret = HGPdtToolDb_ModifyPassword(m_pdtToolDbuserMgr, oldPwd.toStdString().c_str(), newPwd.toStdString().c_str());
|
||||||
if(ret != HGBASE_ERR_OK)
|
// if(ret != HGBASE_ERR_OK)
|
||||||
{
|
// {
|
||||||
QMessageBox::information(this, tr("tips"), tr("Change passwords failed: ") + MainWindow::getLogInfo(ret));
|
// QMessageBox::information(this, tr("tips"), tr("Change passwords failed: ") + MainWindow::getLogInfo(ret));
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
saveCfgValue(m_accountName.toStdString().c_str(), "password", newPwd);
|
saveCfgValue(m_accountName.toStdString().c_str(), "password", newPwd);
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define DIALOG_CHANGEPWD_H
|
#define DIALOG_CHANGEPWD_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include "HGPdtToolDb.h"
|
//#include "HGPdtToolDb.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class Dialog_changePwd;
|
class Dialog_changePwd;
|
||||||
|
@ -13,7 +13,7 @@ class Dialog_changePwd : public QDialog
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Dialog_changePwd(HGPdtToolDbUserMgr pdtToolDbuserMgr, const QString& accountName, QWidget *parent = nullptr);
|
explicit Dialog_changePwd(const QString& accountName, QWidget *parent = nullptr);
|
||||||
~Dialog_changePwd();
|
~Dialog_changePwd();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -24,7 +24,7 @@ private slots:
|
||||||
private:
|
private:
|
||||||
Ui::Dialog_changePwd *ui;
|
Ui::Dialog_changePwd *ui;
|
||||||
|
|
||||||
HGPdtToolDbUserMgr m_pdtToolDbuserMgr;
|
//HGPdtToolDbUserMgr m_pdtToolDbuserMgr;
|
||||||
QString m_accountName;
|
QString m_accountName;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "base/HGBase.h"
|
#include "base/HGBase.h"
|
||||||
|
|
||||||
Dialog_InputSerialNum::Dialog_InputSerialNum(class MainWindow *mainWnd, const QString &devName, HGPdtToolDbUserMgr pdtToolDbuserMgr,
|
Dialog_InputSerialNum::Dialog_InputSerialNum(class MainWindow *mainWnd, const QString &devName,
|
||||||
SANE_Handle handle, const QString &serialNum, const QString &devType) :
|
SANE_Handle handle, const QString &serialNum, const QString &devType) :
|
||||||
QDialog(mainWnd),
|
QDialog(mainWnd),
|
||||||
ui(new Ui::Dialog_InputSerialNum),
|
ui(new Ui::Dialog_InputSerialNum),
|
||||||
|
@ -13,7 +13,6 @@ Dialog_InputSerialNum::Dialog_InputSerialNum(class MainWindow *mainWnd, const QS
|
||||||
m_serialNum(serialNum),
|
m_serialNum(serialNum),
|
||||||
m_devType(devType),
|
m_devType(devType),
|
||||||
m_devName(devName),
|
m_devName(devName),
|
||||||
m_pdtToolDbuserMgr(pdtToolDbuserMgr),
|
|
||||||
m_hg(nullptr)
|
m_hg(nullptr)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
@ -89,7 +88,7 @@ void Dialog_InputSerialNum::setSpeedAndSleep(bool updateSleep)
|
||||||
strcat(cfgPath, m_devType.toStdString().c_str());
|
strcat(cfgPath, m_devType.toStdString().c_str());
|
||||||
strcat(cfgPath, ".json");
|
strcat(cfgPath, ".json");
|
||||||
|
|
||||||
HGPdtToolDb_DownloadFile(m_pdtToolDbuserMgr, m_devType.toStdString().c_str(), cfgPath);
|
//HGPdtToolDb_DownloadFile(m_pdtToolDbuserMgr, m_devType.toStdString().c_str(), cfgPath);
|
||||||
|
|
||||||
AnalysisJson analysisJson(QString::fromStdString(cfgPath));
|
AnalysisJson analysisJson(QString::fromStdString(cfgPath));
|
||||||
AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
|
AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include "sane/sane_ex.h"
|
#include "sane/sane_ex.h"
|
||||||
#include "HGPdtToolDb.h"
|
//#include "HGPdtToolDb.h"
|
||||||
#include "hgscanner.h"
|
#include "hgscanner.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
@ -15,7 +15,7 @@ class Dialog_InputSerialNum : public QDialog
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Dialog_InputSerialNum(class MainWindow *mainWnd, const QString &devName, HGPdtToolDbUserMgr pdtToolDbuserMgr,
|
explicit Dialog_InputSerialNum(class MainWindow *mainWnd, const QString &devName,
|
||||||
SANE_Handle handle, const QString &serialNum, const QString &devType);
|
SANE_Handle handle, const QString &serialNum, const QString &devType);
|
||||||
~Dialog_InputSerialNum();
|
~Dialog_InputSerialNum();
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ private:
|
||||||
QString m_serialNum;
|
QString m_serialNum;
|
||||||
QString m_devType;
|
QString m_devType;
|
||||||
QString m_devName;
|
QString m_devName;
|
||||||
HGPdtToolDbUserMgr m_pdtToolDbuserMgr;
|
//HGPdtToolDbUserMgr m_pdtToolDbuserMgr;
|
||||||
hgscanner *m_hg;
|
hgscanner *m_hg;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
Dialog_logIn::Dialog_logIn(QWidget *parent) :
|
Dialog_logIn::Dialog_logIn(QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::Dialog_logIn)
|
ui(new Ui::Dialog_logIn)
|
||||||
, m_pdtToolDbuserMgr(nullptr)
|
|
||||||
, m_accountName("")
|
, m_accountName("")
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
@ -57,10 +56,10 @@ Dialog_logIn::~Dialog_logIn()
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
HGPdtToolDbUserMgr Dialog_logIn::GetUserMgr()
|
//HGPdtToolDbUserMgr Dialog_logIn::GetUserMgr()
|
||||||
{
|
//{
|
||||||
return m_pdtToolDbuserMgr;
|
// return m_pdtToolDbuserMgr;
|
||||||
}
|
//}
|
||||||
|
|
||||||
QString Dialog_logIn::GetFtpHost()
|
QString Dialog_logIn::GetFtpHost()
|
||||||
{
|
{
|
||||||
|
@ -134,30 +133,32 @@ void Dialog_logIn::on_pbtn_login_clicked()
|
||||||
|
|
||||||
m_accountName = account;
|
m_accountName = account;
|
||||||
|
|
||||||
HGPdtToolDbUserMgr pdtToolDbuserMgr = nullptr;
|
accept();
|
||||||
HGPdtToolDb_CreateUserMgr(dbHost.toStdString().c_str(), dbPort.toInt(), account.toStdString().c_str(), password.toStdString().c_str(),
|
|
||||||
&pdtToolDbuserMgr);
|
// HGPdtToolDbUserMgr pdtToolDbuserMgr = nullptr;
|
||||||
if (NULL != pdtToolDbuserMgr)
|
// HGPdtToolDb_CreateUserMgr(dbHost.toStdString().c_str(), dbPort.toInt(), account.toStdString().c_str(), password.toStdString().c_str(),
|
||||||
{
|
// &pdtToolDbuserMgr);
|
||||||
m_pdtToolDbuserMgr = pdtToolDbuserMgr;
|
// if (NULL != pdtToolDbuserMgr)
|
||||||
accept();
|
// {
|
||||||
}
|
// m_pdtToolDbuserMgr = pdtToolDbuserMgr;
|
||||||
else
|
// accept();
|
||||||
{
|
// }
|
||||||
QMessageBox msg(QMessageBox::Question, tr("tips"), tr("Login failed, sure to enter offline mode?"), QMessageBox::Yes | QMessageBox::No, this);
|
// else
|
||||||
msg.setButtonText(QMessageBox::Yes, tr("yes"));
|
// {
|
||||||
msg.setButtonText(QMessageBox::No, tr("no"));
|
// QMessageBox msg(QMessageBox::Question, tr("tips"), tr("Login failed, sure to enter offline mode?"), QMessageBox::Yes | QMessageBox::No, this);
|
||||||
msg.exec();
|
// msg.setButtonText(QMessageBox::Yes, tr("yes"));
|
||||||
if (msg.clickedButton() == msg.button(QMessageBox::Yes))
|
// msg.setButtonText(QMessageBox::No, tr("no"));
|
||||||
{
|
// msg.exec();
|
||||||
m_pdtToolDbuserMgr = nullptr;
|
// if (msg.clickedButton() == msg.button(QMessageBox::Yes))
|
||||||
accept();
|
// {
|
||||||
}
|
// m_pdtToolDbuserMgr = nullptr;
|
||||||
else
|
// accept();
|
||||||
{
|
// }
|
||||||
return;
|
// else
|
||||||
}
|
// {
|
||||||
}
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void Dialog_logIn::on_pbtn_setting_clicked(bool checked)
|
void Dialog_logIn::on_pbtn_setting_clicked(bool checked)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define DIALOG_LOGIN_H
|
#define DIALOG_LOGIN_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include "HGPdtToolDb.h"
|
//#include "HGPdtToolDb.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class Dialog_logIn;
|
class Dialog_logIn;
|
||||||
|
@ -24,7 +24,7 @@ public:
|
||||||
LogInType_PressureTest = 3
|
LogInType_PressureTest = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
HGPdtToolDbUserMgr GetUserMgr();
|
//HGPdtToolDbUserMgr GetUserMgr();
|
||||||
QString GetFtpHost();
|
QString GetFtpHost();
|
||||||
unsigned short GetFtpPort();
|
unsigned short GetFtpPort();
|
||||||
LogInType GetLogInType();
|
LogInType GetLogInType();
|
||||||
|
@ -48,7 +48,7 @@ private slots:
|
||||||
private:
|
private:
|
||||||
Ui::Dialog_logIn *ui;
|
Ui::Dialog_logIn *ui;
|
||||||
|
|
||||||
HGPdtToolDbUserMgr m_pdtToolDbuserMgr;
|
//HGPdtToolDbUserMgr m_pdtToolDbuserMgr;
|
||||||
QPoint m_startPos;
|
QPoint m_startPos;
|
||||||
QPoint m_endPos;
|
QPoint m_endPos;
|
||||||
bool m_leftMousePressed;
|
bool m_leftMousePressed;
|
||||||
|
|
|
@ -7,9 +7,8 @@
|
||||||
#include "HGUIGlobal.h"
|
#include "HGUIGlobal.h"
|
||||||
#include "base/HGBase.h"
|
#include "base/HGBase.h"
|
||||||
|
|
||||||
Dialog_uploadCfgFile::Dialog_uploadCfgFile(HGPdtToolDbUserMgr pdtToolDbuserMgr, QWidget *parent) :
|
Dialog_uploadCfgFile::Dialog_uploadCfgFile(QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
m_pdtToolDbuserMgr(pdtToolDbuserMgr),
|
|
||||||
ui(new Ui::Dialog_uploadCfgFile)
|
ui(new Ui::Dialog_uploadCfgFile)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
@ -58,16 +57,16 @@ void Dialog_uploadCfgFile::on_pbtn_upload_clicked()
|
||||||
file2.remove();
|
file2.remove();
|
||||||
file.copy(filename, cfgPath);
|
file.copy(filename, cfgPath);
|
||||||
|
|
||||||
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)
|
||||||
{
|
// {
|
||||||
QMessageBox::information(this, tr("tips"), tr("upload succeed"));
|
// QMessageBox::information(this, tr("tips"), tr("upload succeed"));
|
||||||
close();
|
// close();
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
QMessageBox::information(this, tr("tips"), tr("upload to service failed, already save to local host"));
|
// QMessageBox::information(this, tr("tips"), tr("upload to service failed, already save to local host"));
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define DIALOG_UPLOADCFGFILE_H
|
#define DIALOG_UPLOADCFGFILE_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include "HGPdtToolDb.h"
|
//#include "HGPdtToolDb.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class Dialog_uploadCfgFile;
|
class Dialog_uploadCfgFile;
|
||||||
|
@ -13,7 +13,7 @@ class Dialog_uploadCfgFile : public QDialog
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Dialog_uploadCfgFile(HGPdtToolDbUserMgr pdtToolDbuserMgr, QWidget *parent = nullptr);
|
explicit Dialog_uploadCfgFile(QWidget *parent = nullptr);
|
||||||
~Dialog_uploadCfgFile();
|
~Dialog_uploadCfgFile();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -24,7 +24,7 @@ private slots:
|
||||||
private:
|
private:
|
||||||
Ui::Dialog_uploadCfgFile *ui;
|
Ui::Dialog_uploadCfgFile *ui;
|
||||||
|
|
||||||
HGPdtToolDbUserMgr m_pdtToolDbuserMgr;
|
//HGPdtToolDbUserMgr m_pdtToolDbuserMgr;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIALOG_UPLOADCFGFILE_H
|
#endif // DIALOG_UPLOADCFGFILE_H
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include <QTableWidgetItem>
|
#include <QTableWidgetItem>
|
||||||
#include "sane/sane_ex.h"
|
#include "sane/sane_ex.h"
|
||||||
#include "hgscanner.h"
|
#include "hgscanner.h"
|
||||||
#include "HGPdtToolDb.h"
|
//#include "HGPdtToolDb.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class Form_BurnMode;
|
class Form_BurnMode;
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#include "dialog_excepdesc.h"
|
#include "dialog_excepdesc.h"
|
||||||
#include "huagao/hgscanner_error.h"
|
#include "huagao/hgscanner_error.h"
|
||||||
|
|
||||||
Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::LogInType logInType, const QString &accountName, SANE_Handle handle, HGPdtToolDbUserMgr pdtToolDbuserMgr, HGPdtToolDbDevice pdtToolDbDevice,
|
Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::LogInType logInType, const QString &accountName, SANE_Handle handle,
|
||||||
const QString &serialNum, const QString &devType, const QString &devName, const QString &devFwNum)
|
const QString &serialNum, const QString &devType, const QString &devName, const QString &devFwNum)
|
||||||
: QWidget(mainwnd)
|
: QWidget(mainwnd)
|
||||||
, ui(new Ui::Form_mainInterface)
|
, ui(new Ui::Form_mainInterface)
|
||||||
|
@ -25,8 +25,6 @@ Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::
|
||||||
, m_hg(nullptr)
|
, m_hg(nullptr)
|
||||||
, m_handle(handle)
|
, m_handle(handle)
|
||||||
, m_disconnect(false)
|
, m_disconnect(false)
|
||||||
, m_pdtToolDbuserMgr(pdtToolDbuserMgr)
|
|
||||||
, m_pdtToolDbDevice(pdtToolDbDevice)
|
|
||||||
, m_serialNum(serialNum)
|
, m_serialNum(serialNum)
|
||||||
, m_devType(devType)
|
, m_devType(devType)
|
||||||
, m_devName(devName)
|
, m_devName(devName)
|
||||||
|
@ -88,12 +86,12 @@ Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::
|
||||||
|
|
||||||
initTableWidgetUi();
|
initTableWidgetUi();
|
||||||
|
|
||||||
if(!m_devType.isEmpty())
|
// if(!m_devType.isEmpty())
|
||||||
HGPdtToolDb_SetDeviceType(m_pdtToolDbDevice, m_devType.toStdString().c_str());
|
// HGPdtToolDb_SetDeviceType(m_pdtToolDbDevice, m_devType.toStdString().c_str());
|
||||||
if(!m_devFwNum.isEmpty())
|
// if(!m_devFwNum.isEmpty())
|
||||||
HGPdtToolDb_SetDeviceVersion(m_pdtToolDbDevice, m_devFwNum.toStdString().c_str());
|
// HGPdtToolDb_SetDeviceVersion(m_pdtToolDbDevice, m_devFwNum.toStdString().c_str());
|
||||||
if(!m_devName.isEmpty())
|
// if(!m_devName.isEmpty())
|
||||||
HGPdtToolDb_SetDeviceName(m_pdtToolDbDevice, m_devName.toStdString().c_str());
|
// HGPdtToolDb_SetDeviceName(m_pdtToolDbDevice, m_devName.toStdString().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
Form_mainInterface::~Form_mainInterface()
|
Form_mainInterface::~Form_mainInterface()
|
||||||
|
@ -110,8 +108,8 @@ Form_mainInterface::~Form_mainInterface()
|
||||||
|
|
||||||
sane_close(m_handle);
|
sane_close(m_handle);
|
||||||
m_handle = nullptr;
|
m_handle = nullptr;
|
||||||
HGPdtToolDb_CloseDevice(m_pdtToolDbDevice);
|
//HGPdtToolDb_CloseDevice(m_pdtToolDbDevice);
|
||||||
m_pdtToolDbDevice = nullptr;
|
//m_pdtToolDbDevice = nullptr;
|
||||||
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
@ -333,14 +331,14 @@ void Form_mainInterface::on_pbtn_fail_clicked()
|
||||||
Dialog_ExcepDesc dlg(this);
|
Dialog_ExcepDesc dlg(this);
|
||||||
if (dlg.exec())
|
if (dlg.exec())
|
||||||
{
|
{
|
||||||
ui->tableWidget->setItem(row, 2, new QTableWidgetItem(getItemStatusStr(HGPDTTOOLDB_ENTRYSTATUS_NOTPASS)));
|
//ui->tableWidget->setItem(row, 2, new QTableWidgetItem(getItemStatusStr(HGPDTTOOLDB_ENTRYSTATUS_NOTPASS)));
|
||||||
ui->tableWidget->item(row, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
ui->tableWidget->item(row, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
ui->tableWidget->item(row, 2)->setBackgroundColor(QColor(255,0,0));
|
ui->tableWidget->item(row, 2)->setBackgroundColor(QColor(255,0,0));
|
||||||
|
|
||||||
QString str = dlg.getExcepDesc();
|
QString str = dlg.getExcepDesc();
|
||||||
std::string name = m_map_title_name.value(title).name.toStdString();
|
std::string name = m_map_title_name.value(title).name.toStdString();
|
||||||
HGPdtToolDb_SetDeviceEntryStatus(m_pdtToolDbDevice, name.c_str(), HGPDTTOOLDB_ENTRYSTATUS_NOTPASS);
|
//HGPdtToolDb_SetDeviceEntryStatus(m_pdtToolDbDevice, name.c_str(), HGPDTTOOLDB_ENTRYSTATUS_NOTPASS);
|
||||||
HGPdtToolDb_SetDeviceEntryExcepDesc(m_pdtToolDbDevice, name.c_str(), str.toStdString().c_str());
|
//HGPdtToolDb_SetDeviceEntryExcepDesc(m_pdtToolDbDevice, name.c_str(), str.toStdString().c_str());
|
||||||
|
|
||||||
QTableWidgetItem *item2 = ui->tableWidget->item(row, 2);
|
QTableWidgetItem *item2 = ui->tableWidget->item(row, 2);
|
||||||
item2->setToolTip(str);
|
item2->setToolTip(str);
|
||||||
|
@ -359,10 +357,10 @@ void Form_mainInterface::on_pbtn_pass_clicked()
|
||||||
{
|
{
|
||||||
QString title = item->text();
|
QString title = item->text();
|
||||||
std::string name = m_map_title_name.value(title).name.toStdString();
|
std::string name = m_map_title_name.value(title).name.toStdString();
|
||||||
HGPdtToolDb_SetDeviceEntryStatus(m_pdtToolDbDevice, name.c_str(), HGPDTTOOLDB_ENTRYSTATUS_PASS);
|
//HGPdtToolDb_SetDeviceEntryStatus(m_pdtToolDbDevice, name.c_str(), HGPDTTOOLDB_ENTRYSTATUS_PASS);
|
||||||
HGPdtToolDb_SetDeviceEntryExcepDesc(m_pdtToolDbDevice, name.c_str(), "");
|
//HGPdtToolDb_SetDeviceEntryExcepDesc(m_pdtToolDbDevice, name.c_str(), "");
|
||||||
|
|
||||||
ui->tableWidget->setItem(row, 2, new QTableWidgetItem(getItemStatusStr(HGPDTTOOLDB_ENTRYSTATUS_PASS)));
|
//ui->tableWidget->setItem(row, 2, new QTableWidgetItem(getItemStatusStr(HGPDTTOOLDB_ENTRYSTATUS_PASS)));
|
||||||
ui->tableWidget->item(row, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
ui->tableWidget->item(row, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
ui->tableWidget->item(row, 2)->setBackgroundColor(QColor(0,255,0));
|
ui->tableWidget->item(row, 2)->setBackgroundColor(QColor(0,255,0));
|
||||||
|
|
||||||
|
@ -438,7 +436,7 @@ void Form_mainInterface::initTableWidgetUi()
|
||||||
strcat(cfgPath, m_devType.toStdString().c_str());
|
strcat(cfgPath, m_devType.toStdString().c_str());
|
||||||
strcat(cfgPath, ".json");
|
strcat(cfgPath, ".json");
|
||||||
|
|
||||||
HGPdtToolDb_DownloadFile(m_pdtToolDbuserMgr, m_devType.toStdString().c_str(), cfgPath);
|
//HGPdtToolDb_DownloadFile(m_pdtToolDbuserMgr, m_devType.toStdString().c_str(), cfgPath);
|
||||||
|
|
||||||
AnalysisJson analysisJson(QString::fromStdString(cfgPath));
|
AnalysisJson analysisJson(QString::fromStdString(cfgPath));
|
||||||
|
|
||||||
|
@ -455,7 +453,7 @@ void Form_mainInterface::initTableWidgetUi()
|
||||||
|
|
||||||
if (stationStr[m_logInType] == node.station)
|
if (stationStr[m_logInType] == node.station)
|
||||||
{
|
{
|
||||||
HGPdtToolDb_SetEntryNameCnStr(m_pdtToolDbuserMgr, node.name.toStdString().c_str(), node.title.toStdString().c_str());
|
//HGPdtToolDb_SetEntryNameCnStr(m_pdtToolDbuserMgr, node.name.toStdString().c_str(), node.title.toStdString().c_str());
|
||||||
|
|
||||||
ui->tableWidget->setItem(index, 0, new QTableWidgetItem(QString::number(index+1)));
|
ui->tableWidget->setItem(index, 0, new QTableWidgetItem(QString::number(index+1)));
|
||||||
ui->tableWidget->item(index, 0)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
ui->tableWidget->item(index, 0)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
|
@ -464,25 +462,25 @@ void Form_mainInterface::initTableWidgetUi()
|
||||||
|
|
||||||
std::string name = node.name.toStdString();
|
std::string name = node.name.toStdString();
|
||||||
HGUInt status = 0;
|
HGUInt status = 0;
|
||||||
HGPdtToolDb_GetDeviceEntryStatus(m_pdtToolDbDevice, name.c_str(), &status);
|
//HGPdtToolDb_GetDeviceEntryStatus(m_pdtToolDbDevice, name.c_str(), &status);
|
||||||
QString statusStr = getItemStatusStr(status);
|
QString statusStr = getItemStatusStr(status);
|
||||||
ui->tableWidget->setItem(index, 2, new QTableWidgetItem(statusStr));
|
ui->tableWidget->setItem(index, 2, new QTableWidgetItem(statusStr));
|
||||||
ui->tableWidget->item(index, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
ui->tableWidget->item(index, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
if (HGPDTTOOLDB_ENTRYSTATUS_NOTPASS == status)
|
// if (HGPDTTOOLDB_ENTRYSTATUS_NOTPASS == status)
|
||||||
{
|
// {
|
||||||
ui->tableWidget->item(index, 2)->setBackgroundColor(QColor(255,0,0));
|
// ui->tableWidget->item(index, 2)->setBackgroundColor(QColor(255,0,0));
|
||||||
}
|
// }
|
||||||
else if (HGPDTTOOLDB_ENTRYSTATUS_NOTSUPP == status)
|
// else if (HGPDTTOOLDB_ENTRYSTATUS_NOTSUPP == status)
|
||||||
{
|
// {
|
||||||
ui->tableWidget->item(index, 2)->setBackgroundColor(QColor(255,255,0));
|
// ui->tableWidget->item(index, 2)->setBackgroundColor(QColor(255,255,0));
|
||||||
}
|
// }
|
||||||
else if (HGPDTTOOLDB_ENTRYSTATUS_PASS == status)
|
// else if (HGPDTTOOLDB_ENTRYSTATUS_PASS == status)
|
||||||
{
|
// {
|
||||||
ui->tableWidget->item(index, 2)->setBackgroundColor(QColor(0,255,0));
|
// ui->tableWidget->item(index, 2)->setBackgroundColor(QColor(0,255,0));
|
||||||
}
|
// }
|
||||||
|
|
||||||
HGChar desc[512] = {0};
|
HGChar desc[512] = {0};
|
||||||
HGPdtToolDb_GetDeviceEntryExcepDesc(m_pdtToolDbDevice, name.c_str(), desc, 512);
|
//HGPdtToolDb_GetDeviceEntryExcepDesc(m_pdtToolDbDevice, name.c_str(), desc, 512);
|
||||||
QTableWidgetItem *item = ui->tableWidget->item(index, 2);
|
QTableWidgetItem *item = ui->tableWidget->item(index, 2);
|
||||||
item->setToolTip(desc);
|
item->setToolTip(desc);
|
||||||
|
|
||||||
|
@ -744,7 +742,7 @@ void Form_mainInterface::on_tableWidget_currentItemChanged(QTableWidgetItem *cur
|
||||||
|
|
||||||
QString name = m_map_title_name.value(title).name;
|
QString name = m_map_title_name.value(title).name;
|
||||||
HGUInt imageCount = 0;
|
HGUInt imageCount = 0;
|
||||||
HGPdtToolDb_GetDeviceEntryImageCount(m_pdtToolDbDevice, name.toStdString().c_str(), &imageCount);
|
//HGPdtToolDb_GetDeviceEntryImageCount(m_pdtToolDbDevice, name.toStdString().c_str(), &imageCount);
|
||||||
if (imageCount > 0)
|
if (imageCount > 0)
|
||||||
{
|
{
|
||||||
// ui->pbtn_showImg->setVisible(true);
|
// ui->pbtn_showImg->setVisible(true);
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#include "form_texttips.h"
|
#include "form_texttips.h"
|
||||||
#include "analysisjson.h"
|
#include "analysisjson.h"
|
||||||
#include "sane/sane_ex.h"
|
#include "sane/sane_ex.h"
|
||||||
#include "HGPdtToolDb.h"
|
//#include "HGPdtToolDb.h"
|
||||||
#include "hgscanner.h"
|
#include "hgscanner.h"
|
||||||
#include "dialog_login.h"
|
#include "dialog_login.h"
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ class Form_mainInterface : public QWidget
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::LogInType logInType, const QString &accountName, SANE_Handle handle, HGPdtToolDbUserMgr pdtToolDbuserMgr, HGPdtToolDbDevice pdtToolDbDevice,
|
explicit Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::LogInType logInType, const QString &accountName, SANE_Handle handle,
|
||||||
const QString &serialNum, const QString &devType, const QString &devName, const QString &devFwNum);
|
const QString &serialNum, const QString &devType, const QString &devName, const QString &devFwNum);
|
||||||
~Form_mainInterface();
|
~Form_mainInterface();
|
||||||
|
|
||||||
|
@ -120,8 +120,8 @@ private:
|
||||||
hgscanner *m_hg;
|
hgscanner *m_hg;
|
||||||
SANE_Handle m_handle;
|
SANE_Handle m_handle;
|
||||||
bool m_disconnect;
|
bool m_disconnect;
|
||||||
HGPdtToolDbUserMgr m_pdtToolDbuserMgr;
|
//HGPdtToolDbUserMgr m_pdtToolDbuserMgr;
|
||||||
HGPdtToolDbDevice m_pdtToolDbDevice;
|
//HGPdtToolDbDevice m_pdtToolDbDevice;
|
||||||
QString m_serialNum;
|
QString m_serialNum;
|
||||||
QString m_devType;
|
QString m_devType;
|
||||||
QString m_devName;
|
QString m_devName;
|
||||||
|
|
|
@ -18,7 +18,7 @@ int main(int argc, char *argv[])
|
||||||
Dialog_logIn login;
|
Dialog_logIn login;
|
||||||
if (login.exec())
|
if (login.exec())
|
||||||
{
|
{
|
||||||
MainWindow w(login.GetUserMgr(), login.GetLogInType(), login.GetAccountName(), login.GetFtpHost(), login.GetFtpPort());
|
MainWindow w(login.GetLogInType(), login.GetAccountName(), login.GetFtpHost(), login.GetFtpPort());
|
||||||
a.exec();
|
a.exec();
|
||||||
if (w.isExitApp())
|
if (w.isExitApp())
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,10 +11,9 @@
|
||||||
#include "dialog_inputserialnum.h"
|
#include "dialog_inputserialnum.h"
|
||||||
#include "dialog_hgmessagebox.h"
|
#include "dialog_hgmessagebox.h"
|
||||||
|
|
||||||
MainWindow::MainWindow(HGPdtToolDbUserMgr pdtToolDbuserMgr, Dialog_logIn::LogInType loginType, const QString &accountName, const QString &ftpHost, unsigned short ftpPort, QWidget *parent)
|
MainWindow::MainWindow(Dialog_logIn::LogInType loginType, const QString &accountName, const QString &ftpHost, unsigned short ftpPort, QWidget *parent)
|
||||||
: QMainWindow(parent)
|
: QMainWindow(parent)
|
||||||
, ui(new Ui::MainWindow)
|
, ui(new Ui::MainWindow)
|
||||||
, m_pdtToolDbuserMgr(pdtToolDbuserMgr)
|
|
||||||
, m_ftpHost(ftpHost)
|
, m_ftpHost(ftpHost)
|
||||||
, m_ftpPort(ftpPort)
|
, m_ftpPort(ftpPort)
|
||||||
, m_lock(nullptr)
|
, m_lock(nullptr)
|
||||||
|
@ -33,6 +32,7 @@ MainWindow::MainWindow(HGPdtToolDbUserMgr pdtToolDbuserMgr, Dialog_logIn::LogInT
|
||||||
ui->act_close->setVisible(false);
|
ui->act_close->setVisible(false);
|
||||||
ui->act_manage->setVisible(false);
|
ui->act_manage->setVisible(false);
|
||||||
ui->act_export->setVisible(false);
|
ui->act_export->setVisible(false);
|
||||||
|
ui->act_upload->setVisible(false);
|
||||||
|
|
||||||
ui->act_refreshDevice->setShortcut(QKeySequence("F5"));
|
ui->act_refreshDevice->setShortcut(QKeySequence("F5"));
|
||||||
|
|
||||||
|
@ -86,12 +86,12 @@ MainWindow::MainWindow(HGPdtToolDbUserMgr pdtToolDbuserMgr, Dialog_logIn::LogInT
|
||||||
connect(timer, SIGNAL(timeout()), this, SLOT(on_update_userStatus()));
|
connect(timer, SIGNAL(timeout()), this, SLOT(on_update_userStatus()));
|
||||||
|
|
||||||
HGUInt userType = 0;
|
HGUInt userType = 0;
|
||||||
HGPdtToolDb_GetUserType(m_pdtToolDbuserMgr, &userType);
|
//HGPdtToolDb_GetUserType(m_pdtToolDbuserMgr, &userType);
|
||||||
if (userType == HGPDTTOOLDB_USERTYPE_NORMAL)
|
// if (userType == HGPDTTOOLDB_USERTYPE_NORMAL)
|
||||||
{
|
// {
|
||||||
ui->act_manage->setVisible(false);
|
// ui->act_manage->setVisible(false);
|
||||||
ui->act_upload->setVisible(false);
|
// ui->act_upload->setVisible(false);
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (m_loginType == Dialog_logIn::LogInType_InitTest)
|
if (m_loginType == Dialog_logIn::LogInType_InitTest)
|
||||||
setWindowTitle(tr("production tool-init test station"));
|
setWindowTitle(tr("production tool-init test station"));
|
||||||
|
@ -129,8 +129,8 @@ MainWindow::~MainWindow()
|
||||||
|
|
||||||
sane_exit();
|
sane_exit();
|
||||||
|
|
||||||
HGPdtToolDb_DestroyUserMgr(m_pdtToolDbuserMgr);
|
//HGPdtToolDb_DestroyUserMgr(m_pdtToolDbuserMgr);
|
||||||
m_pdtToolDbuserMgr = nullptr;
|
//m_pdtToolDbuserMgr = nullptr;
|
||||||
|
|
||||||
delete m_formBurnMode;
|
delete m_formBurnMode;
|
||||||
m_formBurnMode = nullptr;
|
m_formBurnMode = nullptr;
|
||||||
|
@ -502,43 +502,43 @@ void MainWindow::on_update_userStatus()
|
||||||
{
|
{
|
||||||
QString tips;
|
QString tips;
|
||||||
HGUInt userStatus = 0;
|
HGUInt userStatus = 0;
|
||||||
HGPdtToolDb_GetUserStatus(m_pdtToolDbuserMgr, &userStatus);
|
//HGPdtToolDb_GetUserStatus(m_pdtToolDbuserMgr, &userStatus);
|
||||||
|
|
||||||
switch (userStatus)
|
// switch (userStatus)
|
||||||
{
|
// {
|
||||||
case HGPDTTOOLDB_USERSTATUS_CONFLICT:
|
// case HGPDTTOOLDB_USERSTATUS_CONFLICT:
|
||||||
tips = tr("Account login elsewhere");
|
// tips = tr("Account login elsewhere");
|
||||||
break;
|
// break;
|
||||||
case HGPDTTOOLDB_USERSTATUS_REFUSE:
|
// case HGPDTTOOLDB_USERSTATUS_REFUSE:
|
||||||
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_USERSTATUS_DBERROR:
|
// case HGPDTTOOLDB_USERSTATUS_DBERROR:
|
||||||
tips = tr("Data base error");
|
// tips = tr("Data base error");
|
||||||
break;
|
// break;
|
||||||
default:
|
// default:
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (!tips.isEmpty())
|
// if (!tips.isEmpty())
|
||||||
{
|
// {
|
||||||
if (!isTesting())
|
// if (!isTesting())
|
||||||
{
|
// {
|
||||||
QMessageBox::information(this, (tr("tips")), tips);
|
// QMessageBox::information(this, (tr("tips")), tips);
|
||||||
m_isLogOut = true;
|
// m_isLogOut = true;
|
||||||
close();
|
// close();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_act_newDevice_triggered()
|
void MainWindow::on_act_newDevice_triggered()
|
||||||
{
|
{
|
||||||
m_inputSnDlg = new Dialog_InputSerialNum(this, "", nullptr, nullptr, "", "");
|
m_inputSnDlg = new Dialog_InputSerialNum(this, "", nullptr, "", "");
|
||||||
if (m_inputSnDlg->exec())
|
if (m_inputSnDlg->exec())
|
||||||
{
|
{
|
||||||
HGPdtToolDbDevice pdtToolDbDevice = nullptr;
|
//HGPdtToolDbDevice pdtToolDbDevice = nullptr;
|
||||||
HGPdtToolDb_OpenDevice(m_pdtToolDbuserMgr, m_inputSnDlg->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, m_accountName, nullptr, m_pdtToolDbuserMgr, pdtToolDbDevice,
|
Form_mainInterface *mainInterface = new Form_mainInterface(this, m_loginType, m_accountName, nullptr,
|
||||||
m_inputSnDlg->GetSn(), m_inputSnDlg->GetDevType(), nullptr, nullptr);
|
m_inputSnDlg->GetSn(), m_inputSnDlg->GetDevType(), nullptr, nullptr);
|
||||||
if (!AddInterface(mainInterface))
|
if (!AddInterface(mainInterface))
|
||||||
{
|
{
|
||||||
|
@ -552,30 +552,30 @@ void MainWindow::on_act_newDevice_triggered()
|
||||||
}
|
}
|
||||||
void MainWindow::on_act_manage_triggered()
|
void MainWindow::on_act_manage_triggered()
|
||||||
{
|
{
|
||||||
Dialog_accountManage dlg(m_pdtToolDbuserMgr, this);
|
Dialog_accountManage dlg(this);
|
||||||
dlg.exec();
|
dlg.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_act_changePwd_triggered()
|
void MainWindow::on_act_changePwd_triggered()
|
||||||
{
|
{
|
||||||
Dialog_changePwd dlg(m_pdtToolDbuserMgr, m_accountName, this);
|
Dialog_changePwd dlg(m_accountName, this);
|
||||||
dlg.exec();
|
dlg.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_act_export_triggered()
|
void MainWindow::on_act_export_triggered()
|
||||||
{
|
{
|
||||||
QString filename = QFileDialog::getSaveFileName(this, tr("save"), "test.xls", tr("xls(*.xls)"));
|
// QString filename = QFileDialog::getSaveFileName(this, tr("save"), "test.xls", tr("xls(*.xls)"));
|
||||||
if (!filename.isEmpty())
|
// if (!filename.isEmpty())
|
||||||
{
|
// {
|
||||||
if (HGBASE_ERR_OK == HGPdtToolDb_Export(m_pdtToolDbuserMgr, getStdString(filename).c_str()))
|
// if (HGBASE_ERR_OK == HGPdtToolDb_Export(m_pdtToolDbuserMgr, getStdString(filename).c_str()))
|
||||||
{
|
// {
|
||||||
QMessageBox::information(this, tr("tips"), tr("export succeed"));
|
// QMessageBox::information(this, tr("tips"), tr("export succeed"));
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
QMessageBox::information(this, tr("tips"), tr("export failed"));
|
// QMessageBox::information(this, tr("tips"), tr("export failed"));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_act_logOut_triggered()
|
void MainWindow::on_act_logOut_triggered()
|
||||||
|
@ -604,33 +604,33 @@ void MainWindow::on_act_close_triggered()
|
||||||
QString MainWindow::getLogInfo(HGResult ret)
|
QString MainWindow::getLogInfo(HGResult ret)
|
||||||
{
|
{
|
||||||
QString str;
|
QString str;
|
||||||
if (HGPDTTOOLDB_ERR_INVALID_USER == ret)
|
// if (HGPDTTOOLDB_ERR_INVALID_USER == ret)
|
||||||
{
|
// {
|
||||||
str = tr("Illegal user");
|
// str = tr("Illegal user");
|
||||||
}
|
// }
|
||||||
else if (HGPDTTOOLDB_ERR_WRONG_PASSWORD == ret)
|
// else if (HGPDTTOOLDB_ERR_WRONG_PASSWORD == ret)
|
||||||
{
|
// {
|
||||||
str = tr("Wrong password");
|
// str = tr("Wrong password");
|
||||||
}
|
// }
|
||||||
else if (HGPDTTOOLDB_ERR_DATABASE == ret)
|
// else if (HGPDTTOOLDB_ERR_DATABASE == ret)
|
||||||
{
|
// {
|
||||||
str = tr("Database error");
|
// str = tr("Database error");
|
||||||
}
|
// }
|
||||||
else if (HGPDTTOOLDB_ERR_CONNECT == ret)
|
// else if (HGPDTTOOLDB_ERR_CONNECT == ret)
|
||||||
{
|
// {
|
||||||
str = tr("connect error");
|
// str = tr("connect error");
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
str = tr("Failed");
|
// str = tr("Failed");
|
||||||
}
|
// }
|
||||||
|
|
||||||
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(this);
|
||||||
dlg.exec();
|
dlg.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -660,13 +660,13 @@ void MainWindow::on_act_refreshDevice_triggered()
|
||||||
sane_open(name[i].c_str(), &devHandle);
|
sane_open(name[i].c_str(), &devHandle);
|
||||||
if (nullptr != devHandle)
|
if (nullptr != devHandle)
|
||||||
{
|
{
|
||||||
m_inputSnDlg = new Dialog_InputSerialNum(this, name[i].c_str(), m_pdtToolDbuserMgr, devHandle, getDevSn(devHandle), getDevType(devHandle));
|
m_inputSnDlg = new Dialog_InputSerialNum(this, name[i].c_str(), devHandle, getDevSn(devHandle), getDevType(devHandle));
|
||||||
if (m_inputSnDlg->exec())
|
if (m_inputSnDlg->exec())
|
||||||
{
|
{
|
||||||
HGPdtToolDbDevice pdtToolDbDevice = nullptr;
|
//HGPdtToolDbDevice pdtToolDbDevice = nullptr;
|
||||||
HGPdtToolDb_OpenDevice(m_pdtToolDbuserMgr, m_inputSnDlg->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, m_accountName, devHandle, m_pdtToolDbuserMgr, pdtToolDbDevice,
|
Form_mainInterface *mainInterface = new Form_mainInterface(this, m_loginType, m_accountName, devHandle,
|
||||||
m_inputSnDlg->GetSn(), m_inputSnDlg->GetDevType(), name[i].c_str(), getDevFwNum(devHandle));
|
m_inputSnDlg->GetSn(), m_inputSnDlg->GetDevType(), name[i].c_str(), getDevFwNum(devHandle));
|
||||||
if (!AddInterface(mainInterface))
|
if (!AddInterface(mainInterface))
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include "form_maininterface.h"
|
#include "form_maininterface.h"
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#include <QSplitter>
|
#include <QSplitter>
|
||||||
#include "HGPdtToolDb.h"
|
//#include "HGPdtToolDb.h"
|
||||||
#include "sane/sane_ex.h"
|
#include "sane/sane_ex.h"
|
||||||
#include "base/HGLock.h"
|
#include "base/HGLock.h"
|
||||||
#include "hgscanner.h"
|
#include "hgscanner.h"
|
||||||
|
@ -21,7 +21,7 @@ class MainWindow : public QMainWindow
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MainWindow(HGPdtToolDbUserMgr pdtToolDbuserMgr, Dialog_logIn::LogInType loginType, const QString &accountName, const QString &ftpHost, unsigned short ftpPort, QWidget *parent = nullptr);
|
MainWindow(Dialog_logIn::LogInType loginType, const QString &accountName, const QString &ftpHost, unsigned short ftpPort, QWidget *parent = nullptr);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
static QString getLogInfo(HGResult ret);
|
static QString getLogInfo(HGResult ret);
|
||||||
bool isExitApp();
|
bool isExitApp();
|
||||||
|
@ -80,7 +80,7 @@ private:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
HGPdtToolDbUserMgr m_pdtToolDbuserMgr;
|
//HGPdtToolDbUserMgr m_pdtToolDbuserMgr;
|
||||||
HGLock m_lock;
|
HGLock m_lock;
|
||||||
int m_testingRef;
|
int m_testingRef;
|
||||||
Dialog_logIn::LogInType m_loginType;
|
Dialog_logIn::LogInType m_loginType;
|
||||||
|
|
Loading…
Reference in New Issue