HGGitLab

Commit 2c70a9ad authored by yangjiaxuan's avatar yangjiaxuan

“增加扫描错误提示”

parent c3128453
This diff is collapsed.
...@@ -213,6 +213,7 @@ MainWindow::MainWindow(QWidget *parent) ...@@ -213,6 +213,7 @@ MainWindow::MainWindow(QWidget *parent)
connect(this, SIGNAL(new_image(void *)), this, SLOT(on_new_image(void *)), Qt::QueuedConnection); connect(this, SIGNAL(new_image(void *)), this, SLOT(on_new_image(void *)), Qt::QueuedConnection);
connect(this, SIGNAL(scan_working()), this, SLOT(on_scan_working()), Qt::QueuedConnection); connect(this, SIGNAL(scan_working()), this, SLOT(on_scan_working()), Qt::QueuedConnection);
connect(this, SIGNAL(scan_finish()), this, SLOT(on_scan_finish()), Qt::QueuedConnection); connect(this, SIGNAL(scan_finish()), this, SLOT(on_scan_finish()), Qt::QueuedConnection);
connect(this, SIGNAL(sane_dev_error(QString)), this, SLOT(on_sane_dev_error(QString)), Qt::QueuedConnection);
connect(m_dialog_log, SIGNAL(continuScan(void)), this, SLOT(on_act_acquire_triggered(void)), Qt::QueuedConnection); connect(m_dialog_log, SIGNAL(continuScan(void)), this, SLOT(on_act_acquire_triggered(void)), Qt::QueuedConnection);
connect(m_dialog_log, SIGNAL(invoke_stop(void)), this, SLOT(on_act_acquireStop_triggered(void)), Qt::QueuedConnection); connect(m_dialog_log, SIGNAL(invoke_stop(void)), this, SLOT(on_act_acquireStop_triggered(void)), Qt::QueuedConnection);
...@@ -716,6 +717,12 @@ void MainWindow::on_sane_dev_remove(QString devName) ...@@ -716,6 +717,12 @@ void MainWindow::on_sane_dev_remove(QString devName)
} }
} }
void MainWindow::on_sane_dev_error(QString errorInfo)
{
m_wndStatusBar->setDeviceStatusInfo(errorInfo);
m_dialog_log->add_log(errorInfo, true);
}
bool MainWindow::eventFilter(QObject *obj, QEvent *event) bool MainWindow::eventFilter(QObject *obj, QEvent *event)
{ {
if(obj == m_view) if(obj == m_view)
...@@ -1627,6 +1634,8 @@ int MainWindow::sane_ex_callback(SANE_Handle hdev, int code, void *data, unsigne ...@@ -1627,6 +1634,8 @@ int MainWindow::sane_ex_callback(SANE_Handle hdev, int code, void *data, unsigne
break; break;
case SANE_EVENT_ERROR: case SANE_EVENT_ERROR:
{ {
QString errorInfo((char*)data);
emit p->sane_dev_error(errorInfo);
} }
break; break;
case SANE_EVENT_WORKING: case SANE_EVENT_WORKING:
...@@ -2039,7 +2048,14 @@ void MainWindow::on_act_acquire_triggered() ...@@ -2039,7 +2048,14 @@ void MainWindow::on_act_acquire_triggered()
} }
#else #else
if (nullptr != m_saneDeviceHandle) if (nullptr != m_saneDeviceHandle)
sane_start(m_saneDeviceHandle); {
SANE_Status ret = sane_start(m_saneDeviceHandle);
if(ret != SANE_STATUS_GOOD)
{
m_wndStatusBar->setDeviceStatusInfo(tr("start failed"));
m_dialog_log->add_log(tr("start failed"), true);
}
}
#endif #endif
} }
...@@ -2091,7 +2107,14 @@ void MainWindow::on_act_acquireInto_triggered() ...@@ -2091,7 +2107,14 @@ void MainWindow::on_act_acquireInto_triggered()
} }
#else #else
if (nullptr != m_saneDeviceHandle) if (nullptr != m_saneDeviceHandle)
sane_start(m_saneDeviceHandle); {
SANE_Status ret = sane_start(m_saneDeviceHandle);
if(ret != SANE_STATUS_GOOD)
{
m_wndStatusBar->setDeviceStatusInfo(tr("start failed"));
m_dialog_log->add_log(tr("start failed"), true);
}
}
#endif #endif
} }
} }
......
...@@ -82,6 +82,7 @@ signals: ...@@ -82,6 +82,7 @@ signals:
#if !defined(HG_CMP_MSC) || !defined(APP_USE_TWAIN) #if !defined(HG_CMP_MSC) || !defined(APP_USE_TWAIN)
void sane_dev_arrive(QString devName); void sane_dev_arrive(QString devName);
void sane_dev_remove(QString devName); void sane_dev_remove(QString devName);
void sane_dev_error(QString errorInfo);
#endif #endif
void new_image(void *img); void new_image(void *img);
void scan_working(); void scan_working();
...@@ -105,6 +106,7 @@ private slots: ...@@ -105,6 +106,7 @@ private slots:
void on_devMenu_action_triggered(); void on_devMenu_action_triggered();
void on_sane_dev_arrive(QString devName); void on_sane_dev_arrive(QString devName);
void on_sane_dev_remove(QString devName); void on_sane_dev_remove(QString devName);
void on_sane_dev_error(QString errorInfo);
virtual bool eventFilter(QObject* obj, QEvent* event) override; virtual bool eventFilter(QObject* obj, QEvent* event) override;
#endif #endif
void on_new_image(void *img); void on_new_image(void *img);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment