diff --git a/app/HGProductionTool/ProductionTool_zh_CN.qm b/app/HGProductionTool/ProductionTool_zh_CN.qm index afaea02..2f26014 100644 Binary files a/app/HGProductionTool/ProductionTool_zh_CN.qm and b/app/HGProductionTool/ProductionTool_zh_CN.qm differ diff --git a/app/HGProductionTool/ProductionTool_zh_CN.ts b/app/HGProductionTool/ProductionTool_zh_CN.ts index 54f21e7..dbf7afb 100644 --- a/app/HGProductionTool/ProductionTool_zh_CN.ts +++ b/app/HGProductionTool/ProductionTool_zh_CN.ts @@ -86,6 +86,7 @@ + tips 提示 @@ -95,6 +96,11 @@ Serial num is empty 序列号为空 + + + sn is illegal + 序列号不合法 + The device is testing @@ -523,8 +529,8 @@ - - + + tips 提示 @@ -534,12 +540,12 @@ 文件为空 - + upload succeed 上传成功 - + upload to service failed, already save to local host 上传至服务器失败,已保存至本地 @@ -571,39 +577,51 @@ 设置勾选项序列号 - + + Close + 关闭设备 + + + ID 序号 - + selected 选择 - + device 设备 - + serialNum 序列号 - - - + + + + tips 提示 - + + + Please check a devices at least + 请至少勾选一台设备 + + + Please check single devices to set sn 请只勾选一台设备再进行设置序列号 - + Please check a devices to set sn at least 请至少勾选一台设备再设置序列号 @@ -942,14 +960,14 @@ QObject - + success: success 成功: - + failed: 失败: diff --git a/app/HGProductionTool/dialog_setburnsn.cpp b/app/HGProductionTool/dialog_setburnsn.cpp index 595f357..8c9b535 100644 --- a/app/HGProductionTool/dialog_setburnsn.cpp +++ b/app/HGProductionTool/dialog_setburnsn.cpp @@ -1,6 +1,7 @@ #include "dialog_setburnsn.h" #include "ui_dialog_setburnsn.h" #include +#include Dialog_SetBurnSn::Dialog_SetBurnSn(const QString &originSn, QWidget *parent) : QDialog(parent), @@ -30,6 +31,12 @@ QString Dialog_SetBurnSn::getSn() void Dialog_SetBurnSn::on_pbtn_ok_clicked() { + if (ui->lineEdit->text().isEmpty()) + { + QMessageBox::information(this, tr("tips"), tr("Serial num is empty")); + return; + } + accept(); } diff --git a/app/HGProductionTool/dialog_uploadcfgfile.cpp b/app/HGProductionTool/dialog_uploadcfgfile.cpp index 42adf3a..11a4b7b 100644 --- a/app/HGProductionTool/dialog_uploadcfgfile.cpp +++ b/app/HGProductionTool/dialog_uploadcfgfile.cpp @@ -53,6 +53,9 @@ void Dialog_uploadCfgFile::on_pbtn_upload_clicked() strcat(cfgPath, ".json"); QFile file(filename); + QFile file2(cfgPath); + if (file2.exists()) + file2.remove(); file.copy(filename, cfgPath); HGResult ret = HGPdtToolDb_UploadFile(m_pdtToolDbuserMgr, tag.toStdString().c_str(), getStdString(filename).c_str()); diff --git a/app/HGProductionTool/form_burnmode.cpp b/app/HGProductionTool/form_burnmode.cpp index ea4925f..b27170c 100644 --- a/app/HGProductionTool/form_burnmode.cpp +++ b/app/HGProductionTool/form_burnmode.cpp @@ -46,6 +46,7 @@ void Form_BurnMode::addDevice(DeviceManager *devManager) QVariant var = QVariant::fromValue((void*)devManager); item->setData(Qt::UserRole, var); + updatetablewidget(); // for(int i = 0; i < ui->tableWidget->rowCount(); i++) // { // QTableWidgetItem *item = ui->tableWidget->item(i, 3); @@ -58,7 +59,7 @@ void Form_BurnMode::addDevice(DeviceManager *devManager) void Form_BurnMode::deleteDevice(QString devName) { - for(int i = 0; i < ui->tableWidget->columnCount(); i++) + for(int i = 0; i < ui->tableWidget->rowCount(); i++) { QTableWidgetItem *item = ui->tableWidget->item(i, 1); QTableWidgetItem *item2 = ui->tableWidget->item(i, 2); @@ -75,6 +76,7 @@ void Form_BurnMode::deleteDevice(QString devName) } } } + updatetablewidget(); } void Form_BurnMode::on_testResult(bool setStatus) @@ -111,12 +113,20 @@ void Form_BurnMode::initTableWidget() ui->tableWidget->clearContents(); } +void Form_BurnMode::updatetablewidget() +{ + for(int i = 0; i < ui->tableWidget->rowCount(); i++) + { + ui->tableWidget->setItem(i, 0, new QTableWidgetItem(QString::number(i + 1))); + } +} + void Form_BurnMode::on_cbox_selectAll_stateChanged(int arg1) { (void)arg1; bool check = ui->cbox_selectAll->isChecked(); - for(int i = 0; i < ui->tableWidget->columnCount(); i++) + for(int i = 0; i < ui->tableWidget->rowCount(); i++) { QTableWidgetItem *item = ui->tableWidget->item(i, 1); if (item != nullptr) @@ -132,7 +142,7 @@ void Form_BurnMode::on_cbox_selectAll_stateChanged(int arg1) void Form_BurnMode::on_pbtn_burn_clicked() { int select = 0; - for(int i = 0; i < ui->tableWidget->columnCount(); i++) + for(int i = 0; i < ui->tableWidget->rowCount(); i++) { QTableWidgetItem *item = ui->tableWidget->item(i, 1); if (item != nullptr && Qt::Checked == item->checkState()) @@ -142,11 +152,11 @@ void Form_BurnMode::on_pbtn_burn_clicked() } if (select == 0) { - QMessageBox::information(this, tr("tips"), tr("Please check a devices to set sn at least")); + QMessageBox::information(this, tr("tips"), tr("Please check a devices at least")); return; } - for(int i = 0; i < ui->tableWidget->columnCount(); i++) + for(int i = 0; i < ui->tableWidget->rowCount(); i++) { QTableWidgetItem *item = ui->tableWidget->item(i, 1); if (item != nullptr && Qt::Checked == item->checkState()) @@ -160,7 +170,7 @@ void Form_BurnMode::on_pbtn_burn_clicked() void Form_BurnMode::on_pbtn_setSn_clicked() { int select = 0; - for(int i = 0; i < ui->tableWidget->columnCount(); i++) + for(int i = 0; i < ui->tableWidget->rowCount(); i++) { QTableWidgetItem *item = ui->tableWidget->item(i, 1); if (item != nullptr && Qt::Checked == item->checkState()) @@ -181,7 +191,7 @@ void Form_BurnMode::on_pbtn_setSn_clicked() } else if (select == 1) { - for(int i = 0; i < ui->tableWidget->columnCount(); i++) + for(int i = 0; i < ui->tableWidget->rowCount(); i++) { QTableWidgetItem *item = ui->tableWidget->item(i, 1); QTableWidgetItem *item2 = ui->tableWidget->item(i, 3); @@ -314,4 +324,36 @@ void Form_BurnMode::on_tableWidget_itemDoubleClicked(QTableWidgetItem *item) } } +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 i = 0; + while(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(); + delete devManager; + + ui->tableWidget->removeRow(i); + m_curIndex--; + } + } + + updatetablewidget(); +} diff --git a/app/HGProductionTool/form_burnmode.h b/app/HGProductionTool/form_burnmode.h index 63a779c..c458ba9 100644 --- a/app/HGProductionTool/form_burnmode.h +++ b/app/HGProductionTool/form_burnmode.h @@ -74,8 +74,11 @@ private slots: void on_tableWidget_itemDoubleClicked(QTableWidgetItem *item); + void on_pbtn_close_clicked(); + private: void initTableWidget(); + void updatetablewidget(); private: Ui::Form_BurnMode *ui; diff --git a/app/HGProductionTool/form_burnmode.ui b/app/HGProductionTool/form_burnmode.ui index 7613b71..608b634 100644 --- a/app/HGProductionTool/form_burnmode.ui +++ b/app/HGProductionTool/form_burnmode.ui @@ -52,6 +52,19 @@ + + + + + 91 + 31 + + + + Close + + + diff --git a/cfg-tools/apps/scanner-check/CDlgItemMgr.cpp b/cfg-tools/apps/scanner-check/CDlgItemMgr.cpp index 19af00d..925b9e0 100644 --- a/cfg-tools/apps/scanner-check/CDlgItemMgr.cpp +++ b/cfg-tools/apps/scanner-check/CDlgItemMgr.cpp @@ -165,7 +165,8 @@ void CDlgItemMgr::OnBnClickedButtonAdd() std::wstring desc(get_window_text(GetDlgItem(IDC_EDIT_DESC)->m_hWnd)); replace(desc, L"\r", L"\\r"); replace(desc, L"\n", L"\\n"); - jsn->set_value(L"desc", desc.c_str()); + replace(desc, L"\t", L"\\t"); +jsn->set_value(L"desc", desc.c_str()); list_.SetItemText(ind, 7, desc.c_str()); // param ... @@ -269,6 +270,7 @@ void CDlgItemMgr::OnNMClickList1(NMHDR* pNMHDR, LRESULT* pResult) str = sv; replace(str, L"\\r", L"\r"); replace(str, L"\\n", L"\n"); + replace(str, L"\\t", L"\t"); ::SetDlgItemTextW(m_hWnd, IDC_EDIT_DESC, str.c_str()); str.clear(); } @@ -303,6 +305,7 @@ void CDlgItemMgr::OnNMClickList1(NMHDR* pNMHDR, LRESULT* pResult) { lst_param_.SetItemText(nv, 1, jm.str_val); } + lst_param_.SetItemData(nv, (DWORD_PTR)sane); sane->release(); } jm = param->next_member(); diff --git a/cfg-tools/apps/scanner-check/CDlgMgr.cpp b/cfg-tools/apps/scanner-check/CDlgMgr.cpp index 85290c0..851e933 100644 --- a/cfg-tools/apps/scanner-check/CDlgMgr.cpp +++ b/cfg-tools/apps/scanner-check/CDlgMgr.cpp @@ -1121,12 +1121,12 @@ std::wstring CDlgMgr::export_config(bool *ok, bool used_in_code, int code_ver) static void trans_code_json(std::wstring& json) { - size_t pos = json.find(L"(L\""); + size_t pos = json.find(L"(\""); if (pos == std::wstring::npos) return; - json.erase(0, pos + 3); + json.erase(0, pos + 2); pos = json.rfind(L'\"'); if (pos != std::wstring::npos) json.erase(pos); @@ -1188,8 +1188,13 @@ void CDlgMgr::add_param_from_config(CComboBox* param_ctrl, CComboBox* val_ctrl, } void CDlgMgr::reload(std::wstring& cont) { - if (cont.find(L"static std::wstring") == 0) + bool code_jsn = false; + + if (cont.find(L"static std::string") == 0) + { trans_code_json(cont); + code_jsn = true; + } known_file_util::IJsonW* jsn = known_file_util::create_jsonW(); if (jsn->attach(cont.c_str())) @@ -1270,6 +1275,75 @@ void CDlgMgr::reload(std::wstring& cont) } write->release(); } + else + { + int nv = 0; + if (child->get_value(L"vid-to", nv)) + { + FIND_DATA(combo_param_, GetCount, PARAM_VID, ind); + if (ind != -1) + { + wchar_t hex[40] = { 0 }; + + swprintf_s(hex, _countof(hex) - 1, L"%04x", nv); + combo_param_.SetCurSel(ind); + OnCbnSelchangeComboParam(); + ::SetDlgItemTextW(m_hWnd, IDC_EDIT_PARAM_VAL, hex); + OnBnClickedButtonAddParam(); + } + } + if (child->get_value(L"pid-to", nv)) + { + FIND_DATA(combo_param_, GetCount, PARAM_PID, ind); + if (ind != -1) + { + wchar_t hex[40] = { 0 }; + + swprintf_s(hex, _countof(hex) - 1, L"%04x", nv); + combo_param_.SetCurSel(ind); + OnCbnSelchangeComboParam(); + ::SetDlgItemTextW(m_hWnd, IDC_EDIT_PARAM_VAL, hex); + OnBnClickedButtonAddParam(); + } + } + if (child->get_value(L"speed-mode", nv)) + { + FIND_DATA(combo_param_, GetCount, PARAM_SPEED, ind); + if (ind != -1) + { + combo_param_.SetCurSel(ind); + OnCbnSelchangeComboParam(); + SetDlgItemInt(IDC_EDIT_PARAM_VAL, nv); + OnBnClickedButtonAddParam(); + } + } + if (child->get_value(L"sleep-time", nv)) + { + ind = -1; + for (int i = 0; i < combo_param_.GetCount(); ++i) + { + DWORD_PTR data = combo_param_.GetItemData(i); + if (data != PARAM_VID && data != PARAM_PID && data != PARAM_SPEED) + { + known_file_util::IJsonW* jsn = (known_file_util::IJsonW*)data; + if (wcscmp(jsn->key(), L"time-to-sleep") == 0) + { + ind = i; + break; + } + } + } + if (ind != -1) + { + combo_param_.SetCurSel(ind); + OnCbnSelchangeComboParam(); + ind = combo_param_val_.FindStringExact(-1, L"\u4E94\u5206\u949F"); + if (ind != -1) + combo_param_val_.SetCurSel(ind); + OnBnClickedButtonAddParam(); + } + } + } child->release(); } @@ -1279,10 +1353,12 @@ void CDlgMgr::reload(std::wstring& cont) { known_file_util::IJsonW* tpl = NULL; child->get_value(L"name", &val); - ind = find_template(&combo_param_, val, &tpl); + if (child->get_value(L"ver", id)) + ::PostMessage(GetParent()->m_hWnd, WM_SET_CODE_VER, 0, (LPARAM)id); + id = find_template(&combo_, val, &tpl); if (tpl) { - combo_.SetCurSel(ind); + combo_.SetCurSel(id); OnBnClickedButtonAdd(); FIND_DATA(list_, GetItemCount, tpl, id); if (id != -1) diff --git a/cfg-tools/apps/scanner-check/page.h b/cfg-tools/apps/scanner-check/page.h index 42720ba..e8aef63 100644 --- a/cfg-tools/apps/scanner-check/page.h +++ b/cfg-tools/apps/scanner-check/page.h @@ -9,6 +9,7 @@ #define WM_TO_ITEM_MGR_TAB WM_USER + 102 #define WM_TEST_ITEM_CHANGED WM_USER + 103 #define WM_REFRESH_TEST_ITEM WM_USER + 104 +#define WM_SET_CODE_VER WM_USER + 105 // WPARAM: unused, LPARAM: ver #include #include diff --git a/cfg-tools/apps/scanner-check/scanner-checkDlg.cpp b/cfg-tools/apps/scanner-check/scanner-checkDlg.cpp index 5c4d579..4383510 100644 --- a/cfg-tools/apps/scanner-check/scanner-checkDlg.cpp +++ b/cfg-tools/apps/scanner-check/scanner-checkDlg.cpp @@ -48,6 +48,7 @@ BEGIN_MESSAGE_MAP(CscannercheckDlg, CDialogEx) ON_MESSAGE(WM_TO_ITEM_MGR_TAB, &CscannercheckDlg::on_to_item_manager_tab) ON_MESSAGE(WM_TEST_ITEM_CHANGED, &CscannercheckDlg::on_test_item_changed) ON_MESSAGE(WM_REFRESH_TEST_ITEM, &CscannercheckDlg::on_refresh_test_items) + ON_MESSAGE(WM_SET_CODE_VER, &CscannercheckDlg::on_set_code_ver) END_MESSAGE_MAP() void CscannercheckDlg::add_page(const wchar_t* title, CDialogEx* child) @@ -265,4 +266,10 @@ LRESULT CscannercheckDlg::on_refresh_test_items(WPARAM wp, LPARAM lp) return 0; } +LRESULT CscannercheckDlg::on_set_code_ver(WPARAM wp, LPARAM lp) +{ + SetDlgItemInt(IDC_EDIT_VER, (UINT)lp); + + return 0; +} diff --git a/cfg-tools/apps/scanner-check/scanner-checkDlg.h b/cfg-tools/apps/scanner-check/scanner-checkDlg.h index b0a892b..a3c5105 100644 --- a/cfg-tools/apps/scanner-check/scanner-checkDlg.h +++ b/cfg-tools/apps/scanner-check/scanner-checkDlg.h @@ -48,5 +48,6 @@ public: afx_msg LRESULT on_to_item_manager_tab(WPARAM, LPARAM); afx_msg LRESULT on_test_item_changed(WPARAM wp, LPARAM lp); afx_msg LRESULT on_refresh_test_items(WPARAM wp, LPARAM lp); + afx_msg LRESULT on_set_code_ver(WPARAM wp, LPARAM lp); afx_msg void OnTcnSelchangingTab1(NMHDR* pNMHDR, LRESULT* pResult); }; diff --git a/cfg-tools/solution/Release/config/stored.txt b/cfg-tools/solution/Release/config/stored.txt index e3d8326..b5216ec 100644 Binary files a/cfg-tools/solution/Release/config/stored.txt and b/cfg-tools/solution/Release/config/stored.txt differ diff --git a/cfg-tools/solution/Release/scanner-check.exe b/cfg-tools/solution/Release/scanner-check.exe index b3c0004..d448033 100644 Binary files a/cfg-tools/solution/Release/scanner-check.exe and b/cfg-tools/solution/Release/scanner-check.exe differ