From 8ac3fa3388842b70a2dcccf5b46c603314a05115 Mon Sep 17 00:00:00 2001 From: yangjiaxuan <171295266@qq.com> Date: Fri, 1 Sep 2023 18:42:28 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=83=A7=E5=BD=95=E7=95=8C?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/HGProductionTool/HGProductionTool.pro | 4 +- app/HGProductionTool/ProductionTool_zh_CN.qm | Bin 14034 -> 16146 bytes app/HGProductionTool/ProductionTool_zh_CN.ts | 254 +++++++-- app/HGProductionTool/app_cfg.cpp | 68 +-- app/HGProductionTool/app_cfg.h | 8 +- .../dialog_inputserialnum.cpp | 44 +- app/HGProductionTool/dialog_login.cpp | 29 +- app/HGProductionTool/dialog_login.h | 2 +- app/HGProductionTool/dialog_login.ui | 6 +- .../dialog_registeraccount.cpp | 2 +- app/HGProductionTool/form_burnmode.cpp | 483 ++++++++++++++++-- app/HGProductionTool/form_burnmode.h | 55 +- app/HGProductionTool/form_burnmode.ui | 325 ++++++++++-- app/HGProductionTool/form_maininterface.cpp | 2 + app/HGProductionTool/mainwindow.cpp | 13 +- app/HGProductionTool/mainwindow.h | 1 + 16 files changed, 1081 insertions(+), 215 deletions(-) diff --git a/app/HGProductionTool/HGProductionTool.pro b/app/HGProductionTool/HGProductionTool.pro index c570384..6719b36 100644 --- a/app/HGProductionTool/HGProductionTool.pro +++ b/app/HGProductionTool/HGProductionTool.pro @@ -74,7 +74,7 @@ win32 { } SOURCES += \ - HGString.cpp \ + ../../../code_app/utility/HGString.cpp \ app_cfg.cpp \ HGImgView.cpp \ HGUIGlobal.cpp \ @@ -99,7 +99,7 @@ SOURCES += \ ui_helper.cpp HEADERS += \ - HGString.h \ + ../../../code_app/utility/HGString.h \ app_cfg.h \ HGImgView.h \ HGUIGlobal.h \ diff --git a/app/HGProductionTool/ProductionTool_zh_CN.qm b/app/HGProductionTool/ProductionTool_zh_CN.qm index 09e182e2c42942d9a13a2db0df6602ff81846a83..b5688e1f1f30329075eb04408f6b8697727c2359 100644 GIT binary patch delta 3188 zcmb7Hd2kc=6@HQ>t+cv)O0s-t?fAgAEn^!*0s+Q$2=y%k4vlSDTFU}Ua&?$a)Qo~?2RWbPqgIA-6jA#?v=g6)iTS842GK5ZF65)u3ZngAU|tc3&h{V`Cm+*N z_-I@V;w+??)(_&cRqzx{r~&cI&jMt&fn;@MVdnZB{IR) zduD*b2*I`11px9`p(^h;01|`H95w=wI3(=S;`@l%!lSvkBwd{FOl37#LEa#|+mj1W z^itS!y6XVBSz*>h1gf-QYX?8U<$N3V*@zw+-wylSYX>lXDWb!%pg}FlEWqc<*F?of zZ2&QQMW&M9A)%Y1&TA~d#1>J{2eSYY{>g0>mI$tKXM|OOxuSPh;Sic_qI1urqZ1-U zmz=l~{bsT3jegYRrZ{RNp2Hb&)t8OP=~M9%8;U`-@-gBRALHNTV+M%VA4H2}G>Esb zeYon+#QXmsMBE(lNcKb&;}_x!bSj?p;>$fBqGb|xa6Ms(fr!a+QT@V044zAnQRIPU6FD=r@oF!PtDAm7?IA%;*xe}Lk%~>kd{sRk zV{WK=JkdyRp6dAWm!J+JqE)BjP@nKWtNtBe@wyt-f>)2C6%A^64LU`+PaSJUC*=Cn z$s_2D7`?i3odT_SPR-s!;9knO9!a{&pgz)t_K4Q&lzp_+o(+3xEWFB0Q{X5tq!~2WAQoM zF79uPPBVXfOL!Vpn%RsZP2ycJ`h$=Y?t}%p^QL zPAn7TgJcv#hK&!Gt+GUC_+)pQ8+I=nvCN<`xG3%tqv3WiX0CLCj=RD{B}l6x7BTF1n;w{eu4`x64#wwj23Z$Ik7tmD0&=dE zYk5{4)- zK~B*;jszNHA+-K~q4~}U(hY{joePqh)FA|2*TJ$jW_)i(&3MMR0{FL9HB^N1BS?Nn zFrR2pU0p$lP0~LZ_6WJC$Dll`JXPn7w)-A@1fVfnJa+a`8=82`0;6+w_ZjoN5X)@b z7ek)Cx`aF<*9bz-$c1|7R^*sjyb>P5Kbv95fpPd)r-_+?_jUZq{foxh$b5lGKc!vG zn)wIr6ElW{%l~mr@j|(L_(e!HQux(Vmf`2DX@;NsijfDV{uB-k1wE-_0$}Q1n{#nY zk5+!bWZI8m;$gl1cAtqUvpCvWTN1<6atT>dfsv?@qJlZ#0GoL|S_5NfM)@3vE%>pk zb_8Xc!tjZqE#Z!M$Yb(^Ba|$JVGv8kCyl13{6G97eu?~H4O%uBkyH^C6^Z{q6hTgH T3A=}U?rOEaY#X#rbPN9rC9hWH delta 1532 zcmX|Bdr(w$6h3$NKK9;Sb`fwFmUUMa0YOj_fe|117&J4*704t*LzYDYx8z|E<6=xs zqWHQpYJ*HEX;LD(=A#kK0k?4S5ktZlNu#MrW0s;LrPjA|XZ&O5+jGzF@jcGH+t+p# zr%yhaA9~?_L;b}F%h_e0wf!=Ki2s6!W)WF6z}JBP02dIAJOErs6mgh{?IsF4p`i8R zw)B_7s)@L7iK28wLI#n}hrKeGI1NG5!r8(P`Hn1bUg_Nnu$W|uZquON)~)V-Z%Tv)FDxx|Ho3)r}q zP=~wNl#YC&;fL6?)V&~3%$DDE62<>2x2aN@Tk<1Sh9{FfTm!PkJ#5dE7$hCUi3gjY z`92rC1C|Gl`!=miQ6>ryacEw|}3B9G|d8k~)Ytd~3fjS6IaTxa|Q zaJkR*OHrtIaYN}9=xTm_T>u` z3o)@VvxI3&J|eP22bl~G`H1Vh4=1HM>V>?k?rtn>IDPnje zbf1}xxK|0+p6-A%r-T9V4&0oeQ5_+~c|v0_6yr~xCMW?4V_P-z*UbSIY8of`of{PA z&Yn&*s!CjV0~bd-MY#q7ZS%y2zIQ!1;HJ3$oJ17TD(-Iw275$bCFVj*60fBu!SXKg z&+KdvNE9Cwu$YhCl1&e#p$=(IWgL;lBIP)ep{QMQuSD#@Ez+75e!L;=9B2j+wbbH& zxkIWIG)7A;Q&9`?($T=|-(cZr$(Jiau}ZpdDi#BGM4M5BjUh&D*41M~LH*iAZht*j zyYp!ptj^Ky>%#}YJYIXI_&oYez+1pL?fJ^T;N(>K85eDjuhfk>Gz!Z$>l{zO&(y2S zxpEC}yGyt9ZT~Sgc^+@|SO#@HA3$d054xc|$g=r#LvF~5N)AYA2Rq${fP(L9am?+2 z>L1s_&&GiN)}!O47PAmHQYz2o8=<8O8;3Ltm_f>reyF&C`;ZPTNN&m0M zi2-OeFuOW17&e2}kwr-qaMTc%g}|a880?)0c(~CpzZUW=*#_rxj n%nEfBZWUkjrA%j$b9w2==|x5UMc$m)lwgkaAK~3M*{%8?2YH7= diff --git a/app/HGProductionTool/ProductionTool_zh_CN.ts b/app/HGProductionTool/ProductionTool_zh_CN.ts index 8e03d34..258786a 100644 --- a/app/HGProductionTool/ProductionTool_zh_CN.ts +++ b/app/HGProductionTool/ProductionTool_zh_CN.ts @@ -434,8 +434,9 @@ - Show password - 显示密码 + remember password + Show password + 记住密码 @@ -458,22 +459,22 @@ FTP端口: - + Burn 烧录工位 - + InitTest 初检工位 - + ImageTest 图像测试工位 - + PressureTest 压力测试工位 @@ -530,35 +531,35 @@ 登录 - - - - + + + + Prompt 提示 - + Account dose not exist 账户不存在 - + Password can not be empty 密码不能为空 - + Password error 密码错误 - + Please select a profile first 请先选择配置文件 - + Select profile 选择配置文件 @@ -714,52 +715,195 @@ 烧录模式 - - Select All - 全选 + + Entering burning mode + 进入烧录模式 + + + + Confirm completion of burning + 确认烧录完成并重启 + + + + Check configuration + 检查配置是否一致 + + + + Complete + 完成 + + + + Abnormal exit + 异常退出 + + + Select All + 全选 - Burn - 进入烧录模式 + 进入烧录模式 Set sn 设置勾选项序列号 - Close - 关闭设备 + 关闭设备 - + ID 序号 - + selected 选择 - + device 设备 + + + Target Configration: + + 目标配置: + + + + + Speep mode: %1PPM + + 速度模式: %1PPM + + + + + Sleep time: %1minute + + 休眠时间: %1分钟 + + + + + Sleep time: Not sleeping + + 休眠时间: 不休眠 + + + + + Vid: %1 Pid: %2 + + Vid: %1 Pid: %2 + + + + + Current Configration of device: + 当前设备配置: + + + + + Speep mode: %1PPM + 速度模式: %1PPM + + + + + Sleep time: %1minute + 休眠时间: %1分钟 + + + + + Sleep time: Not sleeping + 休眠时间: 不休眠 + + + + + Vid: %1 Pid: %2 + Vid: %1 Pid: %2 + + + + Complete burning and configure device parameters: + Complete burning and configure device parameters: + 完成烧录并且配置设备参数: + + + + Speed mode + Speed time + 速度模式 + + + + Tester: %1, Test item: Burn, Test completed + 测试员: %1, 测试项: 烧录, 测试完成! + + + + Tester: %1, Test item: Burn, Test result: Failed! Reason: %2 + 测试员: %1, 测试项: 烧录, 测试失败! 原因:%2 + + + + Tester: %1, Test item: Burn, Test contents: %2 + 测试员: %1, 测试项: 烧录, 测试内容: %2 + + + Current Configration of device: + + 当前设备配置: + + + + + Sleep time + 休眠时间 + + + + Vid and Pid + Vid和Pid + + + + + Prompt + 提示 + + + + Inconsistent configuration %1detected, reconfigured, please check again + 检测到配置%1不一致,已重新配置,请再次检查 + + + + Consistent configuration + 配置一致! + serialNum 序列号 - - + tips 提示 - - + Please check a devices at least 请至少勾选一台设备 @@ -1013,7 +1157,7 @@ - + Not sleeping 不休眠 @@ -1040,46 +1184,46 @@ 设备序列号: %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 其他错误 @@ -1088,37 +1232,39 @@ 设备序列号:%1 - + ID 序号 - + Test items 测试项 - + status 测试状态 - + not test 未测试 - + + not pass 不通过 - + not support 不支持 - + + pass 通过 @@ -1144,14 +1290,14 @@ Pid: - - + + device roller count: 设备滚轴张数: - + image pixel: 标准圆:宽 * 高: @@ -1176,7 +1322,7 @@ - + minute 分钟 @@ -1213,7 +1359,7 @@ menu_device - 设备 + F5-刷新设备列表 diff --git a/app/HGProductionTool/app_cfg.cpp b/app/HGProductionTool/app_cfg.cpp index 8740d94..10b4d3c 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 4299390..0b5d122 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 7bc2773..611203e 100644 --- a/app/HGProductionTool/dialog_inputserialnum.cpp +++ b/app/HGProductionTool/dialog_inputserialnum.cpp @@ -101,30 +101,30 @@ void Dialog_InputSerialNum::setSpeedAndSleep(bool updateSleep) return; } - VIDPID vidpid; - vidpid.VID = jsonGlobal.vid_to; - vidpid.PID = jsonGlobal.pid_to; - int vidpidValue = vidpid.Value; - lp->cat = WRITE_CAT_VID_PID; - lp->val = (void*)&vidpidValue; - m_mainWnd->addTestingRef(); - func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg); +// VIDPID vidpid; +// vidpid.VID = jsonGlobal.vid_to; +// vidpid.PID = jsonGlobal.pid_to; +// int vidpidValue = vidpid.Value; +// lp->cat = WRITE_CAT_VID_PID; +// lp->val = (void*)&vidpidValue; +// m_mainWnd->addTestingRef(); +// func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg); - int speedMode = jsonGlobal.speed_mode ; - lp->cat = WRITE_CAT_SPEED; - lp->val = (void*)&speedMode; - m_mainWnd->addTestingRef(); - func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg); +// int speedMode = jsonGlobal.speed_mode ; +// lp->cat = WRITE_CAT_SPEED; +// lp->val = (void*)&speedMode; +// m_mainWnd->addTestingRef(); +// func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg); - QString device_model = jsonGlobal.device_model; - if (!device_model.isEmpty()) - { - std::wstring devModel = device_model.toStdWString(); - lp->cat = WRITE_CAT_DEVS_MODEL; - lp->val = (void*)devModel.c_str(); - m_mainWnd->addTestingRef(); - func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg); - } +// QString device_model = jsonGlobal.device_model; +// if (!device_model.isEmpty()) +// { +// std::wstring devModel = device_model.toStdWString(); +// lp->cat = WRITE_CAT_DEVS_MODEL; +// lp->val = (void*)devModel.c_str(); +// m_mainWnd->addTestingRef(); +// func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg); +// } delete lp; } diff --git a/app/HGProductionTool/dialog_login.cpp b/app/HGProductionTool/dialog_login.cpp index 5cc03e6..8cd38e9 100644 --- a/app/HGProductionTool/dialog_login.cpp +++ b/app/HGProductionTool/dialog_login.cpp @@ -26,6 +26,8 @@ Dialog_logIn::Dialog_logIn(QWidget *parent) : ui->pbtn_setting->setVisible(false); ui->radioButton_pressureTest->setVisible(false); + saveCfgValue("admin", "password", getCfgValue("admin", "password", QString("huagaoadmin"))); + ui->pbtn_setting->setToolTip(tr("Set host and port")); ui->pbtn_minum->setToolTip(tr("Minimize")); ui->pbtn_close->setToolTip(tr("Close")); @@ -34,7 +36,24 @@ Dialog_logIn::Dialog_logIn(QWidget *parent) : ui->lineEdit_profilePath->setReadOnly(true); m_profileName = getCfgValue("login", "profile", m_profileName); + ui->lineEdit_account->setText(getCfgValue("login", "account", QString(""))); ui->lineEdit_profilePath->setText(m_profileName); + ui->checkBox_rememberPswd->setChecked(getCfgValue("login", "rememberPassword", false)); + if (ui->lineEdit_account->text() == "admin") + ui->checkBox_rememberPswd->setChecked(false); + + if (ui->checkBox_rememberPswd->isChecked()) + { + QString account = ui->lineEdit_account->text(); + QString cfgPassword = getCfgValue(account.toStdString().c_str(), "password", QString("")); + + if (!cfgPassword.isEmpty()) + { + ui->lineEdit_password->setText(getCfgValue(account.toStdString().c_str(), "password", QString(""))); + } + } + + ui->stackedWidget->setCurrentIndex(0); // 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]+$"; @@ -49,13 +68,11 @@ Dialog_logIn::Dialog_logIn(QWidget *parent) : // 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); } Dialog_logIn::~Dialog_logIn() @@ -124,7 +141,7 @@ void Dialog_logIn::on_pbtn_login_clicked() QString account = ui->lineEdit_account->text(); QString password = ui->lineEdit_password->text(); - QString cfgPassword = getCfgValue(account.toStdString().c_str(), "password", ""); + QString cfgPassword = getCfgValue(account.toStdString().c_str(), "password", QString("")); if (cfgPassword.isEmpty()) { QMessageBox::information(this, tr("Prompt"), tr("Account dose not exist")); @@ -227,7 +244,7 @@ void Dialog_logIn::on_pbtn_selectCfgFile_clicked() saveCfgValue("login", "profile", m_profileName); } -void Dialog_logIn::on_checkBox_showPassword_toggled(bool checked) +void Dialog_logIn::on_checkBox_rememberPswd_toggled(bool checked) { - ui->lineEdit_password->setEchoMode(checked ? QLineEdit::Normal : QLineEdit::Password); + saveCfgValue("login", "rememberPassword", checked); } diff --git a/app/HGProductionTool/dialog_login.h b/app/HGProductionTool/dialog_login.h index b295799..b894648 100644 --- a/app/HGProductionTool/dialog_login.h +++ b/app/HGProductionTool/dialog_login.h @@ -48,7 +48,7 @@ private slots: void on_pbtn_selectCfgFile_clicked(); - void on_checkBox_showPassword_toggled(bool checked); + void on_checkBox_rememberPswd_toggled(bool checked); private: Ui::Dialog_logIn *ui; diff --git a/app/HGProductionTool/dialog_login.ui b/app/HGProductionTool/dialog_login.ui index 78dcf2f..9e5d080 100644 --- a/app/HGProductionTool/dialog_login.ui +++ b/app/HGProductionTool/dialog_login.ui @@ -216,17 +216,17 @@ QPushButton#pbtn_close::hover - + 310 90 - 111 + 121 21 - Show password + remember password diff --git a/app/HGProductionTool/dialog_registeraccount.cpp b/app/HGProductionTool/dialog_registeraccount.cpp index 811c79e..388f64f 100644 --- a/app/HGProductionTool/dialog_registeraccount.cpp +++ b/app/HGProductionTool/dialog_registeraccount.cpp @@ -36,7 +36,7 @@ void Dialog_RegisterAccount::on_pushButton_register_clicked() return; } - QString account = getCfgValue(ui->lineEdit_account->text().toStdString().c_str(), "password", ""); + QString account = getCfgValue(ui->lineEdit_account->text().toStdString().c_str(), "password", QString("")); if (!account.isEmpty()) { QMessageBox::information(this, tr("Prompt"), tr("User already exists")); diff --git a/app/HGProductionTool/form_burnmode.cpp b/app/HGProductionTool/form_burnmode.cpp index 6d345c3..d5f35af 100644 --- a/app/HGProductionTool/form_burnmode.cpp +++ b/app/HGProductionTool/form_burnmode.cpp @@ -6,19 +6,29 @@ #include "analysisjson.h" #include "base/HGBase.h" #include "HGUIGlobal.h" +#include "dialog_excepdesc.h" #include #include #include -Form_BurnMode::Form_BurnMode(class MainWindow *mainwnd, QWidget *parent) : +Form_BurnMode::Form_BurnMode(class MainWindow *mainwnd, const QString &profileName, const QString &accountName, QWidget *parent) : QWidget(parent), m_curIndex(0), + m_profileName(profileName), + m_accountName(accountName), m_mainwnd(mainwnd), + m_hg(nullptr), ui(new Ui::Form_BurnMode) { ui->setupUi(this); - ui->pbtn_close->setVisible(false); + ui->textEdit_target->setReadOnly(true); + ui->textEdit_curConfig->setReadOnly(true); + + ui->pbtn_enterBurnMode->setEnabled(true); + ui->pbtn_confirmFinishBurn->setEnabled(false); + ui->pbtn_checkConfig->setEnabled(false); + ui->pbtn_complete->setEnabled(false); connect(this, SIGNAL(testResult(bool)), this, SLOT(on_testResult(bool)), Qt::QueuedConnection); @@ -48,6 +58,8 @@ void Form_BurnMode::addDevice(DeviceManager *devManager) item->setData(Qt::UserRole, var); updatetablewidget(); + updateTargetCfg(); + updateCurDeviceCfg(); m_curIndex++; } @@ -72,11 +84,28 @@ void Form_BurnMode::deleteDevice(QString devName) } } updatetablewidget(); + updateTargetCfg(); + updateCurDeviceCfg(); +} + +DeviceManager *Form_BurnMode::getDevManager() +{ + for(int i = 0; i < ui->tableWidget->rowCount(); i++) + { + QTableWidgetItem *item = ui->tableWidget->item(i, 1); + if (item != nullptr && Qt::Checked == item->checkState()) + { + DeviceManager *devManager = (DeviceManager*)item->data(Qt::UserRole).value(); + return devManager; + } + } + + return nullptr; } void Form_BurnMode::on_testResult(bool setStatus) { - m_mainwnd->releaseTesting(); + //m_mainwnd->releaseTesting(); } void Form_BurnMode::initTableWidget() @@ -108,7 +137,7 @@ void Form_BurnMode::initTableWidget() ui->tableWidget->clearContents(); } -void Form_BurnMode::updatetablewidget() +void Form_BurnMode:: updatetablewidget() { for(int i = 0; i < ui->tableWidget->rowCount(); i++) { @@ -121,28 +150,119 @@ void Form_BurnMode::updatetablewidget() if (item != nullptr) item->setCheckState(Qt::Checked); } - ui->cbox_selectAll->setChecked(true); + //ui->cbox_selectAll->setChecked(true); } -void Form_BurnMode::on_cbox_selectAll_stateChanged(int arg1) +void Form_BurnMode::updateTargetCfg() { - (void)arg1; - bool check = ui->cbox_selectAll->isChecked(); + ui->textEdit_target->clear(); - for(int i = 0; i < ui->tableWidget->rowCount(); i++) - { - QTableWidgetItem *item = ui->tableWidget->item(i, 1); - if (item != nullptr) - { - if (check) - item->setCheckState(Qt::Checked); - else - item->setCheckState(Qt::Unchecked); - } - } + AnalysisJson analysisJson(m_profileName); + AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal(); + + int speedMode = jsonGlobal.speed_mode; + int sleepTime = jsonGlobal.sleep_time; + int vid_to = jsonGlobal.vid_to; + int pid_to = jsonGlobal.pid_to; + + char buf[10]; + sprintf(buf, "%x", vid_to); + + char buf2[10]; + sprintf(buf2, "%x", pid_to); + + QString content; + content += tr("Target Configration:\n\t"); + content += tr("Speep mode: %1PPM\n\t").arg(QString::number(speedMode)); + content.append(sleepTime > 0 ? tr("Sleep time: %1minute\n\t").arg(QString::number(sleepTime)) : tr("Sleep time: Not sleeping\n\t")); + content += tr("Vid: %1 Pid: %2\n\t").arg(QString::fromStdString(buf)).arg(QString::fromStdString(buf2)); + + ui->textEdit_target->setText(content); } -void Form_BurnMode::on_pbtn_burn_clicked() +void Form_BurnMode::updateCurDeviceCfg() +{ + ui->textEdit_curConfig->clear(); + + DeviceManager *devManager = getDevManager(); + if (devManager == nullptr) + return; + + int speedMode = devManager->getSpeedMode(); + int sleepTime = devManager->getSleepTime(); + int vid_to = devManager->getDevVid(); + int pid_to = devManager->getDevPid(); + + char buf[10]; + sprintf(buf, "%x", vid_to); + + char buf2[10]; + sprintf(buf2, "%x", pid_to); + + QString content; + content.append(tr("Current Configration of device:") + "\n\t"); + content.append(tr("Speep mode: %1PPM").arg(QString::number(speedMode)) + "\n\t"); + content.append(sleepTime > 0 ? tr("Sleep time: %1minute").arg(QString::number(sleepTime)) : tr("Sleep time: Not sleeping") + "\n\t"); + content.append(tr("Vid: %1 Pid: %2").arg(QString::fromStdString(buf)).arg(QString::fromStdString(buf2)) + "\n\t"); + + ui->textEdit_curConfig->setText(content); +} + +QString Form_BurnMode::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_BurnMode::writeTestLog(QString logContent) +{ + QString logPath = getLogPath(); + HGBase_CreateDir(getStdString(logPath).c_str()); + + DeviceManager *devManager = getDevManager(); + QString serialNum = devManager->getSerialNum(); + QString fileName = logPath + serialNum + ".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_BurnMode::on_cbox_selectAll_stateChanged(int arg1) +//{ +// (void)arg1; +// bool check = ui->cbox_selectAll->isChecked(); + +// for(int i = 0; i < ui->tableWidget->rowCount(); i++) +// { +// QTableWidgetItem *item = ui->tableWidget->item(i, 1); +// if (item != nullptr) +// { +// if (check) +// item->setCheckState(Qt::Checked); +// else +// item->setCheckState(Qt::Unchecked); +// } +// } +//} + +void Form_BurnMode::on_pbtn_enterBurnMode_clicked() { int select = 0; for(int i = 0; i < ui->tableWidget->rowCount(); i++) @@ -166,16 +286,25 @@ void Form_BurnMode::on_pbtn_burn_clicked() { DeviceManager *devManager = (DeviceManager*)item->data(Qt::UserRole).value(); devManager->setBurnMode(); + + ui->pbtn_confirmFinishBurn->setEnabled(true); + ui->pbtn_checkConfig->setEnabled(false); + ui->pbtn_complete->setEnabled(false); + + m_mainwnd->setLogOutStatus(false); } } } -DeviceManager::DeviceManager(class MainWindow *mainwnd, class Form_BurnMode *burnMode, SANE_Handle handle, const QString & devName) +DeviceManager::DeviceManager(class MainWindow *mainwnd, class Form_BurnMode *burnMode, SANE_Handle handle, + const QString &profileName, const QString & devName, const QString &serialNum) { m_mainwnd = mainwnd; m_burnMode = burnMode; m_handle = handle; + m_profileName = profileName; m_devName = devName; + m_serialNum = serialNum; m_hg = new hgscanner(nullptr, m_burnMode, nullptr, m_handle); } @@ -193,14 +322,149 @@ QString DeviceManager::getDevName() return m_devName; } +QString DeviceManager::getSerialNum() +{ + return m_serialNum; +} + void DeviceManager::setBurnMode() { const wchar_t *p = L"1"; - m_mainwnd->addTestingRef(); +// m_mainwnd->addTestingRef(); func_test_go(HGPDTTOOLDB_NAME_REBOOT_DEVICE, p, m_hg); } +void DeviceManager::setSpeedMode() +{ + AnalysisJson analysisJson(m_profileName); + AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal(); + LPWRITECFG lp = new WRITECFG; + + int speedMode = jsonGlobal.speed_mode; + lp->cat = WRITE_CAT_SPEED; + lp->val = (void*)&speedMode; + func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg); + + delete lp; +} + +void DeviceManager::setSleepTime() +{ + AnalysisJson analysisJson(m_profileName); + AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal(); + LPWRITECFG lp = new WRITECFG; + + int sleepTime = jsonGlobal.sleep_time; + lp->cat = WRITE_CAT_SLEEP; + lp->val = (void*)&sleepTime; + func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg); + + delete lp; +} + +void DeviceManager::setVidPid() +{ + AnalysisJson analysisJson(m_profileName); + AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal(); + LPWRITECFG lp = new WRITECFG; + + VIDPID vidpid; + vidpid.VID = jsonGlobal.vid_to; + vidpid.PID = jsonGlobal.pid_to; + int vidpidValue = vidpid.Value; + lp->cat = WRITE_CAT_VID_PID; + lp->val = (void*)&vidpidValue; + func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg); + + delete lp; +} + +void DeviceManager::rebootDevice() +{ + const wchar_t *p = L"0"; + func_test_go(HGPDTTOOLDB_NAME_REBOOT_DEVICE, p, m_hg); +} + +QString DeviceManager::getDevType() +{ + std::string firmWareNum; + unsigned int firmWareNumLen = 0; + if(SANE_STATUS_NO_MEM == sane_io_control(m_handle, IO_CTRL_CODE_GET_HARDWARE_VERSION, nullptr, &firmWareNumLen) && firmWareNumLen) + { + firmWareNum.resize(firmWareNumLen); + sane_io_control(m_handle, IO_CTRL_CODE_GET_HARDWARE_VERSION, &firmWareNum[0], &firmWareNumLen); + } + + QString str = QString::fromStdString(firmWareNum.c_str()); + return str.left(2) + "00"; +} + +int DeviceManager::getSpeedMode() +{ + SANE_Int speedMode = 0; + unsigned int len = sizeof(SANE_Int); + sane_io_control(m_handle, IO_CTRL_CODE_GET_SPEED_MODE, &speedMode, &len); + + const wchar_t G100[6] = { 70,80,90,110 }; + const wchar_t G200[6] = { 100,110,120,130 }; + const wchar_t G300[6] = { 40,50,60,70 }; + const wchar_t G400[6] = { 40,50,60,70,80 }; + + QString devType = getDevType(); + int speed = 0; + + if ((int)speedMode >= 40) + speed = (int)speedMode; + else + { + if (devType == "G100") + speed = G100[(int)speedMode - 1]; + else if (devType == "G200") + speed = G200[(int)speedMode - 1]; + else if (devType == "G300") + speed = G300[(int)speedMode - 1]; + else if (devType == "G400") + speed = G400[(int)speedMode - 1]; + } + + return speed; +} + +int DeviceManager::getSleepTime() +{ + int sleepTime = SANE_POWER_FIRST; + unsigned int len2 = sizeof(int); + sane_io_control(m_handle, IO_CTRL_CODE_GET_POWER_LEVEL, &sleepTime, &len2); + + if (sleepTime > 99999 || sleepTime == -1) + return 0; + + return (sleepTime / 60); +} + +int DeviceManager::getDevVid() +{ + VIDPID vidpid; + int vidpid_val; + unsigned int len = sizeof(int); + sane_io_control(m_handle, IO_CTRL_CODE_GET_VIDPID, &vidpid_val, &len); + vidpid.Value = vidpid_val; + int vid = vidpid.VID; + return vid; +} + +int DeviceManager::getDevPid() +{ + VIDPID vidpid; + int vidpid_val; + unsigned int len = sizeof(int); + sane_io_control(m_handle, IO_CTRL_CODE_GET_VIDPID, &vidpid_val, &len); + vidpid.Value = vidpid_val; + int pid = vidpid.PID; + return pid; +} + void Form_BurnMode::on_tableWidget_itemDoubleClicked(QTableWidgetItem *item) { int row = item->row(); @@ -215,36 +479,157 @@ void Form_BurnMode::on_tableWidget_itemDoubleClicked(QTableWidgetItem *item) } } -void Form_BurnMode::on_pbtn_close_clicked() +//void Form_BurnMode::on_pbtn_close_clicked() +//{ +// int select = 0; +// for(int i = 0; i < ui->tableWidget->rowCount(); i++) +// { +// QTableWidgetItem *item = ui->tableWidget->item(i, 1); +// if (item != nullptr && Qt::Checked == item->checkState()) +// { +// select++; +// } +// } +// if (select == 0) +// { +// QMessageBox::information(this, tr("tips"), tr("Please check a devices at least")); +// return; +// } + +// int rowCount = ui->tableWidget->rowCount(); +// for (int i = rowCount - 1; i >= 0; --i) +// { +// QTableWidgetItem *item = ui->tableWidget->item(i, 1); +// if (item != nullptr && Qt::Checked == item->checkState()) +// { +// DeviceManager *devManager = (DeviceManager*)item->data(Qt::UserRole).value(); +// delete devManager; + +// ui->tableWidget->removeRow(i); +// m_curIndex--; +// } +// } + +// updatetablewidget(); +//} + +void Form_BurnMode::on_pbtn_confirmFinishBurn_clicked() { - int select = 0; - for(int i = 0; i < ui->tableWidget->rowCount(); i++) - { - QTableWidgetItem *item = ui->tableWidget->item(i, 1); - if (item != nullptr && Qt::Checked == item->checkState()) - { - select++; - } - } - if (select == 0) - { - QMessageBox::information(this, tr("tips"), tr("Please check a devices at least")); + DeviceManager *devManager = getDevManager(); + if (devManager == nullptr) return; - } - int rowCount = ui->tableWidget->rowCount(); - for (int i = rowCount - 1; i >= 0; --i) - { - QTableWidgetItem *item = ui->tableWidget->item(i, 1); - if (item != nullptr && Qt::Checked == item->checkState()) - { - DeviceManager *devManager = (DeviceManager*)item->data(Qt::UserRole).value(); - delete devManager; + devManager->setSpeedMode(); + devManager->setSleepTime(); + devManager->setVidPid(); + devManager->rebootDevice(); - ui->tableWidget->removeRow(i); - m_curIndex--; - } - } + AnalysisJson analysisJson(m_profileName); + AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal(); + int speedMode_to = jsonGlobal.speed_mode; + int sleepTime_to = jsonGlobal.sleep_time; + int vid_to = jsonGlobal.vid_to; + int pid_to = jsonGlobal.pid_to; - updatetablewidget(); + char buf[10]; + sprintf(buf, "%x", vid_to); + + char buf2[10]; + sprintf(buf2, "%x", pid_to); + + QString content; + content.append(tr("Complete burning and configure device parameters: ")); + content.append(tr("Speep mode: %1PPM").arg(QString::number(speedMode_to)) + " "); + content.append(sleepTime_to > 0 ? tr("Sleep time: %1minute").arg(QString::number(sleepTime_to)) : tr("Sleep time: Not sleeping") + " "); + content.append(tr("Vid: %1 Pid: %2").arg(QString::fromStdString(buf)).arg(QString::fromStdString(buf2)) + " "); + writeTestLog(tr("Tester: %1, Test item: Burn, Test contents: %2").arg(m_accountName).arg(content)); + + ui->pbtn_checkConfig->setEnabled(true); +} + +void Form_BurnMode::on_pbtn_checkConfig_clicked() +{ + AnalysisJson analysisJson(m_profileName); + AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal(); + + int speedMode_to = jsonGlobal.speed_mode; + int sleepTime_to = jsonGlobal.sleep_time; + int vid_to = jsonGlobal.vid_to; + int pid_to = jsonGlobal.pid_to; + + DeviceManager *devManager = getDevManager(); + if (devManager == nullptr) + return; + + int speedMode = devManager->getSpeedMode(); + int sleepTime = devManager->getSleepTime(); + int vid = devManager->getDevVid(); + int pid = devManager->getDevPid(); + + QString item; + bool right = true; + LPWRITECFG lp = new WRITECFG; + if (speedMode_to != speedMode) + { + item.append(tr("Speed mode")); + item.append(" "); + right = false; + devManager->setSpeedMode(); + } + + if (sleepTime_to != sleepTime) + { + item.append(tr("Sleep time")); + item.append(" "); + right = false; + devManager->setSleepTime(); + } + + if (vid != vid_to || pid != pid_to) + { + item.append(tr("Vid and Pid")); + item.append(" "); + right = false; + devManager->setVidPid(); + } + + if (!right) + { + QMessageBox::information(this, tr("Prompt"), tr("Inconsistent configuration %1detected, reconfigured, please check again").arg(item)); + } + else + { + QMessageBox::information(this, tr("Prompt"), tr("Consistent configuration")); + + ui->pbtn_complete->setEnabled(true); + } + + delete lp; + + updateTargetCfg(); + updateCurDeviceCfg(); +} + +void Form_BurnMode::on_pbtn_complete_clicked() +{ + writeTestLog(tr("Tester: %1, Test item: Burn, Test completed").arg(m_accountName)); + ui->pbtn_enterBurnMode->setEnabled(true); + ui->pbtn_confirmFinishBurn->setEnabled(false); + ui->pbtn_checkConfig->setEnabled(false); + ui->pbtn_complete->setEnabled(false); + + m_mainwnd->setLogOutStatus(true); +} + +void Form_BurnMode::on_pbtn_abnormal_clicked() +{ + Dialog_ExcepDesc dlg; + if (dlg.exec()) + { + QString str = dlg.getExcepDesc(); + writeTestLog(tr("Tester: %1, Test item: Burn, Test result: Failed! Reason: %2") + .arg(m_accountName).arg(str)); + } + + m_mainwnd->setLogOutStatus(true); } diff --git a/app/HGProductionTool/form_burnmode.h b/app/HGProductionTool/form_burnmode.h index 770e2b3..0db4447 100644 --- a/app/HGProductionTool/form_burnmode.h +++ b/app/HGProductionTool/form_burnmode.h @@ -14,11 +14,24 @@ class Form_BurnMode; class DeviceManager { public: - DeviceManager(class MainWindow *mainwnd, class Form_BurnMode *burnMode, SANE_Handle handle, const QString &devName); + DeviceManager(class MainWindow *mainwnd, class Form_BurnMode *burnMode, SANE_Handle handle, + const QString &profileName, const QString &devName, const QString &serialNum); ~DeviceManager(); QString getDevName(); + QString getSerialNum(); void setBurnMode(); + void setSpeedMode(); + void setSleepTime(); + void setVidPid(); + void rebootDevice(); + + QString getDevType(); + int getSpeedMode(); + int getSleepTime(); + int getDevVid(); + int getDevPid(); + SANE_Handle m_handle; private: @@ -36,6 +49,8 @@ private: class MainWindow *m_mainwnd; class Form_BurnMode *m_burnMode; QString m_devName; + QString m_serialNum; + QString m_profileName; hgscanner *m_hg; }; @@ -45,12 +60,25 @@ class Form_BurnMode : public QWidget Q_OBJECT public: - explicit Form_BurnMode(class MainWindow *mainwnd, QWidget *parent = nullptr); + explicit Form_BurnMode(class MainWindow *mainwnd, const QString &profileName, const QString &accountName, QWidget *parent = nullptr); ~Form_BurnMode(); void addDevice(DeviceManager *devManager); void deleteDevice(QString devName); + DeviceManager *getDevManager(); + +private: + union VIDPID + { + struct + { + unsigned short VID; + unsigned short PID; + }; + unsigned int Value; + }; + signals: void testResult(bool setStatus); @@ -58,25 +86,38 @@ private slots: void on_testResult(bool setStatus); private slots: - void on_cbox_selectAll_stateChanged(int arg1); + //void on_cbox_selectAll_stateChanged(int arg1); - void on_pbtn_burn_clicked(); - -// void on_pbtn_setSn_clicked(); + void on_pbtn_enterBurnMode_clicked(); void on_tableWidget_itemDoubleClicked(QTableWidgetItem *item); - void on_pbtn_close_clicked(); + //void on_pbtn_close_clicked(); + + void on_pbtn_confirmFinishBurn_clicked(); + + void on_pbtn_checkConfig_clicked(); + + void on_pbtn_complete_clicked(); + + void on_pbtn_abnormal_clicked(); private: void initTableWidget(); void updatetablewidget(); + void updateTargetCfg(); + void updateCurDeviceCfg(); + QString getLogPath(); + void writeTestLog(QString logContent); private: Ui::Form_BurnMode *ui; class MainWindow *m_mainwnd; + hgscanner *m_hg; int m_curIndex; + QString m_profileName; + QString m_accountName; }; #endif // FORM_BURNMODE_H diff --git a/app/HGProductionTool/form_burnmode.ui b/app/HGProductionTool/form_burnmode.ui index 13045db..df71c6a 100644 --- a/app/HGProductionTool/form_burnmode.ui +++ b/app/HGProductionTool/form_burnmode.ui @@ -6,60 +6,306 @@ 0 0 - 527 - 321 + 735 + 718 Form - + - + + + + 16777215 + 180 + + + - - - Select All + + + + + + Qt::Vertical - - - - 91 - 31 - - - - Burn - - + + + + + + + + Qt::Vertical + + + + 20 + 33 + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 190 + 40 + + + + + 190 + 40 + + + + Qt::LeftToRight + + + Entering burning mode + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - - + + + Qt::Vertical + + - 91 - 31 + 20 + 13 - - Close - - + - - + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 190 + 40 + + + + + 190 + 40 + + + + Confirm completion of burning + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + - 43 - 23 + 20 + 13 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 190 + 40 + + + + + 190 + 40 + + + + Qt::LeftToRight + + + Check configuration + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 13 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 190 + 40 + + + + + 190 + 40 + + + + Qt::LeftToRight + + + Complete + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + Qt::Horizontal @@ -71,6 +317,25 @@ + + + + + 141 + 41 + + + + + 141 + 41 + + + + Abnormal exit + + + diff --git a/app/HGProductionTool/form_maininterface.cpp b/app/HGProductionTool/form_maininterface.cpp index c0d6c1b..a5c74eb 100644 --- a/app/HGProductionTool/form_maininterface.cpp +++ b/app/HGProductionTool/form_maininterface.cpp @@ -336,6 +336,7 @@ void Form_mainInterface::on_pbtn_fail_clicked() //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)->setBackgroundColor(QColor(255,0,0)); + ui->tableWidget->item(row, 2)->setText(tr("not pass")); QString str = dlg.getExcepDesc(); std::string name = m_map_title_name.value(title).name.toStdString(); @@ -365,6 +366,7 @@ void Form_mainInterface::on_pbtn_pass_clicked() //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)->setBackgroundColor(QColor(0,255,0)); + ui->tableWidget->item(row, 2)->setText(tr("pass")); QTableWidgetItem *item2 = ui->tableWidget->item(row, 2); item2->setToolTip(""); diff --git a/app/HGProductionTool/mainwindow.cpp b/app/HGProductionTool/mainwindow.cpp index 0439934..fb64350 100644 --- a/app/HGProductionTool/mainwindow.cpp +++ b/app/HGProductionTool/mainwindow.cpp @@ -34,6 +34,10 @@ MainWindow::MainWindow(Dialog_logIn::LogInType loginType, const QString &profile ui->act_manage->setVisible(false); ui->act_export->setVisible(false); ui->act_upload->setVisible(false); + ui->act_openLog->setVisible(false); + + if (m_accountName == "admin") + ui->act_openLog->setVisible(true); ui->act_refreshDevice->setShortcut(QKeySequence("F5")); @@ -54,7 +58,7 @@ MainWindow::MainWindow(Dialog_logIn::LogInType loginType, const QString &profile // ui->act_newDevice->setVisible(false); - m_formBurnMode = new Form_BurnMode(this, this); + m_formBurnMode = new Form_BurnMode(this, m_profileName, m_accountName, this); QVBoxLayout *vLayout = new QVBoxLayout; vLayout->addWidget(m_formBurnMode); @@ -385,6 +389,11 @@ QString MainWindow::getDevSn(SANE_Handle handle) return QString::fromStdString(serialNum.c_str()); } +void MainWindow::setLogOutStatus(bool show) +{ + ui->act_logOut->setVisible(show); +} + QString MainWindow::getDevType(SANE_Handle handle) { std::string firmWareNum; @@ -648,7 +657,7 @@ void MainWindow::on_act_refreshDevice_triggered() sane_open(name[i].c_str(), &devHandle); if (nullptr != devHandle) { - DeviceManager *devManager = new DeviceManager(this, m_formBurnMode, devHandle, name[i].c_str()); + DeviceManager *devManager = new DeviceManager(this, m_formBurnMode, devHandle, m_profileName, name[i].c_str(), getDevSn(devHandle)); m_formBurnMode->addDevice(devManager); } } diff --git a/app/HGProductionTool/mainwindow.h b/app/HGProductionTool/mainwindow.h index e0b02d3..9673e08 100644 --- a/app/HGProductionTool/mainwindow.h +++ b/app/HGProductionTool/mainwindow.h @@ -36,6 +36,7 @@ public: void releaseTesting(); bool isTesting(); QString getDevSn(SANE_Handle handle); + void setLogOutStatus(bool show); protected: void closeEvent(QCloseEvent *event);