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"
|
2022-12-27 08:25:47 +00:00
|
|
|
#include "HGString.h"
|
2022-12-14 06:39:22 +00:00
|
|
|
#include "form_texttips.h"
|
2022-12-14 12:28:25 +00:00
|
|
|
#include "test_base.h"
|
2023-09-12 03:02:45 +00:00
|
|
|
#include "app_cfg.h"
|
2022-12-16 11:01:30 +00:00
|
|
|
#include "hgscanner.h"
|
|
|
|
#include "mainwindow.h"
|
2022-12-27 11:46:31 +00:00
|
|
|
#include "dialog_excepdesc.h"
|
2022-12-30 02:43:17 +00:00
|
|
|
#include "huagao/hgscanner_error.h"
|
2022-12-14 06:39:22 +00:00
|
|
|
|
2023-08-31 07:15:14 +00:00
|
|
|
Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::LogInType logInType, const QString &profileName, const QString &accountName, SANE_Handle handle,
|
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)
|
2023-01-04 12:48:53 +00:00
|
|
|
, m_logInType(logInType)
|
2023-08-31 02:16:44 +00:00
|
|
|
, m_accountName(accountName)
|
2023-08-31 07:15:14 +00:00
|
|
|
, m_profileName(profileName)
|
2022-12-26 10:38:34 +00:00
|
|
|
, m_hg(nullptr)
|
2022-12-16 11:01:30 +00:00
|
|
|
, m_handle(handle)
|
2022-12-31 04:43:02 +00:00
|
|
|
, m_disconnect(false)
|
2022-12-16 11:01:30 +00:00
|
|
|
, m_serialNum(serialNum)
|
|
|
|
, m_devType(devType)
|
2022-12-23 10:32:57 +00:00
|
|
|
, m_devName(devName)
|
|
|
|
, m_devFwNum(devFwNum)
|
2023-01-09 06:23:43 +00:00
|
|
|
, m_curItemName("")
|
2022-12-29 09:54:32 +00:00
|
|
|
, m_isTesting(false)
|
2023-03-06 09:44:08 +00:00
|
|
|
, m_isCorrectNormal(true)
|
2023-01-05 10:38:10 +00:00
|
|
|
, m_multiIndex(-1)
|
2023-01-09 06:23:43 +00:00
|
|
|
, m_curNameIndex(1)
|
2023-02-11 01:55:12 +00:00
|
|
|
, m_curDpi(0)
|
|
|
|
, m_distortion_200dpi(0.0)
|
|
|
|
, m_distortion_300dpi(0.0)
|
2023-02-28 07:07:31 +00:00
|
|
|
, m_distortion_600dpi(0.0)
|
2022-12-14 06:39:22 +00:00
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
2023-01-06 01:35:41 +00:00
|
|
|
ui->pbtn_showImg->setVisible(false);
|
2023-01-06 08:18:57 +00:00
|
|
|
ui->pbtn_leftRotate->setVisible(false);
|
|
|
|
ui->pbtn_rightRotate->setVisible(false);
|
|
|
|
ui->pbtn_prePage->setVisible(false);
|
|
|
|
ui->pbtn_nextPage->setVisible(false);
|
2023-01-06 01:35:41 +00:00
|
|
|
|
2022-12-28 06:57:00 +00:00
|
|
|
QFont ft;
|
|
|
|
ft.setPointSize(15);
|
|
|
|
this->setFont(ft);
|
|
|
|
|
2022-12-27 08:25:47 +00:00
|
|
|
connect(this, SIGNAL(testResult(QString)), this, SLOT(on_testResult(QString)), Qt::QueuedConnection);
|
|
|
|
connect(this, SIGNAL(testResultImg(void*)), this, SLOT(on_testResultImg(void*)), Qt::QueuedConnection);
|
2023-01-09 10:48:00 +00:00
|
|
|
connect(this, &Form_mainInterface::testDistortion, this, &Form_mainInterface::on_testDistortion);
|
2022-12-30 08:49:55 +00:00
|
|
|
connect(this, SIGNAL(testCorrectInfo(QString)), this, SLOT(on_testCorrectInfo(QString)), Qt::QueuedConnection);
|
2023-03-20 09:38:47 +00:00
|
|
|
connect(this, SIGNAL(testGetDevCfgInfo(int,int,int,int,QString,QString,QString)), this, SLOT(on_testGetDevCfgInfo(int,int,int,int,QString,QString,QString)), Qt::QueuedConnection);
|
2023-03-06 07:26:24 +00:00
|
|
|
connect(this, SIGNAL(testOpenCacheFile(QString)), this, SLOT(on_testOpenCacheFile(QString)), Qt::QueuedConnection);
|
2023-12-21 01:47:30 +00:00
|
|
|
connect(this, SIGNAL(testGetDevCpuDisk(int,int)), this, SLOT(on_testGetDevCpuDisk(int,int)), Qt::QueuedConnection);
|
2024-01-04 09:56:36 +00:00
|
|
|
connect(this, SIGNAL(testGetDevdistortion(float,float,float)), this, SLOT(on_testGetDevdistortion(float,float,float)), Qt::QueuedConnection);
|
2022-12-27 08:25:47 +00:00
|
|
|
|
2022-12-23 10:32:57 +00:00
|
|
|
if (m_handle)
|
2023-01-03 10:42:08 +00:00
|
|
|
{
|
2023-01-06 07:17:48 +00:00
|
|
|
m_hg = new hgscanner(this, nullptr, nullptr, m_handle);
|
2024-07-24 09:33:51 +00:00
|
|
|
func_test_uninit(NULL);
|
|
|
|
func_test_init(NULL, m_hg);
|
2023-01-03 10:42:08 +00:00
|
|
|
}
|
2023-03-06 07:26:24 +00:00
|
|
|
ui->label_devInfo->setText(tr("Device type:") + m_devType + tr(" SerialNum:") + m_serialNum + " " + tr("FirmwareNum:") + m_devFwNum);
|
2022-12-23 10:32:57 +00:00
|
|
|
|
2023-02-11 01:55:12 +00:00
|
|
|
ui->label_speedMode->setText(tr(" speed mode:") + getSpeedMode());
|
|
|
|
ui->label_sleepTime->setText(tr(" sleep time:") + getSleepTime());
|
2023-01-06 08:18:57 +00:00
|
|
|
|
2023-02-11 01:55:12 +00:00
|
|
|
ui->label_vidpid->setText(tr(" VID:") + getDevVid() + tr(" PID:") + getDevPid());
|
2023-01-06 05:39:49 +00:00
|
|
|
|
2023-01-05 12:37:01 +00:00
|
|
|
ui->label_imgInfo->setVisible(false);
|
2023-02-11 01:55:12 +00:00
|
|
|
ui->label_destortionInfo_200dpi->setVisible(false);
|
|
|
|
ui->label_destortionInfo_300dpi->setVisible(false);
|
2023-01-05 12:37:01 +00:00
|
|
|
|
2022-12-23 10:32:57 +00:00
|
|
|
setMinimumWidth(500);
|
2023-02-08 10:24:19 +00:00
|
|
|
ui->tableWidget->setMinimumWidth(450);
|
|
|
|
ui->tableWidget->setMaximumWidth(450);
|
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-27 11:46:31 +00:00
|
|
|
ui->pbtn_showImg->setToolTip(tr("load last image which uploaded last time"));
|
2022-12-14 12:28:25 +00:00
|
|
|
|
2023-01-06 01:35:41 +00:00
|
|
|
connect(m_view, SIGNAL(doubleClicked()), this, SLOT(on_viewerDblClick()));
|
|
|
|
|
2022-12-23 02:42:46 +00:00
|
|
|
initTableWidgetUi();
|
2022-12-23 10:32:57 +00:00
|
|
|
|
2023-08-31 02:50:43 +00:00
|
|
|
// if(!m_devType.isEmpty())
|
|
|
|
// HGPdtToolDb_SetDeviceType(m_pdtToolDbDevice, m_devType.toStdString().c_str());
|
|
|
|
// if(!m_devFwNum.isEmpty())
|
|
|
|
// HGPdtToolDb_SetDeviceVersion(m_pdtToolDbDevice, m_devFwNum.toStdString().c_str());
|
|
|
|
// if(!m_devName.isEmpty())
|
|
|
|
// HGPdtToolDb_SetDeviceName(m_pdtToolDbDevice, m_devName.toStdString().c_str());
|
2022-12-14 06:39:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Form_mainInterface::~Form_mainInterface()
|
|
|
|
{
|
2023-01-05 10:38:10 +00:00
|
|
|
m_multiIndex = -1;
|
2023-01-09 06:23:43 +00:00
|
|
|
m_curNameIndex = 1;
|
2023-01-05 10:38:10 +00:00
|
|
|
m_list_images.clear();
|
|
|
|
QDir dir(getCachePath());
|
|
|
|
if (dir.exists())
|
|
|
|
dir.removeRecursively();
|
|
|
|
|
2022-12-26 10:38:34 +00:00
|
|
|
delete m_hg;
|
|
|
|
m_hg = nullptr;
|
|
|
|
|
2024-07-24 09:33:51 +00:00
|
|
|
func_test_uninit(NULL);
|
|
|
|
|
2022-12-23 10:32:57 +00:00
|
|
|
sane_close(m_handle);
|
2022-12-26 10:38:34 +00:00
|
|
|
m_handle = nullptr;
|
2023-08-31 02:50:43 +00:00
|
|
|
//HGPdtToolDb_CloseDevice(m_pdtToolDbDevice);
|
|
|
|
//m_pdtToolDbDevice = nullptr;
|
2022-12-16 11:01:30 +00:00
|
|
|
|
2022-12-14 06:39:22 +00:00
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
2022-12-29 09:54:32 +00:00
|
|
|
bool Form_mainInterface::isTesting()
|
|
|
|
{
|
|
|
|
return m_isTesting;
|
|
|
|
}
|
|
|
|
|
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-31 04:43:02 +00:00
|
|
|
void Form_mainInterface::setDevDisconnect()
|
|
|
|
{
|
|
|
|
m_disconnect = true;
|
|
|
|
}
|
|
|
|
|
2024-07-24 09:33:51 +00:00
|
|
|
void Form_mainInterface::checkWrongCorrectItem(int correctType)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < ui->tableWidget->rowCount(); i++)
|
|
|
|
{
|
|
|
|
QTableWidgetItem *item = ui->tableWidget->item(i, 1);
|
|
|
|
if (item != nullptr)
|
|
|
|
{
|
|
|
|
QString title = item->text();
|
|
|
|
QString name = m_map_title_name.value(title).name;
|
|
|
|
|
|
|
|
if (1 == correctType && HGPDTTOOLDB_NAME_IMAGE_CORRECTION_RGB_200DPI == name)
|
|
|
|
{
|
|
|
|
ui->tableWidget->item(i, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
|
|
|
ui->tableWidget->item(i, 2)->setBackgroundColor(QColor(255,0,0));
|
|
|
|
ui->tableWidget->item(i, 2)->setText(tr("not pass"));
|
|
|
|
}
|
|
|
|
else if (2 == correctType && HGPDTTOOLDB_NAME_IMAGE_CORRECTION_GRAY_200DPI == name)
|
|
|
|
{
|
|
|
|
ui->tableWidget->item(i, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
|
|
|
ui->tableWidget->item(i, 2)->setBackgroundColor(QColor(255,0,0));
|
|
|
|
ui->tableWidget->item(i, 2)->setText(tr("not pass"));
|
|
|
|
}
|
|
|
|
else if (3 == correctType && HGPDTTOOLDB_NAME_IMAGE_CORRECTION_RGB_300DPI == name)
|
|
|
|
{
|
|
|
|
ui->tableWidget->item(i, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
|
|
|
ui->tableWidget->item(i, 2)->setBackgroundColor(QColor(255,0,0));
|
|
|
|
ui->tableWidget->item(i, 2)->setText(tr("not pass"));
|
|
|
|
}
|
|
|
|
else if (4 == correctType && HGPDTTOOLDB_NAME_IMAGE_CORRECTION_GRAY_300DPI == name)
|
|
|
|
{
|
|
|
|
ui->tableWidget->item(i, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
|
|
|
ui->tableWidget->item(i, 2)->setBackgroundColor(QColor(255,0,0));
|
|
|
|
ui->tableWidget->item(i, 2)->setText(tr("not pass"));
|
|
|
|
}
|
|
|
|
else if (5 == correctType && HGPDTTOOLDB_NAME_IMAGE_CORRECTION_RGB_600DPI == name)
|
|
|
|
{
|
|
|
|
ui->tableWidget->item(i, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
|
|
|
ui->tableWidget->item(i, 2)->setBackgroundColor(QColor(255,0,0));
|
|
|
|
ui->tableWidget->item(i, 2)->setText(tr("not pass"));
|
|
|
|
}
|
|
|
|
else if (6 == correctType && HGPDTTOOLDB_NAME_IMAGE_CORRECTION_GRAY_600DPI == name)
|
|
|
|
{
|
|
|
|
ui->tableWidget->item(i, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
|
|
|
ui->tableWidget->item(i, 2)->setBackgroundColor(QColor(255,0,0));
|
|
|
|
ui->tableWidget->item(i, 2)->setText(tr("not pass"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Form_mainInterface::resetCorrectItems()
|
|
|
|
{
|
|
|
|
for (int i = 0; i < ui->tableWidget->rowCount(); i++)
|
|
|
|
{
|
|
|
|
QTableWidgetItem *item = ui->tableWidget->item(i, 1);
|
|
|
|
if (item != nullptr)
|
|
|
|
{
|
|
|
|
QString title = item->text();
|
|
|
|
QString name = m_map_title_name.value(title).name;
|
|
|
|
|
|
|
|
if (HGPDTTOOLDB_NAME_IMAGE_CORRECTION_RGB_200DPI == name ||
|
|
|
|
HGPDTTOOLDB_NAME_IMAGE_CORRECTION_GRAY_200DPI == name ||
|
|
|
|
HGPDTTOOLDB_NAME_IMAGE_CORRECTION_RGB_300DPI == name ||
|
|
|
|
HGPDTTOOLDB_NAME_IMAGE_CORRECTION_GRAY_300DPI == name ||
|
|
|
|
HGPDTTOOLDB_NAME_IMAGE_CORRECTION_RGB_600DPI == name ||
|
|
|
|
HGPDTTOOLDB_NAME_IMAGE_CORRECTION_GRAY_600DPI == name)
|
|
|
|
{
|
|
|
|
ui->tableWidget->item(i, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
|
|
|
ui->tableWidget->item(i, 2)->setBackground(Qt::transparent);
|
|
|
|
ui->tableWidget->item(i, 2)->setText(tr("not test"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-14 06:39:22 +00:00
|
|
|
void Form_mainInterface::paintEvent(QPaintEvent *event)
|
|
|
|
{
|
|
|
|
(void)event;
|
|
|
|
QPainter p(this);
|
2023-01-05 10:38:10 +00:00
|
|
|
p.fillRect(0, 0, this->width(), this->height(), qRgb(230, 230, 230));
|
2022-12-14 06:39:22 +00:00
|
|
|
p.setPen(QColor("gray"));
|
|
|
|
p.drawRect(0, 0, width() -1, height() -1);
|
|
|
|
}
|
|
|
|
|
2022-12-27 08:25:47 +00:00
|
|
|
void Form_mainInterface::on_testResult(QString text)
|
|
|
|
{
|
2023-03-06 09:44:08 +00:00
|
|
|
if (!m_isCorrectNormal)
|
|
|
|
text += (tr(",but correct information is abnormal"));
|
|
|
|
|
2022-12-30 10:30:02 +00:00
|
|
|
if (!text.isEmpty())
|
|
|
|
QMessageBox::information(this, tr("tips"), text);
|
|
|
|
|
|
|
|
updateUiEnabled(true);
|
|
|
|
m_isTesting = false;
|
|
|
|
m_mainwnd->releaseTesting();
|
2022-12-31 04:43:02 +00:00
|
|
|
|
|
|
|
if (m_disconnect)
|
|
|
|
{
|
|
|
|
m_mainwnd->RemoveInterface(this);
|
|
|
|
}
|
2022-12-27 08:25:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Form_mainInterface::on_testResultImg(void *img)
|
|
|
|
{
|
|
|
|
HGImage image = (HGImage)img;
|
2023-01-05 10:38:10 +00:00
|
|
|
|
2023-01-09 06:23:43 +00:00
|
|
|
QString filename = getCacheFileName();
|
|
|
|
HGImgFmt_SaveImage(image, 0, 0, getStdString(filename).c_str());
|
2023-01-05 10:38:10 +00:00
|
|
|
|
2023-01-09 06:23:43 +00:00
|
|
|
m_list_images.push_back(filename);
|
2023-01-05 10:38:10 +00:00
|
|
|
m_multiIndex = m_list_images.size() - 1;
|
|
|
|
|
2022-12-27 08:25:47 +00:00
|
|
|
ui->stackedWidget->setCurrentWidget(m_view);
|
|
|
|
m_view->addImage(image);
|
2022-12-28 06:57:00 +00:00
|
|
|
ui->pbtn_leftRotate->setVisible(true);
|
|
|
|
ui->pbtn_rightRotate->setVisible(true);
|
2023-01-06 01:35:41 +00:00
|
|
|
ui->pbtn_prePage->setVisible(true);
|
|
|
|
ui->pbtn_nextPage->setVisible(true);
|
2022-12-27 08:25:47 +00:00
|
|
|
|
|
|
|
HGBase_DestroyImage(image);
|
|
|
|
}
|
|
|
|
|
2024-08-15 10:29:14 +00:00
|
|
|
void Form_mainInterface::on_testDistortion(float width, float height, float distortion, bool verify)
|
2022-12-28 06:57:00 +00:00
|
|
|
{
|
2023-01-09 10:48:00 +00:00
|
|
|
ui->label_imgInfo->setVisible(true);
|
|
|
|
|
2024-08-15 10:29:14 +00:00
|
|
|
ui->label_destortionInfo_200dpi->setVisible(!verify);
|
|
|
|
ui->label_destortionInfo_300dpi->setVisible(!verify);
|
2023-01-09 08:45:22 +00:00
|
|
|
|
2024-08-15 10:29:14 +00:00
|
|
|
ui->label_imgInfo->setText(tr("image pixel: ") + QString::number((width > 0 && width < 9999) ? width : 0.0, 'f', 4) +
|
|
|
|
" * " + QString::number((height > 0 && height < 9999) ? height : 0.0, 'f', 4));
|
2023-02-11 01:55:12 +00:00
|
|
|
|
2024-08-15 10:29:14 +00:00
|
|
|
if (!verify)
|
|
|
|
{
|
|
|
|
if (200 == m_curDpi)
|
2023-02-11 01:55:12 +00:00
|
|
|
{
|
2024-08-15 10:29:14 +00:00
|
|
|
m_distortion_200dpi = distortion > 0 ? distortion : 0;
|
|
|
|
ui->label_destortionInfo_200dpi->setText(" 200dpi" + tr("destortion value: ") + QString::number(m_distortion_200dpi, 'f', 4));
|
|
|
|
|
|
|
|
if (m_hg != nullptr)
|
|
|
|
{
|
|
|
|
m_hg->setDistortValue(m_distortion_200dpi);
|
|
|
|
}
|
2023-02-11 01:55:12 +00:00
|
|
|
}
|
2024-08-15 10:29:14 +00:00
|
|
|
else if (300 == m_curDpi)
|
|
|
|
{
|
|
|
|
m_distortion_300dpi = distortion > 0 ? distortion : 0;
|
|
|
|
ui->label_destortionInfo_300dpi->setText(" 300dpi" + tr("destortion value: ") + QString::number(m_distortion_300dpi, 'f', 4));
|
2023-02-28 07:07:31 +00:00
|
|
|
|
2024-08-15 10:29:14 +00:00
|
|
|
if (m_hg != nullptr)
|
|
|
|
{
|
|
|
|
m_hg->setDistortValue(m_distortion_300dpi);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (600 == m_curDpi)
|
2023-02-28 07:07:31 +00:00
|
|
|
{
|
2024-08-15 10:29:14 +00:00
|
|
|
m_distortion_600dpi = distortion > 0 ? distortion : 0;
|
|
|
|
ui->label_destortionInfo_600dpi->setText(" 600dpi" + tr("destortion value: ") + QString::number(m_distortion_600dpi, 'f', 4));
|
|
|
|
|
|
|
|
if (m_hg != nullptr)
|
|
|
|
{
|
|
|
|
m_hg->setDistortValue(m_distortion_600dpi);
|
|
|
|
}
|
2023-02-28 07:07:31 +00:00
|
|
|
}
|
|
|
|
}
|
2023-02-08 10:24:19 +00:00
|
|
|
|
2023-01-05 12:37:01 +00:00
|
|
|
updateUiEnabled(true);
|
|
|
|
m_isTesting = false;
|
|
|
|
m_mainwnd->releaseTesting();
|
|
|
|
|
|
|
|
if (m_disconnect)
|
|
|
|
{
|
|
|
|
m_mainwnd->RemoveInterface(this);
|
2022-12-30 10:30:02 +00:00
|
|
|
}
|
2022-12-29 09:54:32 +00:00
|
|
|
}
|
|
|
|
|
2022-12-30 08:49:55 +00:00
|
|
|
void Form_mainInterface::on_testCorrectInfo(QString info)
|
|
|
|
{
|
2023-03-06 09:44:08 +00:00
|
|
|
if (info.contains("异常"))
|
|
|
|
{
|
|
|
|
m_isCorrectNormal = false;
|
|
|
|
m_textTips->addContent(info, false);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_textTips->addContent(info, true);
|
|
|
|
}
|
2022-12-30 08:49:55 +00:00
|
|
|
}
|
|
|
|
|
2023-03-20 09:38:47 +00:00
|
|
|
void Form_mainInterface::on_testGetDevCfgInfo(int vid, int pid, int sleepTime, int speedMode, QString devSn, QString devFw, QString devModel)
|
2023-02-16 05:52:18 +00:00
|
|
|
{
|
|
|
|
char buf[10];
|
|
|
|
sprintf(buf, "%x", vid);
|
|
|
|
char buf2[10];
|
|
|
|
sprintf(buf2, "%x", pid);
|
|
|
|
QString str = (tr("please verify the configuration of the device:") + "\n\t");
|
|
|
|
str.append(tr("vid:%1\n\t").arg(QString::fromStdString(buf)));
|
|
|
|
str.append(tr("pid:%1\n\t").arg(QString::fromStdString(buf2)));
|
2023-07-25 06:47:59 +00:00
|
|
|
str.append(sleepTime > 0 ? tr("sleep time:%1minute\n\t").arg(QString::number(sleepTime)) : tr("sleep time:%1\n\t").arg(tr("Not sleeping")));
|
2023-02-16 05:52:18 +00:00
|
|
|
str.append(tr("speed mode:%1PPM\n\t").arg(QString::number(speedMode)));
|
2023-03-06 07:26:24 +00:00
|
|
|
str.append(tr("device serial number:%1\n\t").arg(devSn));
|
2023-03-20 09:38:47 +00:00
|
|
|
str.append(tr("device firmware number:%1\n\t").arg(devFw));
|
|
|
|
if (!devModel.isEmpty())
|
|
|
|
str.append(tr("device model:%1").arg(devModel));
|
2023-02-16 05:52:18 +00:00
|
|
|
|
|
|
|
m_textTips->setViewContent(str);
|
|
|
|
}
|
|
|
|
|
2023-12-21 01:47:30 +00:00
|
|
|
void Form_mainInterface::on_testGetDevCpuDisk(int cpu, int disk)
|
2023-09-20 05:46:37 +00:00
|
|
|
{
|
2023-09-21 01:26:12 +00:00
|
|
|
AnalysisJson analysisJson(m_profileName);
|
|
|
|
AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
|
2024-06-25 14:24:04 +00:00
|
|
|
float cpu_size = jsonGlobal.cpu_size;
|
|
|
|
float disk_size = jsonGlobal.disk_size;
|
2023-12-21 01:47:30 +00:00
|
|
|
|
|
|
|
float devCpuSize = (float)cpu / 1024 / 1024;
|
|
|
|
char buf[10] = { 0 };
|
|
|
|
sprintf(buf, "%.2f", devCpuSize);
|
|
|
|
|
|
|
|
float devDiskSize = (float)disk / 1024 / 1024;
|
|
|
|
char buf2[10] = { 0 };
|
|
|
|
sprintf(buf2, "%.2f", devDiskSize);
|
2023-09-21 01:26:12 +00:00
|
|
|
|
|
|
|
QString str = (tr("please verify the size of the device's cpu and disk:") + "\n\n\t");
|
2023-12-21 01:47:30 +00:00
|
|
|
str.append(tr("Target cpu size:>%1").arg(QString::number(cpu_size)) + "GB\n\t");
|
|
|
|
str.append(tr("Target disk size:>%1").arg(QString::number(disk_size)) + "GB\n\n\t");
|
2023-09-21 01:26:12 +00:00
|
|
|
|
2023-12-21 01:47:30 +00:00
|
|
|
str.append(tr("Actual cpu size:%1").arg(buf) + "GB\n\t");
|
|
|
|
str.append(tr("Actual disk size:%1").arg(buf2) + "GB\n\t");
|
2023-09-20 05:46:37 +00:00
|
|
|
m_textTips->setViewContent(str);
|
2023-12-21 01:47:30 +00:00
|
|
|
|
|
|
|
if (cpu_size * 1024 * 1024 > cpu || disk_size * 1024 * 1024 > disk)
|
|
|
|
{
|
|
|
|
QMessageBox::warning(this, tr("Warning"), tr("Device hard drive or memory detected to be too small!"));
|
|
|
|
}
|
2023-09-20 05:46:37 +00:00
|
|
|
}
|
|
|
|
|
2023-03-06 07:26:24 +00:00
|
|
|
void Form_mainInterface::on_testOpenCacheFile(QString name)
|
|
|
|
{
|
|
|
|
if (name == HGPDTTOOLDB_NAME_IMAGE_GRAY_QUALITY && m_curDpi == 600)
|
|
|
|
{
|
2023-03-07 05:59:10 +00:00
|
|
|
if (m_multiIndex != -1)
|
2023-03-06 07:26:24 +00:00
|
|
|
{
|
2023-03-07 05:59:10 +00:00
|
|
|
QString cacheFilePath = getCachePath();
|
|
|
|
QFileInfo fileInfo(cacheFilePath);
|
|
|
|
auto pathDir = fileInfo.path();
|
|
|
|
QString strFilePath = "file:///" + pathDir;
|
|
|
|
QDesktopServices::openUrl(QUrl(strFilePath));
|
2023-03-06 07:26:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-04 09:56:36 +00:00
|
|
|
void Form_mainInterface::on_testGetDevdistortion(float dis_200dpi, float dis_300dpi, float dis_600dpi)
|
|
|
|
{
|
|
|
|
QString info;
|
|
|
|
info.append(tr("The device distortion:") + "\n\n\t");
|
2024-08-15 10:29:14 +00:00
|
|
|
info.append(tr("200dpi: %1").arg(QString::number(dis_200dpi, 'f', 4)) + "\n\t");
|
|
|
|
info.append(tr("300dpi: %1").arg(QString::number(dis_300dpi, 'f', 4)) + "\n\t");
|
|
|
|
info.append(tr("600dpi: %1").arg(QString::number(dis_600dpi, 'f', 4)));
|
2024-01-04 09:56:36 +00:00
|
|
|
|
|
|
|
m_textTips->setViewContent(info);
|
|
|
|
}
|
|
|
|
|
2023-01-06 01:35:41 +00:00
|
|
|
void Form_mainInterface::on_viewerDblClick()
|
|
|
|
{
|
|
|
|
if (m_multiIndex != -1)
|
|
|
|
{
|
2023-03-07 05:59:10 +00:00
|
|
|
QString strFileName = m_list_images[m_multiIndex];
|
|
|
|
QFileInfo fileInfo(strFileName);
|
2023-01-06 01:35:41 +00:00
|
|
|
auto pathDir = fileInfo.path();
|
|
|
|
QString strFilePath = "file:///" + pathDir;
|
|
|
|
QDesktopServices::openUrl(QUrl(strFilePath));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
|
2023-01-06 01:47:28 +00:00
|
|
|
if (item != nullptr)
|
2022-12-27 11:46:31 +00:00
|
|
|
{
|
2023-01-06 01:47:28 +00:00
|
|
|
QString title = item->text();
|
2022-12-23 02:42:46 +00:00
|
|
|
|
2023-01-06 01:47:28 +00:00
|
|
|
Dialog_ExcepDesc dlg(this);
|
|
|
|
if (dlg.exec())
|
|
|
|
{
|
2023-08-31 02:50:43 +00:00
|
|
|
//ui->tableWidget->setItem(row, 2, new QTableWidgetItem(getItemStatusStr(HGPDTTOOLDB_ENTRYSTATUS_NOTPASS)));
|
2023-01-06 01:47:28 +00:00
|
|
|
ui->tableWidget->item(row, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
|
|
|
ui->tableWidget->item(row, 2)->setBackgroundColor(QColor(255,0,0));
|
2023-09-01 10:42:28 +00:00
|
|
|
ui->tableWidget->item(row, 2)->setText(tr("not pass"));
|
2022-12-27 11:46:31 +00:00
|
|
|
|
2023-01-06 01:47:28 +00:00
|
|
|
QString str = dlg.getExcepDesc();
|
|
|
|
std::string name = m_map_title_name.value(title).name.toStdString();
|
2023-08-31 02:50:43 +00:00
|
|
|
//HGPdtToolDb_SetDeviceEntryStatus(m_pdtToolDbDevice, name.c_str(), HGPDTTOOLDB_ENTRYSTATUS_NOTPASS);
|
|
|
|
//HGPdtToolDb_SetDeviceEntryExcepDesc(m_pdtToolDbDevice, name.c_str(), str.toStdString().c_str());
|
2023-01-06 01:47:28 +00:00
|
|
|
|
|
|
|
QTableWidgetItem *item2 = ui->tableWidget->item(row, 2);
|
|
|
|
item2->setToolTip(str);
|
2023-08-31 02:16:44 +00:00
|
|
|
|
2023-08-31 07:15:14 +00:00
|
|
|
writeTestLog(tr("Tester: %1, Test item: %2, Test result: Failed! Reason: %3")
|
|
|
|
.arg(m_accountName).arg(title).arg(str));
|
2023-01-06 01:47:28 +00:00
|
|
|
}
|
2022-12-27 11:46:31 +00:00
|
|
|
}
|
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);
|
2023-01-06 01:47:28 +00:00
|
|
|
if (item != nullptr)
|
|
|
|
{
|
|
|
|
QString title = item->text();
|
|
|
|
std::string name = m_map_title_name.value(title).name.toStdString();
|
2023-08-31 02:50:43 +00:00
|
|
|
//HGPdtToolDb_SetDeviceEntryStatus(m_pdtToolDbDevice, name.c_str(), HGPDTTOOLDB_ENTRYSTATUS_PASS);
|
|
|
|
//HGPdtToolDb_SetDeviceEntryExcepDesc(m_pdtToolDbDevice, name.c_str(), "");
|
2023-01-06 01:47:28 +00:00
|
|
|
|
2023-08-31 02:50:43 +00:00
|
|
|
//ui->tableWidget->setItem(row, 2, new QTableWidgetItem(getItemStatusStr(HGPDTTOOLDB_ENTRYSTATUS_PASS)));
|
2023-01-06 01:47:28 +00:00
|
|
|
ui->tableWidget->item(row, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
|
|
|
ui->tableWidget->item(row, 2)->setBackgroundColor(QColor(0,255,0));
|
2023-09-01 10:42:28 +00:00
|
|
|
ui->tableWidget->item(row, 2)->setText(tr("pass"));
|
2022-12-23 02:42:46 +00:00
|
|
|
|
2023-01-06 01:47:28 +00:00
|
|
|
QTableWidgetItem *item2 = ui->tableWidget->item(row, 2);
|
|
|
|
item2->setToolTip("");
|
2023-08-31 02:16:44 +00:00
|
|
|
|
2023-08-31 07:15:14 +00:00
|
|
|
writeTestLog(tr("Tester: %1, Test item: %2, Test result: Pass!")
|
|
|
|
.arg(m_accountName).arg(title));
|
2023-08-31 02:16:44 +00:00
|
|
|
|
|
|
|
on_pbtn_nextStep_clicked();
|
2023-01-06 01:47:28 +00:00
|
|
|
}
|
2022-12-23 02:42:46 +00:00
|
|
|
|
2022-12-27 11:46:31 +00:00
|
|
|
|
2023-01-06 01:35:41 +00:00
|
|
|
// HGImage img = nullptr;
|
|
|
|
// m_view->getImage(&img);
|
|
|
|
|
|
|
|
// if (img != nullptr)
|
|
|
|
// {
|
|
|
|
// QString fileName = getCacheFileName();
|
|
|
|
// HGResult ret = HGImgFmt_SaveImage(img, 0, 0, getStdString(fileName).c_str());
|
|
|
|
// if(ret == HGBASE_ERR_OK)
|
|
|
|
// {
|
|
|
|
// int row = ui->tableWidget->currentRow();
|
|
|
|
// QTableWidgetItem *item = ui->tableWidget->item(row, 1);
|
|
|
|
// QString title = item->text();
|
|
|
|
// std::string name = m_map_title_name.value(title).name.toStdString();
|
|
|
|
// HGPdtToolDb_ClearDeviceEntryImage(m_pdtToolDbDevice, name.c_str());
|
|
|
|
// HGPdtToolDb_UploadDeviceEntryImage(m_pdtToolDbDevice, name.c_str(), m_mainwnd->m_ftpHost.toStdString().c_str(),
|
|
|
|
// m_mainwnd->m_ftpPort, fileName.toStdString().c_str());
|
|
|
|
// QFile file(fileName);
|
|
|
|
// file.remove();
|
|
|
|
// }
|
|
|
|
// }
|
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)");
|
|
|
|
|
2023-08-31 02:50:43 +00:00
|
|
|
//HGPdtToolDb_DownloadFile(m_pdtToolDbuserMgr, m_devType.toStdString().c_str(), cfgPath);
|
2022-12-23 02:42:46 +00:00
|
|
|
|
2023-08-31 07:15:14 +00:00
|
|
|
AnalysisJson analysisJson(m_profileName);
|
2022-12-23 02:42:46 +00:00
|
|
|
|
2023-01-04 12:48:53 +00:00
|
|
|
const QString stationStr[] = {"烧录工位", "初检工位", "图像测试工位", "压力测试工位"};
|
2022-12-23 02:42:46 +00:00
|
|
|
|
2022-12-31 09:14:20 +00:00
|
|
|
std::vector<AnalysisJson::json_node> list_jsonNode = analysisJson.GetNode();
|
|
|
|
int count = list_jsonNode.size();
|
|
|
|
ui->tableWidget->setRowCount(count);
|
2023-01-04 12:48:53 +00:00
|
|
|
int index = 0;
|
2022-12-31 09:14:20 +00:00
|
|
|
for(int i = 0; i < count; ++i)
|
|
|
|
{
|
|
|
|
AnalysisJson::json_node node = list_jsonNode[i];
|
|
|
|
m_map_title_name.insert(node.title, node);
|
|
|
|
|
2023-01-04 12:48:53 +00:00
|
|
|
if (stationStr[m_logInType] == node.station)
|
2022-12-31 09:14:20 +00:00
|
|
|
{
|
2023-08-31 02:50:43 +00:00
|
|
|
//HGPdtToolDb_SetEntryNameCnStr(m_pdtToolDbuserMgr, node.name.toStdString().c_str(), node.title.toStdString().c_str());
|
2023-01-04 12:48:53 +00:00
|
|
|
|
|
|
|
ui->tableWidget->setItem(index, 0, new QTableWidgetItem(QString::number(index+1)));
|
|
|
|
ui->tableWidget->item(index, 0)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
|
|
|
ui->tableWidget->setItem(index, 1, new QTableWidgetItem(node.title));
|
|
|
|
ui->tableWidget->item(index, 1)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
|
|
|
|
|
|
|
std::string name = node.name.toStdString();
|
|
|
|
HGUInt status = 0;
|
2023-08-31 02:50:43 +00:00
|
|
|
//HGPdtToolDb_GetDeviceEntryStatus(m_pdtToolDbDevice, name.c_str(), &status);
|
2023-01-04 12:48:53 +00:00
|
|
|
QString statusStr = getItemStatusStr(status);
|
|
|
|
ui->tableWidget->setItem(index, 2, new QTableWidgetItem(statusStr));
|
|
|
|
ui->tableWidget->item(index, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
2023-08-31 02:50:43 +00:00
|
|
|
// if (HGPDTTOOLDB_ENTRYSTATUS_NOTPASS == status)
|
|
|
|
// {
|
|
|
|
// ui->tableWidget->item(index, 2)->setBackgroundColor(QColor(255,0,0));
|
|
|
|
// }
|
|
|
|
// else if (HGPDTTOOLDB_ENTRYSTATUS_NOTSUPP == status)
|
|
|
|
// {
|
|
|
|
// ui->tableWidget->item(index, 2)->setBackgroundColor(QColor(255,255,0));
|
|
|
|
// }
|
|
|
|
// else if (HGPDTTOOLDB_ENTRYSTATUS_PASS == status)
|
|
|
|
// {
|
|
|
|
// ui->tableWidget->item(index, 2)->setBackgroundColor(QColor(0,255,0));
|
|
|
|
// }
|
2023-01-04 12:48:53 +00:00
|
|
|
|
|
|
|
HGChar desc[512] = {0};
|
2023-08-31 02:50:43 +00:00
|
|
|
//HGPdtToolDb_GetDeviceEntryExcepDesc(m_pdtToolDbDevice, name.c_str(), desc, 512);
|
2023-01-04 12:48:53 +00:00
|
|
|
QTableWidgetItem *item = ui->tableWidget->item(index, 2);
|
|
|
|
item->setToolTip(desc);
|
|
|
|
|
|
|
|
++index;
|
2022-12-23 10:32:57 +00:00
|
|
|
}
|
2022-12-22 02:48:06 +00:00
|
|
|
}
|
2022-12-31 09:14:20 +00:00
|
|
|
ui->tableWidget->selectRow(0);
|
2022-12-16 11:01:30 +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-27 08:25:47 +00:00
|
|
|
QString Form_mainInterface::getCachePath()
|
|
|
|
{
|
|
|
|
HGChar cachePath[512];
|
2023-01-09 10:53:59 +00:00
|
|
|
HGBase_GetDocumentsPath(cachePath, 512);
|
|
|
|
HGChar procName[512];
|
|
|
|
HGBase_GetProcessName(procName, 512);
|
|
|
|
strcat(cachePath, procName);
|
2022-12-27 08:25:47 +00:00
|
|
|
strcat(cachePath, "/Cache/");
|
|
|
|
|
|
|
|
return getStdFileName(StdStringToUtf8(cachePath).c_str());
|
|
|
|
}
|
|
|
|
|
|
|
|
QString Form_mainInterface::getCacheFileName()
|
|
|
|
{
|
|
|
|
QString cachePath = getCachePath();
|
2023-01-09 06:23:43 +00:00
|
|
|
cachePath.append(m_serialNum);
|
|
|
|
cachePath.append("/");
|
|
|
|
cachePath.append(m_curItemName);
|
|
|
|
cachePath.append("/");
|
|
|
|
HGBase_CreateDir(getStdString(getStdFileName(cachePath)).c_str());
|
2022-12-27 08:25:47 +00:00
|
|
|
|
|
|
|
QString suffix = ".jpg";
|
2023-01-09 06:23:43 +00:00
|
|
|
QString fileName = getStdFileName(cachePath + QString::number(m_curNameIndex++) + suffix);
|
2022-12-27 08:25:47 +00:00
|
|
|
return fileName;
|
|
|
|
}
|
|
|
|
|
2023-01-09 06:23:43 +00:00
|
|
|
QString Form_mainInterface::getCurItemName()
|
|
|
|
{
|
|
|
|
return m_curItemName;
|
|
|
|
}
|
|
|
|
|
2022-12-29 09:54:32 +00:00
|
|
|
void Form_mainInterface::updateUiEnabled(bool enable)
|
|
|
|
{
|
|
|
|
ui->tableWidget->setEnabled(enable);
|
|
|
|
ui->pbtn_preStep->setEnabled(enable);
|
|
|
|
ui->pbtn_nextStep->setEnabled(enable);
|
|
|
|
ui->pbtn_pass->setEnabled(enable);
|
|
|
|
ui->pbtn_fail->setEnabled(enable);
|
|
|
|
ui->pbtn_start->setEnabled(enable);
|
2023-01-06 01:35:41 +00:00
|
|
|
// ui->pbtn_showImg->setEnabled(enable);
|
2022-12-29 09:54:32 +00:00
|
|
|
ui->pbtn_leftRotate->setEnabled(enable);
|
|
|
|
ui->pbtn_rightRotate->setEnabled(enable);
|
|
|
|
ui->pbtn_stop->setEnabled(enable);
|
2023-01-05 12:37:01 +00:00
|
|
|
ui->pbtn_prePage->setEnabled(enable);
|
|
|
|
ui->pbtn_nextPage->setEnabled(enable);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Form_mainInterface::updateImgPixelInfo()
|
|
|
|
{
|
|
|
|
ui->label_imgInfo->setVisible(true);
|
2023-02-11 01:55:12 +00:00
|
|
|
ui->label_destortionInfo_200dpi->setVisible(true);
|
|
|
|
ui->label_destortionInfo_300dpi->setVisible(true);
|
2023-01-05 12:37:01 +00:00
|
|
|
|
|
|
|
HGImage image = NULL;
|
|
|
|
m_view->getImage(&image);
|
|
|
|
HGImageInfo imgInfo;
|
|
|
|
memset(&imgInfo, 0, sizeof(imgInfo));
|
|
|
|
HGBase_GetImageInfo(image, &imgInfo);
|
|
|
|
int imgWidth = imgInfo.width;
|
|
|
|
int imgHeight = imgInfo.height;
|
|
|
|
|
|
|
|
if (imgWidth > 0 && imgHeight > 0)
|
|
|
|
ui->label_imgInfo->setText(tr("image pixel: ") + QString::number(imgWidth) + " * " + QString::number(imgHeight) + " ");
|
2022-12-29 09:54:32 +00:00
|
|
|
}
|
|
|
|
|
2023-02-11 01:55:12 +00:00
|
|
|
QString Form_mainInterface::getSpeedMode()
|
2023-01-06 05:39:49 +00:00
|
|
|
{
|
2023-02-11 01:55:12 +00:00
|
|
|
SANE_Int speedMode = 0;
|
|
|
|
unsigned int len = sizeof(SANE_Int);
|
|
|
|
sane_io_control(m_handle, IO_CTRL_CODE_GET_SPEED_MODE, &speedMode, &len);
|
|
|
|
|
2024-07-09 03:32:54 +00:00
|
|
|
const wchar_t G100[6] = { 60,70,80,90,110 };
|
|
|
|
const wchar_t G200[6] = { 90,100,110,120,130 };
|
2024-08-09 09:04:52 +00:00
|
|
|
const wchar_t G300[6] = { 40,50,60,70,80 };
|
2024-06-18 06:49:54 +00:00
|
|
|
const wchar_t G306[6] = { 30,40,50,60,70 };
|
2024-07-12 10:04:07 +00:00
|
|
|
const wchar_t G400[6] = { 40,50,60,70,80 };
|
2023-01-06 05:39:49 +00:00
|
|
|
|
|
|
|
int speed = 0;
|
2024-06-18 06:49:54 +00:00
|
|
|
QString devType = m_devType;
|
2024-08-09 09:04:52 +00:00
|
|
|
if (m_devFwNum.mid(3, 1) == "Z") //306
|
2024-06-18 06:49:54 +00:00
|
|
|
{
|
|
|
|
devType = "G306";
|
|
|
|
}
|
2023-01-06 05:39:49 +00:00
|
|
|
|
2024-06-18 06:49:54 +00:00
|
|
|
if ((int)speedMode >= 30)
|
2023-03-17 11:37:57 +00:00
|
|
|
speed = (int)speedMode;
|
|
|
|
else
|
|
|
|
{
|
2024-06-18 06:49:54 +00:00
|
|
|
if (devType == "G100")
|
2024-07-12 02:22:38 +00:00
|
|
|
speed = (int)speedMode;
|
2024-06-18 06:49:54 +00:00
|
|
|
else if (devType == "G200")
|
2024-07-12 02:22:38 +00:00
|
|
|
speed = (int)speedMode;
|
2024-06-18 06:49:54 +00:00
|
|
|
else if (devType == "G300")
|
2023-03-17 11:37:57 +00:00
|
|
|
speed = G300[(int)speedMode - 1];
|
2024-06-18 06:49:54 +00:00
|
|
|
else if (devType == "G306")
|
|
|
|
speed = G306[(int)speedMode - 1];
|
|
|
|
else if (devType == "G400")
|
2023-03-17 11:37:57 +00:00
|
|
|
speed = G400[(int)speedMode - 1];
|
|
|
|
}
|
2023-01-06 05:39:49 +00:00
|
|
|
|
|
|
|
return QString::number(speed) + "PPM";
|
|
|
|
}
|
|
|
|
|
2023-02-11 01:55:12 +00:00
|
|
|
QString Form_mainInterface::getSleepTime()
|
2023-01-06 05:39:49 +00:00
|
|
|
{
|
2023-02-11 01:55:12 +00:00
|
|
|
int sleepTime = SANE_POWER_FIRST;
|
|
|
|
unsigned int len2 = sizeof(int);
|
|
|
|
sane_io_control(m_handle, IO_CTRL_CODE_GET_POWER_LEVEL, &sleepTime, &len2);
|
|
|
|
|
2023-01-06 05:39:49 +00:00
|
|
|
if (sleepTime > 99999 || sleepTime == -1)
|
2023-07-25 06:47:59 +00:00
|
|
|
return tr("Not sleeping");
|
2023-01-06 05:39:49 +00:00
|
|
|
|
|
|
|
return QString::number(sleepTime / 60) + tr(" minute");
|
|
|
|
}
|
|
|
|
|
2023-02-11 01:55:12 +00:00
|
|
|
QString Form_mainInterface::getDevVid()
|
2023-01-06 08:18:57 +00:00
|
|
|
{
|
|
|
|
VIDPID vidpid;
|
|
|
|
int vidpid_val;
|
|
|
|
unsigned int len = sizeof(int);
|
|
|
|
sane_io_control(m_handle, IO_CTRL_CODE_GET_VIDPID, &vidpid_val, &len);
|
|
|
|
vidpid.Value = vidpid_val;
|
|
|
|
int vid = vidpid.VID;
|
|
|
|
char buf[10];
|
|
|
|
sprintf(buf, "%x", vid);
|
2023-02-11 01:55:12 +00:00
|
|
|
|
|
|
|
return QString::fromStdString(buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
QString Form_mainInterface::getDevPid()
|
|
|
|
{
|
|
|
|
VIDPID vidpid;
|
|
|
|
int vidpid_val;
|
|
|
|
unsigned int len = sizeof(int);
|
|
|
|
sane_io_control(m_handle, IO_CTRL_CODE_GET_VIDPID, &vidpid_val, &len);
|
|
|
|
vidpid.Value = vidpid_val;
|
|
|
|
int pid = vidpid.PID;
|
|
|
|
char buf[10];
|
|
|
|
sprintf(buf, "%x", pid);
|
|
|
|
|
|
|
|
return QString::fromStdString(buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
int Form_mainInterface::getRollerNum()
|
|
|
|
{
|
|
|
|
SANE_Int rollCount = 0;
|
|
|
|
unsigned int rollCountSize = sizeof(SANE_Int);
|
|
|
|
SANE_Status ret = sane_io_control(m_handle, IO_CTRL_CODE_GET_ROLLER_NUM, &rollCount, &rollCountSize);
|
|
|
|
if (ret == SANE_STATUS_GOOD)
|
|
|
|
return rollCount >= 0 ? rollCount : -1;
|
|
|
|
else
|
|
|
|
return -1;
|
2023-01-06 08:18:57 +00:00
|
|
|
}
|
|
|
|
|
2023-03-06 07:26:24 +00:00
|
|
|
int Form_mainInterface::getHistoryCount()
|
|
|
|
{
|
|
|
|
SANE_Int historyCount = 0;
|
|
|
|
unsigned int historyCountSize = sizeof(SANE_Int);
|
|
|
|
SANE_Status ret = sane_io_control(m_handle, IO_CTRL_CODE_GET_HISTORY_SCAN_NUM, &historyCount, &historyCountSize);
|
|
|
|
if (ret == SANE_STATUS_GOOD)
|
|
|
|
return historyCount >= 0 ? historyCount : -1;
|
|
|
|
else
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2023-06-17 10:05:58 +00:00
|
|
|
void Form_mainInterface::getLogInfo(int ret)
|
|
|
|
{
|
|
|
|
if (ret == SANE_STATUS_NO_DOCS)
|
|
|
|
{
|
|
|
|
QMessageBox::information(this, tr("Prompt"), tr("No paper"));
|
|
|
|
}
|
|
|
|
else if (ret == SCANNER_ERR_DEVICE_SLEEPING)
|
|
|
|
{
|
|
|
|
QMessageBox::information(this, tr("Prompt"), tr("Device is sleeping"));
|
|
|
|
}
|
|
|
|
else if (ret == SCANNER_ERR_DEVICE_COUNT_MODE)
|
|
|
|
{
|
|
|
|
QMessageBox::information(this, tr("Prompt"), tr("Counting mode"));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
QMessageBox::information(this, tr("Prompt"), tr("Other error"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-31 02:16:44 +00:00
|
|
|
QString Form_mainInterface::getLogPath()
|
|
|
|
{
|
2023-09-12 03:02:45 +00:00
|
|
|
HGChar logPath[512];
|
|
|
|
HGBase_GetDocumentsPath(logPath, 512);
|
2023-08-31 02:16:44 +00:00
|
|
|
HGChar procName[512];
|
|
|
|
HGBase_GetProcessName(procName, 512);
|
2023-09-12 03:02:45 +00:00
|
|
|
strcat(logPath, procName);
|
|
|
|
strcat(logPath, "/Test_Log/");
|
|
|
|
strcat(logPath, m_devType.toStdString().c_str());
|
|
|
|
strcat(logPath, "/");
|
2023-08-31 02:16:44 +00:00
|
|
|
|
2023-09-21 01:26:12 +00:00
|
|
|
return getCfgValue(m_devType.toStdString().c_str(), "logPath", getStdFileName(StdStringToUtf8(logPath).c_str()));
|
2023-08-31 02:16:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Form_mainInterface::writeTestLog(QString logContent)
|
|
|
|
{
|
|
|
|
QString logPath = getLogPath();
|
|
|
|
HGBase_CreateDir(getStdString(logPath).c_str());
|
|
|
|
|
2023-08-31 07:15:14 +00:00
|
|
|
QString fileName = logPath + m_serialNum + ".log";
|
2023-08-31 02:16:44 +00:00
|
|
|
QFile file(fileName);
|
|
|
|
if(!file.open(QIODevice::ReadWrite | QIODevice::Append))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
QDateTime dateTime= QDateTime::currentDateTime();
|
|
|
|
QString curTime = dateTime .toString("yyyy-MM-dd hh:mm:ss");
|
|
|
|
QString content = "[" + curTime + "] ";
|
|
|
|
content += logContent;
|
|
|
|
|
|
|
|
QTextStream txtOutput(&file);
|
|
|
|
txtOutput << content << endl;
|
|
|
|
file.close();
|
|
|
|
}
|
|
|
|
|
2024-06-25 14:24:04 +00:00
|
|
|
int Form_mainInterface::str_to_wchar(std::string str, wchar_t *s, size_t *strlen)
|
|
|
|
{
|
|
|
|
if (str.empty())
|
|
|
|
return ERROR_INSUFFICIENT_BUFFER;
|
|
|
|
|
|
|
|
int len = 0;
|
|
|
|
len = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), -1, NULL, 0);
|
|
|
|
if (*strlen < len)
|
|
|
|
{
|
|
|
|
*strlen = len;
|
|
|
|
return ERROR_INSUFFICIENT_BUFFER;
|
|
|
|
}
|
|
|
|
MultiByteToWideChar(CP_UTF8, 0, str.c_str(), -1, s, len);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
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;
|
2023-01-05 10:38:10 +00:00
|
|
|
if (current != nullptr)
|
2023-01-03 10:42:08 +00:00
|
|
|
{
|
2023-01-06 01:35:41 +00:00
|
|
|
// ui->pbtn_showImg->setVisible(false);
|
2023-01-05 10:38:10 +00:00
|
|
|
ui->pbtn_leftRotate->setVisible(false);
|
|
|
|
ui->pbtn_rightRotate->setVisible(false);
|
2023-01-05 12:37:01 +00:00
|
|
|
ui->pbtn_prePage->setVisible(false);
|
|
|
|
ui->pbtn_nextPage->setVisible(false);
|
2023-01-05 10:38:10 +00:00
|
|
|
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();
|
2023-01-09 06:23:43 +00:00
|
|
|
m_curItemName = title;
|
2023-01-05 10:38:10 +00:00
|
|
|
|
|
|
|
if (nullptr == m_handle)
|
|
|
|
{
|
|
|
|
ui->pbtn_start->setVisible(false);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
bool man = m_map_title_name.value(title).is_man;
|
|
|
|
ui->pbtn_start->setEnabled(!man);
|
|
|
|
}
|
2022-12-26 08:24:20 +00:00
|
|
|
|
2023-01-05 10:38:10 +00:00
|
|
|
m_textTips->setViewContent(m_map_title_name.value(title).desc);
|
|
|
|
ui->stackedWidget->setCurrentWidget(m_textTips);
|
|
|
|
m_view->clearImage();
|
2022-12-27 11:46:31 +00:00
|
|
|
|
2023-03-06 07:26:24 +00:00
|
|
|
QString name = m_map_title_name.value(title).name;
|
2023-01-05 10:38:10 +00:00
|
|
|
HGUInt imageCount = 0;
|
2023-08-31 02:50:43 +00:00
|
|
|
//HGPdtToolDb_GetDeviceEntryImageCount(m_pdtToolDbDevice, name.toStdString().c_str(), &imageCount);
|
2023-01-05 10:38:10 +00:00
|
|
|
if (imageCount > 0)
|
|
|
|
{
|
2023-01-06 01:35:41 +00:00
|
|
|
// ui->pbtn_showImg->setVisible(true);
|
2023-01-05 10:38:10 +00:00
|
|
|
}
|
2023-01-06 01:47:28 +00:00
|
|
|
|
2023-02-07 05:39:02 +00:00
|
|
|
// m_multiIndex = -1;
|
|
|
|
// m_curNameIndex = 1;
|
|
|
|
// m_list_images.clear();
|
|
|
|
// QDir dir(getCachePath());
|
|
|
|
// if (dir.exists())
|
|
|
|
// dir.removeRecursively();
|
2023-02-11 01:55:12 +00:00
|
|
|
|
2023-03-06 07:26:24 +00:00
|
|
|
if (name.toStdWString() == HGPDTTOOLDB_NAME_CLEAR_ROLLER_COUNT)
|
2023-02-11 01:55:12 +00:00
|
|
|
{
|
|
|
|
QString str(tr("device roller count:") + QString::number(getRollerNum()));
|
|
|
|
m_textTips->setViewContent(str);
|
|
|
|
}
|
2023-03-06 07:26:24 +00:00
|
|
|
|
|
|
|
if (name.toStdWString() == HGPDTTOOLDB_NAME_CLEAR_HISTORY_COUNT)
|
|
|
|
{
|
|
|
|
QString str(tr("device history scan count:") + QString::number(getHistoryCount()));
|
|
|
|
m_textTips->setViewContent(str);
|
|
|
|
}
|
2024-07-08 10:47:40 +00:00
|
|
|
|
|
|
|
if (name.toStdWString() == HGPDTTOOLDB_NAME_DIAL_SWITCH)
|
|
|
|
{
|
|
|
|
QString path;
|
|
|
|
if(m_devType == "G100")
|
|
|
|
path = QString(":image/image_rsc/source/G100.png");
|
|
|
|
else if (m_devType == "G200")
|
|
|
|
path = QString(":image/image_rsc/source/G200.png");
|
|
|
|
if (!path.isEmpty())
|
2024-07-12 02:22:38 +00:00
|
|
|
m_textTips->insertImg(path);
|
|
|
|
}
|
|
|
|
if (name.toStdWString() == HGPDTTOOLDB_NAME_SKEW_DETECTION)
|
|
|
|
{
|
|
|
|
QString path;
|
|
|
|
path = QString(":image/image_rsc/source/skew.png");
|
|
|
|
if (!path.isEmpty())
|
2024-07-08 10:47:40 +00:00
|
|
|
m_textTips->insertImg(path);
|
|
|
|
}
|
2023-01-06 01:35:41 +00:00
|
|
|
}
|
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()
|
|
|
|
{
|
2023-03-06 09:44:08 +00:00
|
|
|
m_isCorrectNormal = true;
|
2023-01-05 10:38:10 +00:00
|
|
|
m_multiIndex = -1;
|
2023-01-09 06:23:43 +00:00
|
|
|
m_curNameIndex = 1;
|
2023-01-05 10:38:10 +00:00
|
|
|
m_list_images.clear();
|
2023-02-07 05:39:02 +00:00
|
|
|
|
|
|
|
QString cachePath = getCachePath();
|
|
|
|
cachePath.append(m_serialNum);
|
|
|
|
cachePath.append("/");
|
|
|
|
cachePath.append(m_curItemName);
|
|
|
|
cachePath.append("/");
|
|
|
|
QDir dir(getStdString(getStdFileName(cachePath)).c_str());
|
2023-01-05 10:38:10 +00:00
|
|
|
if (dir.exists())
|
|
|
|
dir.removeRecursively();
|
|
|
|
|
2022-12-26 08:24:20 +00:00
|
|
|
int row = ui->tableWidget->currentRow();
|
|
|
|
QTableWidgetItem *item = ui->tableWidget->item(row, 1);
|
2023-01-06 01:47:28 +00:00
|
|
|
if (item != nullptr)
|
|
|
|
{
|
|
|
|
QString title = item->text();
|
|
|
|
QString name = m_map_title_name.value(title).name;
|
2024-03-05 07:24:42 +00:00
|
|
|
|
2024-07-24 09:33:51 +00:00
|
|
|
if (name == HGPDTTOOLDB_NAME_IMAGE_CORRECTION)
|
|
|
|
{
|
|
|
|
resetCorrectItems();
|
|
|
|
}
|
2024-08-15 10:29:14 +00:00
|
|
|
if (name == HGPDTTOOLDB_NAME_VERIFY_DISTORTION_VAL && title.contains("200dpi"))
|
|
|
|
{
|
|
|
|
ui->label_imgInfo->clear();
|
|
|
|
ui->label_destortionInfo_200dpi->clear();
|
|
|
|
ui->label_destortionInfo_300dpi->clear();
|
|
|
|
ui->label_destortionInfo_600dpi->clear();
|
|
|
|
}
|
2024-07-24 09:33:51 +00:00
|
|
|
|
2024-03-05 07:24:42 +00:00
|
|
|
int dpi = 0;
|
2024-08-15 10:29:14 +00:00
|
|
|
if (title.contains("200dpi")) // == "扫描图像彩色质量确认_200dpi" || title == "扫描图像灰度质量确认_200dpi" || title == "计算畸变修正值_200dpi" || title == "设置畸变修正值_200dpi")
|
2024-03-05 07:24:42 +00:00
|
|
|
dpi = 200;
|
2024-08-15 10:29:14 +00:00
|
|
|
else if (title.contains("300dpi"))// == "扫描图像彩色质量确认_300dpi" || title == "扫描图像灰度质量确认_300dpi" || title == "计算畸变修正值_300dpi" || title == "设置畸变修正值_300dpi")
|
2024-03-05 07:24:42 +00:00
|
|
|
dpi = 300;
|
2024-08-15 10:29:14 +00:00
|
|
|
else if (title.contains("600dpi")) // == "扫描图像彩色质量确认_600dpi" || title == "扫描图像灰度质量确认_600dpi" || title == "计算畸变修正值_600dpi" || title == "设置畸变修正值_600dpi")
|
2024-03-05 07:24:42 +00:00
|
|
|
dpi = 600;
|
|
|
|
|
2024-06-25 14:24:04 +00:00
|
|
|
wchar_t buf[128] = {0};
|
2023-01-09 10:48:00 +00:00
|
|
|
if (dpi > 0)
|
|
|
|
{
|
2023-02-11 01:55:12 +00:00
|
|
|
m_curDpi = dpi;
|
2023-01-09 10:48:00 +00:00
|
|
|
swprintf(buf, L"%d", dpi);
|
|
|
|
}
|
|
|
|
|
2024-06-25 14:24:04 +00:00
|
|
|
std::string correctData = m_map_title_name.value(title).dynamic_correct_data.toStdString();
|
|
|
|
if (!correctData.empty())
|
|
|
|
{
|
2024-06-25 15:04:47 +00:00
|
|
|
size_t len = sizeof(buf) / sizeof(buf[0]);
|
2024-06-25 14:24:04 +00:00
|
|
|
str_to_wchar(correctData, buf, &len);
|
|
|
|
}
|
|
|
|
|
2023-01-06 01:47:28 +00:00
|
|
|
if (m_hg != nullptr)
|
2023-01-06 09:24:49 +00:00
|
|
|
{
|
2023-06-17 10:05:58 +00:00
|
|
|
updateUiEnabled(false);
|
|
|
|
m_isTesting = true;
|
|
|
|
m_mainwnd->addTestingRef();
|
2023-06-17 09:27:57 +00:00
|
|
|
int ret = 0;
|
2022-12-30 10:30:02 +00:00
|
|
|
|
2024-07-03 02:52:54 +00:00
|
|
|
if (buf != nullptr || (dpi > 0))
|
2024-06-25 14:24:04 +00:00
|
|
|
{
|
2024-07-24 09:33:51 +00:00
|
|
|
ret = func_test_go(name.toStdWString().c_str(), (const wchar_t*)buf);
|
2024-06-25 14:24:04 +00:00
|
|
|
}
|
2023-01-09 08:45:22 +00:00
|
|
|
else
|
2024-06-25 14:24:04 +00:00
|
|
|
{
|
2024-07-24 09:33:51 +00:00
|
|
|
ret = func_test_go(name.toStdWString().c_str(), L"null");
|
2024-06-25 14:24:04 +00:00
|
|
|
}
|
|
|
|
|
2023-06-17 10:19:50 +00:00
|
|
|
if (ret > SANE_STATUS_GOOD)
|
2023-06-17 09:27:57 +00:00
|
|
|
{
|
2023-10-13 01:54:59 +00:00
|
|
|
//getLogInfo(ret);
|
2023-06-17 10:05:58 +00:00
|
|
|
updateUiEnabled(true);
|
|
|
|
m_isTesting = false;
|
|
|
|
m_mainwnd->releaseTesting();
|
|
|
|
|
2023-06-17 09:27:57 +00:00
|
|
|
return;
|
|
|
|
}
|
2023-01-06 09:24:49 +00:00
|
|
|
}
|
2023-02-11 01:55:12 +00:00
|
|
|
|
2023-03-06 07:26:24 +00:00
|
|
|
if (name == HGPDTTOOLDB_NAME_CLEAR_ROLLER_COUNT)
|
2023-02-11 01:55:12 +00:00
|
|
|
{
|
|
|
|
QString str(tr("device roller count:") + QString::number(getRollerNum()));
|
|
|
|
m_textTips->setViewContent(str);
|
|
|
|
}
|
2023-03-06 07:26:24 +00:00
|
|
|
|
|
|
|
if (name == HGPDTTOOLDB_NAME_CLEAR_HISTORY_COUNT)
|
|
|
|
{
|
|
|
|
QString str(tr("device history scan count:") + QString::number(getHistoryCount()));
|
|
|
|
m_textTips->setViewContent(str);
|
|
|
|
}
|
2023-01-06 01:47:28 +00:00
|
|
|
}
|
2022-12-23 02:42:46 +00:00
|
|
|
}
|
2022-12-27 11:46:31 +00:00
|
|
|
|
|
|
|
void Form_mainInterface::on_pbtn_showImg_clicked()
|
|
|
|
{
|
2023-01-09 06:23:43 +00:00
|
|
|
// QString fileName = getCacheFileName();
|
2022-12-27 11:46:31 +00:00
|
|
|
|
2023-01-09 06:23:43 +00:00
|
|
|
// int row = ui->tableWidget->currentRow();
|
|
|
|
// QTableWidgetItem *item = ui->tableWidget->item(row, 1);
|
|
|
|
// QString title = item->text();
|
|
|
|
// std::string name = m_map_title_name.value(title).name.toStdString();
|
|
|
|
// HGResult ret = HGPdtToolDb_DownloadDeviceEntryImage(m_pdtToolDbDevice, name.c_str(), m_mainwnd->m_ftpHost.toStdString().c_str(),
|
|
|
|
// m_mainwnd->m_ftpPort, 0, fileName.toStdString().c_str());
|
|
|
|
// if(ret == HGBASE_ERR_OK)
|
|
|
|
// {
|
|
|
|
// m_list_images.push_back(fileName);
|
|
|
|
|
|
|
|
// ui->pbtn_leftRotate->setVisible(true);
|
|
|
|
// ui->pbtn_rightRotate->setVisible(true);
|
|
|
|
// ui->pbtn_prePage->setVisible(true);
|
|
|
|
// ui->pbtn_nextPage->setVisible(true);
|
|
|
|
// ui->stackedWidget->setCurrentWidget(m_view);
|
|
|
|
// HGImage img = nullptr;
|
|
|
|
// HGImgFmt_LoadImage(fileName.toStdString().c_str(), 0, 0, 0, 0, &img);
|
|
|
|
// m_view->addImage(img);
|
|
|
|
// m_multiIndex++;
|
|
|
|
// }
|
|
|
|
// else
|
|
|
|
// {
|
|
|
|
// QMessageBox::information(this, tr("tips"), tr("no image"));
|
|
|
|
// }
|
2022-12-27 11:46:31 +00:00
|
|
|
}
|
2022-12-28 06:57:00 +00:00
|
|
|
|
|
|
|
void Form_mainInterface::on_pbtn_leftRotate_clicked()
|
|
|
|
{
|
|
|
|
m_view->rotateLeft();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Form_mainInterface::on_pbtn_rightRotate_clicked()
|
|
|
|
{
|
|
|
|
m_view->rotateRight();
|
|
|
|
}
|
2023-01-05 10:38:10 +00:00
|
|
|
|
|
|
|
void Form_mainInterface::on_pbtn_prePage_clicked()
|
|
|
|
{
|
|
|
|
if (m_multiIndex > 0)
|
|
|
|
--m_multiIndex;
|
|
|
|
|
|
|
|
HGImage img = nullptr;
|
|
|
|
QString filename = m_list_images.at(m_multiIndex);
|
2023-01-09 06:23:43 +00:00
|
|
|
HGImgFmt_LoadImage(getStdString(filename).c_str(), 0, 0, 0, 0, &img);
|
2023-01-05 10:38:10 +00:00
|
|
|
if (nullptr != img)
|
|
|
|
{
|
|
|
|
m_view->addImage(img);
|
|
|
|
HGBase_DestroyImage(img);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Form_mainInterface::on_pbtn_nextPage_clicked()
|
|
|
|
{
|
|
|
|
if (m_multiIndex < m_list_images.size() - 1)
|
|
|
|
++m_multiIndex;
|
|
|
|
HGImage img = nullptr;
|
|
|
|
QString filename = m_list_images.at(m_multiIndex);
|
2023-01-09 06:23:43 +00:00
|
|
|
HGImgFmt_LoadImage(getStdString(filename).c_str(), 0, 0, 0, 0, &img);
|
2023-01-05 10:38:10 +00:00
|
|
|
if (nullptr != img)
|
|
|
|
{
|
|
|
|
m_view->addImage(img);
|
|
|
|
HGBase_DestroyImage(img);
|
|
|
|
}
|
|
|
|
}
|