2022-12-14 06:39:22 +00:00
|
|
|
#include "form_maininterface.h"
|
|
|
|
#include "ui_form_maininterface.h"
|
|
|
|
#include <QPainter>
|
2022-12-16 11:01:30 +00:00
|
|
|
#include <QMessageBox>
|
|
|
|
#include <QInputDialog>
|
|
|
|
#include "base/HGBase.h"
|
2022-12-14 06:39:22 +00:00
|
|
|
#include "imgfmt/HGImgFmt.h"
|
|
|
|
#include "HGUIGlobal.h"
|
|
|
|
#include "form_texttips.h"
|
2022-12-14 12:28:25 +00:00
|
|
|
#include "test_base.h"
|
2022-12-16 11:01:30 +00:00
|
|
|
#include "hgscanner.h"
|
|
|
|
#include "mainwindow.h"
|
2022-12-14 06:39:22 +00:00
|
|
|
|
2022-12-23 02:42:46 +00:00
|
|
|
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}
|
|
|
|
};
|
|
|
|
|
2022-12-26 10:38:34 +00:00
|
|
|
Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, SANE_Handle handle, HGPdtToolDbUserMgr pdtToolDbuserMgr, HGPdtToolDbDevice pdtToolDbDevice,
|
2022-12-23 10:32:57 +00:00
|
|
|
const QString &serialNum, const QString &devType, const QString &devName, const QString &devFwNum)
|
2022-12-16 11:01:30 +00:00
|
|
|
: QWidget(mainwnd)
|
2022-12-14 06:39:22 +00:00
|
|
|
, ui(new Ui::Form_mainInterface)
|
2022-12-16 11:01:30 +00:00
|
|
|
, m_mainwnd(mainwnd)
|
2022-12-26 10:38:34 +00:00
|
|
|
, m_hg(nullptr)
|
2022-12-16 11:01:30 +00:00
|
|
|
, m_handle(handle)
|
2022-12-17 05:48:03 +00:00
|
|
|
, m_pdtToolDbuserMgr(pdtToolDbuserMgr)
|
2022-12-16 11:01:30 +00:00
|
|
|
, m_pdtToolDbDevice(pdtToolDbDevice)
|
|
|
|
, m_serialNum(serialNum)
|
|
|
|
, m_devType(devType)
|
2022-12-23 10:32:57 +00:00
|
|
|
, m_devName(devName)
|
|
|
|
, m_devFwNum(devFwNum)
|
2022-12-14 06:39:22 +00:00
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
2022-12-23 10:32:57 +00:00
|
|
|
QString str;
|
|
|
|
if (m_handle)
|
|
|
|
str = tr("Device has connected");
|
|
|
|
else
|
|
|
|
str = tr("Device hasnot connected");
|
|
|
|
ui->label_sn->setText(tr("Device type:") + m_devType + tr(" SerialNum:") + m_serialNum + tr(" connect status:") + str);
|
|
|
|
|
|
|
|
setMinimumWidth(500);
|
|
|
|
ui->tableWidget->setMinimumWidth(300);
|
|
|
|
ui->tableWidget->setMaximumWidth(300);
|
2022-12-14 12:28:25 +00:00
|
|
|
m_textTips = new Form_textTips();
|
|
|
|
m_view = new HGImgView();
|
|
|
|
ui->stackedWidget->addWidget(m_textTips);
|
|
|
|
ui->stackedWidget->addWidget(m_view);
|
|
|
|
|
2022-12-23 02:42:46 +00:00
|
|
|
initTableWidgetUi();
|
2022-12-23 10:32:57 +00:00
|
|
|
|
|
|
|
HGPdtToolDb_SetDeviceType(m_pdtToolDbDevice, m_devType.toStdString().c_str());
|
|
|
|
HGPdtToolDb_SetDeviceVersion(m_pdtToolDbDevice, m_devFwNum.toStdString().c_str());
|
|
|
|
HGPdtToolDb_SetDeviceName(m_pdtToolDbDevice, m_devName.toStdString().c_str());
|
2022-12-26 10:38:34 +00:00
|
|
|
|
|
|
|
m_hg = new hgscanner(this, m_handle);
|
2022-12-14 06:39:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Form_mainInterface::~Form_mainInterface()
|
|
|
|
{
|
2022-12-26 10:38:34 +00:00
|
|
|
delete m_hg;
|
|
|
|
m_hg = nullptr;
|
|
|
|
|
2022-12-23 10:32:57 +00:00
|
|
|
sane_close(m_handle);
|
2022-12-26 10:38:34 +00:00
|
|
|
m_handle = nullptr;
|
2022-12-16 11:01:30 +00:00
|
|
|
HGPdtToolDb_CloseDevice(m_pdtToolDbDevice);
|
2022-12-26 10:38:34 +00:00
|
|
|
m_pdtToolDbDevice = nullptr;
|
2022-12-16 11:01:30 +00:00
|
|
|
|
2022-12-14 06:39:22 +00:00
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
2022-12-16 11:01:30 +00:00
|
|
|
QString Form_mainInterface::getSn()
|
|
|
|
{
|
|
|
|
return m_serialNum;
|
|
|
|
}
|
|
|
|
|
2022-12-23 10:32:57 +00:00
|
|
|
QString Form_mainInterface::getDevName()
|
|
|
|
{
|
|
|
|
return m_devName;
|
|
|
|
}
|
|
|
|
|
2022-12-26 10:38:34 +00:00
|
|
|
SANE_Handle Form_mainInterface::getDevHandle()
|
|
|
|
{
|
|
|
|
return m_handle;
|
|
|
|
}
|
|
|
|
|
|
|
|
hgscanner *Form_mainInterface::getScanner()
|
|
|
|
{
|
|
|
|
return m_hg;
|
|
|
|
}
|
|
|
|
|
2022-12-14 06:39:22 +00:00
|
|
|
void Form_mainInterface::paintEvent(QPaintEvent *event)
|
|
|
|
{
|
|
|
|
(void)event;
|
|
|
|
QPainter p(this);
|
|
|
|
p.setPen(QColor("gray"));
|
|
|
|
p.drawRect(0, 0, width() -1, height() -1);
|
|
|
|
}
|
|
|
|
|
2022-12-23 02:42:46 +00:00
|
|
|
void Form_mainInterface::on_pbtn_preStep_clicked()
|
2022-12-14 06:39:22 +00:00
|
|
|
{
|
2022-12-23 02:42:46 +00:00
|
|
|
int row = ui->tableWidget->currentRow();
|
|
|
|
if (row > 0)
|
2022-12-14 06:39:22 +00:00
|
|
|
{
|
2022-12-23 02:42:46 +00:00
|
|
|
ui->tableWidget->selectRow(row - 1);
|
2022-12-14 06:39:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Form_mainInterface::on_pbtn_nextStep_clicked()
|
|
|
|
{
|
2022-12-23 02:42:46 +00:00
|
|
|
int row = ui->tableWidget->currentRow();
|
|
|
|
if (row < ui->tableWidget->rowCount() - 1)
|
|
|
|
{
|
|
|
|
ui->tableWidget->selectRow(row + 1);
|
|
|
|
}
|
2022-12-14 06:39:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Form_mainInterface::on_pbtn_fail_clicked()
|
|
|
|
{
|
2022-12-23 02:42:46 +00:00
|
|
|
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));
|
2022-12-14 06:39:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Form_mainInterface::on_pbtn_pass_clicked()
|
|
|
|
{
|
2022-12-23 02:42:46 +00:00
|
|
|
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));
|
|
|
|
|
2022-12-14 12:28:25 +00:00
|
|
|
on_pbtn_nextStep_clicked();
|
2022-12-14 06:39:22 +00:00
|
|
|
}
|
|
|
|
|
2022-12-23 02:42:46 +00:00
|
|
|
void Form_mainInterface::on_pbtn_stop_clicked()
|
2022-12-16 11:01:30 +00:00
|
|
|
{
|
2022-12-23 02:42:46 +00:00
|
|
|
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)");
|
|
|
|
|
2022-12-17 05:48:03 +00:00
|
|
|
HGChar cfgPath[512] = {0};
|
|
|
|
HGBase_GetConfigPath(cfgPath, 512);
|
|
|
|
HGBase_CreateDir(cfgPath);
|
|
|
|
strcat(cfgPath, m_devType.toStdString().c_str());
|
|
|
|
strcat(cfgPath, ".json");
|
|
|
|
|
|
|
|
HGResult ret = HGPdtToolDb_DownloadFile(m_pdtToolDbuserMgr, m_devType.toStdString().c_str(), cfgPath);
|
2022-12-22 02:48:06 +00:00
|
|
|
if(ret == HGBASE_ERR_OK)
|
|
|
|
{
|
2022-12-17 05:48:03 +00:00
|
|
|
AnalysisJson analysisJson(QString::fromStdString(cfgPath));
|
|
|
|
|
2022-12-23 10:32:57 +00:00
|
|
|
std::map<HGUInt, bool> 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;
|
|
|
|
|
2022-12-17 05:48:03 +00:00
|
|
|
std::vector<AnalysisJson::json_node> list_jsonNode = analysisJson.GetNode();
|
2022-12-23 02:42:46 +00:00
|
|
|
int count = list_jsonNode.size();
|
|
|
|
ui->tableWidget->setRowCount(count);
|
|
|
|
for(int i = 0; i < count; ++i)
|
2022-12-17 05:48:03 +00:00
|
|
|
{
|
|
|
|
AnalysisJson::json_node node = list_jsonNode[i];
|
|
|
|
m_map_title_name.insert(node.title, node);
|
2022-12-23 02:42:46 +00:00
|
|
|
|
|
|
|
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));
|
|
|
|
}
|
2022-12-23 10:32:57 +00:00
|
|
|
|
|
|
|
HGUInt entry = getTestItem(node.title);
|
|
|
|
std::map<HGUInt, bool>::iterator iter;
|
|
|
|
for (iter = dbEntryItems.begin(); iter != dbEntryItems.end(); ++iter)
|
|
|
|
{
|
|
|
|
if (entry == iter->first)
|
|
|
|
{
|
|
|
|
iter->second = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
std::map<HGUInt, bool>::iterator iter;
|
|
|
|
for (iter = dbEntryItems.begin(); iter != dbEntryItems.end(); ++iter)
|
|
|
|
{
|
|
|
|
if (!iter->second)
|
|
|
|
{
|
|
|
|
HGPdtToolDb_SetDeviceEntryStatus(m_pdtToolDbDevice, iter->first, HGPDTTOOLDB_ENTRYSTATUS_NOTSUPP);
|
|
|
|
}
|
2022-12-17 05:48:03 +00:00
|
|
|
}
|
2022-12-23 02:42:46 +00:00
|
|
|
|
|
|
|
ui->tableWidget->selectRow(0);
|
2022-12-22 02:48:06 +00:00
|
|
|
}
|
2022-12-16 11:01:30 +00:00
|
|
|
}
|
|
|
|
|
2022-12-23 10:32:57 +00:00
|
|
|
HGUInt Form_mainInterface::getTestItem(const QString &title)
|
|
|
|
{
|
|
|
|
HGUInt entry = 0;
|
|
|
|
for (int i = 0; i < sizeof(Rela) / sizeof(RELA); ++i)
|
|
|
|
{
|
|
|
|
if (0 == wcscmp(title.toStdWString().c_str(), Rela[i].title))
|
|
|
|
{
|
|
|
|
entry = Rela[i].entryName;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return entry;
|
|
|
|
}
|
|
|
|
|
2022-12-23 02:42:46 +00:00
|
|
|
HGUInt Form_mainInterface::getTestItemStatus(const QString &title)
|
2022-12-16 11:01:30 +00:00
|
|
|
{
|
2022-12-23 02:42:46 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
2022-12-17 05:48:03 +00:00
|
|
|
|
2022-12-23 02:42:46 +00:00
|
|
|
return status;
|
|
|
|
}
|
2022-12-17 05:48:03 +00:00
|
|
|
|
2022-12-23 02:42:46 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
2022-12-17 05:48:03 +00:00
|
|
|
|
2022-12-23 02:42:46 +00:00
|
|
|
return ret;
|
|
|
|
}
|
2022-12-17 05:48:03 +00:00
|
|
|
|
2022-12-23 02:42:46 +00:00
|
|
|
QString Form_mainInterface::getItemStatusStr(HGUInt status)
|
|
|
|
{
|
|
|
|
static const QString statusStr[] = {tr("not test"), tr("not pass"), tr("not support"), tr("pass") };
|
|
|
|
return statusStr[status];
|
|
|
|
}
|
2022-12-17 05:48:03 +00:00
|
|
|
|
2022-12-23 02:42:46 +00:00
|
|
|
void Form_mainInterface::on_tableWidget_currentItemChanged(QTableWidgetItem *current, QTableWidgetItem *previous)
|
|
|
|
{
|
2022-12-26 08:24:20 +00:00
|
|
|
(void)previous;
|
2022-12-23 02:42:46 +00:00
|
|
|
int row = current->row();
|
|
|
|
int count = ui->tableWidget->rowCount();
|
|
|
|
ui->pbtn_preStep->setEnabled(row != 0);
|
|
|
|
ui->pbtn_nextStep->setEnabled(row != count- 1);
|
2022-12-17 05:48:03 +00:00
|
|
|
|
2022-12-23 02:42:46 +00:00
|
|
|
QTableWidgetItem *item2 = ui->tableWidget->item(row, 1);
|
|
|
|
QString title = item2->text();
|
2022-12-17 05:48:03 +00:00
|
|
|
|
2022-12-26 08:24:20 +00:00
|
|
|
bool man = m_map_title_name.value(title).is_man;
|
|
|
|
ui->pbtn_start->setEnabled(!man);
|
|
|
|
|
2022-12-23 02:42:46 +00:00
|
|
|
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);
|
|
|
|
}
|
2022-12-26 08:24:20 +00:00
|
|
|
}
|
2022-12-17 05:48:03 +00:00
|
|
|
|
2022-12-26 08:24:20 +00:00
|
|
|
void Form_mainInterface::on_pbtn_start_clicked()
|
|
|
|
{
|
|
|
|
int row = ui->tableWidget->currentRow();
|
|
|
|
QTableWidgetItem *item = ui->tableWidget->item(row, 1);
|
|
|
|
QString title = item->text();
|
2022-12-26 10:38:34 +00:00
|
|
|
func_test_go(title.toStdWString().c_str(), L"null", m_hg);
|
2022-12-23 02:42:46 +00:00
|
|
|
}
|