增加设置固件语言模式功能

This commit is contained in:
yangjiaxuan 2024-01-19 09:10:31 +08:00
parent f43982b4cd
commit a1be80f341
7 changed files with 97 additions and 26 deletions

View File

@ -524,12 +524,27 @@
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="dialog_userinput.cpp" line="96"/> <location filename="dialog_userinput.cpp" line="87"/>
<source>simpleCN</source>
<translation></translation>
</message>
<message>
<location filename="dialog_userinput.cpp" line="87"/>
<source>trodiCN</source>
<translation></translation>
</message>
<message>
<location filename="dialog_userinput.cpp" line="87"/>
<source>English</source>
<translation></translation>
</message>
<message>
<location filename="dialog_userinput.cpp" line="98"/>
<source>tips</source> <source>tips</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="dialog_userinput.cpp" line="96"/> <location filename="dialog_userinput.cpp" line="98"/>
<source>please input valid contents</source> <source>please input valid contents</source>
<translation></translation> <translation></translation>
</message> </message>
@ -789,33 +804,39 @@
<translation type="vanished"></translation> <translation type="vanished"></translation>
</message> </message>
<message> <message>
<location filename="dialog_login.cpp" line="170"/> <location filename="dialog_login.cpp" line="172"/>
<location filename="dialog_login.cpp" line="176"/> <location filename="dialog_login.cpp" line="178"/>
<location filename="dialog_login.cpp" line="182"/> <location filename="dialog_login.cpp" line="184"/>
<location filename="dialog_login.cpp" line="188"/> <location filename="dialog_login.cpp" line="190"/>
<location filename="dialog_login.cpp" line="277"/>
<source>Prompt</source> <source>Prompt</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="dialog_login.cpp" line="170"/> <location filename="dialog_login.cpp" line="172"/>
<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="176"/> <location filename="dialog_login.cpp" line="178"/>
<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="182"/> <location filename="dialog_login.cpp" line="184"/>
<source>Password error</source> <source>Password error</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="dialog_login.cpp" line="188"/> <location filename="dialog_login.cpp" line="190"/>
<source>Please select a profile first</source> <source>Please select a profile first</source>
<translation></translation> <translation></translation>
</message> </message>
<message>
<location filename="dialog_login.cpp" line="277"/>
<source>Profile is not exsits</source>
<translation></translation>
</message>
<message> <message>
<source>Select profile</source> <source>Select profile</source>
<translation type="vanished"></translation> <translation type="vanished"></translation>
@ -1884,19 +1905,19 @@
<context> <context>
<name>QObject</name> <name>QObject</name>
<message> <message>
<location filename="hgscanner.cpp" line="163"/> <location filename="hgscanner.cpp" line="168"/>
<source>success: </source> <source>success: </source>
<oldsource>success</oldsource> <oldsource>success</oldsource>
<translation>: </translation> <translation>: </translation>
</message> </message>
<message> <message>
<location filename="hgscanner.cpp" line="107"/> <location filename="hgscanner.cpp" line="112"/>
<location filename="hgscanner.cpp" line="165"/> <location filename="hgscanner.cpp" line="170"/>
<source>failed: </source> <source>failed: </source>
<translation> </translation> <translation> </translation>
</message> </message>
<message> <message>
<location filename="hgscanner.cpp" line="91"/> <location filename="hgscanner.cpp" line="96"/>
<source>Not find test item</source> <source>Not find test item</source>
<translation></translation> <translation></translation>
</message> </message>

View File

