维护工具添加畸变校正功能,增加读取序列号速度模式

This commit is contained in:
yangjiaxuan 2023-06-12 17:11:25 +08:00
parent 477a3e4330
commit 54d67a3e13
6 changed files with 643 additions and 166 deletions

Binary file not shown.

View File

@ -61,34 +61,33 @@
<translation></translation>
</message>
<message>
<location filename="logindialog.ui" line="137"/>
<location filename="logindialog.ui" line="150"/>
<source>login</source>
<translation></translation>
</message>
<message>
<location filename="logindialog.ui" line="144"/>
<location filename="logindialog.ui" line="157"/>
<source>help</source>
<translation></translation>
</message>
<message>
<location filename="logindialog.ui" line="151"/>
<location filename="logindialog.ui" line="164"/>
<source>exit</source>
<translation></translation>
</message>
<message>
<location filename="logindialog.cpp" line="27"/>
<location filename="logindialog.cpp" line="29"/>
<source>tips</source>
<translation></translation>
</message>
<message>
<location filename="logindialog.cpp" line="27"/>
<location filename="logindialog.cpp" line="29"/>
<source>wrong account or password</source>
<translation></translation>
</message>
<message>
<location filename="logindialog.cpp" line="28"/>
<source>yes</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
</context>
<context>
@ -99,109 +98,188 @@
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="37"/>
<location filename="mainwindow.ui" line="71"/>
<source>update firmware</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="49"/>
<location filename="mainwindow.ui" line="214"/>
<location filename="mainwindow.ui" line="35"/>
<source>device list</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="85"/>
<location filename="mainwindow.ui" line="83"/>
<location filename="mainwindow.ui" line="213"/>
<source>device information</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="96"/>
<source>online upgrade</source>
<translation>线</translation>
</message>
<message>
<location filename="mainwindow.ui" line="107"/>
<location filename="mainwindow.ui" line="118"/>
<source>get version list</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="120"/>
<location filename="mainwindow.ui" line="131"/>
<source>download and upgrade</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="133"/>
<location filename="mainwindow.ui" line="144"/>
<source>version list</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="147"/>
<location filename="mainwindow.ui" line="158"/>
<source>local upgrade</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="159"/>
<location filename="mainwindow.ui" line="170"/>
<source>file path</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="182"/>
<location filename="mainwindow.ui" line="193"/>
<source>open file path</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="195"/>
<location filename="mainwindow.ui" line="206"/>
<source>upgrade</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="202"/>
<source>manager tools</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="mainwindow.ui" line="237"/>
<location filename="mainwindow.ui" line="225"/>
<source>roll count:</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="250"/>
<location filename="mainwindow.ui" line="263"/>
<location filename="mainwindow.ui" line="238"/>
<location filename="mainwindow.ui" line="251"/>
<source>0</source>
<translation>0</translation>
</message>
<message>
<location filename="mainwindow.ui" line="276"/>
<location filename="mainwindow.ui" line="264"/>
<source>scan count:</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="289"/>
<location filename="mainwindow.ui" line="277"/>
<source>clear roll count</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="295"/>
<location filename="mainwindow.ui" line="290"/>
<source>Serial number:</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="303"/>
<source>Firmware number:</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="316"/>
<source>Speed mode:</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="322"/>
<source>correction</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="335"/>
<source>Color</source>
<translation>24</translation>
</message>
<message>
<location filename="mainwindow.ui" line="340"/>
<source>Gray</source>
<translation>256</translation>
</message>
<message>
<location filename="mainwindow.ui" line="355"/>
<source>200</source>
<translation>200</translation>
</message>
<message>
<location filename="mainwindow.ui" line="360"/>
<source>300</source>
<translation>300</translation>
</message>
<message>
<location filename="mainwindow.ui" line="365"/>
<source>600</source>
<translation>600</translation>
</message>
<message>
<location filename="mainwindow.ui" line="379"/>
<source>Color mode:</source>
<translation>:</translation>
</message>
<message>
<location filename="mainwindow.ui" line="392"/>
<source>Dpi:</source>
<translation>:</translation>
</message>
<message>
<location filename="mainwindow.ui" line="418"/>
<source>Get distortion</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="431"/>
<source>Set distortion</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="444"/>
<source>Correct</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="457"/>
<source>Have not corrected</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="473"/>
<source>password change</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="307"/>
<location filename="mainwindow.ui" line="485"/>
<source>old password</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="320"/>
<location filename="mainwindow.ui" line="498"/>
<source>new password</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="353"/>
<location filename="mainwindow.ui" line="531"/>
<source>modify password</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="376"/>
<location filename="mainwindow.ui" line="554"/>
<source>confirm new password</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="400"/>
<location filename="mainwindow.ui" line="578"/>
<source>exit</source>
<translation></translation>
</message>
@ -218,59 +296,50 @@
<translation type="vanished">%1%2</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="252"/>
<location filename="mainwindow.cpp" line="263"/>
<location filename="mainwindow.cpp" line="275"/>
<location filename="mainwindow.cpp" line="361"/>
<location filename="mainwindow.cpp" line="362"/>
<location filename="mainwindow.cpp" line="363"/>
<location filename="mainwindow.cpp" line="375"/>
<location filename="mainwindow.cpp" line="387"/>
<source>do not support</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="287"/>
<location filename="mainwindow.cpp" line="399"/>
<source>open device error: %1</source>
<translation>%1</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="292"/>
<location filename="mainwindow.cpp" line="404"/>
<source>no device opened</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="327"/>
<location filename="mainwindow.cpp" line="373"/>
<location filename="mainwindow.cpp" line="384"/>
<location filename="mainwindow.cpp" line="409"/>
<location filename="mainwindow.cpp" line="460"/>
<location filename="mainwindow.cpp" line="521"/>
<location filename="mainwindow.cpp" line="538"/>
<location filename="mainwindow.cpp" line="546"/>
<location filename="mainwindow.cpp" line="554"/>
<location filename="mainwindow.cpp" line="562"/>
<location filename="mainwindow.cpp" line="572"/>
<location filename="mainwindow.cpp" line="449"/>
<location filename="mainwindow.cpp" line="494"/>
<location filename="mainwindow.cpp" line="504"/>
<location filename="mainwindow.cpp" line="527"/>
<location filename="mainwindow.cpp" line="577"/>
<location filename="mainwindow.cpp" line="641"/>
<location filename="mainwindow.cpp" line="657"/>
<location filename="mainwindow.cpp" line="664"/>
<location filename="mainwindow.cpp" line="671"/>
<location filename="mainwindow.cpp" line="678"/>
<location filename="mainwindow.cpp" line="687"/>
<source>tips</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="327"/>
<location filename="mainwindow.cpp" line="449"/>
<source>no version available</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="328"/>
<location filename="mainwindow.cpp" line="374"/>
<location filename="mainwindow.cpp" line="387"/>
<location filename="mainwindow.cpp" line="410"/>
<location filename="mainwindow.cpp" line="461"/>
<location filename="mainwindow.cpp" line="522"/>
<location filename="mainwindow.cpp" line="539"/>
<location filename="mainwindow.cpp" line="547"/>
<location filename="mainwindow.cpp" line="555"/>
<location filename="mainwindow.cpp" line="563"/>
<location filename="mainwindow.cpp" line="573"/>
<source>yes</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="359"/>
<location filename="mainwindow.cpp" line="480"/>
<source>Open File</source>
<translation></translation>
</message>
@ -279,9 +348,9 @@
<translation type="vanished">(* .zip)</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="451"/>
<location filename="mainwindow.cpp" line="472"/>
<location filename="mainwindow.cpp" line="493"/>
<location filename="mainwindow.cpp" line="568"/>
<location filename="mainwindow.cpp" line="588"/>
<location filename="mainwindow.cpp" line="609"/>
<source>device: %1 upgrade firmware success</source>
<translation>%1 </translation>
</message>
@ -290,23 +359,22 @@
<translation type="vanished">%1 </translation>
</message>
<message>
<location filename="mainwindow.cpp" line="251"/>
<source>device: %1, firmware version: %2, upgrade: %3</source>
<translation>: %1, : %2, : %3</translation>
<translation type="vanished">: %1, : %2, : %3</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="252"/>
<location filename="mainwindow.cpp" line="361"/>
<source>support</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="359"/>
<location filename="mainwindow.cpp" line="480"/>
<source>ZIP Files(*.zip *.zip)</source>
<translation>(*.zip)</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="373"/>
<location filename="mainwindow.cpp" line="409"/>
<location filename="mainwindow.cpp" line="494"/>
<location filename="mainwindow.cpp" line="527"/>
<source>the selected firmware is not newer than the current version</source>
<translation></translation>
</message>
@ -315,62 +383,113 @@
<translation type="vanished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="385"/>
<location filename="mainwindow.cpp" line="505"/>
<source>firmware file mismatch, continue?</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="388"/>
<source>no</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="455"/>
<location filename="mainwindow.cpp" line="476"/>
<location filename="mainwindow.cpp" line="497"/>
<location filename="mainwindow.cpp" line="360"/>
<source>device: %1, upgrade: %2</source>
<translation>: %1, : %2</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="362"/>
<source>FirmWare number: %1</source>
<translation>: %1</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="363"/>
<source>Serial number: %1</source>
<translation>: %1</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="364"/>
<source>speed mode: %1</source>
<translation>: %1</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="572"/>
<location filename="mainwindow.cpp" line="592"/>
<location filename="mainwindow.cpp" line="613"/>
<source>device: %1 upgrade firmware failed, io error</source>
<translation>%1 IO错误</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="460"/>
<location filename="mainwindow.cpp" line="577"/>
<source>download firmware fail</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="516"/>
<location filename="mainwindow.cpp" line="632"/>
<source>Roller scanned count has been set to 0.</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="519"/>
<location filename="mainwindow.cpp" line="636"/>
<source>Do not supported</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="639"/>
<source>Roller scanned count reset failed.</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="538"/>
<location filename="mainwindow.cpp" line="657"/>
<source>old password is wrong</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="546"/>
<location filename="mainwindow.cpp" line="664"/>
<source>new password can not be empty</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="554"/>
<location filename="mainwindow.cpp" line="671"/>
<source>new password is inconsistent</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="562"/>
<location filename="mainwindow.cpp" line="678"/>
<source>modify password fail</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="572"/>
<location filename="mainwindow.cpp" line="687"/>
<source>modify password success</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="700"/>
<location filename="mainwindow.cpp" line="716"/>
<location filename="mainwindow.cpp" line="732"/>
<source>Prompt</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="700"/>
<source>Get failed</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="716"/>
<source>Set failed</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="732"/>
<source>Correct failed</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="737"/>
<source>Have already corrected</source>
<translation></translation>
</message>
</context>
<context>
<name>QObject</name>

