调整上传设备型号为打开的设备名

This commit is contained in:
yangjiaxuan 2022-07-28 17:22:27 +08:00
parent abf1559272
commit 54844f6468
2 changed files with 12 additions and 15 deletions

View File

@ -71,6 +71,7 @@ MainWindow::MainWindow(QWidget *parent)
, m_closeTip(true) , m_closeTip(true)
, m_devSerialNum("") , m_devSerialNum("")
, m_devVersionNum("") , m_devVersionNum("")
, m_currDeviceName("")
{ {
ui->setupUi(this); ui->setupUi(this);
@ -319,6 +320,7 @@ MainWindow::~MainWindow()
cur_dev_.close(); cur_dev_.close();
sane_exit(); sane_exit();
m_versionDll->PostDeviceCloseInfo(m_currDeviceName.toStdString().c_str(), m_devSerialNum.toStdString().c_str(), "", m_devVersionNum.toStdString().c_str());
delete m_versionDll; delete m_versionDll;
m_versionDll = NULL; m_versionDll = NULL;
@ -2218,10 +2220,8 @@ void MainWindow::closeEvent(QCloseEvent *e)
QDir dir = QDir(Dialog_ClrCache::getCachePath()); QDir dir = QDir(Dialog_ClrCache::getCachePath());
dir.removeRecursively(); dir.removeRecursively();
QMainWindow::closeEvent(e); QMainWindow::closeEvent(e);
if(m_versionDll->IsValid())
{
m_versionDll->PostUserCloseInfo(HGVERSION_APPNAME_SCANNER); m_versionDll->PostUserCloseInfo(HGVERSION_APPNAME_SCANNER);
}
} }
int MainWindow::sane_ex_callback(SANE_Handle hdev, int code, void *data, unsigned int* len, void *param) int MainWindow::sane_ex_callback(SANE_Handle hdev, int code, void *data, unsigned int* len, void *param)
@ -2486,10 +2486,8 @@ void MainWindow::on_act_signIn_triggered()
Dialog_Admin dlg(m_password, this); Dialog_Admin dlg(m_password, this);
m_admin_loggedIn = dlg.exec(); m_admin_loggedIn = dlg.exec();
updateActionStatus(); updateActionStatus();
if(m_versionDll->IsValid()) if (m_admin_loggedIn)
{
m_versionDll->PostUserLoginInfo(HGVERSION_APPNAME_SCANNER); m_versionDll->PostUserLoginInfo(HGVERSION_APPNAME_SCANNER);
}
} }
void MainWindow::on_act_passwordChange_triggered() void MainWindow::on_act_passwordChange_triggered()
@ -2523,9 +2521,6 @@ void MainWindow::on_act_signOut_triggered()
{ {
m_admin_loggedIn = false; m_admin_loggedIn = false;
updateActionStatus(); updateActionStatus();
}
if(m_versionDll->IsValid())
{
m_versionDll->PostUserLogoutInfo(HGVERSION_APPNAME_SCANNER); m_versionDll->PostUserLogoutInfo(HGVERSION_APPNAME_SCANNER);
} }
} }
@ -2586,7 +2581,7 @@ void MainWindow::on_act_clearRoller_triggered()
if(ret == SANE_STATUS_GOOD) if(ret == SANE_STATUS_GOOD)
{ {
QMessageBox::information(this, tr("hint"), tr("Roller scanned count has been set to 0.")); QMessageBox::information(this, tr("hint"), tr("Roller scanned count has been set to 0."));
m_versionDll->PostDeviceClearRollerInfo(HGVERSION_APPNAME_SCANNER, m_devSerialNum.toStdString().c_str(), "", m_devVersionNum.toStdString().c_str()); m_versionDll->PostDeviceClearRollerInfo(m_currDeviceName.toStdString().c_str(), m_devSerialNum.toStdString().c_str(), "", m_devVersionNum.toStdString().c_str());
} }
else else
QMessageBox::information(this, tr("hint"), tr("Roller scanned count reset failed.")); QMessageBox::information(this, tr("hint"), tr("Roller scanned count reset failed."));
@ -3078,7 +3073,8 @@ bool MainWindow::open_scanner(const QString& name, OPTSCHEME* schm)
sane_io_control(cur_dev_.handle(), IO_CTRL_CODE_GET_HARDWARE_VERSION, &versionNum[0], &versionNumLen); sane_io_control(cur_dev_.handle(), IO_CTRL_CODE_GET_HARDWARE_VERSION, &versionNum[0], &versionNumLen);
m_devVersionNum = QString::fromStdString(versionNum); m_devVersionNum = QString::fromStdString(versionNum);
m_versionDll->PostDeviceOpenInfo(HGVERSION_APPNAME_SCANNER, m_devSerialNum.toStdString().c_str(), "", m_devVersionNum.toStdString().c_str()); m_versionDll->PostDeviceOpenInfo(name.toStdString().c_str(), m_devSerialNum.toStdString().c_str(), "", m_devVersionNum.toStdString().c_str());
m_currDeviceName = name;
title = name; title = name;
info += tr("success"); info += tr("success");
@ -3325,7 +3321,7 @@ void MainWindow::on_scanOptions_changed(const QString &device, const QString &op
if(msg.clickedButton() == msg.button(QMessageBox::Yes)) if(msg.clickedButton() == msg.button(QMessageBox::Yes))
{ {
cur_dev_.close(); cur_dev_.close();
m_versionDll->PostDeviceCloseInfo(HGVERSION_APPNAME_SCANNER, m_devSerialNum.toStdString().c_str(), "", m_devVersionNum.toStdString().c_str()); m_versionDll->PostDeviceCloseInfo(device.toStdString().c_str(), m_devSerialNum.toStdString().c_str(), "", m_devVersionNum.toStdString().c_str());
m_dialogLog->addLog(tr("close ") + device, false); m_dialogLog->addLog(tr("close ") + device, false);
m_wndStatusBar->setDeviceStatusInfo(tr("close ") + device, false); m_wndStatusBar->setDeviceStatusInfo(tr("close ") + device, false);
@ -3458,10 +3454,10 @@ void MainWindow::on_act_device_log_triggered()
QDesktopServices::openUrl(QUrl::fromLocalFile(log_file_path)); QDesktopServices::openUrl(QUrl::fromLocalFile(log_file_path));
} }
else { else {
if(statu == SANE_STATUS_UNSUPPORTED) // 设备不支持该操作 if(statu == SANE_STATUS_UNSUPPORTED)
QMessageBox::information(this, windowTitle(), tr("The device does not support this operation")); QMessageBox::information(this, windowTitle(), tr("The device does not support this operation"));
else else
QMessageBox::information(this, windowTitle(), tr("IO error")); // IO错误 QMessageBox::information(this, windowTitle(), tr("IO error"));
} }
} }

View File

@ -288,6 +288,7 @@ private:
bool m_closeTip; bool m_closeTip;
QString m_devSerialNum; QString m_devSerialNum;
QString m_devVersionNum; QString m_devVersionNum;
QString m_currDeviceName;
class HGLineEdit* m_multiPageLineEdit; class HGLineEdit* m_multiPageLineEdit;
class Widget_StatusBar *m_wndStatusBar; class Widget_StatusBar *m_wndStatusBar;