@ -28,14 +28,7 @@ Dialog_UserInput::Dialog_UserInput(ui_helper::value_type type, const QString &ti
} }
else if (type == ui_helper::VAL_TYPE_TIPS_VAL) else if (type == ui_helper::VAL_TYPE_TIPS_VAL)
{ {
ui_helper::PINFOTIPS p = (ui_helper::PINFOTIPS)desc; ui->label->setText(QString::fromStdWString(desc));
while(*(p->desc) != '\0')
{
ui->comboBox->addItem(QString::number(*(p->desc)));
p->desc++;
}
ui->label->setText(QString::fromStdWString(p->info));
ui->comboBox->setVisible(true); ui->comboBox->setVisible(true);
} }
@ -77,7 +70,7 @@ parameter *Dialog_UserInput::getParam()
} }
else if (m_type == ui_helper::VAL_TYPE_TIPS_VAL) else if (m_type == ui_helper::VAL_TYPE_TIPS_VAL)
{ {
param->m_iData = ui->comboBox->currentText().toInt(); param->m_iData = ui->comboBox->currentIndex();
} }
return param; return param;
@ -89,6 +82,15 @@ void Dialog_UserInput::setDistortValue(double value)
ui->lineEdit->selectAll(); ui->lineEdit->selectAll();
} }
void Dialog_UserInput::setFwLanguageMode()
{
QStringList mode = { tr("simpleCN"), tr("trodiCN"), tr("English") };
for (int i = 0; i < mode.size(); i++)
{
ui->comboBox->addItem(mode[i]);
}
}
void Dialog_UserInput::on_pbtn_yes_clicked() void Dialog_UserInput::on_pbtn_yes_clicked()
{ {
if (ui->lineEdit->text().isEmpty() && (m_type == ui_helper::VAL_TYPE_INT || m_type == ui_helper::VAL_TYPE_FLOAT || m_type == ui_helper::VAL_TYPE_STRING)) if (ui->lineEdit->text().isEmpty() && (m_type == ui_helper::VAL_TYPE_INT || m_type == ui_helper::VAL_TYPE_FLOAT || m_type == ui_helper::VAL_TYPE_STRING))

View File

@ -35,6 +35,7 @@ public:
parameter *getParam(); parameter *getParam();
void setDistortValue(double value); void setDistortValue(double value);
void setFwLanguageMode();
private slots: private slots:
void on_pbtn_yes_clicked(); void on_pbtn_yes_clicked();

View File

@ -36,6 +36,11 @@ parameter* hgscanner::get_user_input(data_from from, value_type type, const wcha
{ {
dlg.setDistortValue(m_distortValue); dlg.setDistortValue(m_distortValue);
} }
if (wcscmp(L"SET_FIRMWARE_LANGUAGE", title) == 0)
{
dlg.setFwLanguageMode();
}
if (dlg.exec()) if (dlg.exec())
{ {
return dlg.getParam(); return dlg.getParam();

View File

@ -48,7 +48,8 @@ static struct Test_Map
{HGPDTTOOLDB_NAME_GET_DEVICE_CONFIG ,HGPDTTOOLDB_TITLE_GET_DEVICE_CONFIG}, {HGPDTTOOLDB_NAME_GET_DEVICE_CONFIG ,HGPDTTOOLDB_TITLE_GET_DEVICE_CONFIG},
{HGPDTTOOLDB_NAME_GET_DEVICE_CPU_DISK ,HGPDTTOOLDB_TITLE_GET_DEVICE_CPU_DISK}, {HGPDTTOOLDB_NAME_GET_DEVICE_CPU_DISK ,HGPDTTOOLDB_TITLE_GET_DEVICE_CPU_DISK},
{HGPDTTOOLDB_NAME_BACKUP ,HGPDTTOOLDB_TITLE_BACKUP}, {HGPDTTOOLDB_NAME_BACKUP ,HGPDTTOOLDB_TITLE_BACKUP},
{HGPDTTOOLDB_NAME_SHUTDOWN ,HGPDTTOOLDB_TITLE_SHUTDOWN} {HGPDTTOOLDB_NAME_SHUTDOWN ,HGPDTTOOLDB_TITLE_SHUTDOWN},
{HGPDTTOOLDB_NAME_SET_FIRMWARE_LANGUAGE ,HGPDTTOOLDB_TITLE_SET_FIRMWARE_LANGUAGE}
}; };
static std::string StringToUtf(std::string strValue) static std::string StringToUtf(std::string strValue)
@ -592,6 +593,7 @@ public:
test_map_[HGPDTTOOLDB_NAME_GET_DEVICE_CPU_DISK] = &test::test_get_device_cpu_disk; test_map_[HGPDTTOOLDB_NAME_GET_DEVICE_CPU_DISK] = &test::test_get_device_cpu_disk;
test_map_[HGPDTTOOLDB_NAME_BACKUP] = &test::test_backup; test_map_[HGPDTTOOLDB_NAME_BACKUP] = &test::test_backup;
test_map_[HGPDTTOOLDB_NAME_SHUTDOWN] = &test::test_shutdown; test_map_[HGPDTTOOLDB_NAME_SHUTDOWN] = &test::test_shutdown;
test_map_[HGPDTTOOLDB_NAME_SET_FIRMWARE_LANGUAGE] = &test::test_set_firmware_language;
} }
int set_test(const wchar_t* name,const wchar_t* oper) int set_test(const wchar_t* name,const wchar_t* oper)
{ {
@ -1534,6 +1536,42 @@ public:
int ret = helper_->io_control(IO_CTRL_CODE_SET_DEVS_SHUTDOWN, &val, &len); int ret = helper_->io_control(IO_CTRL_CODE_SET_DEVS_SHUTDOWN, &val, &len);
return ret; return ret;
} }
/* 设置固件语言模式 */
int test_set_firmware_language(void* data)
{
int mode = 0;
void* get_data = nullptr;
parameter* ptr = helper_->get_user_input(ui_helper::DATA_FROM_USER, ui_helper::VAL_TYPE_TIPS_VAL, set_test_name_.c_str(), L"请设置固件语言模式");
if (ptr)
{
get_data = ptr->get_data();
if (!get_data)
{
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)L"已退出设置固件语言模式流程", false);
return -1;
}
mode = *((int*)get_data);
}
else
{
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)L"已退出设置固件语言模式流程", false);
return -1;
}
int ret = helper_->io_control(IO_CTRL_CODE_SET_FIRMWARE_LANGUAGE, &mode, NULL);
if (ret != SCANNER_ERR_OK)
{
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)L"不支持设置固件语言模式", false);
return -1;
}
else
{
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)L"设置固件语言模式成功,重启设备生效", true);
}
return ret;
}
/*设置设备型号*/ /*设置设备型号*/
int test_set_devs_model(void* data) int test_set_devs_model(void* data)
{ {

View File

@ -96,6 +96,8 @@
#define HGPDTTOOLDB_TITLE_BACKUP L"备份设备配置" #define HGPDTTOOLDB_TITLE_BACKUP L"备份设备配置"
/*关机*/ /*关机*/
#define HGPDTTOOLDB_TITLE_SHUTDOWN L"关机" #define HGPDTTOOLDB_TITLE_SHUTDOWN L"关机"
/*设置固件语言模式*/
#define HGPDTTOOLDB_TITLE_SET_FIRMWARE_LANGUAGE L"设置固件语言模式"
//////////////////////////////////////NAME////////////////////////////////////// //////////////////////////////////////NAME//////////////////////////////////////
#define WRITE_CFG_NAME L"write-cfg" #define WRITE_CFG_NAME L"write-cfg"
/* 设置json序列号 */ /* 设置json序列号 */
@ -161,7 +163,7 @@
/* 设置畸变修正值 */ /* 设置畸变修正值 */
#define HGPDTTOOLDB_NAME_SET_DISTORTION_VAL L"SET_DISTORTION_VAL" #define HGPDTTOOLDB_NAME_SET_DISTORTION_VAL L"SET_DISTORTION_VAL"
/* 确认畸变修正值 */ /* 确认畸变修正值 */
#define HGPDTTOOLDB_NAME_CONFIRM_DISTORTION_VAL L"CONFIRM_DISTORTION_VAL" #define HGPDTTOOLDB_NAME_CONFIRM_DISTORTION_VAL L"CONFIRM_DISTORTION_VAL"
/* 设置休眠 */ /* 设置休眠 */
#define HGPDTTOOLDB_NAME_DORMANCY L"DORMANCY" #define HGPDTTOOLDB_NAME_DORMANCY L"DORMANCY"
/* 歪斜挡位检测 */ /* 歪斜挡位检测 */
@ -193,11 +195,13 @@
/*获取设备配置*/ /*获取设备配置*/
#define HGPDTTOOLDB_NAME_GET_DEVICE_CONFIG L"GET_DEVICE_CONFIG" #define HGPDTTOOLDB_NAME_GET_DEVICE_CONFIG L"GET_DEVICE_CONFIG"
/*获取设备内存和硬盘容量大小*/ /*获取设备内存和硬盘容量大小*/
#define HGPDTTOOLDB_NAME_GET_DEVICE_CPU_DISK L"GET_DEVICE_CPU_DISK" #define HGPDTTOOLDB_NAME_GET_DEVICE_CPU_DISK L"GET_DEVICE_CPU_DISK"
/*备份设备配置*/ /*备份设备配置*/
#define HGPDTTOOLDB_NAME_BACKUP L"BACKUP" #define HGPDTTOOLDB_NAME_BACKUP L"BACKUP"
/*关机*/ /*关机*/
#define HGPDTTOOLDB_NAME_SHUTDOWN L"SHUTDOWN" #define HGPDTTOOLDB_NAME_SHUTDOWN L"SHUTDOWN"
/*设置固件语言模式*/
#define HGPDTTOOLDB_NAME_SET_FIRMWARE_LANGUAGE L"SET_FIRMWARE_LANGUAGE"
#define TEST_DLL #define TEST_DLL
#ifdef TEST_DLL #ifdef TEST_DLL