diff --git a/app/HGProductionTool/HGProductionTool.pro b/app/HGProductionTool/HGProductionTool.pro index 22569d0..1c2fbbd 100644 --- a/app/HGProductionTool/HGProductionTool.pro +++ b/app/HGProductionTool/HGProductionTool.pro @@ -99,8 +99,7 @@ RESOURCES += \ ProductionTool_resource.qrc TRANSLATIONS += \ - ProductionTool_zh_CN.ts \ + ProductionTool_zh_CN.ts DISTFILES += \ - ProductionTool_zh_CN.qm \ \ - ProductionTool_zh_CN.ts + ProductionTool_zh_CN.qm diff --git a/app/HGProductionTool/ProductionTool_zh_CN.qm b/app/HGProductionTool/ProductionTool_zh_CN.qm index 0060dc4..2a82e01 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 339cfda..ec823cf 100644 --- a/app/HGProductionTool/ProductionTool_zh_CN.ts +++ b/app/HGProductionTool/ProductionTool_zh_CN.ts @@ -14,37 +14,37 @@ 输入序列号: - + Select devType: 设备型号: - + G100 - + G200 - + G300 - + G400 - + OK 确定 - + Cancel 取消 @@ -149,27 +149,31 @@ 修改密码 - + old password: 旧密码: - + new password: 新密码: - - confirm new password: - 确认密码: + + cfm password: + 确认新密码: - + confirm new password: + 确认密码: + + + OK 确定 - + Cancel 取消 @@ -404,35 +408,70 @@ 上一步 - + PASS 通过 - - - FAIL - 失败 - - STOP - 终止 + FAIL + 不通过 + STOP + 结束测试 + + + Next Step 下一步 - + Device type: 设备型号: - + SerialNum: 序列号: + + + ID + 序号 + + + + Test items + 测试项 + + + + status + 测试状态 + + + + not test + 未测试 + + + + not pass + 不通过 + + + + not support + 不支持 + + + + pass + 通过 + Form_textTips @@ -495,7 +534,7 @@ 上传配置文件 - + Account login elsewhere 账户在其他地方登录 @@ -504,76 +543,76 @@ 网络连接断开 - + You have been forced offline by the administrator account 你已被管理员账户强制下线 - + Data base error 数据库错误 - - - - + + + + tips 提示 - + Are you sure to connect the new device 检测到设备连接,是否启动测试? - + yes 确定 - + no 取消 - - + + cannot create more table 不能创建更多项目 - + save 保存 - + xls(*.xls) xls表格(*.xls) - + Illegal user 非法的用户 - + Wrong password 密码错误 - + Database error 数据库错误 - + connect error 连接错误 - + Failed 错误 diff --git a/app/HGProductionTool/dialog_changepwd.ui b/app/HGProductionTool/dialog_changepwd.ui index 242c6df..f9b0c52 100644 --- a/app/HGProductionTool/dialog_changepwd.ui +++ b/app/HGProductionTool/dialog_changepwd.ui @@ -6,166 +6,153 @@ 0 0 - 389 - 150 + 440 + 213 Dialog - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - old password: - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - new password: - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - confirm new password: - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - OK - - - - - - - Cancel - - - - - - + + + + 310 + 160 + 75 + 23 + + + + Cancel + + + + + + 200 + 160 + 75 + 23 + + + + OK + + + + + + 110 + 20 + 219 + 22 + + + + + + + Qt::RightToLeft + + + old password: + + + + + + + + 133 + 0 + + + + + 133 + 16777215 + + + + + + + + + + 110 + 60 + 219 + 22 + + + + + + + Qt::RightToLeft + + + new password: + + + + + + + + 133 + 0 + + + + + 133 + 16777215 + + + + + + + + + + 110 + 100 + 219 + 22 + + + + + + + Qt::RightToLeft + + + cfm password: + + + + + + + + 133 + 0 + + + + + 133 + 16777215 + + + + + + diff --git a/app/HGProductionTool/form_maininterface.cpp b/app/HGProductionTool/form_maininterface.cpp index cf529ad..583d79e 100644 --- a/app/HGProductionTool/form_maininterface.cpp +++ b/app/HGProductionTool/form_maininterface.cpp @@ -11,6 +11,50 @@ #include "hgscanner.h" #include "mainwindow.h" +typedef struct +{ + const wchar_t *title; + HGUInt entryName; +}RELA; + +static const RELA Rela[] = { + {HGPDTTOOLDB_TITLE_DIAL_SWITCH, HGPDTTOOLDB_ENTRYNAME_DIAL_SWITCH}, + {HGPDTTOOLDB_TITLE_ROCKER_SWITCH, HGPDTTOOLDB_ENTRYNAME_ROCKER_SWITCH}, + {HGPDTTOOLDB_TITLE_BOOT_STATUS, HGPDTTOOLDB_ENTRYNAME_BOOT_STATUS}, + {HGPDTTOOLDB_TITLE_LCD_DISPLAY, HGPDTTOOLDB_ENTRYNAME_LCD_DISPLAY}, + {HGPDTTOOLDB_TITLE_CLEAR_PAPER_PATH, HGPDTTOOLDB_ENTRYNAME_CLEAR_PAPER_PATH}, + {HGPDTTOOLDB_TITLE_KEY_FUNCTION, HGPDTTOOLDB_ENTRYNAME_KEY_FUNCTION}, + {HGPDTTOOLDB_TITLE_COUNTING_MODE, HGPDTTOOLDB_ENTRYNAME_COUNTING_MODE}, + {HGPDTTOOLDB_TITLE_SKEW_DETECTION, HGPDTTOOLDB_ENTRYNAME_SKEW_DETECTION}, + {HGPDTTOOLDB_TITLE_SEPARATER_MOTOR, HGPDTTOOLDB_ENTRYNAME_SEPARATER_MOTOR}, + {HGPDTTOOLDB_TITLE_CIS_ORIGINAL_IMAGE, HGPDTTOOLDB_ENTRYNAME_CIS_ORIGINAL_IMAGE}, + {HGPDTTOOLDB_TITLE_HOST_FAN, HGPDTTOOLDB_ENTRYNAME_HOST_FAN}, + {HGPDTTOOLDB_TITLE_ULTRASONIC_MODULE, HGPDTTOOLDB_ENTRYNAME_ULTRASONIC_MODULE}, + {HGPDTTOOLDB_TITLE_LED_LIGHT, HGPDTTOOLDB_ENTRYNAME_LED_LIGHT}, + {HGPDTTOOLDB_TITLE_RESET, HGPDTTOOLDB_ENTRYNAME_RESET}, + {HGPDTTOOLDB_TITLE_PAPER_FEED, HGPDTTOOLDB_ENTRYNAME_PAPER_FEED}, + {HGPDTTOOLDB_TITLE_COVER_SENSOR, HGPDTTOOLDB_ENTRYNAME_COVER_SENSOR}, + {HGPDTTOOLDB_TITLE_SCANNING_SENSOR, HGPDTTOOLDB_ENTRYNAME_SCANNING_SENSOR}, + {HGPDTTOOLDB_TITLE_CONFIGURE_SPEED_MODE, HGPDTTOOLDB_ENTRYNAME_CONFIGURE_SPEED_MODE}, + {HGPDTTOOLDB_TITLE_PLACE_CORRECTION_PAPER, HGPDTTOOLDB_ENTRYNAME_PLACE_CORRECTION_PAPER}, + {HGPDTTOOLDB_TITLE_AUTO_FLAT_FIELD, HGPDTTOOLDB_ENTRYNAME_AUTO_FLAT_FIELD}, + {HGPDTTOOLDB_TITLE_REBOOT_DEVICE, HGPDTTOOLDB_ENTRYNAME_REBOOT_DEVICE}, + {HGPDTTOOLDB_TITLE_IMAGE_QUALITY, HGPDTTOOLDB_ENTRYNAME_IMAGE_QUALITY}, + {HGPDTTOOLDB_TITLE_COLORCARD_IMAGEING_QUALITY, HGPDTTOOLDB_ENTRYNAME_COLORCARD_IMAGEING_QUALITY}, + {HGPDTTOOLDB_TITLE_COLORCARD_BIAS_IMAGEING_QUALITY, HGPDTTOOLDB_ENTRYNAME_COLORCARD_BIAS_IMAGEING_QUALITY}, + {HGPDTTOOLDB_TITLE_CLARITY_QUALITY, HGPDTTOOLDB_ENTRYNAME_CLARITY_QUALITY}, + {HGPDTTOOLDB_TITLE_DISTORTION, HGPDTTOOLDB_ENTRYNAME_DISTORTION}, + {HGPDTTOOLDB_TITLE_DORMANCY, HGPDTTOOLDB_ENTRYNAME_DORMANCY}, + {HGPDTTOOLDB_TITLE_SKEW_GEAR, HGPDTTOOLDB_ENTRYNAME_SKEW_GEAR}, + {HGPDTTOOLDB_TITLE_PAPER_SEPARATION_STRENGTH, HGPDTTOOLDB_ENTRYNAME_PAPER_SEPARATION_STRENGTH}, + {HGPDTTOOLDB_TITLE_MECH_PAPER_FEEDING_INCLINATION, HGPDTTOOLDB_ENTRYNAME_MECH_PAPER_FEEDING_INCLINATION}, + {HGPDTTOOLDB_TITLE_SINGLE_PAGE_TEST_1, HGPDTTOOLDB_ENTRYNAME_SINGLE_PAGE_TEST_1}, + {HGPDTTOOLDB_TITLE_SINGLE_PAGE_TEST_2, HGPDTTOOLDB_ENTRYNAME_SINGLE_PAGE_TEST_2}, + {HGPDTTOOLDB_TITLE_SINGLE_PAGE_TEST_3, HGPDTTOOLDB_ENTRYNAME_SINGLE_PAGE_TEST_3}, + {HGPDTTOOLDB_TITLE_PRESSUER_TEST, HGPDTTOOLDB_ENTRYNAME_PRESSUER_TEST}, + {HGPDTTOOLDB_TITLE_CLEAR_ROLLER_COUNT, HGPDTTOOLDB_ENTRYNAME_CLEAR_ROLLER_COUNT} +}; + Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, SANE_Handle handle, HGPdtToolDbUserMgr pdtToolDbuserMgr, HGPdtToolDbDevice pdtToolDbDevice, const QString &serialNum, const QString &devType) : QWidget(mainwnd) @@ -31,11 +75,7 @@ Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, SANE_Handle ha ui->stackedWidget->addWidget(m_textTips); ui->stackedWidget->addWidget(m_view); - ui->listWidget->setMinimumWidth(200); - ui->listWidget->setCurrentRow(0); - ui->pbtn_preStep->setEnabled(false); - - downloadCfgFile(); + initTableWidgetUi(); } Form_mainInterface::~Form_mainInterface() @@ -59,56 +99,85 @@ void Form_mainInterface::paintEvent(QPaintEvent *event) p.drawRect(0, 0, width() -1, height() -1); } -void Form_mainInterface::on_listWidget_currentTextChanged(const QString ¤tText) -{ - ui->pbtn_preStep->setEnabled(ui->listWidget->currentRow() != 0); - ui->pbtn_nextStep->setEnabled(ui->listWidget->currentRow() != ui->listWidget->count() - 1); - - QString testName; - if (currentText == HGPDTTOOLDB_TITLE_DIAL_SWITCH) - { - m_textTips->setViewContent(m_map_title_name.value(currentText).desc); - testName = m_map_title_name.value(currentText).name; - ui->stackedWidget->setCurrentWidget(m_textTips); - } - else if (currentText == HGPDTTOOLDB_NAME_SINGLE_PAGE_TEST_1) - { - //addImg - testName = m_map_title_name.value(currentText).name; - ui->stackedWidget->setCurrentWidget(m_view); - } - - ui_helper* helper; - hgscanner* hg = new hgscanner(m_handle); - helper = dynamic_cast(hg); - - QString s("test-31"); -// func_test_go(s.toStdWString().c_str(), L"null", helper); -} - void Form_mainInterface::on_pbtn_preStep_clicked() { - ui->listWidget->setCurrentRow(ui->listWidget->currentRow() - 1); + int row = ui->tableWidget->currentRow(); + if (row > 0) + { + ui->tableWidget->selectRow(row - 1); + } } void Form_mainInterface::on_pbtn_nextStep_clicked() { - ui->listWidget->setCurrentRow(ui->listWidget->currentRow() + 1); + int row = ui->tableWidget->currentRow(); + if (row < ui->tableWidget->rowCount() - 1) + { + ui->tableWidget->selectRow(row + 1); + } } void Form_mainInterface::on_pbtn_fail_clicked() { - ui->listWidget->item(ui->listWidget->currentRow())->setBackgroundColor("red"); + int row = ui->tableWidget->currentRow(); + QTableWidgetItem *item = ui->tableWidget->item(row, 1); + QString title = item->text(); + setTestItemStatus(title, 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)->setBackgroundColor(QColor(255,0,0)); } void Form_mainInterface::on_pbtn_pass_clicked() { - ui->listWidget->item(ui->listWidget->currentRow())->setBackgroundColor("yellow"); + int row = ui->tableWidget->currentRow(); + QTableWidgetItem *item = ui->tableWidget->item(row, 1); + QString title = item->text(); + setTestItemStatus(title, 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)->setBackgroundColor(QColor(0,255,0)); + on_pbtn_nextStep_clicked(); } -void Form_mainInterface::downloadCfgFile() +void Form_mainInterface::on_pbtn_stop_clicked() { + m_mainwnd->RemoveInterface(this); +} + +void Form_mainInterface::initTableWidgetUi() +{ + ui->tableWidget->resizeRowsToContents(); + ui->tableWidget->setColumnCount(3); + ui->tableWidget->horizontalHeader()->setDefaultSectionSize(200); + ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); + ui->tableWidget->horizontalHeader()->setSectionResizeMode(0, QHeaderView::ResizeToContents); + + QStringList header; + header<< tr("ID") << tr("Test items") << tr("status"); + ui->tableWidget->setHorizontalHeaderLabels(header); + + QFont font = ui->tableWidget->horizontalHeader()->font(); + font.setBold(true); + ui->tableWidget->horizontalHeader()->setFont(font); + + ui->tableWidget->horizontalHeader()->setStretchLastSection(true); + ui->tableWidget->verticalHeader()->setDefaultSectionSize(10); + ui->tableWidget->setFrameShape(QFrame::NoFrame); + ui->tableWidget->setShowGrid(true); + ui->tableWidget->verticalHeader()->setVisible(false); + ui->tableWidget->setSelectionMode(QAbstractItemView::SingleSelection); + ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); + ui->tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); + ui->tableWidget->horizontalHeader()->setFixedHeight(30); + ui->tableWidget->clearContents(); + 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); @@ -121,26 +190,106 @@ void Form_mainInterface::downloadCfgFile() AnalysisJson analysisJson(QString::fromStdString(cfgPath)); std::vector list_jsonNode = analysisJson.GetNode(); - for(int i = 0; i < (int)list_jsonNode.size(); ++i) + int count = list_jsonNode.size(); + ui->tableWidget->setRowCount(count); + for(int i = 0; i < count; ++i) { AnalysisJson::json_node node = list_jsonNode[i]; - ui->listWidget->addItem(node.title); 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)); + } } + + ui->tableWidget->selectRow(0); } } -void Form_mainInterface::on_pbtn_stop_clicked() +HGUInt Form_mainInterface::getTestItemStatus(const QString &title) { - m_mainwnd->RemoveInterface(this); + HGUInt status = 0; + for (int i = 0; i < sizeof(Rela) / sizeof(RELA); ++i) + { + if (0 == wcscmp(title.toStdWString().c_str(), Rela[i].title)) + { + HGPdtToolDb_GetDeviceEntryStatus(m_pdtToolDbDevice, Rela[i].entryName, &status); + break; + } + } + + return status; } +bool Form_mainInterface::setTestItemStatus(const QString &title, HGUInt status) +{ + bool ret = false; + for (int i = 0; i < sizeof(Rela) / sizeof(RELA); ++i) + { + if (0 == wcscmp(title.toStdWString().c_str(), Rela[i].title)) + { + if (HGBASE_ERR_OK == HGPdtToolDb_SetDeviceEntryStatus(m_pdtToolDbDevice, Rela[i].entryName, status)) + ret = true; + break; + } + } + return ret; +} +QString Form_mainInterface::getItemStatusStr(HGUInt status) +{ + static const QString statusStr[] = {tr("not test"), tr("not pass"), tr("not support"), tr("pass") }; + return statusStr[status]; +} +void Form_mainInterface::on_tableWidget_currentItemChanged(QTableWidgetItem *current, QTableWidgetItem *previous) +{ + int row = current->row(); + int count = ui->tableWidget->rowCount(); + ui->pbtn_preStep->setEnabled(row != 0); + ui->pbtn_nextStep->setEnabled(row != count- 1); + QTableWidgetItem *item2 = ui->tableWidget->item(row, 1); + QString title = item2->text(); + QString testName; + if (title == HGPDTTOOLDB_TITLE_DIAL_SWITCH) + { + m_textTips->setViewContent(m_map_title_name.value(title).desc); + testName = m_map_title_name.value(title).name; + ui->stackedWidget->setCurrentWidget(m_textTips); + } + else if (title == HGPDTTOOLDB_TITLE_SINGLE_PAGE_TEST_1) + { + //addImg + testName = m_map_title_name.value(title).name; + ui->stackedWidget->setCurrentWidget(m_view); + } + ui_helper* helper; + hgscanner* hg = new hgscanner(m_handle); + helper = dynamic_cast(hg); - - + QString s("test-31"); +// func_test_go(s.toStdWString().c_str(), L"null", helper); +} diff --git a/app/HGProductionTool/form_maininterface.h b/app/HGProductionTool/form_maininterface.h index 9240d7e..b11c966 100644 --- a/app/HGProductionTool/form_maininterface.h +++ b/app/HGProductionTool/form_maininterface.h @@ -3,6 +3,7 @@ #include #include +#include #include "HGImgView.h" #include "form_texttips.h" #include "analysisjson.h" @@ -28,8 +29,6 @@ protected: void paintEvent(QPaintEvent *event) override; private slots: - void on_listWidget_currentTextChanged(const QString ¤tText); - void on_pbtn_preStep_clicked(); void on_pbtn_nextStep_clicked(); @@ -40,8 +39,13 @@ private slots: void on_pbtn_stop_clicked(); + void on_tableWidget_currentItemChanged(QTableWidgetItem *current, QTableWidgetItem *previous); + private: - void downloadCfgFile(); + void initTableWidgetUi(); + HGUInt getTestItemStatus(const QString &title); + bool setTestItemStatus(const QString &title, HGUInt status); + QString getItemStatusStr(HGUInt status); private: Ui::Form_mainInterface *ui; diff --git a/app/HGProductionTool/form_maininterface.ui b/app/HGProductionTool/form_maininterface.ui index 50f7ffc..a416bce 100644 --- a/app/HGProductionTool/form_maininterface.ui +++ b/app/HGProductionTool/form_maininterface.ui @@ -13,7 +13,7 @@ Form - + @@ -41,7 +41,7 @@ - + @@ -74,6 +74,13 @@ + + + + Next Step + + + @@ -95,13 +102,6 @@ - - - - Next Step - - - diff --git a/app/HGProductionTool/main.cpp b/app/HGProductionTool/main.cpp index 69716f1..944a0f4 100644 --- a/app/HGProductionTool/main.cpp +++ b/app/HGProductionTool/main.cpp @@ -19,8 +19,6 @@ int main(int argc, char *argv[]) if (login.exec()) { MainWindow w(login.GetUserMgr()); - w.showMaximized(); - w.Init(); a.exec(); if (w.isExitApp()) { diff --git a/app/HGProductionTool/mainwindow.cpp b/app/HGProductionTool/mainwindow.cpp index 71167f6..03e2a9a 100644 --- a/app/HGProductionTool/mainwindow.cpp +++ b/app/HGProductionTool/mainwindow.cpp @@ -51,6 +51,11 @@ MainWindow::MainWindow(HGPdtToolDbUserMgr pdtToolDbuserMgr, QWidget *parent) HGChar userName[128]; HGPdtToolDb_GetUserName(m_pdtToolDbuserMgr, userName, 128); setWindowTitle(userName); + + showMaximized(); + + SANE_Int v = 0; + sane_init_ex(&v, sane_ex_callback, this); } MainWindow::~MainWindow() @@ -75,12 +80,6 @@ MainWindow::~MainWindow() delete ui; } -void MainWindow::Init() -{ - SANE_Int v = 0; - sane_init_ex(&v, sane_ex_callback, this); -} - bool MainWindow::isExitApp() { return !m_isLogOut; diff --git a/app/HGProductionTool/mainwindow.h b/app/HGProductionTool/mainwindow.h index 967e0c1..c120070 100644 --- a/app/HGProductionTool/mainwindow.h +++ b/app/HGProductionTool/mainwindow.h @@ -20,7 +20,6 @@ class MainWindow : public QMainWindow public: MainWindow(HGPdtToolDbUserMgr pdtToolDbuserMgr, QWidget *parent = nullptr); ~MainWindow(); - void Init(); static QString getLogInfo(HGResult ret); bool isExitApp();