This commit is contained in:
13038267101 2023-01-09 16:16:12 +08:00
commit 3f9afc9f0e
6 changed files with 71 additions and 53 deletions

View File

@ -614,34 +614,33 @@
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="form_burnmode.cpp" line="97"/> <location filename="form_burnmode.cpp" line="95"/>
<source>ID</source> <source>ID</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="form_burnmode.cpp" line="97"/> <location filename="form_burnmode.cpp" line="95"/>
<source>selected</source> <source>selected</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="form_burnmode.cpp" line="97"/> <location filename="form_burnmode.cpp" line="95"/>
<source>device</source> <source>device</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="form_burnmode.cpp" line="97"/>
<source>serialNum</source> <source>serialNum</source>
<translation></translation> <translation type="vanished"></translation>
</message> </message>
<message> <message>
<location filename="form_burnmode.cpp" line="155"/> <location filename="form_burnmode.cpp" line="153"/>
<location filename="form_burnmode.cpp" line="341"/> <location filename="form_burnmode.cpp" line="339"/>
<source>tips</source> <source>tips</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="form_burnmode.cpp" line="155"/> <location filename="form_burnmode.cpp" line="153"/>
<location filename="form_burnmode.cpp" line="341"/> <location filename="form_burnmode.cpp" line="339"/>
<source>Please check a devices at least</source> <source>Please check a devices at least</source>
<translation></translation> <translation></translation>
</message> </message>
@ -1003,13 +1002,13 @@
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="420"/> <location filename="mainwindow.cpp" line="420"/>
<source>Are you sure to connect the new device</source> <source>Confirm whether the device is reset</source>
<translation></translation> <oldsource>Are you sure to connect the new device</oldsource>
<translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="422"/>
<source>yes</source> <source>yes</source>
<translation></translation> <translation type="vanished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="423"/> <location filename="mainwindow.cpp" line="423"/>
@ -1027,6 +1026,11 @@
<source>The device has disconnected</source> <source>The device has disconnected</source>
<translation type="vanished"></translation> <translation type="vanished"></translation>
</message> </message>
<message>
<location filename="mainwindow.cpp" line="422"/>
<source>confirm</source>
<translation></translation>
</message>
<message> <message>
<location filename="mainwindow.cpp" line="455"/> <location filename="mainwindow.cpp" line="455"/>
<source>Open device failed</source> <source>Open device failed</source>

View File

