调整烧录界面

This commit is contained in:
yangjiaxuan 2023-09-01 18:42:28 +08:00
parent 3c1ee82d88
commit 8ac3fa3388
16 changed files with 1081 additions and 215 deletions

View File

@ -74,7 +74,7 @@ win32 {
} }
SOURCES += \ SOURCES += \
HGString.cpp \ ../../../code_app/utility/HGString.cpp \
app_cfg.cpp \ app_cfg.cpp \
HGImgView.cpp \ HGImgView.cpp \
HGUIGlobal.cpp \ HGUIGlobal.cpp \
@ -99,7 +99,7 @@ SOURCES += \
ui_helper.cpp ui_helper.cpp
HEADERS += \ HEADERS += \
HGString.h \ ../../../code_app/utility/HGString.h \
app_cfg.h \ app_cfg.h \
HGImgView.h \ HGImgView.h \
HGUIGlobal.h \ HGUIGlobal.h \

View File

@ -434,8 +434,9 @@
</message> </message>
<message> <message>
<location filename="dialog_login.ui" line="229"/> <location filename="dialog_login.ui" line="229"/>
<source>Show password</source> <source>remember password</source>
<translation></translation> <oldsource>Show password</oldsource>
<translation></translation>
</message> </message>
<message> <message>
<location filename="dialog_login.ui" line="244"/> <location filename="dialog_login.ui" line="244"/>
@ -458,22 +459,22 @@
<translation>FTP端口</translation> <translation>FTP端口</translation>
</message> </message>
<message> <message>
<location filename="dialog_login.ui" line="338"/> <location filename="dialog_login.ui" line="351"/>
<source>Burn</source> <source>Burn</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="dialog_login.ui" line="354"/> <location filename="dialog_login.ui" line="367"/>
<source>InitTest</source> <source>InitTest</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="dialog_login.ui" line="367"/> <location filename="dialog_login.ui" line="380"/>
<source>ImageTest</source> <source>ImageTest</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="dialog_login.ui" line="380"/> <location filename="dialog_login.ui" line="336"/>
<source>PressureTest</source> <source>PressureTest</source>
<translation></translation> <translation></translation>
</message> </message>
@ -530,35 +531,35 @@
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="dialog_login.cpp" line="130"/> <location filename="dialog_login.cpp" line="143"/>
<location filename="dialog_login.cpp" line="136"/> <location filename="dialog_login.cpp" line="149"/>
<location filename="dialog_login.cpp" line="142"/> <location filename="dialog_login.cpp" line="155"/>
<location filename="dialog_login.cpp" line="148"/> <location filename="dialog_login.cpp" line="161"/>
<source>Prompt</source> <source>Prompt</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="dialog_login.cpp" line="130"/> <location filename="dialog_login.cpp" line="143"/>
<source>Account dose not exist</source> <source>Account dose not exist</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="dialog_login.cpp" line="136"/> <location filename="dialog_login.cpp" line="149"/>
<source>Password can not be empty</source> <source>Password can not be empty</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="dialog_login.cpp" line="142"/> <location filename="dialog_login.cpp" line="155"/>
<source>Password error</source> <source>Password error</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="dialog_login.cpp" line="148"/> <location filename="dialog_login.cpp" line="161"/>
<source>Please select a profile first</source> <source>Please select a profile first</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="dialog_login.cpp" line="224"/> <location filename="dialog_login.cpp" line="237"/>
<source>Select profile</source> <source>Select profile</source>
<translation></translation> <translation></translation>
</message> </message>
@ -714,52 +715,195 @@
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="form_burnmode.ui" line="25"/> <location filename="form_burnmode.ui" line="92"/>
<source>Select All</source> <source>Entering burning mode</source>
<translation></translation> <translation></translation>
</message>
<message>
<location filename="form_burnmode.ui" line="154"/>
<source>Confirm completion of burning</source>
<translation></translation>
</message>
<message>
<location filename="form_burnmode.ui" line="219"/>
<source>Check configuration</source>
<translation></translation>
</message>
<message>
<location filename="form_burnmode.ui" line="284"/>
<source>Complete</source>
<translation></translation>
</message>
<message>
<location filename="form_burnmode.ui" line="335"/>
<source>Abnormal exit</source>
<translation>退</translation>
</message>
<message>
<source>Select All</source>
<translation type="vanished"></translation>
</message> </message>
<message> <message>
<location filename="form_burnmode.ui" line="38"/>
<source>Burn</source> <source>Burn</source>
<translation></translation> <translation type="vanished"></translation>
</message> </message>
<message> <message>
<source>Set sn</source> <source>Set sn</source>
<translation type="vanished"></translation> <translation type="vanished"></translation>
</message> </message>
<message> <message>
<location filename="form_burnmode.ui" line="51"/>
<source>Close</source> <source>Close</source>
<translation></translation> <translation type="vanished"></translation>
</message> </message>
<message> <message>
<location filename="form_burnmode.cpp" line="92"/> <location filename="form_burnmode.cpp" line="125"/>
<source>ID</source> <source>ID</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="form_burnmode.cpp" line="92"/> <location filename="form_burnmode.cpp" line="125"/>
<source>selected</source> <source>selected</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="form_burnmode.cpp" line="92"/> <location filename="form_burnmode.cpp" line="125"/>
<source>device</source> <source>device</source>
<translation></translation> <translation></translation>
</message> </message>
<message>
<location filename="form_burnmode.cpp" line="179"/>
<source>Target Configration:
</source>
<translation>:
</translation>
</message>
<message>
<location filename="form_burnmode.cpp" line="180"/>
<source>Speep mode: %1PPM
</source>
<translation>: %1PPM
</translation>
</message>
<message>
<location filename="form_burnmode.cpp" line="181"/>
<source>Sleep time: %1minute
</source>
<translation>: %1
</translation>
</message>
<message>
<location filename="form_burnmode.cpp" line="181"/>
<source>Sleep time: Not sleeping
</source>
<translation>休眠时间: 不休眠
</translation>
</message>
<message>
<location filename="form_burnmode.cpp" line="182"/>
<source>Vid: %1 Pid: %2
</source>
<translation>Vid: %1 Pid: %2
</translation>
</message>
<message>
<location filename="form_burnmode.cpp" line="207"/>
<source>Current Configration of device:</source>
<translation>:</translation>
</message>
<message>
<location filename="form_burnmode.cpp" line="208"/>
<location filename="form_burnmode.cpp" line="544"/>
<source>Speep mode: %1PPM</source>
<translation>: %1PPM</translation>
</message>
<message>
<location filename="form_burnmode.cpp" line="209"/>
<location filename="form_burnmode.cpp" line="545"/>
<source>Sleep time: %1minute</source>
<translation>: %1</translation>
</message>
<message>
<location filename="form_burnmode.cpp" line="209"/>
<location filename="form_burnmode.cpp" line="545"/>
<source>Sleep time: Not sleeping</source>
<translation>休眠时间: 不休眠</translation>
</message>
<message>
<location filename="form_burnmode.cpp" line="210"/>
<location filename="form_burnmode.cpp" line="546"/>
<source>Vid: %1 Pid: %2</source>
<translation>Vid: %1 Pid: %2</translation>
</message>
<message>
<location filename="form_burnmode.cpp" line="543"/>
<source>Complete burning and configure device parameters: </source>
<oldsource>Complete burning and configure device parameters:</oldsource>
<translation>: </translation>
</message>
<message>
<location filename="form_burnmode.cpp" line="576"/>
<source>Speed mode</source>
<oldsource>Speed time</oldsource>
<translation></translation>
</message>
<message>
<location filename="form_burnmode.cpp" line="617"/>
<source>Tester: %1, Test item: Burn, Test completed</source>
<translation>: %1, 测试项: 烧录, </translation>
</message>
<message>
<location filename="form_burnmode.cpp" line="630"/>
<source>Tester: %1, Test item: Burn, Test result: Failed! Reason: %2</source>
<translation>: %1, 测试项: 烧录, %2</translation>
</message>
<message>
<location filename="form_burnmode.cpp" line="547"/>
<source>Tester: %1, Test item: Burn, Test contents: %2</source>
<translation>: %1, 测试项: 烧录, : %2</translation>
</message>
<message>
<source>Current Configration of device:
</source>
<translation type="vanished">:
</translation>
</message>
<message>
<location filename="form_burnmode.cpp" line="584"/>
<source>Sleep time</source>
<translation></translation>
</message>
<message>
<location filename="form_burnmode.cpp" line="592"/>
<source>Vid and Pid</source>
<translation>Vid和Pid</translation>
</message>
<message>
<location filename="form_burnmode.cpp" line="600"/>
<location filename="form_burnmode.cpp" line="604"/>
<source>Prompt</source>
<translation></translation>
</message>
<message>
<location filename="form_burnmode.cpp" line="600"/>
<source>Inconsistent configuration %1detected, reconfigured, please check again</source>
<translation>%1</translation>
</message>
<message>
<location filename="form_burnmode.cpp" line="604"/>
<source>Consistent configuration</source>
<translation></translation>
</message>
<message> <message>
<source>serialNum</source> <source>serialNum</source>
<translation type="vanished"></translation> <translation type="vanished"></translation>
</message> </message>
<message> <message>
<location filename="form_burnmode.cpp" line="192"/> <location filename="form_burnmode.cpp" line="282"/>
<location filename="form_burnmode.cpp" line="267"/>
<source>tips</source> <source>tips</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="form_burnmode.cpp" line="192"/> <location filename="form_burnmode.cpp" line="282"/>
<location filename="form_burnmode.cpp" line="267"/>
<source>Please check a devices at least</source> <source>Please check a devices at least</source>
<translation></translation> <translation></translation>
</message> </message>
@ -1013,7 +1157,7 @@
</message> </message>
<message> <message>
<location filename="form_maininterface.cpp" line="269"/> <location filename="form_maininterface.cpp" line="269"/>
<location filename="form_maininterface.cpp" line="597"/> <location filename="form_maininterface.cpp" line="599"/>
<source>Not sleeping</source> <source>Not sleeping</source>
<translation></translation> <translation></translation>
</message> </message>
@ -1040,46 +1184,46 @@
<translation type="vanished">: %1, : %2, 测试结果: 通过!</translation> <translation type="vanished">: %1, : %2, 测试结果: 通过!</translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.cpp" line="762"/> <location filename="form_maininterface.cpp" line="764"/>
<location filename="form_maininterface.cpp" line="833"/> <location filename="form_maininterface.cpp" line="835"/>
<source>device history scan count:</source> <source>device history scan count:</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.cpp" line="656"/> <location filename="form_maininterface.cpp" line="658"/>
<location filename="form_maininterface.cpp" line="660"/> <location filename="form_maininterface.cpp" line="662"/>
<location filename="form_maininterface.cpp" line="664"/> <location filename="form_maininterface.cpp" line="666"/>
<location filename="form_maininterface.cpp" line="668"/> <location filename="form_maininterface.cpp" line="670"/>
<source>Prompt</source> <source>Prompt</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.cpp" line="348"/> <location filename="form_maininterface.cpp" line="349"/>
<source>Tester: %1, Test item: %2, Test result: Failed! Reason: %3</source> <source>Tester: %1, Test item: %2, Test result: Failed! Reason: %3</source>
<translation>: %1, : %2, 测试结果: 不通过! : %3</translation> <translation>: %1, : %2, 测试结果: 不通过! : %3</translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.cpp" line="372"/> <location filename="form_maininterface.cpp" line="374"/>
<source>Tester: %1, Test item: %2, Test result: Pass!</source> <source>Tester: %1, Test item: %2, Test result: Pass!</source>
<translation>: %1, : %2, 测试结果: 通过!</translation> <translation>: %1, : %2, 测试结果: 通过!</translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.cpp" line="656"/> <location filename="form_maininterface.cpp" line="658"/>
<source>No paper</source> <source>No paper</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.cpp" line="660"/> <location filename="form_maininterface.cpp" line="662"/>
<source>Device is sleeping</source> <source>Device is sleeping</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.cpp" line="664"/> <location filename="form_maininterface.cpp" line="666"/>
<source>Counting mode</source> <source>Counting mode</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.cpp" line="668"/> <location filename="form_maininterface.cpp" line="670"/>
<source>Other error</source> <source>Other error</source>
<translation></translation> <translation></translation>
</message> </message>
@ -1088,37 +1232,39 @@
<translation type="vanished">%1</translation> <translation type="vanished">%1</translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.cpp" line="415"/> <location filename="form_maininterface.cpp" line="417"/>
<source>ID</source> <source>ID</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.cpp" line="415"/> <location filename="form_maininterface.cpp" line="417"/>
<source>Test items</source> <source>Test items</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.cpp" line="415"/> <location filename="form_maininterface.cpp" line="417"/>
<source>status</source> <source>status</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.cpp" line="491"/> <location filename="form_maininterface.cpp" line="493"/>
<source>not test</source> <source>not test</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.cpp" line="491"/> <location filename="form_maininterface.cpp" line="339"/>
<location filename="form_maininterface.cpp" line="493"/>
<source>not pass</source> <source>not pass</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.cpp" line="491"/> <location filename="form_maininterface.cpp" line="493"/>
<source>not support</source> <source>not support</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.cpp" line="491"/> <location filename="form_maininterface.cpp" line="369"/>
<location filename="form_maininterface.cpp" line="493"/>
<source>pass</source> <source>pass</source>
<translation></translation> <translation></translation>
</message> </message>
@ -1144,14 +1290,14 @@
<translation type="vanished">Pid</translation> <translation type="vanished">Pid</translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.cpp" line="756"/> <location filename="form_maininterface.cpp" line="758"/>
<location filename="form_maininterface.cpp" line="827"/> <location filename="form_maininterface.cpp" line="829"/>
<source>device roller count:</source> <source>device roller count:</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.cpp" line="202"/> <location filename="form_maininterface.cpp" line="202"/>
<location filename="form_maininterface.cpp" line="557"/> <location filename="form_maininterface.cpp" line="559"/>
<source>image pixel: </source> <source>image pixel: </source>
<translation>标准圆: * : </translation> <translation>标准圆: * : </translation>
</message> </message>
@ -1176,7 +1322,7 @@
</translation> </translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.cpp" line="599"/> <location filename="form_maininterface.cpp" line="601"/>
<source> minute</source> <source> minute</source>
<translation> </translation> <translation> </translation>
</message> </message>
@ -1213,7 +1359,7 @@
<message> <message>
<location filename="mainwindow.ui" line="28"/> <location filename="mainwindow.ui" line="28"/>
<source>menu_device</source> <source>menu_device</source>
<translation></translation> <translation>F5-</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="38"/> <location filename="mainwindow.ui" line="38"/>

