改为登录界面自由选择配置文件

This commit is contained in:
yangjiaxuan 2023-08-31 15:15:14 +08:00
parent e5c59261e6
commit bd7130607d
17 changed files with 623 additions and 457 deletions

View File

@ -118,42 +118,42 @@
<translation></translation>
</message>
<message>
<location filename="dialog_inputserialnum.cpp" line="147"/>
<location filename="dialog_inputserialnum.cpp" line="154"/>
<location filename="dialog_inputserialnum.cpp" line="163"/>
<location filename="dialog_inputserialnum.cpp" line="170"/>
<location filename="dialog_inputserialnum.cpp" line="189"/>
<location filename="dialog_inputserialnum.cpp" line="194"/>
<location filename="dialog_inputserialnum.cpp" line="141"/>
<location filename="dialog_inputserialnum.cpp" line="148"/>
<location filename="dialog_inputserialnum.cpp" line="157"/>
<location filename="dialog_inputserialnum.cpp" line="164"/>
<location filename="dialog_inputserialnum.cpp" line="183"/>
<location filename="dialog_inputserialnum.cpp" line="188"/>
<source>tips</source>
<translation></translation>
</message>
<message>
<location filename="dialog_inputserialnum.cpp" line="147"/>
<location filename="dialog_inputserialnum.cpp" line="141"/>
<source>device is lost</source>
<translation></translation>
</message>
<message>
<location filename="dialog_inputserialnum.cpp" line="154"/>
<location filename="dialog_inputserialnum.cpp" line="148"/>
<source>Serial num is empty</source>
<translation></translation>
</message>
<message>
<location filename="dialog_inputserialnum.cpp" line="163"/>
<location filename="dialog_inputserialnum.cpp" line="157"/>
<source>sn is illegal</source>
<translation></translation>
</message>
<message>
<location filename="dialog_inputserialnum.cpp" line="170"/>
<location filename="dialog_inputserialnum.cpp" line="164"/>
<source>The device is testing</source>
<translation></translation>
</message>
<message>
<location filename="dialog_inputserialnum.cpp" line="189"/>
<location filename="dialog_inputserialnum.cpp" line="183"/>
<source>set sn failed</source>
<translation></translation>
</message>
<message>
<location filename="dialog_inputserialnum.cpp" line="194"/>
<location filename="dialog_inputserialnum.cpp" line="188"/>
<source>set sn succeed</source>
<translation></translation>
</message>
@ -167,7 +167,7 @@
</message>
<message>
<location filename="dialog_registeraccount.ui" line="26"/>
<location filename="dialog_registeraccount.cpp" line="16"/>
<location filename="dialog_registeraccount.cpp" line="14"/>
<source>Register</source>
<translation></translation>
</message>
@ -190,7 +190,7 @@
<message>
<location filename="dialog_registeraccount.cpp" line="29"/>
<location filename="dialog_registeraccount.cpp" line="35"/>
<location filename="dialog_registeraccount.cpp" line="41"/>
<location filename="dialog_registeraccount.cpp" line="42"/>
<source>Prompt</source>
<translation></translation>
</message>
@ -205,7 +205,7 @@
<translation></translation>
</message>
<message>
<location filename="dialog_registeraccount.cpp" line="41"/>
<location filename="dialog_registeraccount.cpp" line="42"/>
<source>User already exists</source>
<translation>!</translation>
</message>
@ -314,52 +314,44 @@
<translation></translation>
</message>
<message>
<location filename="dialog_accountmanage.cpp" line="52"/>
<location filename="dialog_accountmanage.cpp" line="76"/>
<location filename="dialog_accountmanage.cpp" line="94"/>
<location filename="dialog_accountmanage.cpp" line="98"/>
<source>tips</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="dialog_accountmanage.cpp" line="52"/>
<source>create user failed: </source>
<translation> </translation>
<translation type="vanished"> </translation>
</message>
<message>
<location filename="dialog_accountmanage.cpp" line="61"/>
<location filename="dialog_accountmanage.cpp" line="60"/>
<source>Question</source>
<translation></translation>
</message>
<message>
<location filename="dialog_accountmanage.cpp" line="62"/>
<location filename="dialog_accountmanage.cpp" line="61"/>
<source>Are you sure to destroy: </source>
<translation> </translation>
</message>
<message>
<location filename="dialog_accountmanage.cpp" line="64"/>
<location filename="dialog_accountmanage.cpp" line="63"/>
<source>yes</source>
<translation></translation>
</message>
<message>
<location filename="dialog_accountmanage.cpp" line="65"/>
<location filename="dialog_accountmanage.cpp" line="64"/>
<source>no</source>
<translation></translation>
</message>
<message>
<location filename="dialog_accountmanage.cpp" line="76"/>
<source>destroy user failed: </source>
<translation> </translation>
<translation type="vanished"> </translation>
</message>
<message>
<location filename="dialog_accountmanage.cpp" line="94"/>
<source>change password succeed</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="dialog_accountmanage.cpp" line="98"/>
<source>change password failed: </source>
<translation> </translation>
<translation type="vanished"> </translation>
</message>
</context>
<context>
@ -399,20 +391,18 @@
<translation></translation>
</message>
<message>
<location filename="dialog_changepwd.cpp" line="37"/>
<location filename="dialog_changepwd.cpp" line="44"/>
<location filename="dialog_changepwd.cpp" line="40"/>
<source>tips</source>
<translation></translation>
</message>
<message>
<location filename="dialog_changepwd.cpp" line="37"/>
<location filename="dialog_changepwd.cpp" line="40"/>
<source>The passwords entered twice are inconsistent</source>
<translation></translation>
</message>
<message>
<location filename="dialog_changepwd.cpp" line="44"/>
<source>Change passwords failed: </source>
<translation> </translation>
<translation type="vanished"> </translation>
</message>
</context>
<context>
@ -428,60 +418,80 @@
<translation></translation>
</message>
<message>
<location filename="dialog_login.ui" line="167"/>
<location filename="dialog_login.ui" line="158"/>
<source>Login</source>
<translation></translation>
</message>
<message>
<location filename="dialog_login.ui" line="183"/>
<source>account:</source>
<translation></translation>
</message>
<message>
<location filename="dialog_login.ui" line="190"/>
<location filename="dialog_login.ui" line="206"/>
<source>password:</source>
<translation></translation>
</message>
<message>
<location filename="dialog_login.ui" line="215"/>
<location filename="dialog_login.ui" line="229"/>
<source>Show password</source>
<translation></translation>
</message>
<message>
<location filename="dialog_login.ui" line="244"/>
<source>dbHost:</source>
<translation></translation>
</message>
<message>
<location filename="dialog_login.ui" line="238"/>
<location filename="dialog_login.ui" line="267"/>
<source>dbPort:</source>
<translation></translation>
</message>
<message>
<location filename="dialog_login.ui" line="261"/>
<location filename="dialog_login.ui" line="290"/>
<source>ftpHost:</source>
<translation>FTP地址</translation>
</message>
<message>
<location filename="dialog_login.ui" line="284"/>
<location filename="dialog_login.ui" line="313"/>
<source>ftpPort:</source>
<translation>FTP端口</translation>
</message>
<message>
<location filename="dialog_login.ui" line="328"/>
<location filename="dialog_login.ui" line="338"/>
<source>Burn</source>
<translation></translation>
</message>
<message>
<location filename="dialog_login.ui" line="344"/>
<location filename="dialog_login.ui" line="354"/>
<source>InitTest</source>
<translation></translation>
</message>
<message>
<location filename="dialog_login.ui" line="357"/>
<location filename="dialog_login.ui" line="367"/>
<source>ImageTest</source>
<translation></translation>
</message>
<message>
<location filename="dialog_login.ui" line="370"/>
<location filename="dialog_login.ui" line="380"/>
<source>PressureTest</source>
<translation></translation>
</message>
<message>
<location filename="dialog_login.ui" line="383"/>
<location filename="dialog_login.ui" line="412"/>
<source>Register</source>
<translation></translation>
</message>
<message>
<location filename="dialog_login.ui" line="418"/>
<source>Select Profile</source>
<translation></translation>
</message>
<message>
<location filename="dialog_login.ui" line="430"/>
<source>Select config file</source>
<translation></translation>
</message>
<message>
<source>host:</source>
<translation type="vanished">IP地址</translation>
@ -491,7 +501,7 @@
<translation type="vanished"></translation>
</message>
<message>
<location filename="dialog_login.ui" line="309"/>
<location filename="dialog_login.ui" line="393"/>
<source>LOG IN</source>
<translation></translation>
</message>
@ -520,24 +530,53 @@
<translation></translation>
</message>
<message>
<location filename="dialog_login.cpp" line="149"/>
<source>tips</source>
<location filename="dialog_login.cpp" line="130"/>
<location filename="dialog_login.cpp" line="136"/>
<location filename="dialog_login.cpp" line="142"/>
<location filename="dialog_login.cpp" line="148"/>
<source>Prompt</source>
<translation></translation>
</message>
<message>
<location filename="dialog_login.cpp" line="149"/>
<location filename="dialog_login.cpp" line="130"/>
<source>Account dose not exist</source>
<translation></translation>
</message>
<message>
<location filename="dialog_login.cpp" line="136"/>
<source>Password can not be empty</source>
<translation></translation>
</message>
<message>
<location filename="dialog_login.cpp" line="142"/>
<source>Password error</source>
<translation></translation>
</message>
<message>
<location filename="dialog_login.cpp" line="148"/>
<source>Please select a profile first</source>
<translation></translation>
</message>
<message>
<location filename="dialog_login.cpp" line="224"/>
<source>Select profile</source>
<translation></translation>
</message>
<message>
<source>tips</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Login failed, sure to enter offline mode?</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="dialog_login.cpp" line="150"/>
<source>yes</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="dialog_login.cpp" line="151"/>
<source>no</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<source>Login failed: </source>
@ -635,36 +674,32 @@
<translation></translation>
</message>
<message>
<location filename="dialog_uploadcfgfile.cpp" line="30"/>
<location filename="dialog_uploadcfgfile.cpp" line="29"/>
<source>Browse directory</source>
<translation></translation>
</message>
<message>
<location filename="dialog_uploadcfgfile.cpp" line="30"/>
<location filename="dialog_uploadcfgfile.cpp" line="29"/>
<source>config(*json)</source>
<translation>(*json)</translation>
</message>
<message>
<location filename="dialog_uploadcfgfile.cpp" line="42"/>
<location filename="dialog_uploadcfgfile.cpp" line="64"/>
<location filename="dialog_uploadcfgfile.cpp" line="69"/>
<location filename="dialog_uploadcfgfile.cpp" line="41"/>
<source>tips</source>
<translation></translation>
</message>
<message>
<location filename="dialog_uploadcfgfile.cpp" line="42"/>
<location filename="dialog_uploadcfgfile.cpp" line="41"/>
<source>empty filename</source>
<translation></translation>
</message>
<message>
<location filename="dialog_uploadcfgfile.cpp" line="64"/>
<source>upload succeed</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="dialog_uploadcfgfile.cpp" line="69"/>
<source>upload to service failed, already save to local host</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<source>upload failed: </source>
@ -698,17 +733,17 @@
<translation></translation>
</message>
<message>
<location filename="form_burnmode.cpp" line="89"/>
<location filename="form_burnmode.cpp" line="92"/>
<source>ID</source>
<translation></translation>
</message>
<message>
<location filename="form_burnmode.cpp" line="89"/>
<location filename="form_burnmode.cpp" line="92"/>
<source>selected</source>
<translation></translation>
</message>
<message>
<location filename="form_burnmode.cpp" line="89"/>
<location filename="form_burnmode.cpp" line="92"/>
<source>device</source>
<translation></translation>
</message>
@ -717,14 +752,14 @@
<translation type="vanished"></translation>
</message>
<message>
<location filename="form_burnmode.cpp" line="155"/>
<location filename="form_burnmode.cpp" line="332"/>
<location filename="form_burnmode.cpp" line="192"/>
<location filename="form_burnmode.cpp" line="267"/>
<source>tips</source>
<translation></translation>
</message>
<message>
<location filename="form_burnmode.cpp" line="155"/>
<location filename="form_burnmode.cpp" line="332"/>
<location filename="form_burnmode.cpp" line="192"/>
<location filename="form_burnmode.cpp" line="267"/>
<source>Please check a devices at least</source>
<translation></translation>
</message>
@ -978,7 +1013,7 @@
</message>
<message>
<location filename="form_maininterface.cpp" line="269"/>
<location filename="form_maininterface.cpp" line="603"/>
<location filename="form_maininterface.cpp" line="597"/>
<source>Not sleeping</source>
<translation></translation>
</message>
@ -995,48 +1030,56 @@
<translation>%1</translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="348"/>
<source>Serial number: %1, Test item: %2, Test result: Failed! Reason: %3</source>
<oldsource>Serial number: %1, Test item: %2, Test result: Failed! Reason: %3</oldsource>
<translation>: %1, : %2, 测试结果: 不通过! : %3</translation>
<translation type="vanished">: %1, : %2, 测试结果: 不通过! : %3</translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="372"/>
<source>Serial number: %1, Test item: %2, Test result: Pass!</source>
<oldsource>Serial number: %1, Test item: %2, Test result: Pass!</oldsource>
<translation>: %1, : %2, 测试结果: 通过!</translation>
<translation type="vanished">: %1, : %2, 测试结果: 通过!</translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="768"/>
<location filename="form_maininterface.cpp" line="839"/>
<location filename="form_maininterface.cpp" line="762"/>
<location filename="form_maininterface.cpp" line="833"/>
<source>device history scan count:</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="662"/>
<location filename="form_maininterface.cpp" line="666"/>
<location filename="form_maininterface.cpp" line="670"/>
<location filename="form_maininterface.cpp" line="674"/>
<location filename="form_maininterface.cpp" line="656"/>
<location filename="form_maininterface.cpp" line="660"/>
<location filename="form_maininterface.cpp" line="664"/>
<location filename="form_maininterface.cpp" line="668"/>
<source>Prompt</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="662"/>
<location filename="form_maininterface.cpp" line="348"/>
<source>Tester: %1, Test item: %2, Test result: Failed! Reason: %3</source>
<translation>: %1, : %2, 测试结果: 不通过! : %3</translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="372"/>
<source>Tester: %1, Test item: %2, Test result: Pass!</source>
<translation>: %1, : %2, 测试结果: 通过!</translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="656"/>
<source>No paper</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="666"/>
<location filename="form_maininterface.cpp" line="660"/>
<source>Device is sleeping</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="670"/>
<location filename="form_maininterface.cpp" line="664"/>
<source>Counting mode</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="674"/>
<location filename="form_maininterface.cpp" line="668"/>
<source>Other error</source>
<translation></translation>
</message>
@ -1060,22 +1103,22 @@
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="497"/>
<location filename="form_maininterface.cpp" line="491"/>
<source>not test</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="497"/>
<location filename="form_maininterface.cpp" line="491"/>
<source>not pass</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="497"/>
<location filename="form_maininterface.cpp" line="491"/>
<source>not support</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="497"/>
<location filename="form_maininterface.cpp" line="491"/>
<source>pass</source>
<translation></translation>
</message>
@ -1101,14 +1144,14 @@
<translation type="vanished">Pid</translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="762"/>
<location filename="form_maininterface.cpp" line="833"/>
<location filename="form_maininterface.cpp" line="756"/>
<location filename="form_maininterface.cpp" line="827"/>
<source>device roller count:</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="202"/>
<location filename="form_maininterface.cpp" line="563"/>
<location filename="form_maininterface.cpp" line="557"/>
<source>image pixel: </source>
<translation>标准圆: * : </translation>
</message>
@ -1133,7 +1176,7 @@
</translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="605"/>
<location filename="form_maininterface.cpp" line="599"/>
<source> minute</source>
<translation> </translation>
</message>
@ -1178,100 +1221,99 @@
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="54"/>
<location filename="mainwindow.ui" line="55"/>
<source>act_newDevice</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="59"/>
<location filename="mainwindow.ui" line="60"/>
<source>act_manage</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="64"/>
<location filename="mainwindow.ui" line="65"/>
<source>act_changePwd</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="69"/>
<location filename="mainwindow.ui" line="70"/>
<source>act_export</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="74"/>
<location filename="mainwindow.ui" line="75"/>
<source>act_logOut</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="79"/>
<location filename="mainwindow.ui" line="80"/>
<source>act_close</source>
<translation>退</translation>
</message>
<message>
<location filename="mainwindow.ui" line="84"/>
<location filename="mainwindow.ui" line="85"/>
<source>act_upload</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="89"/>
<location filename="mainwindow.ui" line="90"/>
<source>act_refreshDevice</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="506"/>
<location filename="mainwindow.ui" line="95"/>
<source>act_openLog</source>
<translation></translation>
</message>
<message>
<source>Account login elsewhere</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<source>Network connection lost</source>
<translation type="vanished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="509"/>
<source>You have been forced offline by the administrator account</source>
<translation>线</translation>
<translation type="vanished">线</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="512"/>
<source>Data base error</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="313"/>
<location filename="mainwindow.cpp" line="522"/>
<location filename="mainwindow.cpp" line="541"/>
<location filename="mainwindow.cpp" line="568"/>
<location filename="mainwindow.cpp" line="572"/>
<location filename="mainwindow.cpp" line="581"/>
<location filename="mainwindow.cpp" line="593"/>
<location filename="mainwindow.cpp" line="669"/>
<location filename="mainwindow.cpp" line="318"/>
<location filename="mainwindow.cpp" line="546"/>
<location filename="mainwindow.cpp" line="586"/>
<location filename="mainwindow.cpp" line="598"/>
<location filename="mainwindow.cpp" line="674"/>
<source>tips</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="48"/>
<location filename="mainwindow.cpp" line="53"/>
<source>production tool-burn station</source>
<translation>-</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="93"/>
<location filename="mainwindow.cpp" line="98"/>
<source>production tool-init test station</source>
<translation>-</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="95"/>
<location filename="mainwindow.cpp" line="100"/>
<source>production tool-image test station</source>
<translation>-</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="97"/>
<location filename="mainwindow.cpp" line="102"/>
<source>production tool-pressure test station</source>
<translation>-</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="313"/>
<location filename="mainwindow.cpp" line="581"/>
<location filename="mainwindow.cpp" line="593"/>
<location filename="mainwindow.cpp" line="318"/>
<location filename="mainwindow.cpp" line="586"/>
<location filename="mainwindow.cpp" line="598"/>
<source>Is testing, do not close!</source>
<translation></translation>
</message>
@ -1293,8 +1335,8 @@
<translation type="vanished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="541"/>
<location filename="mainwindow.cpp" line="669"/>
<location filename="mainwindow.cpp" line="546"/>
<location filename="mainwindow.cpp" line="674"/>
<source>cannot create more table</source>
<translation></translation>
</message>
@ -1311,49 +1353,40 @@
<translation type="vanished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="563"/>
<source>save</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="563"/>
<source>xls(*.xls)</source>
<translation>xls表格(*.xls)</translation>
<translation type="vanished">xls表格(*.xls)</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="568"/>
<source>export succeed</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="572"/>
<source>export failed</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="605"/>
<source>Illegal user</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="609"/>
<source>Wrong password</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="613"/>
<source>Database error</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="617"/>
<source>connect error</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="621"/>
<source>Failed</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
</context>
<context>

