diff --git a/app/fwupgrade/mainwindow.cpp b/app/fwupgrade/mainwindow.cpp index 18516350..a24f3ad7 100644 --- a/app/fwupgrade/mainwindow.cpp +++ b/app/fwupgrade/mainwindow.cpp @@ -250,17 +250,27 @@ void MainWindow::on_comboDevList_currentIndexChanged(int index) ui->labelDevInfo->setText(QString(tr("device: %1, firmware version: %2, upgrade: %3")).arg(name) .arg(m_curFwVersion).arg(!devType.isEmpty() ? tr("support") : tr("do not support"))); - SANE_Int historyScanNum = 0; - unsigned int historyScanNumLen = sizeof(SANE_Int); - SANE_Status ret = sane_io_control(m_curDevHandle, IO_CTRL_CODE_GET_HISTORY_NUM, &historyScanNum, &historyScanNumLen); - if(ret == SANE_STATUS_GOOD && historyScanNum >= 0) + SANE_Int rollCount = 0; + unsigned int rollCountSize = sizeof(SANE_Int); + SANE_Status ret = sane_io_control(m_curDevHandle, IO_CTRL_CODE_GET_HISTORY_ROLLER_NUM, &rollCount, &rollCountSize); + if(ret == SANE_STATUS_GOOD && rollCount >= 0) { - ui->labelRollCount->setText(QString(historyScanNum)); - ui->labelScanCount->setText(QString(historyScanNum)); + ui->labelRollCount->setText(QString("%1").arg(rollCount)); } else { ui->labelRollCount->setText(tr("do not support")); + } + + SANE_Int scanCount = 0; + unsigned int scanCountSize = sizeof(SANE_Int); + ret = sane_io_control(m_curDevHandle, IO_CTRL_CODE_GET_SCANN_NUM, &scanCount, &scanCountSize); + if (ret == SANE_STATUS_GOOD && scanCount >= 0) + { + ui->labelScanCount->setText(QString("%1").arg(scanCount)); + } + else + { ui->labelScanCount->setText(tr("do not support")); } @@ -490,8 +500,11 @@ void MainWindow::on_btnClearRollCount_clicked() int ret = sane_io_control(m_curDevHandle, IO_CTRL_CODE_CLEAR_ROLLER_COUNT, nullptr, &count); QString info; - if(ret == SANE_STATUS_GOOD) + if (ret == SANE_STATUS_GOOD) + { + ui->labelRollCount->setText("0"); info = tr("Roller scanned count has been set to 0."); + } else info = tr("Roller scanned count reset failed.");