View File

@ -17,27 +17,27 @@ QString getCfgValue(const char *appName, const char *key, const QString &def)
return StdStringToUtf8(value).c_str(); return StdStringToUtf8(value).c_str();
} }
//int getCfgValue(const char *appName, const char *key, int def) int getCfgValue(const char *appName, const char *key, int def)
//{ {
// HGChar cfgPath[512]; HGChar cfgPath[512];
// HGBase_GetConfigPath(cfgPath, 512); HGBase_GetConfigPath(cfgPath, 512);
// strcat(cfgPath, "config.ini"); strcat(cfgPath, "config.ini");
// HGInt value = 0; HGInt value = 0;
// HGBase_GetProfileInt(cfgPath, appName, key, def, &value); HGBase_GetProfileInt(cfgPath, appName, key, def, &value);
// return value; return value;
//} }
//bool getCfgValue(const char *appName, const char *key, bool def) bool getCfgValue(const char *appName, const char *key, bool def)
//{ {
// HGChar cfgPath[512]; HGChar cfgPath[512];
// HGBase_GetConfigPath(cfgPath, 512); HGBase_GetConfigPath(cfgPath, 512);
// strcat(cfgPath, "config.ini"); strcat(cfgPath, "config.ini");
// HGInt value = 0; HGInt value = 0;
// HGBase_GetProfileInt(cfgPath, appName, key, (HGInt)def, &value); HGBase_GetProfileInt(cfgPath, appName, key, (HGInt)def, &value);
// return (bool)value; return (bool)value;
//} }
void saveCfgValue(const char *appName, const char *key, const QString &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()); HGBase_SetProfileString(cfgPath, appName, key, getStdString(value).c_str());
} }
//void saveCfgValue(const char *appName, const char *key, int value) void saveCfgValue(const char *appName, const char *key, int value)
//{ {
// HGChar cfgPath[512]; HGChar cfgPath[512];
// HGBase_GetConfigPath(cfgPath, 512); HGBase_GetConfigPath(cfgPath, 512);
// HGBase_CreateDir(cfgPath); HGBase_CreateDir(cfgPath);
// strcat(cfgPath, "config.ini"); 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) void saveCfgValue(const char *appName, const char *key, bool value)
//{ {
// HGChar cfgPath[512]; HGChar cfgPath[512];
// HGBase_GetConfigPath(cfgPath, 512); HGBase_GetConfigPath(cfgPath, 512);
// HGBase_CreateDir(cfgPath); HGBase_CreateDir(cfgPath);
// strcat(cfgPath, "config.ini"); strcat(cfgPath, "config.ini");
// HGBase_SetProfileInt(cfgPath, appName, key, (HGInt)value); HGBase_SetProfileInt(cfgPath, appName, key, (HGInt)value);
//} }