View File

@ -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);
//}

View File

@ -4,11 +4,11 @@
#include <QString>
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__ */

View File

@ -3,13 +3,14 @@
#include "mainwindow.h"
#include "base/HGBase.h"
Dialog_InputSerialNum::Dialog_InputSerialNum(class MainWindow *mainWnd, const QString &devName,
Dialog_InputSerialNum::Dialog_InputSerialNum(class MainWindow *mainWnd, const QString &devName, const QString &profileName,
SANE_Handle handle, const QString &serialNum, const QString &devType) :
QDialog(mainWnd),
ui(new Ui::Dialog_InputSerialNum),
m_mainWnd(mainWnd),
m_handle(handle),
m_valid(true),
m_profileName(profileName),
m_serialNum(serialNum),
m_devType(devType),
m_devName(devName),
@ -82,15 +83,9 @@ void Dialog_InputSerialNum::setSpeedAndSleep(bool updateSleep)
return;
}
HGChar cfgPath[512] = {0};
HGBase_GetConfigPath(cfgPath, 512);
HGBase_CreateDir(cfgPath);
strcat(cfgPath, m_devType.toStdString().c_str());
strcat(cfgPath, ".json");
//HGPdtToolDb_DownloadFile(m_pdtToolDbuserMgr, m_devType.toStdString().c_str(), cfgPath);
AnalysisJson analysisJson(QString::fromStdString(cfgPath));
AnalysisJson analysisJson(m_profileName);
AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
LPWRITECFG lp = new WRITECFG;

