调整维护工具界面布局和提示信息

This commit is contained in:
yangjiaxuan 2023-06-15 10:58:30 +08:00
parent ab22192234
commit ecffb647ce
6 changed files with 164 additions and 120 deletions

Binary file not shown.

View File

@ -76,12 +76,12 @@
<translation></translation>
</message>
<message>
<location filename="logindialog.cpp" line="29"/>
<location filename="logindialog.cpp" line="32"/>
<source>tips</source>
<translation></translation>
</message>
<message>
<location filename="logindialog.cpp" line="29"/>
<location filename="logindialog.cpp" line="32"/>
<source>wrong account or password</source>
<translation></translation>
</message>
@ -98,18 +98,17 @@
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="71"/>
<location filename="mainwindow.ui" line="84"/>
<source>update firmware</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="35"/>
<location filename="mainwindow.ui" line="41"/>
<source>device list</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="83"/>
<location filename="mainwindow.ui" line="213"/>
<location filename="mainwindow.ui" line="226"/>
<source>device information</source>
<translation></translation>
</message>
@ -158,128 +157,128 @@
<translation type="vanished"></translation>
</message>
<message>
<location filename="mainwindow.ui" line="225"/>
<location filename="mainwindow.ui" line="238"/>
<source>roll count:</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="238"/>
<location filename="mainwindow.ui" line="251"/>
<location filename="mainwindow.ui" line="264"/>
<source>0</source>
<translation>0</translation>
</message>
<message>
<location filename="mainwindow.ui" line="264"/>
<location filename="mainwindow.ui" line="277"/>
<source>scan count:</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="277"/>
<location filename="mainwindow.ui" line="290"/>
<source>clear roll count</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="290"/>
<location filename="mainwindow.ui" line="303"/>
<source>Serial number:</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="303"/>
<location filename="mainwindow.ui" line="316"/>
<source>Firmware number:</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="316"/>
<location filename="mainwindow.ui" line="329"/>
<source>Speed mode:</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="322"/>
<location filename="mainwindow.ui" line="335"/>
<source>correction</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="335"/>
<location filename="mainwindow.ui" line="348"/>
<source>Color</source>
<translation>24</translation>
</message>
<message>
<location filename="mainwindow.ui" line="340"/>
<location filename="mainwindow.ui" line="353"/>
<source>Gray</source>
<translation>256</translation>
</message>
<message>
<location filename="mainwindow.ui" line="355"/>
<location filename="mainwindow.ui" line="368"/>
<source>200</source>
<translation>200</translation>
</message>
<message>
<location filename="mainwindow.ui" line="360"/>
<location filename="mainwindow.ui" line="373"/>
<source>300</source>
<translation>300</translation>
</message>
<message>
<location filename="mainwindow.ui" line="365"/>
<location filename="mainwindow.ui" line="378"/>
<source>600</source>
<translation>600</translation>
</message>
<message>
<location filename="mainwindow.ui" line="379"/>
<location filename="mainwindow.ui" line="392"/>
<source>Color mode:</source>
<translation>:</translation>
</message>
<message>
<location filename="mainwindow.ui" line="392"/>
<location filename="mainwindow.ui" line="405"/>
<source>Dpi:</source>
<translation>:</translation>
</message>
<message>
<location filename="mainwindow.ui" line="418"/>
<location filename="mainwindow.ui" line="431"/>
<source>Get distortion</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="431"/>
<location filename="mainwindow.ui" line="444"/>
<source>Set distortion</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="444"/>
<location filename="mainwindow.ui" line="457"/>
<source>Correct</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="457"/>
<location filename="mainwindow.ui" line="470"/>
<source>Have not corrected</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="473"/>
<location filename="mainwindow.ui" line="486"/>
<source>password change</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="485"/>
<location filename="mainwindow.ui" line="498"/>
<source>old password</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="498"/>
<location filename="mainwindow.ui" line="511"/>
<source>new password</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="531"/>
<location filename="mainwindow.ui" line="544"/>
<source>modify password</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="554"/>
<location filename="mainwindow.ui" line="567"/>
<source>confirm new password</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="578"/>
<location filename="mainwindow.ui" line="591"/>
<source>exit</source>
<translation></translation>
</message>
@ -296,41 +295,40 @@
<translation type="vanished">%1%2</translation>
</message>
<message>
<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"/>
<location filename="mainwindow.cpp" line="369"/>
<location filename="mainwindow.cpp" line="370"/>
<location filename="mainwindow.cpp" line="371"/>
<location filename="mainwindow.cpp" line="383"/>
<location filename="mainwindow.cpp" line="395"/>
<source>do not support</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="399"/>
<source>open device error: %1</source>
<translation>%1</translation>
<translation type="vanished">%1</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="404"/>
<location filename="mainwindow.cpp" line="423"/>
<source>no device opened</source>
<translation></translation>
</message>
<message>
<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"/>
<location filename="mainwindow.cpp" line="468"/>
<location filename="mainwindow.cpp" line="513"/>
<location filename="mainwindow.cpp" line="523"/>
<location filename="mainwindow.cpp" line="546"/>
<location filename="mainwindow.cpp" line="596"/>
<location filename="mainwindow.cpp" line="660"/>
<location filename="mainwindow.cpp" line="676"/>
<location filename="mainwindow.cpp" line="683"/>
<location filename="mainwindow.cpp" line="690"/>
<location filename="mainwindow.cpp" line="697"/>
<location filename="mainwindow.cpp" line="706"/>
<source>tips</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="449"/>
<location filename="mainwindow.cpp" line="468"/>
<source>no version available</source>
<translation></translation>
</message>
@ -339,7 +337,7 @@
<translation type="vanished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="480"/>
<location filename="mainwindow.cpp" line="499"/>
<source>Open File</source>
<translation></translation>
</message>
@ -348,9 +346,9 @@
<translation type="vanished">(* .zip)</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="568"/>
<location filename="mainwindow.cpp" line="588"/>
<location filename="mainwindow.cpp" line="609"/>
<location filename="mainwindow.cpp" line="587"/>
<location filename="mainwindow.cpp" line="607"/>
<location filename="mainwindow.cpp" line="628"/>
<source>device: %1 upgrade firmware success</source>
<translation>%1 </translation>
</message>
@ -363,18 +361,24 @@
<translation type="vanished">: %1, : %2, : %3</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="361"/>
<location filename="mainwindow.cpp" line="369"/>
<source>support</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="480"/>
<location filename="mainwindow.cpp" line="369"/>
<source>upgrade: %1</source>
<oldsource>upgrade: %2</oldsource>
<translation>: %1</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="499"/>
<source>ZIP Files(*.zip *.zip)</source>
<translation>(*.zip)</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="494"/>
<location filename="mainwindow.cpp" line="527"/>
<location filename="mainwindow.cpp" line="513"/>
<location filename="mainwindow.cpp" line="546"/>
<source>the selected firmware is not newer than the current version</source>
<translation></translation>
</message>
@ -383,7 +387,7 @@
<translation type="vanished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="505"/>
<location filename="mainwindow.cpp" line="524"/>
<source>firmware file mismatch, continue?</source>
<translation></translation>
</message>
@ -392,101 +396,110 @@
<translation type="vanished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="360"/>
<source>device: %1, upgrade: %2</source>
<translation>: %1, : %2</translation>
<translation type="vanished">: %1, : %2</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="362"/>
<location filename="mainwindow.cpp" line="370"/>
<source>FirmWare number: %1</source>
<translation>: %1</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="363"/>
<location filename="mainwindow.cpp" line="371"/>
<source>Serial number: %1</source>
<translation>: %1</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="364"/>
<location filename="mainwindow.cpp" line="372"/>
<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"/>
<location filename="mainwindow.cpp" line="414"/>
<source>Device is opened by other process</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="418"/>
<source>open device error</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="591"/>
<location filename="mainwindow.cpp" line="611"/>
<location filename="mainwindow.cpp" line="632"/>
<source>device: %1 upgrade firmware failed, io error</source>
<translation>%1 IO错误</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="577"/>
<location filename="mainwindow.cpp" line="596"/>
<source>download firmware fail</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="632"/>
<location filename="mainwindow.cpp" line="651"/>
<source>Roller scanned count has been set to 0.</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="636"/>
<location filename="mainwindow.cpp" line="655"/>
<source>Do not supported</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="639"/>
<location filename="mainwindow.cpp" line="658"/>
<source>Roller scanned count reset failed.</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="657"/>
<location filename="mainwindow.cpp" line="676"/>
<source>old password is wrong</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="664"/>
<location filename="mainwindow.cpp" line="683"/>
<source>new password can not be empty</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="671"/>
<location filename="mainwindow.cpp" line="690"/>
<source>new password is inconsistent</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="678"/>
<location filename="mainwindow.cpp" line="697"/>
<source>modify password fail</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="687"/>
<location filename="mainwindow.cpp" line="706"/>
<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"/>
<location filename="mainwindow.cpp" line="719"/>
<location filename="mainwindow.cpp" line="735"/>
<location filename="mainwindow.cpp" line="751"/>
<source>Prompt</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="700"/>
<location filename="mainwindow.cpp" line="719"/>
<source>Get failed</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="716"/>
<location filename="mainwindow.cpp" line="735"/>
<source>Set failed</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="732"/>
<location filename="mainwindow.cpp" line="751"/>
<source>Correct failed</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="737"/>
<location filename="mainwindow.cpp" line="756"/>
<source>Have already corrected</source>
<translation></translation>
</message>