@ -39,8 +39,6 @@ void Form_BurnMode::addDevice(DeviceManager *devManager)
ui->tableWidget->item(m_curIndex, 1)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); ui->tableWidget->item(m_curIndex, 1)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
ui->tableWidget->setItem(m_curIndex, 2, new QTableWidgetItem(devManager->getDevName())); ui->tableWidget->setItem(m_curIndex, 2, new QTableWidgetItem(devManager->getDevName()));
ui->tableWidget->item(m_curIndex, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); ui->tableWidget->item(m_curIndex, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
ui->tableWidget->setItem(m_curIndex, 3, new QTableWidgetItem(devManager->getSn()));
ui->tableWidget->item(m_curIndex, 3)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
QTableWidgetItem *item = ui->tableWidget->item(m_curIndex, 1); QTableWidgetItem *item = ui->tableWidget->item(m_curIndex, 1);
QVariant var = QVariant::fromValue((void*)devManager); QVariant var = QVariant::fromValue((void*)devManager);
@ -87,14 +85,14 @@ void Form_BurnMode::on_testResult(bool setStatus)
void Form_BurnMode::initTableWidget() void Form_BurnMode::initTableWidget()
{ {
ui->tableWidget->resizeRowsToContents(); ui->tableWidget->resizeRowsToContents();
ui->tableWidget->setColumnCount(4); ui->tableWidget->setColumnCount(3);
ui->tableWidget->horizontalHeader()->setDefaultSectionSize(200); ui->tableWidget->horizontalHeader()->setDefaultSectionSize(200);
// ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); // ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
ui->tableWidget->horizontalHeader()->setSectionResizeMode(0, QHeaderView::ResizeToContents); ui->tableWidget->horizontalHeader()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
ui->tableWidget->horizontalHeader()->setSectionResizeMode(1, QHeaderView::ResizeToContents); ui->tableWidget->horizontalHeader()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
QStringList header; QStringList header;
header<< tr("ID") << tr("selected") << tr("device") << tr("serialNum"); header<< tr("ID") << tr("selected") << tr("device");
ui->tableWidget->setHorizontalHeaderLabels(header); ui->tableWidget->setHorizontalHeaderLabels(header);
QFont font = ui->tableWidget->horizontalHeader()->font(); QFont font = ui->tableWidget->horizontalHeader()->font();

View File

@ -29,8 +29,10 @@ Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::
, m_devType(devType) , m_devType(devType)
, m_devName(devName) , m_devName(devName)
, m_devFwNum(devFwNum) , m_devFwNum(devFwNum)
, m_curItemName("")
, m_isTesting(false) , m_isTesting(false)
, m_multiIndex(-1) , m_multiIndex(-1)
, m_curNameIndex(1)
{ {
ui->setupUi(this); ui->setupUi(this);
@ -99,6 +101,7 @@ Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::
Form_mainInterface::~Form_mainInterface() Form_mainInterface::~Form_mainInterface()
{ {
m_multiIndex = -1; m_multiIndex = -1;
m_curNameIndex = 1;
m_list_images.clear(); m_list_images.clear();
QDir dir(getCachePath()); QDir dir(getCachePath());
if (dir.exists()) if (dir.exists())
@ -175,10 +178,10 @@ void Form_mainInterface::on_testResultImg(void *img)
{ {
HGImage image = (HGImage)img; HGImage image = (HGImage)img;
std::string filename = getStdString(getCacheFileName()); QString filename = getCacheFileName();
HGImgFmt_SaveImage(image, 0, 0, filename.c_str()); HGImgFmt_SaveImage(image, 0, 0, getStdString(filename).c_str());
m_list_images.push_back(QString::fromStdString(filename)); m_list_images.push_back(filename);
m_multiIndex = m_list_images.size() - 1; m_multiIndex = m_list_images.size() - 1;
ui->stackedWidget->setCurrentWidget(m_view); ui->stackedWidget->setCurrentWidget(m_view);
@ -193,7 +196,7 @@ void Form_mainInterface::on_testResultImg(void *img)
void Form_mainInterface::on_testDistortion(float value) void Form_mainInterface::on_testDistortion(float value)
{ {
ui->label_destortionInfo->setText(tr("destortion value: ") + QString::number(value, 'f', 4)); ui->label_destortionInfo->setText(tr("destortion value: ") + QString::number(value, 'f'));
updateImgPixelInfo(); updateImgPixelInfo();
updateUiEnabled(true); updateUiEnabled(true);
@ -424,15 +427,22 @@ QString Form_mainInterface::getCachePath()
QString Form_mainInterface::getCacheFileName() QString Form_mainInterface::getCacheFileName()
{ {
QString cachePath = getCachePath(); QString cachePath = getCachePath();
HGBase_CreateDir(getStdString(cachePath).c_str()); cachePath.append(m_serialNum);
cachePath.append("/");
cachePath.append(m_curItemName);
cachePath.append("/");
HGBase_CreateDir(getStdString(getStdFileName(cachePath)).c_str());
char uuid[256] = {0};
HGBase_GetUuid(uuid, 256);
QString suffix = ".jpg"; QString suffix = ".jpg";
QString fileName = getStdFileName(cachePath + uuid + suffix); QString fileName = getStdFileName(cachePath + QString::number(m_curNameIndex++) + suffix);
return fileName; return fileName;
} }
QString Form_mainInterface::getCurItemName()
{
return m_curItemName;
}
void Form_mainInterface::updateUiEnabled(bool enable) void Form_mainInterface::updateUiEnabled(bool enable)
{ {
ui->tableWidget->setEnabled(enable); ui->tableWidget->setEnabled(enable);
@ -528,6 +538,7 @@ void Form_mainInterface::on_tableWidget_currentItemChanged(QTableWidgetItem *cur
QTableWidgetItem *item2 = ui->tableWidget->item(row, 1); QTableWidgetItem *item2 = ui->tableWidget->item(row, 1);
QString title = item2->text(); QString title = item2->text();
m_curItemName = title;
if (nullptr == m_handle) if (nullptr == m_handle)
{ {
@ -552,6 +563,7 @@ void Form_mainInterface::on_tableWidget_currentItemChanged(QTableWidgetItem *cur
} }
m_multiIndex = -1; m_multiIndex = -1;
m_curNameIndex = 1;
m_list_images.clear(); m_list_images.clear();
QDir dir(getCachePath()); QDir dir(getCachePath());
if (dir.exists()) if (dir.exists())
@ -562,6 +574,7 @@ void Form_mainInterface::on_tableWidget_currentItemChanged(QTableWidgetItem *cur
void Form_mainInterface::on_pbtn_start_clicked() void Form_mainInterface::on_pbtn_start_clicked()
{ {
m_multiIndex = -1; m_multiIndex = -1;
m_curNameIndex = 1;
m_list_images.clear(); m_list_images.clear();
QDir dir(getCachePath()); QDir dir(getCachePath());
if (dir.exists()) if (dir.exists())
@ -586,32 +599,32 @@ void Form_mainInterface::on_pbtn_start_clicked()
void Form_mainInterface::on_pbtn_showImg_clicked() void Form_mainInterface::on_pbtn_showImg_clicked()
{ {
QString fileName = getCacheFileName(); // QString fileName = getCacheFileName();
int row = ui->tableWidget->currentRow(); // int row = ui->tableWidget->currentRow();
QTableWidgetItem *item = ui->tableWidget->item(row, 1); // QTableWidgetItem *item = ui->tableWidget->item(row, 1);
QString title = item->text(); // QString title = item->text();
std::string name = m_map_title_name.value(title).name.toStdString(); // 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(), // 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()); // m_mainwnd->m_ftpPort, 0, fileName.toStdString().c_str());
if(ret == HGBASE_ERR_OK) // if(ret == HGBASE_ERR_OK)
{ // {
m_list_images.push_back(fileName); // m_list_images.push_back(fileName);
ui->pbtn_leftRotate->setVisible(true); // ui->pbtn_leftRotate->setVisible(true);
ui->pbtn_rightRotate->setVisible(true); // ui->pbtn_rightRotate->setVisible(true);
ui->pbtn_prePage->setVisible(true); // ui->pbtn_prePage->setVisible(true);
ui->pbtn_nextPage->setVisible(true); // ui->pbtn_nextPage->setVisible(true);
ui->stackedWidget->setCurrentWidget(m_view); // ui->stackedWidget->setCurrentWidget(m_view);
HGImage img = nullptr; // HGImage img = nullptr;
HGImgFmt_LoadImage(fileName.toStdString().c_str(), 0, 0, 0, 0, &img); // HGImgFmt_LoadImage(fileName.toStdString().c_str(), 0, 0, 0, 0, &img);
m_view->addImage(img); // m_view->addImage(img);
m_multiIndex++; // m_multiIndex++;
} // }
else // else
{ // {
QMessageBox::information(this, tr("tips"), tr("no image")); // QMessageBox::information(this, tr("tips"), tr("no image"));
} // }
} }
void Form_mainInterface::on_pbtn_leftRotate_clicked() void Form_mainInterface::on_pbtn_leftRotate_clicked()
@ -631,7 +644,7 @@ void Form_mainInterface::on_pbtn_prePage_clicked()
HGImage img = nullptr; HGImage img = nullptr;
QString filename = m_list_images.at(m_multiIndex); QString filename = m_list_images.at(m_multiIndex);
HGImgFmt_LoadImage(filename.toStdString().c_str(), 0, 0, 0, 0, &img); HGImgFmt_LoadImage(getStdString(filename).c_str(), 0, 0, 0, 0, &img);
if (nullptr != img) if (nullptr != img)
{ {
m_view->addImage(img); m_view->addImage(img);
@ -645,7 +658,7 @@ void Form_mainInterface::on_pbtn_nextPage_clicked()
++m_multiIndex; ++m_multiIndex;
HGImage img = nullptr; HGImage img = nullptr;
QString filename = m_list_images.at(m_multiIndex); QString filename = m_list_images.at(m_multiIndex);
HGImgFmt_LoadImage(filename.toStdString().c_str(), 0, 0, 0, 0, &img); HGImgFmt_LoadImage(getStdString(filename).c_str(), 0, 0, 0, 0, &img);
if (nullptr != img) if (nullptr != img)
{ {
m_view->addImage(img); m_view->addImage(img);

View File

@ -79,6 +79,7 @@ private:
QString getItemStatusStr(HGUInt status); QString getItemStatusStr(HGUInt status);
QString getCachePath(); QString getCachePath();
QString getCacheFileName(); QString getCacheFileName();
QString getCurItemName();
void updateUiEnabled(bool enable); void updateUiEnabled(bool enable);
void updateImgPixelInfo(); void updateImgPixelInfo();
QString getSpeedMode(SANE_Int speedMode); QString getSpeedMode(SANE_Int speedMode);
@ -114,8 +115,10 @@ private:
QString m_devType; QString m_devType;
QString m_devName; QString m_devName;
QString m_devFwNum; QString m_devFwNum;
QString m_curItemName;
bool m_isTesting; bool m_isTesting;
int m_multiIndex; int m_multiIndex;
int m_curNameIndex;
QStringList m_list_images; QStringList m_list_images;
QMap<QString, AnalysisJson::json_node> m_map_title_name; QMap<QString, AnalysisJson::json_node> m_map_title_name;

View File

@ -417,9 +417,9 @@ void MainWindow::on_sane_dev_arrive(QString devName)
else else
{ {
QMessageBox msg(QMessageBox::Question, tr("tips"), QMessageBox msg(QMessageBox::Question, tr("tips"),
tr("Are you sure to connect the new device"), tr("Confirm whether the device is reset"),
QMessageBox::Yes | QMessageBox::No, this); QMessageBox::Yes | QMessageBox::No, this);
msg.setButtonText(QMessageBox::Yes, tr("yes")); msg.setButtonText(QMessageBox::Yes, tr("confirm"));
msg.setButtonText(QMessageBox::No, tr("no")); msg.setButtonText(QMessageBox::No, tr("no"));
msg.exec(); msg.exec();
if (msg.clickedButton() == msg.button(QMessageBox::Yes)) if (msg.clickedButton() == msg.button(QMessageBox::Yes))