View File

@ -4,11 +4,11 @@
#include <QString> #include <QString>
QString getCfgValue(const char *appName, const char *key, const QString &def); QString getCfgValue(const char *appName, const char *key, const QString &def);
//int getCfgValue(const char *appName, const char *key, int def); int getCfgValue(const char *appName, const char *key, int def);
//bool getCfgValue(const char *appName, const char *key, bool 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, const QString &value);
//void saveCfgValue(const char *appName, const char *key, int 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, bool value);
#endif /* __APP_CFG_H__ */ #endif /* __APP_CFG_H__ */

View File

@ -101,30 +101,30 @@ void Dialog_InputSerialNum::setSpeedAndSleep(bool updateSleep)
return; return;
} }
VIDPID vidpid; // VIDPID vidpid;
vidpid.VID = jsonGlobal.vid_to; // vidpid.VID = jsonGlobal.vid_to;
vidpid.PID = jsonGlobal.pid_to; // vidpid.PID = jsonGlobal.pid_to;
int vidpidValue = vidpid.Value; // int vidpidValue = vidpid.Value;
lp->cat = WRITE_CAT_VID_PID; // lp->cat = WRITE_CAT_VID_PID;
lp->val = (void*)&vidpidValue; // lp->val = (void*)&vidpidValue;
m_mainWnd->addTestingRef(); // m_mainWnd->addTestingRef();
func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg); // func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg);
int speedMode = jsonGlobal.speed_mode ; // int speedMode = jsonGlobal.speed_mode ;
lp->cat = WRITE_CAT_SPEED; // lp->cat = WRITE_CAT_SPEED;
lp->val = (void*)&speedMode; // lp->val = (void*)&speedMode;
m_mainWnd->addTestingRef(); // m_mainWnd->addTestingRef();
func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg); // func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg);
QString device_model = jsonGlobal.device_model; // QString device_model = jsonGlobal.device_model;
if (!device_model.isEmpty()) // if (!device_model.isEmpty())
{ // {
std::wstring devModel = device_model.toStdWString(); // std::wstring devModel = device_model.toStdWString();
lp->cat = WRITE_CAT_DEVS_MODEL; // lp->cat = WRITE_CAT_DEVS_MODEL;
lp->val = (void*)devModel.c_str(); // lp->val = (void*)devModel.c_str();
m_mainWnd->addTestingRef(); // m_mainWnd->addTestingRef();
func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg); // func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg);
} // }
delete lp; delete lp;
} }

