diff --git a/app/HGProductionTool/ProductionTool_zh_CN.ts b/app/HGProductionTool/ProductionTool_zh_CN.ts index 4585953..92afcff 100644 --- a/app/HGProductionTool/ProductionTool_zh_CN.ts +++ b/app/HGProductionTool/ProductionTool_zh_CN.ts @@ -709,49 +709,49 @@ 下一步 - + Device has connected 设备已连接 - + Device hasnot connected 设备未连接 - + Device type: 设备型号: - + SerialNum: 序列号: - - + + connect status: 设备连接状态: - + load last image which uploaded last time 加载上一次上传的图片 - + Device has disconnected 设备已断开 - - + + tips 提示 - + destortion value: 畸变修正值: @@ -764,47 +764,47 @@ 取消 - + ID 序号 - + Test items 测试项 - + status 测试状态 - + not test 未测试 - + not pass 不通过 - + not support 不支持 - + pass 通过 - + image pixel: 图像像素: - + no image 无图 diff --git a/app/HGProductionTool/form_maininterface.cpp b/app/HGProductionTool/form_maininterface.cpp index 24defd4..4e37ef2 100644 --- a/app/HGProductionTool/form_maininterface.cpp +++ b/app/HGProductionTool/form_maininterface.cpp @@ -34,6 +34,8 @@ Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn:: { ui->setupUi(this); + ui->pbtn_showImg->setVisible(false); + QFont ft; ft.setPointSize(15); this->setFont(ft); @@ -66,6 +68,8 @@ Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn:: ui->stackedWidget->addWidget(m_view); ui->pbtn_showImg->setToolTip(tr("load last image which uploaded last time")); + connect(m_view, SIGNAL(doubleClicked()), this, SLOT(on_viewerDblClick())); + initTableWidgetUi(); if(!m_devType.isEmpty()) @@ -165,6 +169,8 @@ void Form_mainInterface::on_testResultImg(void *img) m_view->addImage(image); ui->pbtn_leftRotate->setVisible(true); ui->pbtn_rightRotate->setVisible(true); + ui->pbtn_prePage->setVisible(true); + ui->pbtn_nextPage->setVisible(true); HGBase_DestroyImage(image); } @@ -189,6 +195,18 @@ void Form_mainInterface::on_testCorrectInfo(QString info) m_textTips->addContent(info); } +void Form_mainInterface::on_viewerDblClick() +{ + if (m_multiIndex != -1) + { + QString strFileName = m_list_images[m_multiIndex]; + QFileInfo fileInfo(strFileName); + auto pathDir = fileInfo.path(); + QString strFilePath = "file:///" + pathDir; + QDesktopServices::openUrl(QUrl(strFilePath)); + } +} + void Form_mainInterface::on_pbtn_preStep_clicked() { int row = ui->tableWidget->currentRow(); @@ -246,26 +264,26 @@ void Form_mainInterface::on_pbtn_pass_clicked() QTableWidgetItem *item2 = ui->tableWidget->item(row, 2); item2->setToolTip(""); - HGImage img = nullptr; - m_view->getImage(&img); +// 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(); - } - } +// 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(); +// } +// } on_pbtn_nextStep_clicked(); } @@ -399,7 +417,7 @@ void Form_mainInterface::updateUiEnabled(bool enable) ui->pbtn_pass->setEnabled(enable); ui->pbtn_fail->setEnabled(enable); ui->pbtn_start->setEnabled(enable); - ui->pbtn_showImg->setEnabled(enable); +// ui->pbtn_showImg->setEnabled(enable); ui->pbtn_leftRotate->setEnabled(enable); ui->pbtn_rightRotate->setEnabled(enable); ui->pbtn_stop->setEnabled(enable); @@ -429,7 +447,7 @@ void Form_mainInterface::on_tableWidget_currentItemChanged(QTableWidgetItem *cur (void)previous; if (current != nullptr) { - ui->pbtn_showImg->setVisible(false); +// ui->pbtn_showImg->setVisible(false); ui->pbtn_leftRotate->setVisible(false); ui->pbtn_rightRotate->setVisible(false); ui->pbtn_prePage->setVisible(false); @@ -461,9 +479,13 @@ void Form_mainInterface::on_tableWidget_currentItemChanged(QTableWidgetItem *cur HGPdtToolDb_GetDeviceEntryImageCount(m_pdtToolDbDevice, name.c_str(), &imageCount); if (imageCount > 0) { - ui->pbtn_showImg->setVisible(true); +// ui->pbtn_showImg->setVisible(true); } } + else + { + updateUiEnabled(false); + } } void Form_mainInterface::on_pbtn_start_clicked() @@ -474,9 +496,6 @@ void Form_mainInterface::on_pbtn_start_clicked() if (dir.exists()) dir.removeRecursively(); - ui->label_imgInfo->setVisible(false); - ui->label_destortionInfo->setVisible(false); - int row = ui->tableWidget->currentRow(); QTableWidgetItem *item = ui->tableWidget->item(row, 1); QString title = item->text(); @@ -501,6 +520,8 @@ void Form_mainInterface::on_pbtn_showImg_clicked() 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); @@ -509,8 +530,7 @@ void Form_mainInterface::on_pbtn_showImg_clicked() HGImage img = nullptr; HGImgFmt_LoadImage(fileName.toStdString().c_str(), 0, 0, 0, 0, &img); m_view->addImage(img); - QFile file(fileName); - file.remove(); + m_multiIndex++; } else { diff --git a/app/HGProductionTool/form_maininterface.h b/app/HGProductionTool/form_maininterface.h index 3776c9e..22fc8e5 100644 --- a/app/HGProductionTool/form_maininterface.h +++ b/app/HGProductionTool/form_maininterface.h @@ -47,6 +47,8 @@ private slots: void on_testDistortion(float value); void on_testCorrectInfo(QString info); + void on_viewerDblClick(); + private slots: void on_pbtn_preStep_clicked();