diff --git a/app/HGProductionTool/HGProductionTool.pro b/app/HGProductionTool/HGProductionTool.pro
index 74c683e..5a91e98 100644
--- a/app/HGProductionTool/HGProductionTool.pro
+++ b/app/HGProductionTool/HGProductionTool.pro
@@ -75,6 +75,7 @@ win32 {
SOURCES += \
../../../code_app/utility/HGString.cpp \
+ app_cfg.cpp \
HGImgView.cpp \
HGUIGlobal.cpp \
analysisjson.cpp \
@@ -88,6 +89,7 @@ SOURCES += \
dialog_setburnsn.cpp \
dialog_uploadcfgfile.cpp \
dialog_userinput.cpp \
+ dialog_registeraccount.cpp \
form_burnmode.cpp \
form_maininterface.cpp \
form_texttips.cpp \
@@ -98,6 +100,7 @@ SOURCES += \
HEADERS += \
../../../code_app/utility/HGString.h \
+ app_cfg.h \
HGImgView.h \
HGUIGlobal.h \
analysisjson.h \
@@ -111,6 +114,7 @@ HEADERS += \
dialog_setburnsn.h \
dialog_uploadcfgfile.h \
dialog_userinput.h \
+ dialog_registeraccount.h \
form_burnmode.h \
form_maininterface.h \
form_texttips.h \
@@ -129,6 +133,7 @@ FORMS += \
dialog_setburnsn.ui \
dialog_uploadcfgfile.ui \
dialog_userinput.ui \
+ dialog_registeraccount.ui \
form_burnmode.ui \
form_maininterface.ui \
form_texttips.ui \
diff --git a/app/HGProductionTool/ProductionTool_zh_CN.qm b/app/HGProductionTool/ProductionTool_zh_CN.qm
index d806910..403bc2b 100644
Binary files a/app/HGProductionTool/ProductionTool_zh_CN.qm and b/app/HGProductionTool/ProductionTool_zh_CN.qm differ
diff --git a/app/HGProductionTool/ProductionTool_zh_CN.ts b/app/HGProductionTool/ProductionTool_zh_CN.ts
index c471429..365984c 100644
--- a/app/HGProductionTool/ProductionTool_zh_CN.ts
+++ b/app/HGProductionTool/ProductionTool_zh_CN.ts
@@ -118,46 +118,98 @@
取消
-
-
+
-
-
+
+
+
提示
-
+
设备已丢失
-
+
序列号为空
-
+
序列号不合法
-
+
该设备正在进行测试
-
+
设置序列号失败
-
+
设置序列号成功
+
+ Dialog_RegisterAccount
+
+
+
+
+
+
+
+
+
+ 注册
+
+
+
+
+ 用户名:
+
+
+
+
+ Password
+ 密码:
+
+
+
+
+ 确认密码:
+
+
+
+
+
+
+ 提示
+
+
+
+
+ 输入不能为空!
+
+
+
+
+ 密码不一致!
+
+
+
+
+ 用户已存在!
+
+
Dialog_SetBurnSn
@@ -406,25 +458,30 @@
FTP端口:
-
+
烧录工位
-
+
初检工位
-
+
图像测试工位
-
+
压力测试工位
+
+
+
+ 注册
+
IP地址:
@@ -434,52 +491,51 @@
端口号:
-
+
登录
-
- 退出
+ 退出
-
+
设置IP与端口
-
+
最小化
-
+
关闭
-
+
登录
-
+
提示
-
+
登录失败,是否进入单机测试模式?
-
+
确定
-
+
取消
@@ -822,12 +878,12 @@
设备未连接
-
+
设备类型:
-
+
序列号:
@@ -844,7 +900,7 @@
休眠时间:
-
+
加载上一次上传的图片
@@ -853,14 +909,14 @@
设备已断开
-
+
提示
-
-
-
+
+
+
畸变修正值:
@@ -873,102 +929,114 @@
取消
-
+
目标配置: 速度模式:
-
+
休眠时间:
-
+
,但是校正有异常
-
+
请验证设备配置:
-
+
vid:%1
-
+
pid:%1
-
+
休眠时间:%1分钟
-
+
休眠时间:%1
-
-
+
+
不休眠
-
+
速度模式:%1PPM
-
+
设备型号:%1
-
-
+
+
+ Serial number: %1, Test item: %2, Test result: Failed! Reason: %3
+ 设备序列号: %1, 测试项: %2, 测试结果: 不通过! 原因: %3
+
+
+
+
+ Serial number: %1, Test item: %2, Test result: Pass!
+ 设备序列号: %1, 测试项: %2, 测试结果: 通过!
+
+
+
+
设备历史扫描张数:
-
-
+
+
提示
-
+
无纸
-
+
设备处于休眠模式
-
+
设备处于计数模式
-
+
其他错误
@@ -977,37 +1045,37 @@
设备序列号:%1
-
+
序号
-
+
测试项
-
+
测试状态
-
+
未测试
-
+
不通过
-
+
不支持
-
+
通过
@@ -1033,31 +1101,31 @@
Pid:
-
-
+
+
设备滚轴张数:
-
-
+
+
标准圆:宽 * 高:
-
+
固件号:
-
+
设备序列号:%1
-
+
device firmware number:%1
@@ -1065,17 +1133,17 @@
-
+
分钟
-
+
VID:
-
+
PID:
@@ -1150,7 +1218,7 @@
刷新设备列表
-
+
账户在其他地方登录
@@ -1159,51 +1227,51 @@
网络连接断开
-
+
你已被管理员账户强制下线
-
+
数据库错误
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
提示
-
+
华高生产工具-烧录工位
-
+
华高生产工具-初检工位
-
+
华高生产工具-图像测试工位
-
+
华高生产工具-压力测试工位
-
-
-
+
+
+
测试中,请勿关闭!
@@ -1225,8 +1293,8 @@
取消
-
-
+
+
不能创建更多项目
@@ -1243,47 +1311,47 @@
打开设备失败
-
+
保存
-
+
xls表格(*.xls)
-
+
导出成功
-
+
导出失败
-
+
非法的用户
-
+
密码错误
-
+
数据库错误
-
+
连接错误
-
+
错误
diff --git a/app/HGProductionTool/app_cfg.cpp b/app/HGProductionTool/app_cfg.cpp
new file mode 100644
index 0000000..10b4d3c
--- /dev/null
+++ b/app/HGProductionTool/app_cfg.cpp
@@ -0,0 +1,70 @@
+#include "app_cfg.h"
+#include "base/HGDef.h"
+#include "base/HGInc.h"
+#include "base/HGUtility.h"
+#include "base/HGIni.h"
+#include "HGUIGlobal.h"
+#include "HGString.h"
+
+QString 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();
+}
+
+int getCfgValue(const char *appName, const char *key, int def)
+{
+ HGChar cfgPath[512];
+ HGBase_GetConfigPath(cfgPath, 512);
+ strcat(cfgPath, "config.ini");
+
+ HGInt value = 0;
+ HGBase_GetProfileInt(cfgPath, appName, key, def, &value);
+ return value;
+}
+
+bool getCfgValue(const char *appName, const char *key, bool def)
+{
+ HGChar cfgPath[512];
+ HGBase_GetConfigPath(cfgPath, 512);
+ strcat(cfgPath, "config.ini");
+
+ HGInt value = 0;
+ HGBase_GetProfileInt(cfgPath, appName, key, (HGInt)def, &value);
+ return (bool)value;
+}
+
+void 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());
+}
+
+void saveCfgValue(const char *appName, const char *key, int value)
+{
+ HGChar cfgPath[512];
+ HGBase_GetConfigPath(cfgPath, 512);
+ HGBase_CreateDir(cfgPath);
+ strcat(cfgPath, "config.ini");
+
+ HGBase_SetProfileInt(cfgPath, appName, key, value);
+}
+
+void saveCfgValue(const char *appName, const char *key, bool value)
+{
+ HGChar cfgPath[512];
+ HGBase_GetConfigPath(cfgPath, 512);
+ HGBase_CreateDir(cfgPath);
+ strcat(cfgPath, "config.ini");
+
+ HGBase_SetProfileInt(cfgPath, appName, key, (HGInt)value);
+}
diff --git a/app/HGProductionTool/app_cfg.h b/app/HGProductionTool/app_cfg.h
new file mode 100644
index 0000000..0b5d122
--- /dev/null
+++ b/app/HGProductionTool/app_cfg.h
@@ -0,0 +1,14 @@
+#ifndef __APP_CFG_H__
+#define __APP_CFG_H__
+
+#include
+
+QString getCfgValue(const char *appName, const char *key, const QString &def);
+int getCfgValue(const char *appName, const char *key, int def);
+bool getCfgValue(const char *appName, const char *key, bool def);
+
+void saveCfgValue(const char *appName, const char *key, const QString &value);
+void saveCfgValue(const char *appName, const char *key, int value);
+void saveCfgValue(const char *appName, const char *key, bool value);
+
+#endif /* __APP_CFG_H__ */
diff --git a/app/HGProductionTool/dialog_changepwd.cpp b/app/HGProductionTool/dialog_changepwd.cpp
index b96bd14..adf44bc 100644
--- a/app/HGProductionTool/dialog_changepwd.cpp
+++ b/app/HGProductionTool/dialog_changepwd.cpp
@@ -2,11 +2,15 @@
#include "ui_dialog_changepwd.h"
#include
#include "mainwindow.h"
+#include "dialog_login.h"
+#include "base/HGUtility.h"
+#include "app_cfg.h"
-Dialog_changePwd::Dialog_changePwd(HGPdtToolDbUserMgr pdtToolDbuserMgr, QWidget *parent) :
- QDialog(parent),
- m_pdtToolDbuserMgr(pdtToolDbuserMgr),
- ui(new Ui::Dialog_changePwd)
+Dialog_changePwd::Dialog_changePwd(HGPdtToolDbUserMgr pdtToolDbuserMgr, const QString& accountName, QWidget *parent) :
+ QDialog(parent)
+ , m_pdtToolDbuserMgr(pdtToolDbuserMgr)
+ , m_accountName(accountName)
+ , ui(new Ui::Dialog_changePwd)
{
ui->setupUi(this);
@@ -44,6 +48,9 @@ void Dialog_changePwd::on_pbtn_ok_clicked()
QMessageBox::information(this, tr("tips"), tr("Change passwords failed: ") + MainWindow::getLogInfo(ret));
return;
}
+
+ saveCfgValue(m_accountName.toStdString().c_str(), "password", newPwd);
+
accept();
}
diff --git a/app/HGProductionTool/dialog_changepwd.h b/app/HGProductionTool/dialog_changepwd.h
index 4a12330..1c45540 100644
--- a/app/HGProductionTool/dialog_changepwd.h
+++ b/app/HGProductionTool/dialog_changepwd.h
@@ -13,7 +13,7 @@ class Dialog_changePwd : public QDialog
Q_OBJECT
public:
- explicit Dialog_changePwd(HGPdtToolDbUserMgr pdtToolDbuserMgr, QWidget *parent = nullptr);
+ explicit Dialog_changePwd(HGPdtToolDbUserMgr pdtToolDbuserMgr, const QString& accountName, QWidget *parent = nullptr);
~Dialog_changePwd();
private slots:
@@ -25,6 +25,7 @@ private:
Ui::Dialog_changePwd *ui;
HGPdtToolDbUserMgr m_pdtToolDbuserMgr;
+ QString m_accountName;
};
diff --git a/app/HGProductionTool/dialog_login.cpp b/app/HGProductionTool/dialog_login.cpp
index 19f20f2..5882eeb 100644
--- a/app/HGProductionTool/dialog_login.cpp
+++ b/app/HGProductionTool/dialog_login.cpp
@@ -4,14 +4,14 @@
#include
#include
#include "base/HGUtility.h"
-#include "base/HGIni.h"
-#include "HGUIGlobal.h"
-#include "HGString.h"
+#include "dialog_registeraccount.h"
+#include "app_cfg.h"
Dialog_logIn::Dialog_logIn(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog_logIn)
, m_pdtToolDbuserMgr(nullptr)
+ , m_accountName("")
{
ui->setupUi(this);
@@ -21,6 +21,9 @@ Dialog_logIn::Dialog_logIn(QWidget *parent) :
ft.setPointSize(15);
this->setFont(ft);
+ ui->pbtn_setting->setVisible(false);
+ ui->radioButton_pressureTest->setVisible(false);
+
ui->pbtn_setting->setToolTip(tr("Set host and port"));
ui->pbtn_minum->setToolTip(tr("Minimize"));
ui->pbtn_close->setToolTip(tr("Close"));
@@ -74,6 +77,11 @@ Dialog_logIn::LogInType Dialog_logIn::GetLogInType()
return m_loginType;
}
+QString Dialog_logIn::GetAccountName()
+{
+ return m_accountName;
+}
+
void Dialog_logIn::mousePressEvent(QMouseEvent *event)
{
if(event->button()==Qt::LeftButton)
@@ -124,6 +132,8 @@ void Dialog_logIn::on_pbtn_login_clicked()
else if (ui->radioButton_pressureTest->isChecked())
m_loginType = LogInType_PressureTest;
+ m_accountName = account;
+
HGPdtToolDbUserMgr pdtToolDbuserMgr = nullptr;
HGPdtToolDb_CreateUserMgr(dbHost.toStdString().c_str(), dbPort.toInt(), account.toStdString().c_str(), password.toStdString().c_str(),
&pdtToolDbuserMgr);
@@ -141,7 +151,7 @@ void Dialog_logIn::on_pbtn_login_clicked()
if (msg.clickedButton() == msg.button(QMessageBox::Yes))
{
m_pdtToolDbuserMgr = nullptr;
- accept();;
+ accept();
}
else
{
@@ -150,11 +160,6 @@ void Dialog_logIn::on_pbtn_login_clicked()
}
}
-void Dialog_logIn::on_pushButton_exit_clicked()
-{
- reject();
-}
-
void Dialog_logIn::on_pbtn_setting_clicked(bool checked)
{
if (checked)
@@ -177,24 +182,9 @@ void Dialog_logIn::on_pbtn_close_clicked()
close();
}
-void Dialog_logIn::saveCfgValue(const char *appName, const char *key, const QString &value)
+void Dialog_logIn::on_pbtn_register_clicked()
{
- HGChar cfgPath[512];
- HGBase_GetConfigPath(cfgPath, 512);
- HGBase_CreateDir(cfgPath);
- strcat(cfgPath, "config.ini");
-
- HGBase_SetProfileString(cfgPath, appName, key, getStdString(value).c_str());
+ Dialog_RegisterAccount dlg;
+ dlg.exec();
}
-QString Dialog_logIn::getCfgValue(const char *appName, const char *key, const QString &def)
-{
- HGChar cfgPath[512];
- HGBase_GetConfigPath(cfgPath, 512);
- strcat(cfgPath, "config.ini");
-
- std::string def2 = getStdString(def);
- HGChar value[512] = {0};
- HGBase_GetProfileString(cfgPath, appName, key, def2.c_str(), value, 512);
- return StdStringToUtf8(value).c_str();
-}
diff --git a/app/HGProductionTool/dialog_login.h b/app/HGProductionTool/dialog_login.h
index 3863a38..d7cb832 100644
--- a/app/HGProductionTool/dialog_login.h
+++ b/app/HGProductionTool/dialog_login.h
@@ -28,6 +28,7 @@ public:
QString GetFtpHost();
unsigned short GetFtpPort();
LogInType GetLogInType();
+ QString GetAccountName();
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
@@ -36,17 +37,14 @@ public:
private slots:
void on_pbtn_login_clicked();
- void on_pushButton_exit_clicked();
-
void on_pbtn_setting_clicked(bool checked);
void on_pbtn_minum_clicked();
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);
+ void on_pbtn_register_clicked();
+
private:
Ui::Dialog_logIn *ui;
@@ -55,6 +53,7 @@ private:
QPoint m_endPos;
bool m_leftMousePressed;
LogInType m_loginType;
+ QString m_accountName;
};
#endif // DIALOG_LOGIN_H
diff --git a/app/HGProductionTool/dialog_login.ui b/app/HGProductionTool/dialog_login.ui
index e7d82df..daf6a91 100644
--- a/app/HGProductionTool/dialog_login.ui
+++ b/app/HGProductionTool/dialog_login.ui
@@ -296,19 +296,6 @@ QPushButton#pbtn_close::hover
-
-
-
- 270
- 280
- 75
- 31
-
-
-
- EXIT
-
-
@@ -383,6 +370,19 @@ QPushButton#pbtn_close::hover
PressureTest
+
+
+
+ 260
+ 280
+ 75
+ 31
+
+
+
+ Register
+
+
diff --git a/app/HGProductionTool/dialog_registeraccount.cpp b/app/HGProductionTool/dialog_registeraccount.cpp
new file mode 100644
index 0000000..3795b6c
--- /dev/null
+++ b/app/HGProductionTool/dialog_registeraccount.cpp
@@ -0,0 +1,48 @@
+#include "dialog_registeraccount.h"
+#include "ui_dialog_registeraccount.h"
+
+#include
+#include "base/HGUtility.h"
+#include "app_cfg.h"
+
+Dialog_RegisterAccount::Dialog_RegisterAccount(QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::Dialog_RegisterAccount)
+{
+ ui->setupUi(this);
+
+ setWindowTitle(tr("Register"));
+ setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
+ ui->lineEdit_password->setEchoMode(QLineEdit::EchoMode::Password);
+ ui->lineEdit_confirmPswd->setEchoMode(QLineEdit::EchoMode::Password);
+}
+
+Dialog_RegisterAccount::~Dialog_RegisterAccount()
+{
+ delete ui;
+}
+
+void Dialog_RegisterAccount::on_pushButton_register_clicked()
+{
+ if (ui->lineEdit_account->text().isEmpty() || ui->lineEdit_password->text().isEmpty() || ui->lineEdit_confirmPswd->text().isEmpty())
+ {
+ QMessageBox::information(this, tr("Prompt"), tr("Input cannot be empty!"));
+ return;
+ }
+
+ if (ui->lineEdit_password->text() != ui->lineEdit_confirmPswd->text())
+ {
+ QMessageBox::information(this, tr("Prompt"), tr("Password inconsistency"));
+ return;
+ }
+
+ if (0)
+ {
+ QMessageBox::information(this, tr("Prompt"), tr("User already exists"));
+ return;
+ }
+
+ saveCfgValue(ui->lineEdit_account->text().toStdString().c_str(), "password", ui->lineEdit_password->text());
+
+ accept();
+}
diff --git a/app/HGProductionTool/dialog_registeraccount.h b/app/HGProductionTool/dialog_registeraccount.h
new file mode 100644
index 0000000..f011ba8
--- /dev/null
+++ b/app/HGProductionTool/dialog_registeraccount.h
@@ -0,0 +1,25 @@
+#ifndef DIALOG_REGISTERACCOUNT_H
+#define DIALOG_REGISTERACCOUNT_H
+
+#include
+
+namespace Ui {
+class Dialog_RegisterAccount;
+}
+
+class Dialog_RegisterAccount : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit Dialog_RegisterAccount(QWidget *parent = nullptr);
+ ~Dialog_RegisterAccount();
+
+private slots:
+ void on_pushButton_register_clicked();
+
+private:
+ Ui::Dialog_RegisterAccount *ui;
+};
+
+#endif // DIALOG_REGISTERACCOUNT_H
diff --git a/app/HGProductionTool/dialog_registeraccount.ui b/app/HGProductionTool/dialog_registeraccount.ui
new file mode 100644
index 0000000..fa6a03c
--- /dev/null
+++ b/app/HGProductionTool/dialog_registeraccount.ui
@@ -0,0 +1,101 @@
+
+
+ Dialog_RegisterAccount
+
+
+
+ 0
+ 0
+ 407
+ 235
+
+
+
+ Dialog
+
+
+
+
+ 150
+ 180
+ 91
+ 31
+
+
+
+ Register
+
+
+
+
+
+ 120
+ 20
+ 41
+ 31
+
+
+
+ Account name:
+
+
+
+
+
+ 130
+ 70
+ 31
+ 31
+
+
+
+ Password:
+
+
+
+
+
+ 170
+ 29
+ 131
+ 21
+
+
+
+
+
+
+ 170
+ 79
+ 131
+ 21
+
+
+
+
+
+
+ 110
+ 120
+ 51
+ 31
+
+
+
+ confirm password:
+
+
+
+
+
+ 170
+ 129
+ 131
+ 21
+
+
+
+
+
+
+
diff --git a/app/HGProductionTool/form_burnmode.cpp b/app/HGProductionTool/form_burnmode.cpp
index 86b3140..a92d4a1 100644
--- a/app/HGProductionTool/form_burnmode.cpp
+++ b/app/HGProductionTool/form_burnmode.cpp
@@ -17,6 +17,8 @@ Form_BurnMode::Form_BurnMode(class MainWindow *mainwnd, QWidget *parent) :
{
ui->setupUi(this);
+ ui->pbtn_close->setVisible(false);
+
connect(this, SIGNAL(testResult(bool)), this, SLOT(on_testResult(bool)), Qt::QueuedConnection);
initTableWidget();
diff --git a/app/HGProductionTool/form_maininterface.cpp b/app/HGProductionTool/form_maininterface.cpp
index 2e41dbf..6cb23ff 100644
--- a/app/HGProductionTool/form_maininterface.cpp
+++ b/app/HGProductionTool/form_maininterface.cpp
@@ -4,6 +4,7 @@
#include
#include
#include "base/HGBase.h"
+#include "base/HGInfo.h"
#include "imgfmt/HGImgFmt.h"
#include "HGUIGlobal.h"
#include "HGString.h"
@@ -14,12 +15,13 @@
#include "dialog_excepdesc.h"
#include "huagao/hgscanner_error.h"
-Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::LogInType logInType, SANE_Handle handle, HGPdtToolDbUserMgr pdtToolDbuserMgr, HGPdtToolDbDevice pdtToolDbDevice,
+Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::LogInType logInType, const QString &accountName, 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_logInType(logInType)
+ , m_accountName(accountName)
, m_hg(nullptr)
, m_handle(handle)
, m_disconnect(false)
@@ -342,6 +344,9 @@ void Form_mainInterface::on_pbtn_fail_clicked()
QTableWidgetItem *item2 = ui->tableWidget->item(row, 2);
item2->setToolTip(str);
+
+ writeTestLog(tr("Serial number: %1, Test item: %2, Test result: Failed! Reason: %3")
+ .arg(m_serialNum).arg(title).arg(str));
}
}
}
@@ -363,6 +368,11 @@ void Form_mainInterface::on_pbtn_pass_clicked()
QTableWidgetItem *item2 = ui->tableWidget->item(row, 2);
item2->setToolTip("");
+
+ writeTestLog(tr("Serial number: %1, Test item: %2, Test result: Pass!")
+ .arg(m_serialNum).arg(title));
+
+ on_pbtn_nextStep_clicked();
}
@@ -386,8 +396,6 @@ void Form_mainInterface::on_pbtn_pass_clicked()
// file.remove();
// }
// }
-
- on_pbtn_nextStep_clicked();
}
void Form_mainInterface::on_pbtn_stop_clicked()
@@ -667,6 +675,40 @@ void Form_mainInterface::getLogInfo(int ret)
}
}
+QString Form_mainInterface::getLogPath()
+{
+ HGChar cachePath[512];
+ HGBase_GetDocumentsPath(cachePath, 512);
+ HGChar procName[512];
+ HGBase_GetProcessName(procName, 512);
+ strcat(cachePath, procName);
+ strcat(cachePath, "/Test_Log/");
+
+ return getStdFileName(cachePath);
+}
+
+void Form_mainInterface::writeTestLog(QString logContent)
+{
+ QString logPath = getLogPath();
+ HGBase_CreateDir(getStdString(logPath).c_str());
+
+ QString fileName = logPath + m_accountName + ".log";
+ QFile file(fileName);
+ if(!file.open(QIODevice::ReadWrite | QIODevice::Append))
+ {
+ return;
+ }
+
+ QDateTime dateTime= QDateTime::currentDateTime();
+ QString curTime = dateTime .toString("yyyy-MM-dd hh:mm:ss");
+ QString content = "[" + curTime + "] ";
+ content += logContent;
+
+ QTextStream txtOutput(&file);
+ txtOutput << content << endl;
+ file.close();
+}
+
void Form_mainInterface::on_tableWidget_currentItemChanged(QTableWidgetItem *current, QTableWidgetItem *previous)
{
(void)previous;
diff --git a/app/HGProductionTool/form_maininterface.h b/app/HGProductionTool/form_maininterface.h
index a682ffa..68ed887 100644
--- a/app/HGProductionTool/form_maininterface.h
+++ b/app/HGProductionTool/form_maininterface.h
@@ -21,7 +21,7 @@ class Form_mainInterface : public QWidget
Q_OBJECT
public:
- explicit Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::LogInType logInType, SANE_Handle handle, HGPdtToolDbUserMgr pdtToolDbuserMgr, HGPdtToolDbDevice pdtToolDbDevice,
+ explicit Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::LogInType logInType, const QString &accountName, SANE_Handle handle, HGPdtToolDbUserMgr pdtToolDbuserMgr, HGPdtToolDbDevice pdtToolDbDevice,
const QString &serialNum, const QString &devType, const QString &devName, const QString &devFwNum);
~Form_mainInterface();
@@ -93,6 +93,8 @@ private:
int getRollerNum();
int getHistoryCount();
void getLogInfo(int ret);
+ QString getLogPath();
+ void writeTestLog(QString logContent);
private:
union VIDPID
@@ -114,6 +116,7 @@ private:
class MainWindow *m_mainwnd;
Dialog_logIn::LogInType m_logInType;
+ QString m_accountName;
hgscanner *m_hg;
SANE_Handle m_handle;
bool m_disconnect;
diff --git a/app/HGProductionTool/main.cpp b/app/HGProductionTool/main.cpp
index 42b692d..3e79922 100644
--- a/app/HGProductionTool/main.cpp
+++ b/app/HGProductionTool/main.cpp
@@ -18,7 +18,7 @@ int main(int argc, char *argv[])
Dialog_logIn login;
if (login.exec())
{
- MainWindow w(login.GetUserMgr(), login.GetLogInType(), login.GetFtpHost(), login.GetFtpPort());
+ MainWindow w(login.GetUserMgr(), login.GetLogInType(), login.GetAccountName(), login.GetFtpHost(), login.GetFtpPort());
a.exec();
if (w.isExitApp())
{
diff --git a/app/HGProductionTool/mainwindow.cpp b/app/HGProductionTool/mainwindow.cpp
index 4498405..05061f8 100644
--- a/app/HGProductionTool/mainwindow.cpp
+++ b/app/HGProductionTool/mainwindow.cpp
@@ -11,7 +11,7 @@
#include "dialog_inputserialnum.h"
#include "dialog_hgmessagebox.h"
-MainWindow::MainWindow(HGPdtToolDbUserMgr pdtToolDbuserMgr, Dialog_logIn::LogInType loginType, const QString &ftpHost, unsigned short ftpPort, QWidget *parent)
+MainWindow::MainWindow(HGPdtToolDbUserMgr pdtToolDbuserMgr, Dialog_logIn::LogInType loginType, const QString &accountName, const QString &ftpHost, unsigned short ftpPort, QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
, m_pdtToolDbuserMgr(pdtToolDbuserMgr)
@@ -20,6 +20,7 @@ MainWindow::MainWindow(HGPdtToolDbUserMgr pdtToolDbuserMgr, Dialog_logIn::LogInT
, m_lock(nullptr)
, m_testingRef(0)
, m_loginType(loginType)
+ , m_accountName(accountName)
, m_formBurnMode(nullptr)
, m_top_splitter(nullptr)
, m_bot_splitter(nullptr)
@@ -29,6 +30,10 @@ MainWindow::MainWindow(HGPdtToolDbUserMgr pdtToolDbuserMgr, Dialog_logIn::LogInT
ui->setupUi(this);
ui->act_newDevice->setVisible(false);
+ ui->act_close->setVisible(false);
+ ui->act_manage->setVisible(false);
+ ui->act_export->setVisible(false);
+
ui->act_refreshDevice->setShortcut(QKeySequence("F5"));
QFont ft;
@@ -533,7 +538,7 @@ void MainWindow::on_act_newDevice_triggered()
HGPdtToolDbDevice pdtToolDbDevice = nullptr;
HGPdtToolDb_OpenDevice(m_pdtToolDbuserMgr, m_inputSnDlg->GetSn().toStdString().c_str(), &pdtToolDbDevice);
- Form_mainInterface *mainInterface = new Form_mainInterface(this, m_loginType, nullptr, m_pdtToolDbuserMgr, pdtToolDbDevice,
+ Form_mainInterface *mainInterface = new Form_mainInterface(this, m_loginType, m_accountName, nullptr, m_pdtToolDbuserMgr, pdtToolDbDevice,
m_inputSnDlg->GetSn(), m_inputSnDlg->GetDevType(), nullptr, nullptr);
if (!AddInterface(mainInterface))
{
@@ -553,7 +558,7 @@ void MainWindow::on_act_manage_triggered()
void MainWindow::on_act_changePwd_triggered()
{
- Dialog_changePwd dlg(m_pdtToolDbuserMgr, this);
+ Dialog_changePwd dlg(m_pdtToolDbuserMgr, m_accountName, this);
dlg.exec();
}
@@ -661,7 +666,7 @@ void MainWindow::on_act_refreshDevice_triggered()
HGPdtToolDbDevice pdtToolDbDevice = nullptr;
HGPdtToolDb_OpenDevice(m_pdtToolDbuserMgr, m_inputSnDlg->GetSn().toStdString().c_str(), &pdtToolDbDevice);
- Form_mainInterface *mainInterface = new Form_mainInterface(this, m_loginType, devHandle, m_pdtToolDbuserMgr, pdtToolDbDevice,
+ Form_mainInterface *mainInterface = new Form_mainInterface(this, m_loginType, m_accountName, devHandle, m_pdtToolDbuserMgr, pdtToolDbDevice,
m_inputSnDlg->GetSn(), m_inputSnDlg->GetDevType(), name[i].c_str(), getDevFwNum(devHandle));
if (!AddInterface(mainInterface))
{
diff --git a/app/HGProductionTool/mainwindow.h b/app/HGProductionTool/mainwindow.h
index fb673cf..478be8d 100644
--- a/app/HGProductionTool/mainwindow.h
+++ b/app/HGProductionTool/mainwindow.h
@@ -21,7 +21,7 @@ class MainWindow : public QMainWindow
Q_OBJECT
public:
- MainWindow(HGPdtToolDbUserMgr pdtToolDbuserMgr, Dialog_logIn::LogInType loginType, const QString &ftpHost, unsigned short ftpPort, QWidget *parent = nullptr);
+ MainWindow(HGPdtToolDbUserMgr pdtToolDbuserMgr, Dialog_logIn::LogInType loginType, const QString &accountName, const QString &ftpHost, unsigned short ftpPort, QWidget *parent = nullptr);
~MainWindow();
static QString getLogInfo(HGResult ret);
bool isExitApp();
@@ -84,6 +84,7 @@ private:
HGLock m_lock;
int m_testingRef;
Dialog_logIn::LogInType m_loginType;
+ QString m_accountName;
class Dialog_InputSerialNum *m_inputSnDlg;
Form_BurnMode *m_formBurnMode;