This commit is contained in:
yangjiaxuan 2023-06-17 18:05:58 +08:00
parent f0a6eadfff
commit e5935da944
2 changed files with 30 additions and 23 deletions

View File

@ -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;
}
}

View File

@ -92,6 +92,7 @@ private:
QString getDevPid();
int getRollerNum();
int getHistoryCount();
void getLogInfo(int ret);
private:
union VIDPID