View File

@ -11,6 +11,9 @@ LoginDialog::LoginDialog(const QString &account, const QString &password, QWidge
{
ui->setupUi(this);
setWindowFlags(Qt::WindowCloseButtonHint);
ui->editAccount->setEnabled(false);
ui->editAccount->setText(m_account);
ui->editPassword->setEchoMode(QLineEdit::EchoMode::Password);

View File

@ -65,10 +65,6 @@ int main(int argc, char *argv[])
if (translator_qt.load(":translation/qt_zh_CN.qm"))
a.installTranslator(&translator_qt);
MainWindow w;
QScreen *screen = QGuiApplication::primaryScreen();
w.move((screen->size().width() - w.width()) / 2, (screen->size().height() - w.height()) / 2);
HGChar cfgPath[256]= {0};
GetConfigPath(cfgPath, 256);
strcat(cfgPath, "config.ini");
@ -76,9 +72,13 @@ int main(int argc, char *argv[])
HGBase_GetProfileString(cfgPath, "login", "password", "", str, 256);
QString password = (0 == *str) ? "huagoscan" : MainWindow::passwordDecrypt(str);
LoginDialog login("admin", password, &w);
LoginDialog login("admin", password, nullptr);
if (login.exec())
{
MainWindow w;
QScreen *screen = QGuiApplication::primaryScreen();
w.move((screen->size().width() - w.width()) / 2, (screen->size().height() - w.height()) / 2);
w.show();
a.exec();
}

View File

@ -10,6 +10,7 @@
#include "dialog_updateprogress.h"
#include "base/HGBase.h"
#include "base/HGInc.h"
#include "huagao/hgscanner_error.h"
#include "sane/sane_option_definitions.h"
#include "HGString.h"
#include <algorithm>
@ -312,6 +313,8 @@ void MainWindow::on_comboDevList_currentIndexChanged(int index)
ui->editFilePath->clear();
ui->labelRollCount->setText("0");
ui->labelScanCount->setText("0");
ui->label_deviceError->clear();
ui->labelDevInfo->clear();
if (nullptr != m_curDevHandle)
{
@ -328,10 +331,18 @@ void MainWindow::on_comboDevList_currentIndexChanged(int index)
ui->btnUpgrade->setEnabled(false);
ui->btnClearRollCount->setEnabled(false);
ui->comboBox_colorMode->setEnabled(false);
ui->comboBox_dpi->setEnabled(false);
ui->pushButton_getDistortion->setEnabled(false);
ui->pushButton_setDistortion->setEnabled(false);
ui->lineEdit_distortion->setEnabled(false);
ui->pushButton_correct->setEnabled(false);
if (-1 != index)
{
QString name = ui->comboDevList->itemText(index);
if (SANE_STATUS_GOOD == sane_open(name.toStdString().c_str(), &m_curDevHandle))
SANE_Status ret = sane_open(name.toStdString().c_str(), &m_curDevHandle);
if (SANE_STATUS_GOOD == ret)
{
m_curDevName = name;
@ -357,8 +368,7 @@ void MainWindow::on_comboDevList_currentIndexChanged(int index)
m_curFwVersion = QString::fromStdString(fwVersionNum.c_str());
QString devType = GetDevType(m_curFwVersion, NULL);
ui->labelDevInfo->setText(QString(tr("device: %1, upgrade: %2")).arg(name)
.arg(!devType.isEmpty() ? tr("support") : tr("do not support")));
ui->labelDevInfo->setText(QString(tr("upgrade: %1")).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())));
@ -393,15 +403,26 @@ void MainWindow::on_comboDevList_currentIndexChanged(int index)
ui->btnOpenFilePath->setEnabled(true);
}
ui->btnClearRollCount->setEnabled(true);
ui->comboBox_colorMode->setEnabled(true);
ui->comboBox_dpi->setEnabled(true);
ui->pushButton_getDistortion->setEnabled(true);
ui->pushButton_setDistortion->setEnabled(true);
ui->lineEdit_distortion->setEnabled(true);
ui->pushButton_correct->setEnabled(true);
}
else if (SCANNER_ERR_OPENED_BY_OTHER_PROCESS == ret)
{
ui->label_deviceError->setText(QString(tr("Device is opened by other process")));
}
else
{
ui->labelDevInfo->setText(QString(tr("open device error: %1")).arg(name));
ui->label_deviceError->setText(QString(tr("open device error")));
}
}
else
{
ui->labelDevInfo->setText(tr("no device opened"));
ui->label_deviceError->setText(tr("no device opened"));
}
}

