This commit is contained in:
luoliangyi 2022-12-23 14:17:45 +08:00
commit d4433e1d0b
12 changed files with 596 additions and 325 deletions

View File

@ -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

View File

@ -14,37 +14,37 @@
<translation></translation>
</message>
<message>
<location filename="dialog_inputserialnum.ui" line="75"/>
<location filename="dialog_inputserialnum.ui" line="82"/>
<source>Select devType:</source>
<translation></translation>
</message>
<message>
<location filename="dialog_inputserialnum.ui" line="89"/>
<location filename="dialog_inputserialnum.ui" line="96"/>
<source>G100</source>
<translation></translation>
</message>
<message>
<location filename="dialog_inputserialnum.ui" line="94"/>
<location filename="dialog_inputserialnum.ui" line="101"/>
<source>G200</source>
<translation></translation>
</message>
<message>
<location filename="dialog_inputserialnum.ui" line="99"/>
<location filename="dialog_inputserialnum.ui" line="106"/>
<source>G300</source>
<translation></translation>
</message>
<message>
<location filename="dialog_inputserialnum.ui" line="104"/>
<location filename="dialog_inputserialnum.ui" line="111"/>
<source>G400</source>
<translation></translation>
</message>
<message>
<location filename="dialog_inputserialnum.ui" line="142"/>
<location filename="dialog_inputserialnum.ui" line="149"/>
<source>OK</source>
<translation></translation>
</message>
<message>
<location filename="dialog_inputserialnum.ui" line="149"/>
<location filename="dialog_inputserialnum.ui" line="156"/>
<source>Cancel</source>
<translation></translation>
</message>
@ -149,27 +149,31 @@
<translation></translation>
</message>
<message>
<location filename="dialog_changepwd.ui" line="35"/>
<location filename="dialog_changepwd.ui" line="58"/>
<source>old password:</source>
<translation></translation>
</message>
<message>
<location filename="dialog_changepwd.ui" line="75"/>
<location filename="dialog_changepwd.ui" line="96"/>
<source>new password:</source>
<translation></translation>
</message>
<message>
<location filename="dialog_changepwd.ui" line="115"/>
<source>confirm new password:</source>
<translation></translation>
<location filename="dialog_changepwd.ui" line="134"/>
<source>cfm password:</source>
<translation></translation>
</message>
<message>
<location filename="dialog_changepwd.ui" line="155"/>
<source>confirm new password:</source>
<translation type="vanished"></translation>
</message>
<message>
<location filename="dialog_changepwd.ui" line="39"/>
<source>OK</source>
<translation></translation>
</message>
<message>
<location filename="dialog_changepwd.ui" line="162"/>
<location filename="dialog_changepwd.ui" line="26"/>
<source>Cancel</source>
<translation></translation>
</message>
@ -404,35 +408,70 @@
<translation></translation>
</message>
<message>
<location filename="form_maininterface.ui" line="80"/>
<location filename="form_maininterface.ui" line="87"/>
<source>PASS</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.ui" line="87"/>
<source>FAIL</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.ui" line="94"/>
<source>STOP</source>
<translation></translation>
<source>FAIL</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.ui" line="101"/>
<source>STOP</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.ui" line="80"/>
<source>Next Step</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="27"/>
<location filename="form_maininterface.cpp" line="71"/>
<source>Device type:</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="27"/>
<location filename="form_maininterface.cpp" line="71"/>
<source> SerialNum:</source>
<translation> </translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="185"/>
<source>ID</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="185"/>
<source>Test items</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="185"/>
<source>status</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="272"/>
<source>not test</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="272"/>
<source>not pass</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="272"/>
<source>not support</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="272"/>
<source>pass</source>
<translation></translation>
</message>
</context>
<context>
<name>Form_textTips</name>
@ -495,7 +534,7 @@
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="285"/>
<location filename="mainwindow.cpp" line="284"/>
<source>Account login elsewhere</source>
<translation></translation>
</message>
@ -504,76 +543,76 @@
<translation type="vanished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="288"/>
<location filename="mainwindow.cpp" line="287"/>
<source>You have been forced offline by the administrator account</source>
<translation>线</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="291"/>
<location filename="mainwindow.cpp" line="290"/>
<source>Data base error</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="240"/>
<location filename="mainwindow.cpp" line="260"/>
<location filename="mainwindow.cpp" line="299"/>
<location filename="mainwindow.cpp" line="317"/>
<location filename="mainwindow.cpp" line="239"/>
<location filename="mainwindow.cpp" line="259"/>
<location filename="mainwindow.cpp" line="298"/>
<location filename="mainwindow.cpp" line="316"/>
<source>tips</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="241"/>
<location filename="mainwindow.cpp" line="240"/>
<source>Are you sure to connect the new device</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="243"/>
<location filename="mainwindow.cpp" line="242"/>
<source>yes</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="244"/>
<location filename="mainwindow.cpp" line="243"/>
<source>no</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="260"/>
<location filename="mainwindow.cpp" line="317"/>
<location filename="mainwindow.cpp" line="259"/>
<location filename="mainwindow.cpp" line="316"/>
<source>cannot create more table</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="337"/>
<location filename="mainwindow.cpp" line="336"/>
<source>save</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="337"/>
<location filename="mainwindow.cpp" line="336"/>
<source>xls(*.xls)</source>
<translation>xls表格(*.xls)</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="361"/>
<location filename="mainwindow.cpp" line="360"/>
<source>Illegal user</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="365"/>
<location filename="mainwindow.cpp" line="364"/>
<source>Wrong password</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="369"/>
<location filename="mainwindow.cpp" line="368"/>
<source>Database error</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="373"/>
<location filename="mainwindow.cpp" line="372"/>
<source>connect error</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="377"/>
<location filename="mainwindow.cpp" line="376"/>
<source>Failed</source>
<translation></translation>
</message>