View File

@ -15,7 +15,7 @@ class Dialog_InputSerialNum : public QDialog
Q_OBJECT
public:
explicit Dialog_InputSerialNum(class MainWindow *mainWnd, const QString &devName,
explicit Dialog_InputSerialNum(class MainWindow *mainWnd, const QString &devName, const QString &profileName,
SANE_Handle handle, const QString &serialNum, const QString &devType);
~Dialog_InputSerialNum();
@ -54,6 +54,7 @@ private:
class MainWindow *m_mainWnd;
SANE_Handle m_handle;
bool m_valid;
QString m_profileName;
QString m_serialNum;
QString m_devType;
QString m_devName;

View File

@ -3,7 +3,9 @@
#include <QMessageBox>
#include <QRegExpValidator>
#include <QMouseEvent>
#include <QFileDialog>
#include "base/HGUtility.h"
#include "HGUIGlobal.h"
#include "dialog_registeraccount.h"
#include "app_cfg.h"
@ -11,6 +13,7 @@ Dialog_logIn::Dialog_logIn(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog_logIn)
, m_accountName("")
, m_profileName("")
{
ui->setupUi(this);
@ -28,25 +31,29 @@ Dialog_logIn::Dialog_logIn(QWidget *parent) :
ui->pbtn_close->setToolTip(tr("Close"));
ui->label_title->setText(tr("LogIn"));
ui->lineEdit_password->setEchoMode(QLineEdit::EchoMode::Password);
ui->lineEdit_profilePath->setReadOnly(true);
QString ipStr = "\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b";
QString portStr = "[0-9]+$";
ui->lineEdit_dbHost->setValidator(new QRegExpValidator(QRegExp(ipStr)));
ui->lineEdit_ftpHost->setValidator(new QRegExpValidator(QRegExp(ipStr)));
ui->lineEdit_dbPort->setValidator(new QRegExpValidator(QRegExp(portStr)));
ui->lineEdit_ftpPort->setValidator(new QRegExpValidator(QRegExp(portStr)));
m_profileName = getCfgValue("login", "profile", m_profileName);
ui->lineEdit_profilePath->setText(m_profileName);
QString account("root");
QString dbHost("192.168.1.70");
QString dbPort("3306");
QString ftpHost("192.168.1.70");
QString ftpPort("21");
// QString ipStr = "\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b";
// QString portStr = "[0-9]+$";
// ui->lineEdit_dbHost->setValidator(new QRegExpValidator(QRegExp(ipStr)));
// ui->lineEdit_ftpHost->setValidator(new QRegExpValidator(QRegExp(ipStr)));
// ui->lineEdit_dbPort->setValidator(new QRegExpValidator(QRegExp(portStr)));
// ui->lineEdit_ftpPort->setValidator(new QRegExpValidator(QRegExp(portStr)));
ui->lineEdit_account->setText(getCfgValue("login", "account", account));
ui->lineEdit_dbHost->setText(getCfgValue("login", "dbHost", dbHost));
ui->lineEdit_dbPort->setText(getCfgValue("login", "dbPort", dbPort));
ui->lineEdit_ftpHost->setText(getCfgValue("login", "ftpHost", ftpHost));
ui->lineEdit_ftpPort->setText(getCfgValue("login", "ftpPort", ftpPort));
// QString account("root");
// QString dbHost("192.168.1.70");
// QString dbPort("3306");
// QString ftpHost("192.168.1.70");
// QString ftpPort("21");
ui->lineEdit_account->setText(getCfgValue("login", "account", ""));
// ui->lineEdit_dbHost->setText(getCfgValue("login", "dbHost", dbHost));
// ui->lineEdit_dbPort->setText(getCfgValue("login", "dbPort", dbPort));
// ui->lineEdit_ftpHost->setText(getCfgValue("login", "ftpHost", ftpHost));
// ui->lineEdit_ftpPort->setText(getCfgValue("login", "ftpPort", ftpPort));
ui->stackedWidget->setCurrentIndex(0);
}
@ -81,6 +88,11 @@ QString Dialog_logIn::GetAccountName()
return m_accountName;
}
QString Dialog_logIn::GetProfileName()
{
return m_profileName;
}
void Dialog_logIn::mousePressEvent(QMouseEvent *event)
{
if(event->button()==Qt::LeftButton)
@ -111,16 +123,33 @@ void Dialog_logIn::on_pbtn_login_clicked()
{
QString account = ui->lineEdit_account->text();
QString password = ui->lineEdit_password->text();
QString dbHost = ui->lineEdit_dbHost->text();
QString dbPort = ui->lineEdit_dbPort->text();
QString ftpHost = ui->lineEdit_ftpHost->text();
QString ftpPort = ui->lineEdit_ftpPort->text();
QString cfgPassword = getCfgValue(account.toStdString().c_str(), "password", "");
if (cfgPassword.isEmpty())
{
QMessageBox::information(this, tr("Prompt"), tr("Account dose not exist"));
return;
}
if (password.isEmpty())
{
QMessageBox::information(this, tr("Prompt"), tr("Password can not be empty"));
return;
}
if (password != cfgPassword)
{
QMessageBox::information(this, tr("Prompt"), tr("Password error"));
return;
}
if (ui->lineEdit_profilePath->text().isEmpty())
{
QMessageBox::information(this, tr("Prompt"), tr("Please select a profile first"));
return;
}
saveCfgValue("login", "account", account);
saveCfgValue("login", "dbHost", dbHost);
saveCfgValue("login", "dbPort", dbPort);
saveCfgValue("login", "ftpHost", ftpHost);
saveCfgValue("login", "ftpPort", ftpPort);
if (ui->radioButton_burn->isChecked())
m_loginType = LogInType_Burn;
@ -189,3 +218,16 @@ void Dialog_logIn::on_pbtn_register_clicked()
dlg.exec();
}
void Dialog_logIn::on_pbtn_selectCfgFile_clicked()
{
QString fileName = QFileDialog::getOpenFileName(nullptr, tr("Select profile"), "", "*.json");
ui->lineEdit_profilePath->setText(fileName);
m_profileName = getStdFileName(fileName);
saveCfgValue("login", "profile", m_profileName);
}
void Dialog_logIn::on_checkBox_showPassword_toggled(bool checked)
{
ui->lineEdit_password->setEchoMode(checked ? QLineEdit::Normal : QLineEdit::Password);
}

View File

@ -29,6 +29,7 @@ public:
unsigned short GetFtpPort();
LogInType GetLogInType();
QString GetAccountName();
QString GetProfileName();
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
@ -45,6 +46,10 @@ private slots:
void on_pbtn_register_clicked();
void on_pbtn_selectCfgFile_clicked();
void on_checkBox_showPassword_toggled(bool checked);
private:
Ui::Dialog_logIn *ui;
@ -54,6 +59,7 @@ private:
bool m_leftMousePressed;
LogInType m_loginType;
QString m_accountName;
QString m_profileName;
};
#endif // DIALOG_LOGIN_H

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>479</width>
<height>329</height>
<width>538</width>
<height>339</height>
</rect>
</property>
<property name="windowTitle">
@ -18,7 +18,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>481</width>
<width>541</width>
<height>30</height>
</rect>
</property>
@ -141,247 +141,312 @@ QPushButton#pbtn_close::hover
</item>
</layout>
</widget>
<widget class="QStackedWidget" name="stackedWidget">
<widget class="QTabWidget" name="tabWidget">
<property name="geometry">
<rect>
<x>40</x>
<y>40</y>
<width>411</width>
<height>141</height>
<x>10</x>
<y>30</y>
<width>521</width>
<height>291</height>
</rect>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="page">
<widget class="QLabel" name="label_user">
<widget class="QWidget" name="tab_login">
<attribute name="title">
<string>Login</string>
</attribute>
<widget class="QStackedWidget" name="stackedWidget">
<property name="geometry">
<rect>
<x>80</x>
<y>30</y>
<width>48</width>
<height>16</height>
<x>60</x>
<y>0</y>
<width>421</width>
<height>141</height>
</rect>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="page">
<widget class="QLabel" name="label_user">
<property name="geometry">
<rect>
<x>80</x>
<y>30</y>
<width>48</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>account:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_account">
<property name="geometry">
<rect>
<x>140</x>
<y>30</y>
<width>161</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_password">
<property name="geometry">
<rect>
<x>80</x>
<y>90</y>
<width>54</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>password:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_password">
<property name="geometry">
<rect>
<x>140</x>
<y>90</y>
<width>161</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_showPassword">
<property name="geometry">
<rect>
<x>310</x>
<y>90</y>
<width>111</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Show password</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="page_2">
<widget class="QLabel" name="label_dbHost">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>111</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>dbHost:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_dbHost">
<property name="geometry">
<rect>
<x>150</x>
<y>20</y>
<width>171</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_dbPort">
<property name="geometry">
<rect>
<x>20</x>
<y>50</y>
<width>111</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>dbPort:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_dbPort">
<property name="geometry">
<rect>
<x>150</x>
<y>50</y>
<width>171</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_ftpHost">
<property name="geometry">
<rect>
<x>50</x>
<y>80</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>ftpHost:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_ftpHost">
<property name="geometry">
<rect>
<x>150</x>
<y>80</y>
<width>171</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_ftpPort">
<property name="geometry">
<rect>
<x>50</x>
<y>110</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>ftpPort:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_ftpPort">
<property name="geometry">
<rect>
<x>150</x>
<y>110</y>
<width>171</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QRadioButton" name="radioButton_pressureTest">
<property name="geometry">
<rect>
<x>80</x>
<y>40</y>
<width>151</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>PressureTest</string>
</property>
</widget>
</widget>
</widget>
<widget class="QRadioButton" name="radioButton_burn">
<property name="geometry">
<rect>
<x>40</x>
<y>150</y>
<width>131</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>account:</string>
<string>Burn</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_account">
<widget class="QRadioButton" name="radioButton_initTest">
<property name="geometry">
<rect>
<x>140</x>
<y>30</y>
<width>161</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_password">
<property name="geometry">
<rect>
<x>80</x>
<y>90</y>
<width>54</width>
<height>16</height>
<x>190</x>
<y>150</y>
<width>141</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>password:</string>
<string>InitTest</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_password">
<widget class="QRadioButton" name="radioButton_imageTest">
<property name="geometry">
<rect>
<x>140</x>
<y>90</y>
<width>161</width>
<height>22</height>
<x>340</x>
<y>150</y>
<width>151</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>ImageTest</string>
</property>
</widget>
<widget class="QPushButton" name="pbtn_login">
<property name="geometry">
<rect>
<x>150</x>
<y>210</y>
<width>75</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>LOG IN</string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton" name="pbtn_register">
<property name="geometry">
<rect>
<x>280</x>
<y>210</y>
<width>75</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Register</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="tab_selectProfile">
<attribute name="title">
<string>Select Profile</string>
</attribute>
<widget class="QPushButton" name="pbtn_selectCfgFile">
<property name="geometry">
<rect>
<x>170</x>
<y>140</y>
<width>141</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Select config file</string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_profilePath">
<property name="geometry">
<rect>
<x>20</x>
<y>60</y>
<width>481</width>
<height>31</height>
</rect>
</property>
</widget>
</widget>
<widget class="QWidget" name="page_2">
<widget class="QLabel" name="label_dbHost">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>111</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>dbHost:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_dbHost">
<property name="geometry">
<rect>
<x>150</x>
<y>20</y>
<width>171</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_dbPort">
<property name="geometry">
<rect>
<x>20</x>
<y>50</y>
<width>111</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>dbPort:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_dbPort">
<property name="geometry">
<rect>
<x>150</x>
<y>50</y>
<width>171</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_ftpHost">
<property name="geometry">
<rect>
<x>50</x>
<y>80</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>ftpHost:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_ftpHost">
<property name="geometry">
<rect>
<x>150</x>
<y>80</y>
<width>171</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_ftpPort">
<property name="geometry">
<rect>
<x>50</x>
<y>110</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>ftpPort:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_ftpPort">
<property name="geometry">
<rect>
<x>150</x>
<y>110</y>
<width>171</width>
<height>20</height>
</rect>
</property>
</widget>
</widget>
</widget>
<widget class="QPushButton" name="pbtn_login">
<property name="geometry">
<rect>
<x>140</x>
<y>280</y>
<width>75</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>LOG IN</string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
<widget class="QRadioButton" name="radioButton_burn">
<property name="geometry">
<rect>
<x>90</x>
<y>186</y>
<width>131</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Burn</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
<widget class="QRadioButton" name="radioButton_initTest">
<property name="geometry">
<rect>
<x>270</x>
<y>185</y>
<width>141</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>InitTest</string>
</property>
</widget>
<widget class="QRadioButton" name="radioButton_imageTest">
<property name="geometry">
<rect>
<x>90</x>
<y>230</y>
<width>151</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>ImageTest</string>
</property>
</widget>
<widget class="QRadioButton" name="radioButton_pressureTest">
<property name="geometry">
<rect>
<x>270</x>
<y>230</y>
<width>151</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>PressureTest</string>
</property>
</widget>
<widget class="QPushButton" name="pbtn_register">
<property name="geometry">
<rect>
<x>260</x>
<y>280</y>
<width>75</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Register</string>
</property>
</widget>
</widget>
<resources/>