View File

@ -26,6 +26,8 @@ Dialog_logIn::Dialog_logIn(QWidget *parent) :
ui->pbtn_setting->setVisible(false); ui->pbtn_setting->setVisible(false);
ui->radioButton_pressureTest->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_setting->setToolTip(tr("Set host and port"));
ui->pbtn_minum->setToolTip(tr("Minimize")); ui->pbtn_minum->setToolTip(tr("Minimize"));
ui->pbtn_close->setToolTip(tr("Close")); ui->pbtn_close->setToolTip(tr("Close"));
@ -34,7 +36,24 @@ Dialog_logIn::Dialog_logIn(QWidget *parent) :
ui->lineEdit_profilePath->setReadOnly(true); ui->lineEdit_profilePath->setReadOnly(true);
m_profileName = getCfgValue("login", "profile", m_profileName); m_profileName = getCfgValue("login", "profile", m_profileName);
ui->lineEdit_account->setText(getCfgValue("login", "account", QString("")));
ui->lineEdit_profilePath->setText(m_profileName); 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 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]+$"; // QString portStr = "[0-9]+$";
@ -49,13 +68,11 @@ Dialog_logIn::Dialog_logIn(QWidget *parent) :
// QString ftpHost("192.168.1.70"); // QString ftpHost("192.168.1.70");
// QString ftpPort("21"); // QString ftpPort("21");
ui->lineEdit_account->setText(getCfgValue("login", "account", ""));
// ui->lineEdit_dbHost->setText(getCfgValue("login", "dbHost", dbHost)); // ui->lineEdit_dbHost->setText(getCfgValue("login", "dbHost", dbHost));
// ui->lineEdit_dbPort->setText(getCfgValue("login", "dbPort", dbPort)); // ui->lineEdit_dbPort->setText(getCfgValue("login", "dbPort", dbPort));
// ui->lineEdit_ftpHost->setText(getCfgValue("login", "ftpHost", ftpHost)); // ui->lineEdit_ftpHost->setText(getCfgValue("login", "ftpHost", ftpHost));
// ui->lineEdit_ftpPort->setText(getCfgValue("login", "ftpPort", ftpPort)); // ui->lineEdit_ftpPort->setText(getCfgValue("login", "ftpPort", ftpPort));
ui->stackedWidget->setCurrentIndex(0);
} }
Dialog_logIn::~Dialog_logIn() Dialog_logIn::~Dialog_logIn()
@ -124,7 +141,7 @@ void Dialog_logIn::on_pbtn_login_clicked()
QString account = ui->lineEdit_account->text(); QString account = ui->lineEdit_account->text();
QString password = ui->lineEdit_password->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()) if (cfgPassword.isEmpty())
{ {
QMessageBox::information(this, tr("Prompt"), tr("Account dose not exist")); 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); 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);
} }

