diff --git a/app/HGProductionTool/ProductionTool_zh_CN.qm b/app/HGProductionTool/ProductionTool_zh_CN.qm index a5af882..975f961 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 c021f6d..fbe89c4 100644 --- a/app/HGProductionTool/ProductionTool_zh_CN.ts +++ b/app/HGProductionTool/ProductionTool_zh_CN.ts @@ -354,14 +354,28 @@ 登录 - + tips 提示 - + + Login failed, sure to enter offline mode? + 登录失败,是否进入单机测试模式? + + + + yes + 确定 + + + + no + 取消 + + Login failed: - 登录失败: + 登录失败: @@ -455,36 +469,40 @@ 上传 - + Browse directory 打开文件 - + config(*json) 配置文件(*json) - - - + + + tips 提示 - + empty filename 文件为空 - + upload succeed 上传成功 - + + upload to service failed, already save to local host + 上传至服务器失败,已保存至本地 + + upload failed: - 上传失败: + 上传失败: @@ -550,95 +568,94 @@ 下一步 - - + Device has connected 设备已连接 - + Device hasnot connected 设备未连接 - + Device type: 设备型号: - + SerialNum: 序列号: - - + + connect status: 设备连接状态: - + load last image which uploaded last time 加载上一次上传的图片 - + Device has disconnected 设备已断开 - - + + tips 提示 - + yes 确定 - + no 取消 - + ID 序号 - + Test items 测试项 - + status 测试状态 - + not test 未测试 - + not pass 不通过 - + not support 不支持 - + pass 通过 - + no image 无图 @@ -704,7 +721,7 @@ 上传配置文件 - + Account login elsewhere 账户在其他地方登录 @@ -713,54 +730,54 @@ 网络连接断开 - + You have been forced offline by the administrator account 你已被管理员账户强制下线 - + Data base error 数据库错误 - - - - - + + + + + + - - - + + tips 提示 - - + + Is testing, do not close! 测试中,请勿关闭! - + Are you sure to connect the new device 检测到设备连接,是否启动测试? - + yes 确定 - + no 取消 - - + + cannot create more table 不能创建更多项目 @@ -769,52 +786,52 @@ 设备已断开连接 - + Open device failed 打开设备失败 - + save 保存 - + xls(*.xls) xls表格(*.xls) - + export succeed 导出成功 - + export failed 导出失败 - + Illegal user 非法的用户 - + Wrong password 密码错误 - + Database error 数据库错误 - + connect error 连接错误 - + Failed 错误 diff --git a/app/HGProductionTool/dialog_login.cpp b/app/HGProductionTool/dialog_login.cpp index 00237fd..d93d563 100644 --- a/app/HGProductionTool/dialog_login.cpp +++ b/app/HGProductionTool/dialog_login.cpp @@ -110,7 +110,7 @@ void Dialog_logIn::on_pbtn_login_clicked() saveCfgValue("login", "ftpPort", ftpPort); HGPdtToolDbUserMgr pdtToolDbuserMgr = nullptr; - HGResult ret = HGPdtToolDb_CreateUserMgr(dbHost.toStdString().c_str(), dbPort.toInt(), account.toStdString().c_str(), password.toStdString().c_str(), + HGPdtToolDb_CreateUserMgr(dbHost.toStdString().c_str(), dbPort.toInt(), account.toStdString().c_str(), password.toStdString().c_str(), &pdtToolDbuserMgr); if (NULL != pdtToolDbuserMgr) { @@ -119,8 +119,19 @@ void Dialog_logIn::on_pbtn_login_clicked() } else { - QMessageBox::information(this, tr("tips"), tr("Login failed: ") + MainWindow::getLogInfo(ret)); - return; + QMessageBox msg(QMessageBox::Question, tr("tips"), tr("Login failed, sure to enter offline mode?"), QMessageBox::Yes | QMessageBox::No, this); + msg.setButtonText(QMessageBox::Yes, tr("yes")); + msg.setButtonText(QMessageBox::No, tr("no")); + msg.exec(); + if (msg.clickedButton() == msg.button(QMessageBox::Yes)) + { + m_pdtToolDbuserMgr = nullptr; + accept();; + } + else + { + return; + } } } diff --git a/app/HGProductionTool/dialog_uploadcfgfile.cpp b/app/HGProductionTool/dialog_uploadcfgfile.cpp index 95418ed..42adf3a 100644 --- a/app/HGProductionTool/dialog_uploadcfgfile.cpp +++ b/app/HGProductionTool/dialog_uploadcfgfile.cpp @@ -5,6 +5,7 @@ #include #include "mainwindow.h" #include "HGUIGlobal.h" +#include "base/HGBase.h" Dialog_uploadCfgFile::Dialog_uploadCfgFile(HGPdtToolDbUserMgr pdtToolDbuserMgr, QWidget *parent) : QDialog(parent), @@ -44,6 +45,16 @@ void Dialog_uploadCfgFile::on_pbtn_upload_clicked() QString tag = ui->comboBox_tag->currentText(); QString filename = ui->lineEdit_filename->text(); + + HGChar cfgPath[512] = {0}; + HGBase_GetConfigPath(cfgPath, 512); + HGBase_CreateDir(cfgPath); + strcat(cfgPath, tag.toStdString().c_str()); + strcat(cfgPath, ".json"); + + QFile file(filename); + file.copy(filename, cfgPath); + HGResult ret = HGPdtToolDb_UploadFile(m_pdtToolDbuserMgr, tag.toStdString().c_str(), getStdString(filename).c_str()); if(ret == HGBASE_ERR_OK) { @@ -52,7 +63,7 @@ void Dialog_uploadCfgFile::on_pbtn_upload_clicked() } else { - QMessageBox::information(this, tr("tips"), tr("upload failed: ") + MainWindow::getLogInfo(ret)); + QMessageBox::information(this, tr("tips"), tr("upload to service failed, already save to local host")); } } diff --git a/app/HGProductionTool/form_maininterface.cpp b/app/HGProductionTool/form_maininterface.cpp index d0c271e..340b261 100644 --- a/app/HGProductionTool/form_maininterface.cpp +++ b/app/HGProductionTool/form_maininterface.cpp @@ -342,80 +342,78 @@ void Form_mainInterface::initTableWidgetUi() strcat(cfgPath, m_devType.toStdString().c_str()); strcat(cfgPath, ".json"); - HGResult ret = HGPdtToolDb_DownloadFile(m_pdtToolDbuserMgr, m_devType.toStdString().c_str(), cfgPath); - if(ret == HGBASE_ERR_OK) + HGPdtToolDb_DownloadFile(m_pdtToolDbuserMgr, m_devType.toStdString().c_str(), cfgPath); + + AnalysisJson analysisJson(QString::fromStdString(cfgPath)); + + setGlobalCfg(analysisJson); + + std::map dbEntryItems; + for (int i = HGPDTTOOLDB_ENTRYNAME_DIAL_SWITCH; i <= HGPDTTOOLDB_ENTRYNAME_SCANNING_SENSOR; ++i) + dbEntryItems[i] = false; + for (int i = HGPDTTOOLDB_ENTRYNAME_CONFIGURE_SPEED_MODE; i <= HGPDTTOOLDB_ENTRYNAME_MECH_PAPER_FEEDING_INCLINATION; ++i) + dbEntryItems[i] = false; + for (int i = HGPDTTOOLDB_ENTRYNAME_SINGLE_PAGE_TEST_1; i <= HGPDTTOOLDB_ENTRYNAME_CLEAR_ROLLER_COUNT; ++i) + dbEntryItems[i] = false; + + std::vector list_jsonNode = analysisJson.GetNode(); + int count = list_jsonNode.size(); + ui->tableWidget->setRowCount(count); + for(int i = 0; i < count; ++i) { - AnalysisJson analysisJson(QString::fromStdString(cfgPath)); + AnalysisJson::json_node node = list_jsonNode[i]; + m_map_title_name.insert(node.title, node); - setGlobalCfg(analysisJson); + ui->tableWidget->setItem(i, 0, new QTableWidgetItem(QString::number(i+1))); + ui->tableWidget->item(i, 0)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); - std::map dbEntryItems; - for (int i = HGPDTTOOLDB_ENTRYNAME_DIAL_SWITCH; i <= HGPDTTOOLDB_ENTRYNAME_SCANNING_SENSOR; ++i) - dbEntryItems[i] = false; - for (int i = HGPDTTOOLDB_ENTRYNAME_CONFIGURE_SPEED_MODE; i <= HGPDTTOOLDB_ENTRYNAME_MECH_PAPER_FEEDING_INCLINATION; ++i) - dbEntryItems[i] = false; - for (int i = HGPDTTOOLDB_ENTRYNAME_SINGLE_PAGE_TEST_1; i <= HGPDTTOOLDB_ENTRYNAME_CLEAR_ROLLER_COUNT; ++i) - dbEntryItems[i] = false; + ui->tableWidget->setItem(i, 1, new QTableWidgetItem(node.title)); + ui->tableWidget->item(i, 1)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); - std::vector list_jsonNode = analysisJson.GetNode(); - int count = list_jsonNode.size(); - ui->tableWidget->setRowCount(count); - for(int i = 0; i < count; ++i) + HGUInt status = getTestItemStatus(node.title); + QString statusStr = getItemStatusStr(status); + ui->tableWidget->setItem(i, 2, new QTableWidgetItem(statusStr)); + ui->tableWidget->item(i, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); + if (HGPDTTOOLDB_ENTRYSTATUS_NOTPASS == status) { - AnalysisJson::json_node node = list_jsonNode[i]; - m_map_title_name.insert(node.title, node); - - ui->tableWidget->setItem(i, 0, new QTableWidgetItem(QString::number(i+1))); - ui->tableWidget->item(i, 0)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); - - ui->tableWidget->setItem(i, 1, new QTableWidgetItem(node.title)); - ui->tableWidget->item(i, 1)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); - - HGUInt status = getTestItemStatus(node.title); - QString statusStr = getItemStatusStr(status); - ui->tableWidget->setItem(i, 2, new QTableWidgetItem(statusStr)); - ui->tableWidget->item(i, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); - if (HGPDTTOOLDB_ENTRYSTATUS_NOTPASS == status) - { - ui->tableWidget->item(i, 2)->setBackgroundColor(QColor(255,0,0)); - } - else if (HGPDTTOOLDB_ENTRYSTATUS_NOTSUPP == status) - { - ui->tableWidget->item(i, 2)->setBackgroundColor(QColor(255,255,0)); - } - else if (HGPDTTOOLDB_ENTRYSTATUS_PASS == status) - { - ui->tableWidget->item(i, 2)->setBackgroundColor(QColor(0,255,0)); - } - - HGUInt entry = getTestItem(node.title); - std::map::iterator iter; - for (iter = dbEntryItems.begin(); iter != dbEntryItems.end(); ++iter) - { - if (entry == iter->first) - { - iter->second = true; - break; - } - } - - HGChar desc[512] = {0}; - HGPdtToolDb_GetDeviceEntryExcepDesc(m_pdtToolDbDevice, getTestItem(node.title), desc, 512); - QTableWidgetItem *item = ui->tableWidget->item(i, 2); - item->setToolTip(desc); + ui->tableWidget->item(i, 2)->setBackgroundColor(QColor(255,0,0)); + } + else if (HGPDTTOOLDB_ENTRYSTATUS_NOTSUPP == status) + { + ui->tableWidget->item(i, 2)->setBackgroundColor(QColor(255,255,0)); + } + else if (HGPDTTOOLDB_ENTRYSTATUS_PASS == status) + { + ui->tableWidget->item(i, 2)->setBackgroundColor(QColor(0,255,0)); } + HGUInt entry = getTestItem(node.title); std::map::iterator iter; for (iter = dbEntryItems.begin(); iter != dbEntryItems.end(); ++iter) { - if (!iter->second) + if (entry == iter->first) { - HGPdtToolDb_SetDeviceEntryStatus(m_pdtToolDbDevice, iter->first, HGPDTTOOLDB_ENTRYSTATUS_NOTSUPP); + iter->second = true; + break; } } - ui->tableWidget->selectRow(0); + HGChar desc[512] = {0}; + HGPdtToolDb_GetDeviceEntryExcepDesc(m_pdtToolDbDevice, getTestItem(node.title), desc, 512); + QTableWidgetItem *item = ui->tableWidget->item(i, 2); + item->setToolTip(desc); } + + std::map::iterator iter; + for (iter = dbEntryItems.begin(); iter != dbEntryItems.end(); ++iter) + { + if (!iter->second) + { + HGPdtToolDb_SetDeviceEntryStatus(m_pdtToolDbDevice, iter->first, HGPDTTOOLDB_ENTRYSTATUS_NOTSUPP); + } + } + + ui->tableWidget->selectRow(0); } HGUInt Form_mainInterface::getTestItem(const QString &title) diff --git a/app/HGProductionTool/mainwindow.cpp b/app/HGProductionTool/mainwindow.cpp index 2c12a31..3f5b972 100644 --- a/app/HGProductionTool/mainwindow.cpp +++ b/app/HGProductionTool/mainwindow.cpp @@ -61,7 +61,7 @@ MainWindow::MainWindow(HGPdtToolDbUserMgr pdtToolDbuserMgr, const QString &ftpHo ui->act_upload->setVisible(false); } - HGChar userName[128]; + HGChar userName[128] = {0}; HGPdtToolDb_GetUserName(m_pdtToolDbuserMgr, userName, 128); setWindowTitle(userName); @@ -418,7 +418,7 @@ void MainWindow::on_sane_dev_remove(QString devName) void MainWindow::on_update_userStatus() { QString tips; - HGUInt userStatus; + HGUInt userStatus = 0; HGPdtToolDb_GetUserStatus(m_pdtToolDbuserMgr, &userStatus); switch (userStatus)