View File

@ -6,166 +6,153 @@
<rect>
<x>0</x>
<y>0</y>
<width>389</width>
<height>150</height>
<width>440</width>
<height>213</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>old password:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_oldPwd"/>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>new password:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_newPwd"/>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>confirm new password:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_confirmNewPwd"/>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pbtn_ok">
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbtn_cancel">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
<widget class="QPushButton" name="pbtn_cancel">
<property name="geometry">
<rect>
<x>310</x>
<y>160</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Cancel</string>
</property>
</widget>
<widget class="QPushButton" name="pbtn_ok">
<property name="geometry">
<rect>
<x>200</x>
<y>160</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>OK</string>
</property>
</widget>
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>110</x>
<y>20</y>
<width>219</width>
<height>22</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>old password:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_oldPwd">
<property name="minimumSize">
<size>
<width>133</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>133</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>110</x>
<y>60</y>
<width>219</width>
<height>22</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>new password:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_newPwd">
<property name="minimumSize">
<size>
<width>133</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>133</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>110</x>
<y>100</y>
<width>219</width>
<height>22</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_3">
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>cfm password:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_confirmNewPwd">
<property name="minimumSize">
<size>
<width>133</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>133</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>

View File

@ -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 &currentText)
{
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<hgscanner*>(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<AnalysisJson::json_node> 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<hgscanner*>(hg);
QString s("test-31");
// func_test_go(s.toStdWString().c_str(), L"null", helper);
}

View File

@ -3,6 +3,7 @@
#include <QWidget>
#include <QMap>
#include <QTableWidgetItem>
#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 &currentText);
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;

View File

@ -13,7 +13,7 @@
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
@ -41,7 +41,7 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="1,3">
<item>
<widget class="QListWidget" name="listWidget"/>
<widget class="QTableWidget" name="tableWidget"/>
</item>
<item>
<widget class="QStackedWidget" name="stackedWidget">
@ -74,6 +74,13 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbtn_nextStep">
<property name="text">
<string>Next Step</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbtn_pass">
<property name="text">
@ -95,13 +102,6 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbtn_nextStep">
<property name="text">
<string>Next Step</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">

View File

@ -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())
{

View File

@ -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;

View File

@ -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();

View File

@ -12,61 +12,176 @@ class test
ui_helper* helper_;
public:
test(ui_helper* helper) :helper_(helper)
{}
{
init_test_map_();
}
~test()
{}
std::map<const wchar_t*, test> test_map_;
struct ptrcmp
{
bool operator()(const wchar_t* name1, const wchar_t* name2)const
{
return wcscmp(name1, name2) < 0;
}
};
std::map<std::wstring, int(test::*)()> test_map_;
void init_test_map_()
{
// test_map_[HGPDTTOOLDB_NAME_DIAL_SWITCH] = &test::test_dial_switch;
test_map_[HGPDTTOOLDB_NAME_DIAL_SWITCH] = &test::test_dial_switch;
test_map_[HGPDTTOOLDB_NAME_ROCKER_SWITCH] = &test::test_pocker_switch;
test_map_[HGPDTTOOLDB_NAME_BOOT_STATUS] = &test::test_boot_status;
test_map_[HGPDTTOOLDB_NAME_LCD_DISPLAY] = &test::test_lcd_display;
test_map_[HGPDTTOOLDB_NAME_CLEAR_PAPER_PATH] = &test::tset_clear_paper_path;
test_map_[HGPDTTOOLDB_NAME_KEY_FUNCTION] = &test::test_key_funtion;
test_map_[HGPDTTOOLDB_NAME_COUNTING_MODE] = &test::test_count_mode;
test_map_[HGPDTTOOLDB_NAME_SKEW_DETECTION] = &test::test_skew_detection;
test_map_[HGPDTTOOLDB_NAME_SEPARATER_MOTOR] = &test::test_separater_motor;
test_map_[HGPDTTOOLDB_NAME_CIS_ORIGINAL_IMAGE] = &test::test_cis__original_image;
test_map_[HGPDTTOOLDB_NAME_HOST_FAN] = &test::test_host_fan;
test_map_[HGPDTTOOLDB_NAME_ULTRASONIC_MODULE] = &test::test_ultrasonic_module;
test_map_[HGPDTTOOLDB_NAME_LED_LIGHT] = &test::test_led_light;
test_map_[HGPDTTOOLDB_NAME_RESET] = &test::test_reset;
test_map_[HGPDTTOOLDB_NAME_PAPER_FEED] = &test::test_paper_feed;
test_map_[HGPDTTOOLDB_NAME_COVER_SENSOR] = &test::test_cover_sensor;
test_map_[HGPDTTOOLDB_NAME_SCANNING_SENSOR] = &test::test_scanning_sensor;
test_map_[HGPDTTOOLDB_NAME_CONFIGURE_SPEED_MODE] = &test::test_configure_speed_mode;
test_map_[HGPDTTOOLDB_NAME_PLACE_CORRECTION_PAPER] = &test::test_place_correction_paper;
test_map_[HGPDTTOOLDB_NAME_AUTO_FLAT_FIELD] = &test::test_auto_flat_field;
test_map_[HGPDTTOOLDB_NAME_REBOOT_DEVICE] = &test::test_reboot_device;
test_map_[HGPDTTOOLDB_NAME_IMAGE_QUALITY] = &test::test_image_quality;
test_map_[HGPDTTOOLDB_NAME_COLORCARD_IMAGEING_QUALITY] = &test::test_colorcard_imageing_quality;
test_map_[HGPDTTOOLDB_NAME_COLORCARD_BIAS_IMAGEING_QUALITY] = &test::test_colorcard_bias_imageing_quality;
test_map_[HGPDTTOOLDB_NAME_CLARITY_QUALITY] = &test::test_clarity_quality;
test_map_[HGPDTTOOLDB_NAME_DISTORTION] = &test::test_distortion;
test_map_[HGPDTTOOLDB_NAME_DORMANCY] = &test::test_dormancy;
test_map_[HGPDTTOOLDB_NAME_SKEW_GEAR] = &test::test_skew_gear;
test_map_[HGPDTTOOLDB_NAME_PAPER_SEPARATION_STRENGTH] = &test::test_paper_separation_strength;
test_map_[HGPDTTOOLDB_NAME_MECH_PAPER_FEEDING_INCLINATION] = &test::test_mech_paper_feeding_inclination;
test_map_[HGPDTTOOLDB_NAME_SINGLE_PAGE_TEST_1] = &test::test_single_page_test_1;
test_map_[HGPDTTOOLDB_NAME_SINGLE_PAGE_TEST_2] = &test::test_single_page_test_2;
test_map_[HGPDTTOOLDB_NAME_SINGLE_PAGE_TEST_3] = &test::test_single_page_test_3;
test_map_[HGPDTTOOLDB_NAME_PRESSUER_TEST] = &test::test_pressuer_test;
test_map_[HGPDTTOOLDB_NAME_CLEAR_ROLLER_COUNT] = &test::test_clear_roller_count;
}
int set_test(const wchar_t* str)
{
if (!str)
return SCANNER_ERR_NO_DATA;
ui_helper::test_event test_ev_;
int ret = SCANNER_ERR_OK;
std::wstring s = str;
//int count = test_map_.count(str) > 0;
wchar_t* start = (wchar_t*)L"START TEST ";
wchar_t* stop = (wchar_t*)L"STOP TEST ";
wchar_t ss[10];
wcscpy(ss,str);
/*if (!count)
{
ret = SCANNER_ERR_NO_DATA;
return ret;
}*/
//wcscat(start,str);
//helper_->test_callback(str, ui_helper::TEST_EVENT_TIPS, start, NULL);
auto it = test_map_.find(str);
if (it != test_map_.end())
{
ret = (this->*test_map_[str])();
}
else
{
return SCANNER_ERR_OK;
}
if (ret != SCANNER_ERR_OK)
{
helper_->test_callback(str, ui_helper::TEST_EVENT_TIPS, NULL, ret);
return ret;
}
helper_->test_callback(str, ui_helper::TEST_EVENT_TIPS, stop, ret);
return ret;
}
public:
/* 拨码开关校验 */
int test_dial_switch()
{
ui_helper::test_event ev = ui_helper::TEST_EVENT_TIPS;
int ret = helper_->io_control(IO_CTRL_CODE_BASE, NULL, NULL);
helper_->test_callback(HGPDTTOOLDB_NAME_DIAL_SWITCH, ev, NULL, ret);
return SCANNER_ERR_OK;
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
}
/* 检查船型开关功能 */
int test_pocker_switch()
{
return SCANNER_ERR_OK;
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
}
/* 设备上电并观察开机状态 */
int test_boot_status()
{
return SCANNER_ERR_OK;
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
}
/* 检查液晶显示 */
int test_lcd_display()
{
return SCANNER_ERR_OK;
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
}
/* 清理纸道功能确认 */
int tset_clear_paper_path()
{
return SCANNER_ERR_OK;
ui_helper::test_event test_ev_ = ui_helper::TEST_EVENT_RESULT;
int ret = helper_->io_control(IO_CTRL_CODE_GET_CLEAN_PAPER_ROAD, NULL, NULL);
if (ret != SCANNER_ERR_OK)
{
helper_->test_callback(HGPDTTOOLDB_NAME_DIAL_SWITCH, test_ev_, NULL, ret);
}
return ret;
}
/* 按键功能检测 */
int test_key_funtion()
{
return SCANNER_ERR_OK;
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
}
/* 计数模式检测 */
int test_count_mode()
{
return SCANNER_ERR_OK;
ui_helper::test_event test_ev_= ui_helper::TEST_EVENT_RESULT;
SANE_Bool ismode = false;
unsigned int len = sizeof(SANE_Bool);
int ret = helper_->io_control(IO_CTRL_CODE_GET_CLEAN_PAPER_ROAD, &ismode, &len);
if (ret != SCANNER_ERR_OK)
{
helper_->test_callback(HGPDTTOOLDB_NAME_DIAL_SWITCH, test_ev_, NULL, ret);
return ret;
}
helper_->test_callback(HGPDTTOOLDB_NAME_DIAL_SWITCH, test_ev_, NULL, ismode);
return ret;
}
/* 歪斜检测 */
int test_skew_detection()
{
ui_helper::test_event test_ev_ = ui_helper::TEST_EVENT_RESULT;
SANE_Bool ismode = true;
unsigned int len = sizeof(SANE_Bool);
int ret = helper_->io_control(IO_CTRL_CODE_SET_SKEW_CHECK, &ismode, &len);
if (ret != SCANNER_ERR_OK)
{
helper_->test_callback(HGPDTTOOLDB_NAME_SKEW_DETECTION, test_ev_, NULL, ret);
return ret;
}
int i = 5;
ret = helper_->io_control(IO_CTRL_CODE_SET_SKEW_CHECK_VAL, &i, &len);
ret = helper_->io_control(IO_CTRL_CODE_TEST_SINGLE, NULL, NULL);
helper_->test_callback(HGPDTTOOLDB_NAME_SKEW_DETECTION, test_ev_, NULL, ismode);
return ret;
return SCANNER_ERR_OK;
}
/* 分纸电机检测 */
@ -132,62 +247,77 @@ public:
/* 重启设备 */
int test_reboot_device()
{
return SCANNER_ERR_OK;
}
/* 扫描图像质量确认 */
int test_image_quality()
{
return SCANNER_ERR_OK;
}
/* 色卡纸成像质量评估 */
int test_colorcard_imageing_quality()
{
return SCANNER_ERR_OK;
}
/* 色卡纸偏色成像质量评估 */
int test_colorcard_bias_imageing_quality()
{
return SCANNER_ERR_OK;
}
/* 清晰度质量评估 */
int test_clarity_quality()
{
return SCANNER_ERR_OK;
}
/* 畸变修正 */
int test_distortion()
{
return SCANNER_ERR_OK;
}
/* 设置休眠 */
int test_dormancy()
{
return SCANNER_ERR_OK;
}
/* 歪斜挡位检测 */
int test_skew_gear()
{
return SCANNER_ERR_OK;
}
/* 分纸强度检测 */
int test_paper_separation_strength()
{
return SCANNER_ERR_OK;
}
/* 机械走纸倾斜检测 */
int test_mech_paper_feeding_inclination()
{
return SCANNER_ERR_OK;
}
/* 单张测试1 */
int test_single_page_test_1()
{
return SCANNER_ERR_OK;
}
/* 单张测试2 */
int test_single_page_test_2()
{
return SCANNER_ERR_OK;
}
/* 单张测试3 */
int test_single_page_test_3()
{
return SCANNER_ERR_OK;
}
/* 压力测试2轮 */
int test_pressuer_test()
{
return SCANNER_ERR_OK;
}
/* 清除滚轴计数 */
int test_clear_roller_count()
{
return SCANNER_ERR_OK;
}
private:
@ -197,7 +327,7 @@ private:
//test
static std::string jsontext1("{\"1\":{\"name\":\"test-8\",\"ver\":1}}");
std::string str_ret_call_= "";
std::string ret_call_= "";
bool have_img_ = false;
int sane_ex_callback1(SANE_Handle hdev, int code, void* data, unsigned int* len, void* param)
{
@ -205,22 +335,22 @@ int sane_ex_callback1(SANE_Handle hdev, int code, void* data, unsigned int* len,
{
case SANE_EVENT_WORKING:
{
str_ret_call_ = (char*)data;
ret_call_ = (char*)data;
}
break;
case SANE_EVENT_SCAN_FINISHED:
{
str_ret_call_ = (char*)data;
ret_call_ = (char*)data;
}
break;
case SANE_EVENT_STATUS:
{
str_ret_call_ = (char*)data;
ret_call_ = (char*)data;
}
break;
case SANE_EVENT_ERROR:
{
str_ret_call_ = (char*)data;
ret_call_ = (char*)data;
}
break;
case SANE_EVENT_IMAGE_OK:
@ -295,46 +425,12 @@ DECL_API(int) func_test_go(const wchar_t* name, const wchar_t* oper, ui_helper*
//helper->add_ref();
helper->register_sane_callback(sane_ex_callback1, NULL);
bool flag = false;
wchar_t* des = NULL;
int ret = 0;
size_t map_bool_len = sizeof(Test_Map_Bool) / sizeof(Test_Map_Bool[0]);
size_t map_str_len = sizeof(Test_Map_String) / sizeof(Test_Map_String[0]);
size_t map_int_len = sizeof(Test_Map_Int) / sizeof(Test_Map_Int[0]);
ui_helper::test_event ev = ui_helper::TEST_EVENT_TIPS; //项目测试设置TEST_EVENT_TIPS测试结果设置TEST_EVENT_RESULT
for (size_t i = 0; i < map_bool_len; i++)
{
des = (wchar_t*)Test_Map_Bool[i].title;
if (wcscmp(name, Test_Map_Bool[i].name) == 0) //理论上手动处理的事项是不会传下来
{
SANE_Bool map_bool = true;
unsigned int len = sizeof(SANE_Bool);
ret = helper->io_control(Test_Map_Bool[i].num,(void *)&map_bool, &len);
ev = ui_helper::TEST_EVENT_RESULT;
helper->test_callback(Test_Map_Bool[i].name, ev, NULL, ret);
test ts(helper);
ret = ts.set_test(name);
return SCANNER_ERR_OK;
}
/*else if(wcscmp(name, Test_Map_String[i].name) == 0)
{
return SCANNER_ERR_OK;
}
else if (wcscmp(name, Test_Map_Int[i].name) == 0)
{
return SCANNER_ERR_OK;
}*/
}
ret = helper->io_control(IO_CTRL_CODE_RESTORE_SETTINGS, NULL, NULL);
//helper->release();
//helper->unregister_sane_callback(sane_ex_callback);
if (!helper)
{
return SCANNER_ERR_NO_DATA;
}
//test ts(helper);
return SCANNER_ERR_OK;
ret = helper->io_control(IO_CTRL_CODE_RESTORE_SETTINGS, NULL, NULL);//½áÊø»Ö¸´Ä¬ÈÏ
return ret;
}
DECL_API(int) func_test_uninit(void* uninit)
{

View File

@ -13,13 +13,13 @@
/* 检查液晶显示 */
#define HGPDTTOOLDB_TITLE_LCD_DISPLAY L"检查液晶显示"
/* 清理纸道功能确认 */
#define HGPDTTOOLDB_TITLE_CLEAR_PAPER_PATH L"清理纸道功能确认"
#define HGPDTTOOLDB_TITLE_CLEAR_PAPER_PATH L"清理纸道功能确认" //1
/* 按键功能检测 */
#define HGPDTTOOLDB_TITLE_KEY_FUNCTION L"按键功能检测"
/* 计数模式检测 */
#define HGPDTTOOLDB_TITLE_COUNTING_MODE L"计数模式检测"
#define HGPDTTOOLDB_TITLE_COUNTING_MODE L"计数模式检测"//1
/* 歪斜检测 */
#define HGPDTTOOLDB_TITLE_SKEW_DETECTION L"歪斜检测"
#define HGPDTTOOLDB_TITLE_SKEW_DETECTION L"歪斜检测"//1
/* 分纸电机检测 */
#define HGPDTTOOLDB_TITLE_SEPARATER_MOTOR L"分纸电机检测"
/* CIS原图初检 */
@ -146,6 +146,7 @@
#define HGPDTTOOLDB_NAME_PRESSUER_TEST L"test-34"
/* 清除滚轴计数 */
#define HGPDTTOOLDB_NAME_CLEAR_ROLLER_COUNT L"test-35"
static struct Test_Map
{
const wchar_t* name; //test-1