View File

@ -36,7 +36,8 @@ void Dialog_RegisterAccount::on_pushButton_register_clicked()
return;
}
if (0)
QString account = getCfgValue(ui->lineEdit_account->text().toStdString().c_str(), "password", "");
if (!account.isEmpty())
{
QMessageBox::information(this, tr("Prompt"), tr("User already exists"));
return;

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>407</width>
<width>406</width>
<height>235</height>
</rect>
</property>

View File

@ -15,13 +15,14 @@
#include "dialog_excepdesc.h"
#include "huagao/hgscanner_error.h"
Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::LogInType logInType, const QString &accountName, SANE_Handle handle,
Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::LogInType logInType, const QString &profileName, const QString &accountName, SANE_Handle handle,
const QString &serialNum, const QString &devType, const QString &devName, const QString &devFwNum)
: QWidget(mainwnd)
, ui(new Ui::Form_mainInterface)
, m_mainwnd(mainwnd)
, m_logInType(logInType)
, m_accountName(accountName)
, m_profileName(profileName)
, m_hg(nullptr)
, m_handle(handle)
, m_disconnect(false)
@ -46,6 +47,7 @@ Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::
ui->pbtn_rightRotate->setVisible(false);
ui->pbtn_prePage->setVisible(false);
ui->pbtn_nextPage->setVisible(false);
ui->pbtn_stop->setVisible(false);
QFont ft;
ft.setPointSize(15);
@ -343,8 +345,8 @@ void Form_mainInterface::on_pbtn_fail_clicked()
QTableWidgetItem *item2 = ui->tableWidget->item(row, 2);
item2->setToolTip(str);
writeTestLog(tr("Serial number: %1, Test item: %2, Test result: Failed! Reason: %3")
.arg(m_serialNum).arg(title).arg(str));
writeTestLog(tr("Tester: %1, Test item: %2, Test result: Failed! Reason: %3")
.arg(m_accountName).arg(title).arg(str));
}
}
}
@ -367,8 +369,8 @@ void Form_mainInterface::on_pbtn_pass_clicked()
QTableWidgetItem *item2 = ui->tableWidget->item(row, 2);
item2->setToolTip("");
writeTestLog(tr("Serial number: %1, Test item: %2, Test result: Pass!")
.arg(m_serialNum).arg(title));
writeTestLog(tr("Tester: %1, Test item: %2, Test result: Pass!")
.arg(m_accountName).arg(title));
on_pbtn_nextStep_clicked();
}
@ -430,15 +432,9 @@ void Form_mainInterface::initTableWidgetUi()
ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
ui->tableWidget->setStyleSheet("selection-background-color:rgb(193,210,240)");
HGChar cfgPath[512] = {0};
HGBase_GetConfigPath(cfgPath, 512);
HGBase_CreateDir(cfgPath);
strcat(cfgPath, m_devType.toStdString().c_str());
strcat(cfgPath, ".json");
//HGPdtToolDb_DownloadFile(m_pdtToolDbuserMgr, m_devType.toStdString().c_str(), cfgPath);
AnalysisJson analysisJson(QString::fromStdString(cfgPath));
AnalysisJson analysisJson(m_profileName);
const QString stationStr[] = {"烧录工位", "初检工位", "图像测试工位", "压力测试工位"};
@ -690,7 +686,7 @@ void Form_mainInterface::writeTestLog(QString logContent)
QString logPath = getLogPath();
HGBase_CreateDir(getStdString(logPath).c_str());
QString fileName = logPath + m_accountName + ".log";
QString fileName = logPath + m_serialNum + ".log";
QFile file(fileName);
if(!file.open(QIODevice::ReadWrite | QIODevice::Append))
{

View File

@ -21,7 +21,7 @@ class Form_mainInterface : public QWidget
Q_OBJECT
public:
explicit Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::LogInType logInType, const QString &accountName, SANE_Handle handle,
explicit Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::LogInType logInType, const QString &profileName, const QString &accountName, SANE_Handle handle,
const QString &serialNum, const QString &devType, const QString &devName, const QString &devFwNum);
~Form_mainInterface();
@ -117,6 +117,7 @@ private:
class MainWindow *m_mainwnd;
Dialog_logIn::LogInType m_logInType;
QString m_accountName;
QString m_profileName;
hgscanner *m_hg;
SANE_Handle m_handle;
bool m_disconnect;