View File

@ -52,6 +52,13 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_deviceError">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
@ -70,30 +77,17 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>2</number>
<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>70</x>
<y>30</y>
<width>391</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>device information</string>
</property>
</widget>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>70</x>
<y>80</y>
<x>80</x>
<y>60</y>
<width>501</width>
<height>111</height>
</rect>
@ -154,8 +148,8 @@
<widget class="QGroupBox" name="groupBox_2">
<property name="geometry">
<rect>
<x>70</x>
<y>220</y>
<x>80</x>
<y>190</y>
<width>501</width>
<height>111</height>
</rect>
@ -213,6 +207,19 @@
</property>
</widget>
</widget>
<widget class="QLabel" name="labelDevInfo">
<property name="geometry">
<rect>
<x>80</x>
<y>10</y>
<width>108</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
@ -221,7 +228,7 @@
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>170</x>
<x>220</x>
<y>180</y>
<width>71</width>
<height>20</height>
@ -234,7 +241,7 @@
<widget class="QLabel" name="labelRollCount">
<property name="geometry">
<rect>
<x>240</x>
<x>310</x>
<y>180</y>
<width>81</width>
<height>21</height>
@ -247,7 +254,7 @@
<widget class="QLabel" name="labelScanCount">
<property name="geometry">
<rect>
<x>260</x>
<x>310</x>
<y>230</y>
<width>81</width>
<height>21</height>
@ -260,7 +267,7 @@
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>170</x>
<x>220</x>
<y>230</y>
<width>81</width>
<height>20</height>
@ -273,7 +280,7 @@
<widget class="QPushButton" name="btnClearRollCount">
<property name="geometry">
<rect>
<x>270</x>
<x>240</x>
<y>280</y>
<width>111</width>
<height>31</height>
@ -286,7 +293,7 @@
<widget class="QLabel" name="label_sn">
<property name="geometry">
<rect>
<x>170</x>
<x>220</x>
<y>30</y>
<width>321</width>
<height>16</height>
@ -299,7 +306,7 @@
<widget class="QLabel" name="label_fwNum">
<property name="geometry">
<rect>
<x>170</x>
<x>220</x>
<y>80</y>
<width>321</width>
<height>16</height>
@ -312,7 +319,7 @@
<widget class="QLabel" name="label_speedMode">
<property name="geometry">
<rect>
<x>170</x>
<x>220</x>
<y>130</y>
<width>321</width>
<height>16</height>