scantool改为静态编译,解决扫描指示器界面刷新异常;非7010设备不再添加到界面

This commit is contained in:
yangjiaxuan 2024-05-29 14:31:13 +08:00
parent c7bda6e9ff
commit 1e329882af
3 changed files with 13 additions and 16 deletions

View File

@ -112,7 +112,7 @@ MainWindow::MainWindow(QWidget *parent)
connect(this, SIGNAL(scanInfo(QString, bool)), this, SLOT(on_scanInfo(QString, bool)));
connect(this, SIGNAL(scanImage(unsigned int)), this, SLOT(on_scanImage(unsigned int)));
connect(this, SIGNAL(scanFinish()), this, SLOT(on_scanFinish()));
connect(this, SIGNAL(saneEventCloseDevice(void*)), this, SLOT(on_saneEventCloseDevice(void*)));
connect(this, SIGNAL(saneEventCloseDevice(void*, bool)), this, SLOT(on_saneEventCloseDevice(void*, bool)));
SANE_Int version_code = 0;
sane_init_ex(&version_code, sane_ex_callback, this);
@ -1125,7 +1125,8 @@ int MainWindow::sane_ex_callback(SANE_Handle hdev, int code, void* data, unsigne
break;
case SANE_EVENT_SCANNER_CLOSED:
{
emit p->saneEventCloseDevice((void*)hdev);
bool isOnline = *(bool*)data;
emit p->saneEventCloseDevice((void*)hdev, isOnline);
}
break;
case SANE_EVENT_IMAGE_OK:
@ -1260,17 +1261,13 @@ void MainWindow::timerEvent(QTimerEvent *e)
this->killTimer(m_timerId);
m_timerId = -1;
}
else if (SCANNER_ERR_DEVICE_NOT_SUPPORT == status)
{
this->killTimer(m_timerId);
m_timerId = -1;
}
}
}
void MainWindow::on_deviceArrive(QString devName)
{
ui->comboBox->addItem(devName);
if (devName.contains("306") || devName.contains("307"))
ui->comboBox->addItem(devName);
}
void MainWindow::on_deviceRemove(QString devName)
@ -1387,10 +1384,6 @@ void MainWindow::on_comboBox_currentIndexChanged(const QString &arg1)
ui->pushButtonAdd->setEnabled(true);
ui->pushButtonModify->setEnabled(true);
}
else if (SCANNER_ERR_DEVICE_NOT_SUPPORT == status)
{
QMessageBox::information(this, tr("Tips"), tr("Do not supported to open %1").arg(arg1));
}
else
{
m_timerId = this->startTimer(5000);
@ -1424,7 +1417,7 @@ void MainWindow::on_showMainWindowDlg()
Show();
}
void MainWindow::on_saneEventCloseDevice(void* devHandle)
void MainWindow::on_saneEventCloseDevice(void* devHandle, bool isOnline)
{
assert(nullptr != m_devHandle || nullptr != devHandle);
if (devHandle != m_devHandle)
@ -1446,7 +1439,8 @@ void MainWindow::on_saneEventCloseDevice(void* devHandle)
m_timerId = -1;
}
m_timerId = this->startTimer(5000);
if (isOnline)
m_timerId = this->startTimer(5000);
}
void MainWindow:: on_pushButtonAdd_clicked()

View File

@ -60,7 +60,7 @@ signals:
void scanImage(unsigned int count);
void scanFinish();
void closeDevice();
void saneEventCloseDevice(void* devHandle);
void saneEventCloseDevice(void* devHandle, bool isOnline);
private slots:
void on_deviceArrive(QString devName);
@ -74,7 +74,7 @@ private slots:
void on_pushButtonScan_clicked();
void on_trayActivated(QSystemTrayIcon::ActivationReason reason);
void on_showMainWindowDlg();
void on_saneEventCloseDevice(void* devHandle);
void on_saneEventCloseDevice(void* devHandle, bool isOnline);
void on_pushButtonAdd_clicked();
void on_pushButtonModify_clicked();
void on_pushButtonRemove_clicked();

View File

@ -247,6 +247,9 @@ if "%OEM%" == "hw" (
cd /d HGTwainUI
%QT_STATIC_PATH%/x86-windows-static-md/tools/qt5/bin/qmake -r -tp vc HGTwainUI.pro
MSBuild.exe HGTwainUI.vcxproj -t:rebuild /m:8 /p:Configuration=Release
cd /d ../HGScanTool
%QT_STATIC_PATH%/x86-windows-static-md/tools/qt5/bin/qmake -r -tp vc HGScanTool.pro
MSBuild.exe HGScanTool.vcxproj -t:rebuild /m:8 /p:Configuration=Release
cd /d ../
)
)