From bd7130607d3ec2f2d2dca8764625fddc084aec1a Mon Sep 17 00:00:00 2001 From: yangjiaxuan <171295266@qq.com> Date: Thu, 31 Aug 2023 15:15:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E4=B8=BA=E7=99=BB=E5=BD=95=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E8=87=AA=E7=94=B1=E9=80=89=E6=8B=A9=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/HGProductionTool/ProductionTool_zh_CN.qm | Bin 15076 -> 14034 bytes app/HGProductionTool/ProductionTool_zh_CN.ts | 325 +++++++----- app/HGProductionTool/app_cfg.cpp | 68 +-- app/HGProductionTool/app_cfg.h | 8 +- .../dialog_inputserialnum.cpp | 11 +- app/HGProductionTool/dialog_inputserialnum.h | 3 +- app/HGProductionTool/dialog_login.cpp | 90 +++- app/HGProductionTool/dialog_login.h | 6 + app/HGProductionTool/dialog_login.ui | 499 ++++++++++-------- .../dialog_registeraccount.cpp | 3 +- .../dialog_registeraccount.ui | 2 +- app/HGProductionTool/form_maininterface.cpp | 22 +- app/HGProductionTool/form_maininterface.h | 3 +- app/HGProductionTool/main.cpp | 2 +- app/HGProductionTool/mainwindow.cpp | 27 +- app/HGProductionTool/mainwindow.h | 5 +- app/HGProductionTool/mainwindow.ui | 6 + 17 files changed, 623 insertions(+), 457 deletions(-) diff --git a/app/HGProductionTool/ProductionTool_zh_CN.qm b/app/HGProductionTool/ProductionTool_zh_CN.qm index 403bc2b738b1f799e7f186ef7ab37ed95a7596d3..09e182e2c42942d9a13a2db0df6602ff81846a83 100644 GIT binary patch delta 2125 zcmZvddr(y88OGnUdoFu9yNd|B?1Jo~f(Xl{Do{yqLOK{J%0-sZdP7(aD;8MFE+W)s z*Dx^^#Y>M&Ok!+fh*qpfvT4-Rq;)`2oTjFZ2FFmzBq53PLSu-Dt=c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wQL{Ni`K$Bot(wvmnAf2 z?t}9CqCxzXwcO%H-sO4X18g^x6=OzQ?n%tgmP6foYO;^Yf<%k?GZAPVVQXfX5S|mC nYJ|n$0QbuJ`YDhANsuP3A<-XBE_S#RlG5;hq9~FuEl2n-E13%T diff --git a/app/HGProductionTool/ProductionTool_zh_CN.ts b/app/HGProductionTool/ProductionTool_zh_CN.ts index 365984c..8e03d34 100644 --- a/app/HGProductionTool/ProductionTool_zh_CN.ts +++ b/app/HGProductionTool/ProductionTool_zh_CN.ts @@ -118,42 +118,42 @@ 取消 - - - - - - + + + + + + tips 提示 - + device is lost 设备已丢失 - + Serial num is empty 序列号为空 - + sn is illegal 序列号不合法 - + The device is testing 该设备正在进行测试 - + set sn failed 设置序列号失败 - + set sn succeed 设置序列号成功 @@ -167,7 +167,7 @@ - + Register 注册 @@ -190,7 +190,7 @@ - + Prompt 提示 @@ -205,7 +205,7 @@ 密码不一致! - + User already exists 用户已存在! @@ -314,52 +314,44 @@ 重置密码 - - - - tips - 提示 + 提示 - create user failed: - 创建账户失败: + 创建账户失败: - + Question 询问 - + Are you sure to destroy: 请确认是否删除账户: - + yes 确定 - + no 取消 - destroy user failed: - 销毁账户失败: + 销毁账户失败: - change password succeed - 修改密码成功 + 修改密码成功 - change password failed: - 修改密码失败: + 修改密码失败: @@ -399,20 +391,18 @@ 取消 - - + tips 提示 - + The passwords entered twice are inconsistent 两次输入的密码不一致 - Change passwords failed: - 修改密码失败: + 修改密码失败: @@ -428,60 +418,80 @@ - + + Login + 登录 + + + account: 账户: - + password: 密码: - + + Show password + 显示密码 + + + dbHost: 数据库地址: - + dbPort: 数据库端口: - + ftpHost: FTP地址: - + ftpPort: FTP端口: - + Burn 烧录工位 - + InitTest 初检工位 - + ImageTest 图像测试工位 - + PressureTest 压力测试工位 - + Register 注册 + + + Select Profile + 选择配置文件 + + + + Select config file + 选择配置文件 + host: IP地址: @@ -491,7 +501,7 @@ 端口号: - + LOG IN 登录 @@ -520,24 +530,53 @@ 登录 - - tips + + + + + Prompt 提示 - + + Account dose not exist + 账户不存在 + + + + Password can not be empty + 密码不能为空 + + + + Password error + 密码错误 + + + + Please select a profile first + 请先选择配置文件 + + + + Select profile + 选择配置文件 + + + tips + 提示 + + Login failed, sure to enter offline mode? - 登录失败,是否进入单机测试模式? + 登录失败,是否进入单机测试模式? - yes - 确定 + 确定 - no - 取消 + 取消 Login failed: @@ -635,36 +674,32 @@ 上传 - + Browse directory 打开文件 - + config(*json) 配置文件(*json) - - - + tips 提示 - + empty filename 文件为空 - upload succeed - 上传成功 + 上传成功 - upload to service failed, already save to local host - 上传至服务器失败,已保存至本地 + 上传至服务器失败,已保存至本地 upload failed: @@ -698,17 +733,17 @@ 关闭设备 - + ID 序号 - + selected 选择 - + device 设备 @@ -717,14 +752,14 @@ 序列号 - - + + tips 提示 - - + + Please check a devices at least 请至少勾选一台设备 @@ -978,7 +1013,7 @@ - + Not sleeping 不休眠 @@ -995,48 +1030,56 @@ 设备型号:%1 - Serial number: %1, Test item: %2, Test result: Failed! Reason: %3 Serial number: %1, Test item: %2, Test result: Failed! Reason: %3 - 设备序列号: %1, 测试项: %2, 测试结果: 不通过! 原因: %3 + 设备序列号: %1, 测试项: %2, 测试结果: 不通过! 原因: %3 - Serial number: %1, Test item: %2, Test result: Pass! Serial number: %1, Test item: %2, Test result: Pass! - 设备序列号: %1, 测试项: %2, 测试结果: 通过! + 设备序列号: %1, 测试项: %2, 测试结果: 通过! - - + + device history scan count: 设备历史扫描张数: - - - - + + + + Prompt 提示 - + + Tester: %1, Test item: %2, Test result: Failed! Reason: %3 + 测试员: %1, 测试项: %2, 测试结果: 不通过! 原因: %3 + + + + Tester: %1, Test item: %2, Test result: Pass! + 测试员: %1, 测试项: %2, 测试结果: 通过! + + + No paper 无纸 - + Device is sleeping 设备处于休眠模式 - + Counting mode 设备处于计数模式 - + Other error 其他错误 @@ -1060,22 +1103,22 @@ 测试状态 - + not test 未测试 - + not pass 不通过 - + not support 不支持 - + pass 通过 @@ -1101,14 +1144,14 @@ Pid: - - + + device roller count: 设备滚轴张数: - + image pixel: 标准圆:宽 * 高: @@ -1133,7 +1176,7 @@ - + minute 分钟 @@ -1178,100 +1221,99 @@ 用户 - + act_newDevice 新建项目 - + act_manage 账户管理 - + act_changePwd 修改密码 - + act_export 导出 - + act_logOut 登出 - + act_close 退出 - + act_upload 上传配置文件 - + act_refreshDevice 刷新设备列表 - + + act_openLog + 查看日志 + + Account login elsewhere - 账户在其他地方登录 + 账户在其他地方登录 Network connection lost 网络连接断开 - You have been forced offline by the administrator account - 你已被管理员账户强制下线 + 你已被管理员账户强制下线 - Data base error - 数据库错误 + 数据库错误 - - - - - - - - + + + + + tips 提示 - + production tool-burn station 华高生产工具-烧录工位 - + production tool-init test station 华高生产工具-初检工位 - + production tool-image test station 华高生产工具-图像测试工位 - + production tool-pressure test station 华高生产工具-压力测试工位 - - - + + + Is testing, do not close! 测试中,请勿关闭! @@ -1293,8 +1335,8 @@ 取消 - - + + cannot create more table 不能创建更多项目 @@ -1311,49 +1353,40 @@ 打开设备失败 - save - 保存 + 保存 - xls(*.xls) - xls表格(*.xls) + xls表格(*.xls) - export succeed - 导出成功 + 导出成功 - export failed - 导出失败 + 导出失败 - Illegal user - 非法的用户 + 非法的用户 - Wrong password - 密码错误 + 密码错误 - Database error - 数据库错误 + 数据库错误 - connect error - 连接错误 + 连接错误 - Failed - 错误 + 错误 diff --git a/app/HGProductionTool/app_cfg.cpp b/app/HGProductionTool/app_cfg.cpp index 10b4d3c..8740d94 100644 --- a/app/HGProductionTool/app_cfg.cpp +++ b/app/HGProductionTool/app_cfg.cpp @@ -17,27 +17,27 @@ QString getCfgValue(const char *appName, const char *key, const QString &def) 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"); +//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; -} +// 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"); +//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; -} +// 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) { @@ -49,22 +49,22 @@ void saveCfgValue(const char *appName, const char *key, const QString &value) 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"); +//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); -} +// 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"); +//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); -} +// HGBase_SetProfileInt(cfgPath, appName, key, (HGInt)value); +//} diff --git a/app/HGProductionTool/app_cfg.h b/app/HGProductionTool/app_cfg.h index 0b5d122..4299390 100644 --- a/app/HGProductionTool/app_cfg.h +++ b/app/HGProductionTool/app_cfg.h @@ -4,11 +4,11 @@ #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); +//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); +//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_inputserialnum.cpp b/app/HGProductionTool/dialog_inputserialnum.cpp index 7518ddf..7bc2773 100644 --- a/app/HGProductionTool/dialog_inputserialnum.cpp +++ b/app/HGProductionTool/dialog_inputserialnum.cpp @@ -3,13 +3,14 @@ #include "mainwindow.h" #include "base/HGBase.h" -Dialog_InputSerialNum::Dialog_InputSerialNum(class MainWindow *mainWnd, const QString &devName, +Dialog_InputSerialNum::Dialog_InputSerialNum(class MainWindow *mainWnd, const QString &devName, const QString &profileName, SANE_Handle handle, const QString &serialNum, const QString &devType) : QDialog(mainWnd), ui(new Ui::Dialog_InputSerialNum), m_mainWnd(mainWnd), m_handle(handle), m_valid(true), + m_profileName(profileName), m_serialNum(serialNum), m_devType(devType), m_devName(devName), @@ -82,15 +83,9 @@ void Dialog_InputSerialNum::setSpeedAndSleep(bool updateSleep) return; } - HGChar cfgPath[512] = {0}; - HGBase_GetConfigPath(cfgPath, 512); - HGBase_CreateDir(cfgPath); - strcat(cfgPath, m_devType.toStdString().c_str()); - strcat(cfgPath, ".json"); - //HGPdtToolDb_DownloadFile(m_pdtToolDbuserMgr, m_devType.toStdString().c_str(), cfgPath); - AnalysisJson analysisJson(QString::fromStdString(cfgPath)); + AnalysisJson analysisJson(m_profileName); AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal(); LPWRITECFG lp = new WRITECFG; diff --git a/app/HGProductionTool/dialog_inputserialnum.h b/app/HGProductionTool/dialog_inputserialnum.h index dfd703b..876eacc 100644 --- a/app/HGProductionTool/dialog_inputserialnum.h +++ b/app/HGProductionTool/dialog_inputserialnum.h @@ -15,7 +15,7 @@ class Dialog_InputSerialNum : public QDialog Q_OBJECT public: - explicit Dialog_InputSerialNum(class MainWindow *mainWnd, const QString &devName, + explicit Dialog_InputSerialNum(class MainWindow *mainWnd, const QString &devName, const QString &profileName, SANE_Handle handle, const QString &serialNum, const QString &devType); ~Dialog_InputSerialNum(); @@ -54,6 +54,7 @@ private: class MainWindow *m_mainWnd; SANE_Handle m_handle; bool m_valid; + QString m_profileName; QString m_serialNum; QString m_devType; QString m_devName; diff --git a/app/HGProductionTool/dialog_login.cpp b/app/HGProductionTool/dialog_login.cpp index 1643408..5cc03e6 100644 --- a/app/HGProductionTool/dialog_login.cpp +++ b/app/HGProductionTool/dialog_login.cpp @@ -3,7 +3,9 @@ #include #include #include +#include #include "base/HGUtility.h" +#include "HGUIGlobal.h" #include "dialog_registeraccount.h" #include "app_cfg.h" @@ -11,6 +13,7 @@ Dialog_logIn::Dialog_logIn(QWidget *parent) : QDialog(parent), ui(new Ui::Dialog_logIn) , m_accountName("") + , m_profileName("") { ui->setupUi(this); @@ -28,25 +31,29 @@ Dialog_logIn::Dialog_logIn(QWidget *parent) : ui->pbtn_close->setToolTip(tr("Close")); ui->label_title->setText(tr("LogIn")); ui->lineEdit_password->setEchoMode(QLineEdit::EchoMode::Password); + ui->lineEdit_profilePath->setReadOnly(true); - QString ipStr = "\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b"; - QString portStr = "[0-9]+$"; - ui->lineEdit_dbHost->setValidator(new QRegExpValidator(QRegExp(ipStr))); - ui->lineEdit_ftpHost->setValidator(new QRegExpValidator(QRegExp(ipStr))); - ui->lineEdit_dbPort->setValidator(new QRegExpValidator(QRegExp(portStr))); - ui->lineEdit_ftpPort->setValidator(new QRegExpValidator(QRegExp(portStr))); + m_profileName = getCfgValue("login", "profile", m_profileName); + ui->lineEdit_profilePath->setText(m_profileName); - QString account("root"); - QString dbHost("192.168.1.70"); - QString dbPort("3306"); - QString ftpHost("192.168.1.70"); - QString ftpPort("21"); +// QString ipStr = "\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b"; +// QString portStr = "[0-9]+$"; +// ui->lineEdit_dbHost->setValidator(new QRegExpValidator(QRegExp(ipStr))); +// ui->lineEdit_ftpHost->setValidator(new QRegExpValidator(QRegExp(ipStr))); +// ui->lineEdit_dbPort->setValidator(new QRegExpValidator(QRegExp(portStr))); +// ui->lineEdit_ftpPort->setValidator(new QRegExpValidator(QRegExp(portStr))); - ui->lineEdit_account->setText(getCfgValue("login", "account", account)); - ui->lineEdit_dbHost->setText(getCfgValue("login", "dbHost", dbHost)); - ui->lineEdit_dbPort->setText(getCfgValue("login", "dbPort", dbPort)); - ui->lineEdit_ftpHost->setText(getCfgValue("login", "ftpHost", ftpHost)); - ui->lineEdit_ftpPort->setText(getCfgValue("login", "ftpPort", ftpPort)); +// QString account("root"); +// QString dbHost("192.168.1.70"); +// QString dbPort("3306"); +// QString ftpHost("192.168.1.70"); +// QString ftpPort("21"); + + ui->lineEdit_account->setText(getCfgValue("login", "account", "")); +// ui->lineEdit_dbHost->setText(getCfgValue("login", "dbHost", dbHost)); +// ui->lineEdit_dbPort->setText(getCfgValue("login", "dbPort", dbPort)); +// ui->lineEdit_ftpHost->setText(getCfgValue("login", "ftpHost", ftpHost)); +// ui->lineEdit_ftpPort->setText(getCfgValue("login", "ftpPort", ftpPort)); ui->stackedWidget->setCurrentIndex(0); } @@ -81,6 +88,11 @@ QString Dialog_logIn::GetAccountName() return m_accountName; } +QString Dialog_logIn::GetProfileName() +{ + return m_profileName; +} + void Dialog_logIn::mousePressEvent(QMouseEvent *event) { if(event->button()==Qt::LeftButton) @@ -111,16 +123,33 @@ void Dialog_logIn::on_pbtn_login_clicked() { QString account = ui->lineEdit_account->text(); QString password = ui->lineEdit_password->text(); - QString dbHost = ui->lineEdit_dbHost->text(); - QString dbPort = ui->lineEdit_dbPort->text(); - QString ftpHost = ui->lineEdit_ftpHost->text(); - QString ftpPort = ui->lineEdit_ftpPort->text(); + + QString cfgPassword = getCfgValue(account.toStdString().c_str(), "password", ""); + if (cfgPassword.isEmpty()) + { + QMessageBox::information(this, tr("Prompt"), tr("Account dose not exist")); + return; + } + + if (password.isEmpty()) + { + QMessageBox::information(this, tr("Prompt"), tr("Password can not be empty")); + return; + } + + if (password != cfgPassword) + { + QMessageBox::information(this, tr("Prompt"), tr("Password error")); + return; + } + + if (ui->lineEdit_profilePath->text().isEmpty()) + { + QMessageBox::information(this, tr("Prompt"), tr("Please select a profile first")); + return; + } saveCfgValue("login", "account", account); - saveCfgValue("login", "dbHost", dbHost); - saveCfgValue("login", "dbPort", dbPort); - saveCfgValue("login", "ftpHost", ftpHost); - saveCfgValue("login", "ftpPort", ftpPort); if (ui->radioButton_burn->isChecked()) m_loginType = LogInType_Burn; @@ -189,3 +218,16 @@ void Dialog_logIn::on_pbtn_register_clicked() dlg.exec(); } + +void Dialog_logIn::on_pbtn_selectCfgFile_clicked() +{ + QString fileName = QFileDialog::getOpenFileName(nullptr, tr("Select profile"), "", "*.json"); + ui->lineEdit_profilePath->setText(fileName); + m_profileName = getStdFileName(fileName); + saveCfgValue("login", "profile", m_profileName); +} + +void Dialog_logIn::on_checkBox_showPassword_toggled(bool checked) +{ + ui->lineEdit_password->setEchoMode(checked ? QLineEdit::Normal : QLineEdit::Password); +} diff --git a/app/HGProductionTool/dialog_login.h b/app/HGProductionTool/dialog_login.h index 3b8626f..b295799 100644 --- a/app/HGProductionTool/dialog_login.h +++ b/app/HGProductionTool/dialog_login.h @@ -29,6 +29,7 @@ public: unsigned short GetFtpPort(); LogInType GetLogInType(); QString GetAccountName(); + QString GetProfileName(); void mousePressEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event); @@ -45,6 +46,10 @@ private slots: void on_pbtn_register_clicked(); + void on_pbtn_selectCfgFile_clicked(); + + void on_checkBox_showPassword_toggled(bool checked); + private: Ui::Dialog_logIn *ui; @@ -54,6 +59,7 @@ private: bool m_leftMousePressed; LogInType m_loginType; QString m_accountName; + QString m_profileName; }; #endif // DIALOG_LOGIN_H diff --git a/app/HGProductionTool/dialog_login.ui b/app/HGProductionTool/dialog_login.ui index daf6a91..7403051 100644 --- a/app/HGProductionTool/dialog_login.ui +++ b/app/HGProductionTool/dialog_login.ui @@ -6,8 +6,8 @@ 0 0 - 479 - 329 + 538 + 339 @@ -18,7 +18,7 @@ 0 0 - 481 + 541 30 @@ -141,247 +141,312 @@ QPushButton#pbtn_close::hover - + - 40 - 40 - 411 - 141 + 10 + 30 + 521 + 291 0 - - + + + Login + + - 80 - 30 - 48 - 16 + 60 + 0 + 421 + 141 + + + + 0 + + + + + + 80 + 30 + 48 + 16 + + + + account: + + + + + + 140 + 30 + 161 + 22 + + + + + + + 80 + 90 + 54 + 16 + + + + password: + + + + + + 140 + 90 + 161 + 22 + + + + + + + 310 + 90 + 111 + 21 + + + + Show password + + + + + + + + 20 + 20 + 111 + 16 + + + + dbHost: + + + + + + 150 + 20 + 171 + 20 + + + + + + + 20 + 50 + 111 + 16 + + + + dbPort: + + + + + + 150 + 50 + 171 + 20 + + + + + + + 50 + 80 + 81 + 16 + + + + ftpHost: + + + + + + 150 + 80 + 171 + 20 + + + + + + + 50 + 110 + 81 + 16 + + + + ftpPort: + + + + + + 150 + 110 + 171 + 20 + + + + + + + 80 + 40 + 151 + 21 + + + + PressureTest + + + + + + + + 40 + 150 + 131 + 20 - account: + Burn + + + true - + - 140 - 30 - 161 - 22 - - - - - - - 80 - 90 - 54 - 16 + 190 + 150 + 141 + 21 - password: + InitTest - + - 140 - 90 - 161 - 22 + 340 + 150 + 151 + 21 + + + + ImageTest + + + + + + 150 + 210 + 75 + 31 + + + + LOG IN + + + true + + + true + + + + + + 280 + 210 + 75 + 31 + + + + Register + + + + + + Select Profile + + + + + 170 + 140 + 141 + 31 + + + + Select config file + + + true + + + true + + + + + + 20 + 60 + 481 + 31 - - - - - 20 - 20 - 111 - 16 - - - - dbHost: - - - - - - 150 - 20 - 171 - 20 - - - - - - - 20 - 50 - 111 - 16 - - - - dbPort: - - - - - - 150 - 50 - 171 - 20 - - - - - - - 50 - 80 - 81 - 16 - - - - ftpHost: - - - - - - 150 - 80 - 171 - 20 - - - - - - - 50 - 110 - 81 - 16 - - - - ftpPort: - - - - - - 150 - 110 - 171 - 20 - - - - - - - - - 140 - 280 - 75 - 31 - - - - LOG IN - - - true - - - true - - - - - - 90 - 186 - 131 - 20 - - - - Burn - - - true - - - - - - 270 - 185 - 141 - 21 - - - - InitTest - - - - - - 90 - 230 - 151 - 21 - - - - ImageTest - - - - - - 270 - 230 - 151 - 21 - - - - PressureTest - - - - - - 260 - 280 - 75 - 31 - - - - Register - diff --git a/app/HGProductionTool/dialog_registeraccount.cpp b/app/HGProductionTool/dialog_registeraccount.cpp index 3795b6c..811c79e 100644 --- a/app/HGProductionTool/dialog_registeraccount.cpp +++ b/app/HGProductionTool/dialog_registeraccount.cpp @@ -36,7 +36,8 @@ void Dialog_RegisterAccount::on_pushButton_register_clicked() return; } - if (0) + QString account = getCfgValue(ui->lineEdit_account->text().toStdString().c_str(), "password", ""); + if (!account.isEmpty()) { QMessageBox::information(this, tr("Prompt"), tr("User already exists")); return; diff --git a/app/HGProductionTool/dialog_registeraccount.ui b/app/HGProductionTool/dialog_registeraccount.ui index fa6a03c..cd52f4b 100644 --- a/app/HGProductionTool/dialog_registeraccount.ui +++ b/app/HGProductionTool/dialog_registeraccount.ui @@ -6,7 +6,7 @@ 0 0 - 407 + 406 235 diff --git a/app/HGProductionTool/form_maininterface.cpp b/app/HGProductionTool/form_maininterface.cpp index 0f72539..c0d6c1b 100644 --- a/app/HGProductionTool/form_maininterface.cpp +++ b/app/HGProductionTool/form_maininterface.cpp @@ -15,13 +15,14 @@ #include "dialog_excepdesc.h" #include "huagao/hgscanner_error.h" -Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::LogInType logInType, const QString &accountName, SANE_Handle handle, +Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::LogInType logInType, const QString &profileName, const QString &accountName, SANE_Handle handle, 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_profileName(profileName) , m_hg(nullptr) , m_handle(handle) , m_disconnect(false) @@ -46,6 +47,7 @@ Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn:: ui->pbtn_rightRotate->setVisible(false); ui->pbtn_prePage->setVisible(false); ui->pbtn_nextPage->setVisible(false); + ui->pbtn_stop->setVisible(false); QFont ft; ft.setPointSize(15); @@ -343,8 +345,8 @@ 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)); + writeTestLog(tr("Tester: %1, Test item: %2, Test result: Failed! Reason: %3") + .arg(m_accountName).arg(title).arg(str)); } } } @@ -367,8 +369,8 @@ 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)); + writeTestLog(tr("Tester: %1, Test item: %2, Test result: Pass!") + .arg(m_accountName).arg(title)); on_pbtn_nextStep_clicked(); } @@ -430,15 +432,9 @@ void Form_mainInterface::initTableWidgetUi() ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); ui->tableWidget->setStyleSheet("selection-background-color:rgb(193,210,240)"); - HGChar cfgPath[512] = {0}; - HGBase_GetConfigPath(cfgPath, 512); - HGBase_CreateDir(cfgPath); - strcat(cfgPath, m_devType.toStdString().c_str()); - strcat(cfgPath, ".json"); - //HGPdtToolDb_DownloadFile(m_pdtToolDbuserMgr, m_devType.toStdString().c_str(), cfgPath); - AnalysisJson analysisJson(QString::fromStdString(cfgPath)); + AnalysisJson analysisJson(m_profileName); const QString stationStr[] = {"烧录工位", "初检工位", "图像测试工位", "压力测试工位"}; @@ -690,7 +686,7 @@ void Form_mainInterface::writeTestLog(QString logContent) QString logPath = getLogPath(); HGBase_CreateDir(getStdString(logPath).c_str()); - QString fileName = logPath + m_accountName + ".log"; + QString fileName = logPath + m_serialNum + ".log"; QFile file(fileName); if(!file.open(QIODevice::ReadWrite | QIODevice::Append)) { diff --git a/app/HGProductionTool/form_maininterface.h b/app/HGProductionTool/form_maininterface.h index 99fbc1e..d5f8947 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, const QString &accountName, SANE_Handle handle, + explicit Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::LogInType logInType, const QString &profileName, const QString &accountName, SANE_Handle handle, const QString &serialNum, const QString &devType, const QString &devName, const QString &devFwNum); ~Form_mainInterface(); @@ -117,6 +117,7 @@ private: class MainWindow *m_mainwnd; Dialog_logIn::LogInType m_logInType; QString m_accountName; + QString m_profileName; hgscanner *m_hg; SANE_Handle m_handle; bool m_disconnect; diff --git a/app/HGProductionTool/main.cpp b/app/HGProductionTool/main.cpp index e46134f..729e9e0 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.GetLogInType(), login.GetAccountName(), login.GetFtpHost(), login.GetFtpPort()); + MainWindow w(login.GetLogInType(), login.GetProfileName(), login.GetAccountName(), login.GetFtpHost(), login.GetFtpPort()); a.exec(); if (w.isExitApp()) { diff --git a/app/HGProductionTool/mainwindow.cpp b/app/HGProductionTool/mainwindow.cpp index 1212060..0439934 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(Dialog_logIn::LogInType loginType, const QString &accountName, const QString &ftpHost, unsigned short ftpPort, QWidget *parent) +MainWindow::MainWindow(Dialog_logIn::LogInType loginType, const QString &profileName, const QString &accountName, const QString &ftpHost, unsigned short ftpPort, QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) , m_ftpHost(ftpHost) @@ -20,6 +20,7 @@ MainWindow::MainWindow(Dialog_logIn::LogInType loginType, const QString &account , m_testingRef(0) , m_loginType(loginType) , m_accountName(accountName) + , m_profileName(profileName) , m_formBurnMode(nullptr) , m_top_splitter(nullptr) , m_bot_splitter(nullptr) @@ -532,13 +533,13 @@ void MainWindow::on_update_userStatus() void MainWindow::on_act_newDevice_triggered() { - m_inputSnDlg = new Dialog_InputSerialNum(this, "", nullptr, "", ""); + m_inputSnDlg = new Dialog_InputSerialNum(this, "", m_profileName, nullptr, "", ""); if (m_inputSnDlg->exec()) { //HGPdtToolDbDevice pdtToolDbDevice = nullptr; //HGPdtToolDb_OpenDevice(m_pdtToolDbuserMgr, m_inputSnDlg->GetSn().toStdString().c_str(), &pdtToolDbDevice); - Form_mainInterface *mainInterface = new Form_mainInterface(this, m_loginType, m_accountName, nullptr, + Form_mainInterface *mainInterface = new Form_mainInterface(this, m_loginType, m_profileName, m_accountName, nullptr, m_inputSnDlg->GetSn(), m_inputSnDlg->GetDevType(), nullptr, nullptr); if (!AddInterface(mainInterface)) { @@ -660,13 +661,13 @@ void MainWindow::on_act_refreshDevice_triggered() sane_open(name[i].c_str(), &devHandle); if (nullptr != devHandle) { - m_inputSnDlg = new Dialog_InputSerialNum(this, name[i].c_str(), devHandle, getDevSn(devHandle), getDevType(devHandle)); + m_inputSnDlg = new Dialog_InputSerialNum(this, name[i].c_str(), m_profileName, devHandle, getDevSn(devHandle), getDevType(devHandle)); if (m_inputSnDlg->exec()) { //HGPdtToolDbDevice pdtToolDbDevice = nullptr; //HGPdtToolDb_OpenDevice(m_pdtToolDbuserMgr, m_inputSnDlg->GetSn().toStdString().c_str(), &pdtToolDbDevice); - Form_mainInterface *mainInterface = new Form_mainInterface(this, m_loginType, m_accountName, devHandle, + Form_mainInterface *mainInterface = new Form_mainInterface(this, m_loginType, m_profileName, m_accountName, devHandle, m_inputSnDlg->GetSn(), m_inputSnDlg->GetDevType(), name[i].c_str(), getDevFwNum(devHandle)); if (!AddInterface(mainInterface)) { @@ -684,3 +685,19 @@ void MainWindow::on_act_refreshDevice_triggered() } } } + +void MainWindow::on_act_openLog_triggered() +{ + HGChar logPath[512]; + HGBase_GetDocumentsPath(logPath, 512); + HGChar procName[512]; + HGBase_GetProcessName(procName, 512); + strcat(logPath, procName); + strcat(logPath, "/Test_Log/"); + + QString fileName = logPath + m_accountName + ".log"; + QFileInfo fileInfo(getStdFileName(fileName)); + auto pathDir = fileInfo.path(); + QString strFilePath = "file:///" + pathDir; + QDesktopServices::openUrl(QUrl(strFilePath)); +} diff --git a/app/HGProductionTool/mainwindow.h b/app/HGProductionTool/mainwindow.h index 2c6e009..e0b02d3 100644 --- a/app/HGProductionTool/mainwindow.h +++ b/app/HGProductionTool/mainwindow.h @@ -21,7 +21,7 @@ class MainWindow : public QMainWindow Q_OBJECT public: - MainWindow(Dialog_logIn::LogInType loginType, const QString &accountName, const QString &ftpHost, unsigned short ftpPort, QWidget *parent = nullptr); + MainWindow(Dialog_logIn::LogInType loginType, const QString &profileName, const QString &accountName, const QString &ftpHost, unsigned short ftpPort, QWidget *parent = nullptr); ~MainWindow(); static QString getLogInfo(HGResult ret); bool isExitApp(); @@ -72,6 +72,8 @@ private slots: void on_act_refreshDevice_triggered(); + void on_act_openLog_triggered(); + private: QSplitter *m_top_splitter; QSplitter *m_bot_splitter; @@ -85,6 +87,7 @@ private: int m_testingRef; Dialog_logIn::LogInType m_loginType; QString m_accountName; + QString m_profileName; class Dialog_InputSerialNum *m_inputSnDlg; Form_BurnMode *m_formBurnMode; diff --git a/app/HGProductionTool/mainwindow.ui b/app/HGProductionTool/mainwindow.ui index 2488f48..4c46ceb 100644 --- a/app/HGProductionTool/mainwindow.ui +++ b/app/HGProductionTool/mainwindow.ui @@ -44,6 +44,7 @@ + @@ -89,6 +90,11 @@ act_refreshDevice + + + act_openLog + +