View File

@ -7,6 +7,32 @@
#include <QTranslator>
#include <QMessageBox>
#include "base/HGBase.h"
#include <shlobj.h>
HGResult GetConfigPath(HGChar* configPath, HGUInt maxLen)
{
if (NULL == configPath || 0 == maxLen)
{
return HGBASE_ERR_INVALIDARG;
}
const char *appName = "HuaGoScan";
CHAR cfgPath[MAX_PATH] = { 0 };
BOOL ret = SHGetSpecialFolderPathA(NULL, cfgPath, CSIDL_APPDATA, FALSE);
if (!ret)
return HGBASE_ERR_FAIL;
if (cfgPath[strlen(cfgPath) - 1] != '\\')
strcat(cfgPath, "\\");
strcat(cfgPath, appName);
strcat(cfgPath, "\\Cfg\\");
if (maxLen < strlen(cfgPath) + 1)
return HGBASE_ERR_FAIL;
strcpy(configPath, cfgPath);
return HGBASE_ERR_OK;
}
int main(int argc, char *argv[])
{
@ -25,11 +51,11 @@ int main(int argc, char *argv[])
w.move((screen->size().width() - w.width()) / 2, (screen->size().height() - w.height()) / 2);
HGChar cfgPath[256]= {0};
HGBase_GetConfigPath(cfgPath, 256);
GetConfigPath(cfgPath, 256);
strcat(cfgPath, "config.ini");
HGChar str[256] = {0};
HGBase_GetProfileString(cfgPath, "login", "password", "", str, 256);
QString password = (0 == *str) ? "123456" : MainWindow::passwordDecrypt(str);
QString password = (0 == *str) ? "huagoscan" : MainWindow::passwordDecrypt(str);
LoginDialog login("admin", password, &w);
if (login.exec())

View File

@ -10,6 +10,7 @@
#include "dialog_updateprogress.h"
#include "base/HGBase.h"
#include "base/HGInc.h"
#include "sane/sane_option_definitions.h"
#include "HGString.h"
#include <algorithm>
@ -24,6 +25,7 @@ MainWindow::MainWindow(QWidget *parent)
m_curDevName.clear();
m_curDevHandle = nullptr;
m_curFwVersion.clear();
m_curSerialNum.clear();
ui->editFilePath->setEnabled(false);
ui->editOldPassword->setEchoMode(QLineEdit::EchoMode::Password);
@ -38,6 +40,7 @@ MainWindow::MainWindow(QWidget *parent)
connect(this, SIGNAL(sane_dev_arrive(QString, bool)), this, SLOT(on_sane_dev_arrive(QString, bool)), Qt::QueuedConnection);
connect(this, SIGNAL(sane_dev_remove(QString)), this, SLOT(on_sane_dev_remove(QString)), Qt::QueuedConnection);
connect(this, SIGNAL(correctInfo(QString)), this, SLOT(on_correctInfo(QString)), Qt::QueuedConnection);
m_versionMgr = nullptr;
HGVersion_CreateMgr(&m_versionMgr);
@ -176,7 +179,6 @@ void MainWindow::on_sane_dev_arrive(QString devName, bool opened)
{
assert(!opened);
ui->comboDevList->addItem(devName);
ui->comboDevList2->addItem(devName);
}
else if (opened)
{
@ -202,10 +204,15 @@ void MainWindow::on_sane_dev_remove(QString devName)
if (-1 != idx)
{
ui->comboDevList->removeItem(idx);
ui->comboDevList2->removeItem(idx);
}
}
void MainWindow::on_correctInfo(QString info)
{
ui->textBrowser->insertPlainText(info);
ui->textBrowser->moveCursor(QTextCursor::End);
}
void MainWindow::on_btnExit_clicked()
{
close();
@ -230,15 +237,75 @@ int MainWindow::sane_ex_callback(SANE_Handle hdev, int code, void *data, unsigne
emit p->sane_dev_remove(sane_dev->name);
}
break;
case SANE_EVENT_STATUS:
{
QString info;
if (data != nullptr)
{
info = QString::fromStdString((const char*)data);
emit p->correctInfo(info);
}
}
break;
}
return 0;
}
void MainWindow::initColorAndDpi()
{
const char *color = nullptr;
if (0 == ui->comboBox_colorMode->currentIndex())
{
color = OPTION_VALUE_YSMS_24WCS;
}
else
{
color = OPTION_VALUE_YSMS_256JHD;
}
int dpi = ui->comboBox_dpi->currentText().toInt();
unsigned int colorLen = strlen(color);
unsigned int len = sizeof(int);
sane_io_control(m_curDevHandle, IO_CTRL_CODE_SET_COLOR, (void*)color, &colorLen);
sane_io_control(m_curDevHandle, IO_CTRL_CODE_SET_DPI, (void*)&dpi, &len);
}
QString MainWindow::getSpeedMode()
{
QString devType = m_curFwVersion.left(2) + "00";
SANE_Int speedMode = 0;
unsigned int len = sizeof(SANE_Int);
sane_io_control(m_curDevHandle, IO_CTRL_CODE_GET_SPEED_MODE, &speedMode, &len);
const wchar_t G100[6] = { 70,80,90,110 };
const wchar_t G200[6] = { 100,110,120,130 };
const wchar_t G300[6] = { 40,50,60,70 };
const wchar_t G400[6] = { 40,50,60,70,80 };
int speed = 0;
if ((int)speedMode >= 40)
speed = (int)speedMode;
else
{
if (devType == "G100")
speed = G100[(int)speedMode - 1];
else if (devType == "G200")
speed = G200[(int)speedMode - 1];
else if (devType == "G300")
speed = G300[(int)speedMode - 1];
else if (devType == "G400")
speed = G400[(int)speedMode - 1];
}
return QString::number(speed) + "PPM";
}
void MainWindow::on_comboDevList_currentIndexChanged(int index)
{
ui->comboDevList2->setCurrentIndex(index);
m_vVersion.clear();
ui->comboVersionList->clear();
@ -252,6 +319,7 @@ void MainWindow::on_comboDevList_currentIndexChanged(int index)
m_curDevHandle = nullptr;
}
m_curFwVersion.clear();
m_curSerialNum.clear();
m_curDevName.clear();
ui->btnGetVersionList->setEnabled(false);
@ -267,20 +335,33 @@ void MainWindow::on_comboDevList_currentIndexChanged(int index)
{
m_curDevName = name;
std::string versionNum;
unsigned int versionNumLen = 0;
if(SANE_STATUS_NO_MEM == sane_io_control(m_curDevHandle, IO_CTRL_CODE_GET_HARDWARE_VERSION, nullptr, &versionNumLen)
&& versionNumLen)
std::string fwVersionNum;
unsigned int fwVersionNumLen = 0;
if(SANE_STATUS_NO_MEM == sane_io_control(m_curDevHandle, IO_CTRL_CODE_GET_HARDWARE_VERSION, nullptr, &fwVersionNumLen)
&& fwVersionNumLen)
{
versionNum.resize(versionNumLen);
sane_io_control(m_curDevHandle, IO_CTRL_CODE_GET_HARDWARE_VERSION, &versionNum[0], &versionNumLen);
fwVersionNum.resize(fwVersionNumLen);
sane_io_control(m_curDevHandle, IO_CTRL_CODE_GET_HARDWARE_VERSION, &fwVersionNum[0], &fwVersionNumLen);
}
m_curFwVersion = QString::fromStdString(versionNum.c_str());
std::string serialNum;
unsigned int serialNumLen = 0;
if(SANE_STATUS_NO_MEM == sane_io_control(m_curDevHandle, IO_CTRL_CODE_GET_SERIAL, nullptr, &serialNumLen)
&& serialNumLen)
{
serialNum.resize(serialNumLen);
sane_io_control(m_curDevHandle, IO_CTRL_CODE_GET_SERIAL, &serialNum[0], &serialNumLen);
}
m_curSerialNum =QString::fromStdString(serialNum.c_str());
m_curFwVersion = QString::fromStdString(fwVersionNum.c_str());
QString devType = GetDevType(m_curFwVersion, NULL);
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")));
ui->labelDevInfo->setText(QString(tr("device: %1, upgrade: %2")).arg(name)
.arg(!devType.isEmpty() ? tr("support") : tr("do not support")));
ui->label_fwNum->setText(QString((!m_curFwVersion.isEmpty()) ? tr("FirmWare number: %1").arg(m_curFwVersion) : tr("do not support")));
ui->label_sn->setText(QString((!m_curSerialNum.isEmpty()) ? tr("Serial number: %1").arg(m_curSerialNum) : tr("do not support")));
ui->label_speedMode->setText(QString(tr("speed mode: %1").arg(getSpeedMode())));
SANE_Int rollCount = 0;
unsigned int rollCountSize = sizeof(SANE_Int);
@ -550,6 +631,10 @@ void MainWindow::on_btnClearRollCount_clicked()
ui->labelRollCount->setText("0");
info = tr("Roller scanned count has been set to 0.");
}
else if (ret == SANE_STATUS_UNSUPPORTED)
{
info = tr("Do not supported");
}
else
info = tr("Roller scanned count reset failed.");
@ -602,3 +687,53 @@ void MainWindow::on_btnModifyPassword_clicked()
QMessageBox msg(QMessageBox::Information, tr("tips"), tr("modify password success"), QMessageBox::Ok, this);
msg.exec();
}
void MainWindow::on_pushButton_getDistortion_clicked()
{
initColorAndDpi();
float distortion = 0.0;
unsigned int len = sizeof(int);
SANE_Status ret = sane_io_control(m_curDevHandle, IO_CTRL_CODE_GET_DISTORTION_DEVS_CHECK_VAL, &distortion, &len);
if (ret != SANE_STATUS_GOOD)
{
QMessageBox::information(this, tr("Prompt"), tr("Get failed"));
return;
}
ui->lineEdit_distortion->setText(QString::number(distortion));
}
void MainWindow::on_pushButton_setDistortion_clicked()
{
initColorAndDpi();
QString value = ui->lineEdit_distortion->text();
float distortion = value.toFloat();
unsigned int len = sizeof(int);
SANE_Status ret = sane_io_control(m_curDevHandle, IO_CTRL_CODE_SET_DISTORTION_DEVS_CHECK_VAL, &distortion, &len);
if (ret != SANE_STATUS_GOOD)
{
QMessageBox::information(this, tr("Prompt"), tr("Set failed"));
return;
}
}
void MainWindow::on_pushButton_correct_clicked()
{
ui->textBrowser->clear();
initColorAndDpi();
int type = 0;
unsigned int len = sizeof(int);;
SANE_Status ret = sane_io_control(m_curDevHandle, IO_CTRL_CODE_SET_AUTO_FALT, (void*)&type, &len);
if (ret != SANE_STATUS_GOOD)
{
QMessageBox::information(this, tr("Prompt"), tr("Correct failed"));
return;
}
else
{
ui->label_correct->setText(tr("Have already corrected"));
}
}