View File

@ -18,7 +18,7 @@ int main(int argc, char *argv[])
Dialog_logIn login;
if (login.exec())
{
MainWindow w(login.GetLogInType(), login.GetAccountName(), login.GetFtpHost(), login.GetFtpPort());
MainWindow w(login.GetLogInType(), login.GetProfileName(), login.GetAccountName(), login.GetFtpHost(), login.GetFtpPort());
a.exec();
if (w.isExitApp())
{

View File

@ -11,7 +11,7 @@
#include "dialog_inputserialnum.h"
#include "dialog_hgmessagebox.h"
MainWindow::MainWindow(Dialog_logIn::LogInType loginType, const QString &accountName, const QString &ftpHost, unsigned short ftpPort, QWidget *parent)
MainWindow::MainWindow(Dialog_logIn::LogInType loginType, const QString &profileName, const QString &accountName, const QString &ftpHost, unsigned short ftpPort, QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
, m_ftpHost(ftpHost)
@ -20,6 +20,7 @@ MainWindow::MainWindow(Dialog_logIn::LogInType loginType, const QString &account
, m_testingRef(0)
, m_loginType(loginType)
, m_accountName(accountName)
, m_profileName(profileName)
, m_formBurnMode(nullptr)
, m_top_splitter(nullptr)
, m_bot_splitter(nullptr)
@ -532,13 +533,13 @@ void MainWindow::on_update_userStatus()
void MainWindow::on_act_newDevice_triggered()
{
m_inputSnDlg = new Dialog_InputSerialNum(this, "", nullptr, "", "");
m_inputSnDlg = new Dialog_InputSerialNum(this, "", m_profileName, nullptr, "", "");
if (m_inputSnDlg->exec())
{
//HGPdtToolDbDevice pdtToolDbDevice = nullptr;
//HGPdtToolDb_OpenDevice(m_pdtToolDbuserMgr, m_inputSnDlg->GetSn().toStdString().c_str(), &pdtToolDbDevice);
Form_mainInterface *mainInterface = new Form_mainInterface(this, m_loginType, m_accountName, nullptr,
Form_mainInterface *mainInterface = new Form_mainInterface(this, m_loginType, m_profileName, m_accountName, nullptr,
m_inputSnDlg->GetSn(), m_inputSnDlg->GetDevType(), nullptr, nullptr);
if (!AddInterface(mainInterface))
{
@ -660,13 +661,13 @@ void MainWindow::on_act_refreshDevice_triggered()
sane_open(name[i].c_str(), &devHandle);
if (nullptr != devHandle)
{
m_inputSnDlg = new Dialog_InputSerialNum(this, name[i].c_str(), devHandle, getDevSn(devHandle), getDevType(devHandle));
m_inputSnDlg = new Dialog_InputSerialNum(this, name[i].c_str(), m_profileName, devHandle, getDevSn(devHandle), getDevType(devHandle));
if (m_inputSnDlg->exec())
{
//HGPdtToolDbDevice pdtToolDbDevice = nullptr;
//HGPdtToolDb_OpenDevice(m_pdtToolDbuserMgr, m_inputSnDlg->GetSn().toStdString().c_str(), &pdtToolDbDevice);
Form_mainInterface *mainInterface = new Form_mainInterface(this, m_loginType, m_accountName, devHandle,
Form_mainInterface *mainInterface = new Form_mainInterface(this, m_loginType, m_profileName, m_accountName, devHandle,
m_inputSnDlg->GetSn(), m_inputSnDlg->GetDevType(), name[i].c_str(), getDevFwNum(devHandle));
if (!AddInterface(mainInterface))
{
@ -684,3 +685,19 @@ void MainWindow::on_act_refreshDevice_triggered()
}
}
}
void MainWindow::on_act_openLog_triggered()
{
HGChar logPath[512];
HGBase_GetDocumentsPath(logPath, 512);
HGChar procName[512];
HGBase_GetProcessName(procName, 512);
strcat(logPath, procName);
strcat(logPath, "/Test_Log/");
QString fileName = logPath + m_accountName + ".log";
QFileInfo fileInfo(getStdFileName(fileName));
auto pathDir = fileInfo.path();
QString strFilePath = "file:///" + pathDir;
QDesktopServices::openUrl(QUrl(strFilePath));
}

View File

@ -21,7 +21,7 @@ class MainWindow : public QMainWindow
Q_OBJECT
public:
MainWindow(Dialog_logIn::LogInType loginType, const QString &accountName, const QString &ftpHost, unsigned short ftpPort, QWidget *parent = nullptr);
MainWindow(Dialog_logIn::LogInType loginType, const QString &profileName, const QString &accountName, const QString &ftpHost, unsigned short ftpPort, QWidget *parent = nullptr);
~MainWindow();
static QString getLogInfo(HGResult ret);
bool isExitApp();
@ -72,6 +72,8 @@ private slots:
void on_act_refreshDevice_triggered();
void on_act_openLog_triggered();
private:
QSplitter *m_top_splitter;
QSplitter *m_bot_splitter;
@ -85,6 +87,7 @@ private:
int m_testingRef;
Dialog_logIn::LogInType m_loginType;
QString m_accountName;
QString m_profileName;
class Dialog_InputSerialNum *m_inputSnDlg;
Form_BurnMode *m_formBurnMode;

View File

@ -44,6 +44,7 @@
<addaction name="act_upload"/>
<addaction name="separator"/>
<addaction name="act_logOut"/>
<addaction name="act_openLog"/>
</widget>
<addaction name="menu_device"/>
<addaction name="menu_user"/>
@ -89,6 +90,11 @@
<string>act_refreshDevice</string>
</property>
</action>
<action name="act_openLog">
<property name="text">
<string>act_openLog</string>
</property>
</action>
</widget>
<resources/>
<connections/>