From e5935da944f726ff553925a9a99d28b75baee332 Mon Sep 17 00:00:00 2001 From: yangjiaxuan <171295266@qq.com> Date: Sat, 17 Jun 2023 18:05:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/HGProductionTool/form_maininterface.cpp | 52 ++++++++++++--------- app/HGProductionTool/form_maininterface.h | 1 + 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/app/HGProductionTool/form_maininterface.cpp b/app/HGProductionTool/form_maininterface.cpp index fd7b917..3306a13 100644 --- a/app/HGProductionTool/form_maininterface.cpp +++ b/app/HGProductionTool/form_maininterface.cpp @@ -647,6 +647,26 @@ int Form_mainInterface::getHistoryCount() return -1; } +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")); + } +} + void Form_mainInterface::on_tableWidget_currentItemChanged(QTableWidgetItem *current, QTableWidgetItem *previous) { (void)previous; @@ -746,36 +766,22 @@ void Form_mainInterface::on_pbtn_start_clicked() if (m_hg != nullptr) { + updateUiEnabled(false); + m_isTesting = true; + m_mainwnd->addTestingRef(); int ret = 0; if (buf != nullptr && (dpi > 0 || (correct_value > -1 && correct_value < 7))) ret = func_test_go(name.toStdWString().c_str(), (const wchar_t*)buf, m_hg); else ret = func_test_go(name.toStdWString().c_str(), L"null", m_hg); - if (ret == SANE_STATUS_GOOD) + if (ret != SANE_STATUS_GOOD) { - updateUiEnabled(false); - m_isTesting = true; - m_mainwnd->addTestingRef(); - } - else if (ret == SANE_STATUS_NO_DOCS) - { - QMessageBox::information(this, tr("Prompt"), tr("No paper")); - return; - } - else if (ret == SCANNER_ERR_DEVICE_SLEEPING) - { - QMessageBox::information(this, tr("Prompt"), tr("Device is sleeping")); - return; - } - else if (ret == SCANNER_ERR_DEVICE_COUNT_MODE) - { - QMessageBox::information(this, tr("Prompt"), tr("Counting mode")); - return; - } - else - { - QMessageBox::information(this, tr("Prompt"), tr("Other error")); + getLogInfo(ret); + updateUiEnabled(true); + m_isTesting = false; + m_mainwnd->releaseTesting(); + return; } } diff --git a/app/HGProductionTool/form_maininterface.h b/app/HGProductionTool/form_maininterface.h index 3dbb9af..a682ffa 100644 --- a/app/HGProductionTool/form_maininterface.h +++ b/app/HGProductionTool/form_maininterface.h @@ -92,6 +92,7 @@ private: QString getDevPid(); int getRollerNum(); int getHistoryCount(); + void getLogInfo(int ret); private: union VIDPID