View File

@ -48,7 +48,7 @@ private slots:
void on_pbtn_selectCfgFile_clicked(); void on_pbtn_selectCfgFile_clicked();
void on_checkBox_showPassword_toggled(bool checked); void on_checkBox_rememberPswd_toggled(bool checked);
private: private:
Ui::Dialog_logIn *ui; Ui::Dialog_logIn *ui;

View File

@ -216,17 +216,17 @@ QPushButton#pbtn_close::hover
</rect> </rect>
</property> </property>
</widget> </widget>
<widget class="QCheckBox" name="checkBox_showPassword"> <widget class="QCheckBox" name="checkBox_rememberPswd">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>310</x> <x>310</x>
<y>90</y> <y>90</y>
<width>111</width> <width>121</width>
<height>21</height> <height>21</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>Show password</string> <string>remember password</string>
</property> </property>
</widget> </widget>
</widget> </widget>

View File

@ -36,7 +36,7 @@ void Dialog_RegisterAccount::on_pushButton_register_clicked()
return; 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()) if (!account.isEmpty())
{ {
QMessageBox::information(this, tr("Prompt"), tr("User already exists")); QMessageBox::information(this, tr("Prompt"), tr("User already exists"));

View File

@ -6,19 +6,29 @@
#include "analysisjson.h" #include "analysisjson.h"
#include "base/HGBase.h" #include "base/HGBase.h"
#include "HGUIGlobal.h" #include "HGUIGlobal.h"
#include "dialog_excepdesc.h"
#include <QMessageBox> #include <QMessageBox>
#include <QLineEdit> #include <QLineEdit>
#include <QInputDialog> #include <QInputDialog>
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), QWidget(parent),
m_curIndex(0), m_curIndex(0),
m_profileName(profileName),
m_accountName(accountName),
m_mainwnd(mainwnd), m_mainwnd(mainwnd),
m_hg(nullptr),
ui(new Ui::Form_BurnMode) ui(new Ui::Form_BurnMode)
{ {
ui->setupUi(this); 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); 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); item->setData(Qt::UserRole, var);
updatetablewidget(); updatetablewidget();
updateTargetCfg();
updateCurDeviceCfg();
m_curIndex++; m_curIndex++;
} }
@ -72,11 +84,28 @@ void Form_BurnMode::deleteDevice(QString devName)
} }
} }
updatetablewidget(); 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<void*>();
return devManager;
}
}
return nullptr;
} }
void Form_BurnMode::on_testResult(bool setStatus) void Form_BurnMode::on_testResult(bool setStatus)
{ {
m_mainwnd->releaseTesting(); //m_mainwnd->releaseTesting();
} }
void Form_BurnMode::initTableWidget() void Form_BurnMode::initTableWidget()
@ -108,7 +137,7 @@ void Form_BurnMode::initTableWidget()
ui->tableWidget->clearContents(); ui->tableWidget->clearContents();
} }
void Form_BurnMode::updatetablewidget() void Form_BurnMode:: updatetablewidget()
{ {
for(int i = 0; i < ui->tableWidget->rowCount(); i++) for(int i = 0; i < ui->tableWidget->rowCount(); i++)
{ {
@ -121,28 +150,119 @@ void Form_BurnMode::updatetablewidget()
if (item != nullptr) if (item != nullptr)
item->setCheckState(Qt::Checked); 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; ui->textEdit_target->clear();
bool check = ui->cbox_selectAll->isChecked();
for(int i = 0; i < ui->tableWidget->rowCount(); i++) AnalysisJson analysisJson(m_profileName);
{ AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
QTableWidgetItem *item = ui->tableWidget->item(i, 1);
if (item != nullptr) int speedMode = jsonGlobal.speed_mode;
{ int sleepTime = jsonGlobal.sleep_time;
if (check) int vid_to = jsonGlobal.vid_to;
item->setCheckState(Qt::Checked); int pid_to = jsonGlobal.pid_to;
else
item->setCheckState(Qt::Unchecked); 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; int select = 0;
for(int i = 0; i < ui->tableWidget->rowCount(); i++) 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<void*>(); DeviceManager *devManager = (DeviceManager*)item->data(Qt::UserRole).value<void*>();
devManager->setBurnMode(); 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_mainwnd = mainwnd;
m_burnMode = burnMode; m_burnMode = burnMode;
m_handle = handle; m_handle = handle;
m_profileName = profileName;
m_devName = devName; m_devName = devName;
m_serialNum = serialNum;
m_hg = new hgscanner(nullptr, m_burnMode, nullptr, m_handle); m_hg = new hgscanner(nullptr, m_burnMode, nullptr, m_handle);
} }
@ -193,14 +322,149 @@ QString DeviceManager::getDevName()
return m_devName; return m_devName;
} }
QString DeviceManager::getSerialNum()
{
return m_serialNum;
}
void DeviceManager::setBurnMode() void DeviceManager::setBurnMode()
{ {
const wchar_t *p = L"1"; const wchar_t *p = L"1";
m_mainwnd->addTestingRef(); // m_mainwnd->addTestingRef();
func_test_go(HGPDTTOOLDB_NAME_REBOOT_DEVICE, p, m_hg); 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) void Form_BurnMode::on_tableWidget_itemDoubleClicked(QTableWidgetItem *item)
{ {
int row = item->row(); 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<void*>();
// delete devManager;
// ui->tableWidget->removeRow(i);
// m_curIndex--;
// }
// }
// updatetablewidget();
//}
void Form_BurnMode::on_pbtn_confirmFinishBurn_clicked()
{ {
int select = 0; DeviceManager *devManager = getDevManager();
for(int i = 0; i < ui->tableWidget->rowCount(); i++) if (devManager == nullptr)
{
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; return;
}
int rowCount = ui->tableWidget->rowCount(); devManager->setSpeedMode();
for (int i = rowCount - 1; i >= 0; --i) devManager->setSleepTime();
{ devManager->setVidPid();
QTableWidgetItem *item = ui->tableWidget->item(i, 1); devManager->rebootDevice();
if (item != nullptr && Qt::Checked == item->checkState())
{
DeviceManager *devManager = (DeviceManager*)item->data(Qt::UserRole).value<void*>();
delete devManager;
ui->tableWidget->removeRow(i); AnalysisJson analysisJson(m_profileName);
m_curIndex--; 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);
} }

View File

@ -14,11 +14,24 @@ class Form_BurnMode;
class DeviceManager class DeviceManager
{ {
public: 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(); ~DeviceManager();
QString getDevName(); QString getDevName();
QString getSerialNum();
void setBurnMode(); void setBurnMode();
void setSpeedMode();
void setSleepTime();
void setVidPid();
void rebootDevice();
QString getDevType();
int getSpeedMode();
int getSleepTime();
int getDevVid();
int getDevPid();
SANE_Handle m_handle; SANE_Handle m_handle;
private: private:
@ -36,6 +49,8 @@ private:
class MainWindow *m_mainwnd; class MainWindow *m_mainwnd;
class Form_BurnMode *m_burnMode; class Form_BurnMode *m_burnMode;
QString m_devName; QString m_devName;
QString m_serialNum;
QString m_profileName;
hgscanner *m_hg; hgscanner *m_hg;
}; };
@ -45,12 +60,25 @@ class Form_BurnMode : public QWidget
Q_OBJECT Q_OBJECT
public: 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(); ~Form_BurnMode();
void addDevice(DeviceManager *devManager); void addDevice(DeviceManager *devManager);
void deleteDevice(QString devName); void deleteDevice(QString devName);
DeviceManager *getDevManager();
private:
union VIDPID
{
struct
{
unsigned short VID;
unsigned short PID;
};
unsigned int Value;
};
signals: signals:
void testResult(bool setStatus); void testResult(bool setStatus);
@ -58,25 +86,38 @@ private slots:
void on_testResult(bool setStatus); void on_testResult(bool setStatus);
private slots: private slots:
void on_cbox_selectAll_stateChanged(int arg1); //void on_cbox_selectAll_stateChanged(int arg1);
void on_pbtn_burn_clicked(); void on_pbtn_enterBurnMode_clicked();
// void on_pbtn_setSn_clicked();
void on_tableWidget_itemDoubleClicked(QTableWidgetItem *item); 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: private:
void initTableWidget(); void initTableWidget();
void updatetablewidget(); void updatetablewidget();
void updateTargetCfg();
void updateCurDeviceCfg();
QString getLogPath();
void writeTestLog(QString logContent);
private: private:
Ui::Form_BurnMode *ui; Ui::Form_BurnMode *ui;
class MainWindow *m_mainwnd; class MainWindow *m_mainwnd;
hgscanner *m_hg;
int m_curIndex; int m_curIndex;
QString m_profileName;
QString m_accountName;
}; };
#endif // FORM_BURNMODE_H #endif // FORM_BURNMODE_H

View File

@ -6,60 +6,306 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>527</width> <width>735</width>
<height>321</height> <height>718</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<widget class="QTableWidget" name="tableWidget"/> <widget class="QTableWidget" name="tableWidget">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>180</height>
</size>
</property>
</widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QCheckBox" name="cbox_selectAll"> <widget class="QTextEdit" name="textEdit_target"/>
<property name="text"> </item>
<string>Select All</string> <item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="pbtn_burn"> <widget class="QTextEdit" name="textEdit_curConfig"/>
<property name="minimumSize"> </item>
<size> </layout>
<width>91</width> </item>
<height>31</height> <item>
</size> <spacer name="verticalSpacer_4">
</property> <property name="orientation">
<property name="text"> <enum>Qt::Vertical</enum>
<string>Burn</string> </property>
</property> <property name="sizeHint" stdset="0">
</widget> <size>
<width>20</width>
<height>33</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pbtn_enterBurnMode">
<property name="minimumSize">
<size>
<width>190</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>190</width>
<height>40</height>
</size>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Entering burning mode</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item> </item>
<item> <item>
<widget class="QPushButton" name="pbtn_close"> <spacer name="verticalSpacer">
<property name="minimumSize"> <property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size> <size>
<width>91</width> <width>20</width>
<height>31</height> <height>13</height>
</size> </size>
</property> </property>
<property name="text"> </spacer>
<string>Close</string>
</property>
</widget>
</item> </item>
<item> <item>
<spacer name="horizontalSpacer"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="minimumSize"> <item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pbtn_confirmFinishBurn">
<property name="minimumSize">
<size>
<width>190</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>190</width>
<height>40</height>
</size>
</property>
<property name="text">
<string>Confirm completion of burning</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size> <size>
<width>43</width> <width>20</width>
<height>23</height> <height>13</height>
</size> </size>
</property> </property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pbtn_checkConfig">
<property name="minimumSize">
<size>
<width>190</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>190</width>
<height>40</height>
</size>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Check configuration</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>13</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pbtn_complete">
<property name="minimumSize">
<size>
<width>190</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>190</width>
<height>40</height>
</size>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Complete</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<spacer name="horizontalSpacer_9">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@ -71,6 +317,25 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item>
<widget class="QPushButton" name="pbtn_abnormal">
<property name="minimumSize">
<size>
<width>141</width>
<height>41</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>141</width>
<height>41</height>
</size>
</property>
<property name="text">
<string>Abnormal exit</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>

View File

@ -336,6 +336,7 @@ void Form_mainInterface::on_pbtn_fail_clicked()
//ui->tableWidget->setItem(row, 2, new QTableWidgetItem(getItemStatusStr(HGPDTTOOLDB_ENTRYSTATUS_NOTPASS))); //ui->tableWidget->setItem(row, 2, new QTableWidgetItem(getItemStatusStr(HGPDTTOOLDB_ENTRYSTATUS_NOTPASS)));
ui->tableWidget->item(row, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); ui->tableWidget->item(row, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
ui->tableWidget->item(row, 2)->setBackgroundColor(QColor(255,0,0)); ui->tableWidget->item(row, 2)->setBackgroundColor(QColor(255,0,0));
ui->tableWidget->item(row, 2)->setText(tr("not pass"));
QString str = dlg.getExcepDesc(); QString str = dlg.getExcepDesc();
std::string name = m_map_title_name.value(title).name.toStdString(); std::string name = m_map_title_name.value(title).name.toStdString();
@ -365,6 +366,7 @@ void Form_mainInterface::on_pbtn_pass_clicked()
//ui->tableWidget->setItem(row, 2, new QTableWidgetItem(getItemStatusStr(HGPDTTOOLDB_ENTRYSTATUS_PASS))); //ui->tableWidget->setItem(row, 2, new QTableWidgetItem(getItemStatusStr(HGPDTTOOLDB_ENTRYSTATUS_PASS)));
ui->tableWidget->item(row, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); ui->tableWidget->item(row, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
ui->tableWidget->item(row, 2)->setBackgroundColor(QColor(0,255,0)); ui->tableWidget->item(row, 2)->setBackgroundColor(QColor(0,255,0));
ui->tableWidget->item(row, 2)->setText(tr("pass"));
QTableWidgetItem *item2 = ui->tableWidget->item(row, 2); QTableWidgetItem *item2 = ui->tableWidget->item(row, 2);
item2->setToolTip(""); item2->setToolTip("");

View File

@ -34,6 +34,10 @@ MainWindow::MainWindow(Dialog_logIn::LogInType loginType, const QString &profile
ui->act_manage->setVisible(false); ui->act_manage->setVisible(false);
ui->act_export->setVisible(false); ui->act_export->setVisible(false);
ui->act_upload->setVisible(false); ui->act_upload->setVisible(false);
ui->act_openLog->setVisible(false);
if (m_accountName == "admin")
ui->act_openLog->setVisible(true);
ui->act_refreshDevice->setShortcut(QKeySequence("F5")); ui->act_refreshDevice->setShortcut(QKeySequence("F5"));
@ -54,7 +58,7 @@ MainWindow::MainWindow(Dialog_logIn::LogInType loginType, const QString &profile
// ui->act_newDevice->setVisible(false); // 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; QVBoxLayout *vLayout = new QVBoxLayout;
vLayout->addWidget(m_formBurnMode); vLayout->addWidget(m_formBurnMode);
@ -385,6 +389,11 @@ QString MainWindow::getDevSn(SANE_Handle handle)
return QString::fromStdString(serialNum.c_str()); return QString::fromStdString(serialNum.c_str());
} }
void MainWindow::setLogOutStatus(bool show)
{
ui->act_logOut->setVisible(show);
}
QString MainWindow::getDevType(SANE_Handle handle) QString MainWindow::getDevType(SANE_Handle handle)
{ {
std::string firmWareNum; std::string firmWareNum;
@ -648,7 +657,7 @@ void MainWindow::on_act_refreshDevice_triggered()
sane_open(name[i].c_str(), &devHandle); sane_open(name[i].c_str(), &devHandle);
if (nullptr != devHandle) if (nullptr != devHandle)
{ {
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); m_formBurnMode->addDevice(devManager);
} }
} }

View File

@ -36,6 +36,7 @@ public:
void releaseTesting(); void releaseTesting();
bool isTesting(); bool isTesting();
QString getDevSn(SANE_Handle handle); QString getDevSn(SANE_Handle handle);
void setLogOutStatus(bool show);
protected: protected:
void closeEvent(QCloseEvent *event); void closeEvent(QCloseEvent *event);