View File

@ -31,10 +31,12 @@ public:
signals:
void sane_dev_arrive(QString devName, bool opened);
void sane_dev_remove(QString devName);
void correctInfo(QString info);
private slots:
void on_sane_dev_arrive(QString devName, bool opened);
void on_sane_dev_remove(QString devName);
void on_correctInfo(QString info);
void on_btnExit_clicked();
void on_comboDevList_currentIndexChanged(int index);
@ -57,9 +59,19 @@ private slots:
void on_btnModifyPassword_clicked();
void on_pushButton_getDistortion_clicked();
void on_pushButton_setDistortion_clicked();
void on_pushButton_correct_clicked();
private:
static int sane_ex_callback(SANE_Handle hdev, int code, void *data, unsigned int* len, void *param);
private:
void initColorAndDpi();
QString getSpeedMode();
private:
Ui::MainWindow *ui;
HGVersionMgr m_versionMgr;
@ -68,5 +80,6 @@ private:
QString m_curDevName;
SANE_Handle m_curDevHandle;
QString m_curFwVersion;
QString m_curSerialNum;
};
#endif // MAINWINDOW_H

View File

@ -28,55 +28,72 @@
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>update firmware</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>103</x>
<y>40</y>
<width>81</width>
<height>20</height>
</rect>
<property name="minimumSize">
<size>
<width>0</width>
<height>51</height>
</size>
</property>
<property name="text">
<string>device list</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboDevList">
<property name="minimumSize">
<size>
<width>181</width>
<height>20</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>update firmware</string>
</attribute>
<widget class="QLabel" name="labelDevInfo">
<property name="geometry">
<rect>
<x>190</x>
<y>80</y>
<x>80</x>
<y>170</y>
<width>391</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QComboBox" name="comboDevList">
<property name="geometry">
<rect>
<x>190</x>
<y>40</y>
<width>391</width>
<height>22</height>
</rect>
<string>device information</string>
</property>
</widget>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>90</x>
<y>110</y>
<x>70</x>
<y>30</y>
<width>501</width>
<height>111</height>
</rect>
@ -137,8 +154,8 @@
<widget class="QGroupBox" name="groupBox_2">
<property name="geometry">
<rect>
<x>90</x>
<y>250</y>
<x>70</x>
<y>220</y>
<width>501</width>
<height>111</height>
</rect>
@ -199,37 +216,14 @@
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>manager tools</string>
<string>device information</string>
</attribute>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>103</x>
<y>50</y>
<width>81</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>device list</string>
</property>
</widget>
<widget class="QComboBox" name="comboDevList2">
<property name="geometry">
<rect>
<x>200</x>
<y>50</y>
<width>361</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>110</x>
<y>120</y>
<width>81</width>
<x>170</x>
<y>180</y>
<width>71</width>
<height>20</height>
</rect>
</property>
@ -240,8 +234,8 @@
<widget class="QLabel" name="labelRollCount">
<property name="geometry">
<rect>
<x>200</x>
<y>120</y>
<x>240</x>
<y>180</y>
<width>81</width>
<height>21</height>
</rect>
@ -253,8 +247,8 @@
<widget class="QLabel" name="labelScanCount">
<property name="geometry">
<rect>
<x>200</x>
<y>150</y>
<x>260</x>
<y>230</y>
<width>81</width>
<height>21</height>
</rect>
@ -266,8 +260,8 @@
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>110</x>
<y>150</y>
<x>170</x>
<y>230</y>
<width>81</width>
<height>20</height>
</rect>
@ -279,8 +273,8 @@
<widget class="QPushButton" name="btnClearRollCount">
<property name="geometry">
<rect>
<x>200</x>
<y>200</y>
<x>270</x>
<y>280</y>
<width>111</width>
<height>31</height>
</rect>
@ -289,6 +283,196 @@
<string>clear roll count</string>
</property>
</widget>
<widget class="QLabel" name="label_sn">
<property name="geometry">
<rect>
<x>170</x>
<y>30</y>
<width>321</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Serial number:</string>
</property>
</widget>
<widget class="QLabel" name="label_fwNum">
<property name="geometry">
<rect>
<x>170</x>
<y>80</y>
<width>321</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Firmware number:</string>
</property>
</widget>
<widget class="QLabel" name="label_speedMode">
<property name="geometry">
<rect>
<x>170</x>
<y>130</y>
<width>321</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Speed mode:</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="tab_4">
<attribute name="title">
<string>correction</string>
</attribute>
<widget class="QComboBox" name="comboBox_colorMode">
<property name="geometry">
<rect>
<x>120</x>
<y>20</y>
<width>121</width>
<height>22</height>
</rect>
</property>
<item>
<property name="text">
<string>Color</string>
</property>
</item>
<item>
<property name="text">
<string>Gray</string>
</property>
</item>
</widget>
<widget class="QComboBox" name="comboBox_dpi">
<property name="geometry">
<rect>
<x>370</x>
<y>20</y>
<width>121</width>
<height>22</height>
</rect>
</property>
<item>
<property name="text">
<string>200</string>
</property>
</item>
<item>
<property name="text">
<string>300</string>
</property>
</item>
<item>
<property name="text">
<string>600</string>
</property>
</item>
</widget>
<widget class="QLabel" name="label_10">
<property name="geometry">
<rect>
<x>30</x>
<y>20</y>
<width>81</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Color mode:</string>
</property>
</widget>
<widget class="QLabel" name="label_11">
<property name="geometry">
<rect>
<x>290</x>
<y>20</y>
<width>71</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Dpi:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_distortion">
<property name="geometry">
<rect>
<x>170</x>
<y>60</y>
<width>113</width>
<height>20</height>
</rect>
</property>
<property name="echoMode">
<enum>QLineEdit::Normal</enum>
</property>
</widget>
<widget class="QPushButton" name="pushButton_getDistortion">
<property name="geometry">
<rect>
<x>30</x>
<y>60</y>
<width>101</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Get distortion</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_setDistortion">
<property name="geometry">
<rect>
<x>320</x>
<y>60</y>
<width>101</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Set distortion</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_correct">
<property name="geometry">
<rect>
<x>30</x>
<y>110</y>
<width>131</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Correct</string>
</property>
</widget>
<widget class="QLabel" name="label_correct">
<property name="geometry">
<rect>
<x>180</x>
<y>110</y>
<width>111</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Have not corrected</string>
</property>
</widget>
<widget class="QTextBrowser" name="textBrowser">
<property name="geometry">
<rect>
<x>30</x>
<y>150</y>
<width>421</width>
<height>191</height>
</rect>
</property>
</widget>
</widget>
<widget class="QWidget" name="tab_3">
<attribute name="title">