微调界面和翻译,暂时json不生成分辨率等特殊key值

This commit is contained in:
yangjiaxuan 2024-03-05 15:24:42 +08:00
parent 416d5d5262
commit 632607bdf5
6 changed files with 136 additions and 66 deletions

View File

@ -19,6 +19,47 @@ TARGET = HGPdtJsonTool
RC_ICONS = image_rsc/logo/logo.ico
CONFIG(debug, debug|release) {
MY_CONFIGURE = Debug
}
CONFIG(release, debug|release) {
MY_CONFIGURE = Release
}
MY_OS = windows
OEM_NAME = huagao
OEM_PREFIX = HG
win32 {
contains(QT_ARCH, i386) {
MY_ARCH = x86
}
contains(QT_ARCH, x86_64) {
MY_ARCH = x64
}
}
DESTDIR = $$PWD/../../../code_app/build2/build/$${MY_OS}/$${OEM_NAME}/$${MY_ARCH}/$${MY_CONFIGURE}
win32 {
CONFIG(release, debug|release) {
DESTEXE_PATH = $${PWD}/../../../release/win/$${MY_ARCH}/$${MY_CONFIGURE}/
DESTEXE_PATH = $$replace(DESTEXE_PATH, /, \\)
message(DESTEXE_PATH: $$DESTEXE_PATH)
SRCEXE_FILE = $${DESTDIR}/$${TARGET}.exe
SRCEXE_FILE = $$replace(SRCEXE_FILE, /, \\)
message(SRCEXE_FILE: $$SRCEXE_FILE)
SRCPDB_FILE = $${DESTDIR}/$${TARGET}.pdb
SRCPDB_FILE = $$replace(SRCPDB_FILE, /, \\)
message(SRCPDB_FILE: $$SRCPDB_FILE)
QMAKE_POST_LINK += xcopy /y $$SRCEXE_FILE $$DESTEXE_PATH && xcopy /y $$SRCPDB_FILE $$DESTEXE_PATH
}
}
SOURCES += \
main.cpp \
mainwindow.cpp \
@ -39,8 +80,3 @@ TRANSLATIONS += \
DISTFILES += \
HGPdtJsonTool_zh_CN.qm
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

View File

@ -101,7 +101,7 @@
<message>
<location filename="mainwindow.ui" line="421"/>
<source>Delete</source>
<translation></translation>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="434"/>
@ -229,7 +229,7 @@
<message>
<location filename="mainwindow.cpp" line="52"/>
<source>Fill in hexadecimal format, such as &apos;0xFFFF&apos;</source>
<translation>160xFFFF</translation>
<translation>0xFFFF</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="66"/>

View File

@ -52,6 +52,8 @@ void MainWindow::initDeviceInfo()
QString prompt(tr("Fill in hexadecimal format, such as '0xFFFF'"));
ui->lineEdit_vid->setToolTip(prompt);
ui->lineEdit_pid->setToolTip(prompt);
ui->lineEdit_vid->setPlaceholderText(prompt);
ui->lineEdit_pid->setPlaceholderText(prompt);
}
void MainWindow::initTableWidgetUi()
@ -108,11 +110,13 @@ void MainWindow::on_pushButton_generate_clicked()
globalObject.insert("pid-to", ui->lineEdit_pid->text().toInt(&ok, 16));
globalObject.insert("sleep-time", sleepTime[ui->comboBox_sleepTime->currentIndex()]);
globalObject.insert("speed-mode", ui->comboBox_speedMode->currentText().toInt());
globalObject.insert("device-model", ui->lineEdit_deviceModle->text());
globalObject.insert("cpu-size", ui->lineEdit_cpuSize->text().toInt());
globalObject.insert("disk-size", ui->lineEdit_diskSize->text().toInt());
globalObject.insert("firmware-version", ui->lineEdit_fwVersion->text());
globalObject.insert("lock-device", ui->comboBox_lockDevice->currentIndex() == 0 ? false : true);
if (!ui->lineEdit_deviceModle->text().isEmpty())
globalObject.insert("device-model", ui->lineEdit_deviceModle->text());
if (!ui->lineEdit_fwVersion->text().isEmpty())
globalObject.insert("firmware-version", ui->lineEdit_fwVersion->text());
QJsonObject json;
json.insert("global", QJsonValue(globalObject));
@ -133,6 +137,9 @@ void MainWindow::on_pushButton_generate_clicked()
doc.setObject(json);
QString fileName = QFileDialog::getSaveFileName(this, tr("Select profile path"), "", tr("Json(*.json)"));
if (fileName.isEmpty())
return;
if (!fileName.endsWith(".json"))
fileName.append(".json");
@ -264,7 +271,7 @@ void MainWindow::on_pushButton_import_clicked()
ui->tableWidget->setItem(i, 4, new QTableWidgetItem(node.station));
ui->tableWidget->item(i, 4)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
ui->tableWidget->setItem(i, 5, new QTableWidgetItem(node.is_man ? tr("automatic testing") : tr("Manual testing")));
ui->tableWidget->setItem(i, 5, new QTableWidgetItem(node.is_man ? tr("Manual testing") : tr("automatic testing")));
ui->tableWidget->item(i, 5)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
ui->tableWidget->setItem(i, 6, new QTableWidgetItem(node.desc));
@ -284,7 +291,10 @@ void MainWindow::on_pushButton_delete_clicked()
if (item != nullptr)
{
if (item->checkState() == Qt::Checked)
ui->tableWidget->removeRow(i);
{
ui->tableWidget->removeRow(item->row());
i = 0;
}
}
}
updateTableWidget();

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>965</width>
<height>752</height>
<width>988</width>
<height>758</height>
</rect>
</property>
<property name="windowTitle">
@ -17,7 +17,7 @@
<widget class="QLineEdit" name="lineEdit_pid">
<property name="geometry">
<rect>
<x>720</x>
<x>740</x>
<y>30</y>
<width>161</width>
<height>20</height>
@ -37,9 +37,9 @@
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>680</x>
<x>690</x>
<y>30</y>
<width>51</width>
<width>41</width>
<height>21</height>
</rect>
</property>
@ -83,7 +83,7 @@
<widget class="QLabel" name="label_15">
<property name="geometry">
<rect>
<x>20</x>
<x>50</x>
<y>140</y>
<width>101</width>
<height>21</height>
@ -96,9 +96,9 @@
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>360</x>
<x>400</x>
<y>30</y>
<width>54</width>
<width>41</width>
<height>21</height>
</rect>
</property>
@ -122,7 +122,7 @@
<widget class="QLineEdit" name="lineEdit_deviceModle">
<property name="geometry">
<rect>
<x>720</x>
<x>740</x>
<y>90</y>
<width>161</width>
<height>20</height>
@ -132,9 +132,9 @@
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>630</x>
<x>660</x>
<y>90</y>
<width>91</width>
<width>81</width>
<height>16</height>
</rect>
</property>
@ -145,10 +145,10 @@
<widget class="QLabel" name="label_7">
<property name="geometry">
<rect>
<x>350</x>
<x>340</x>
<y>140</y>
<width>81</width>
<height>16</height>
<width>91</width>
<height>20</height>
</rect>
</property>
<property name="text">
@ -158,7 +158,7 @@
<widget class="QLineEdit" name="lineEdit_cpuSize">
<property name="geometry">
<rect>
<x>720</x>
<x>740</x>
<y>140</y>
<width>161</width>
<height>20</height>
@ -168,7 +168,7 @@
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>30</x>
<x>20</x>
<y>90</y>
<width>101</width>
<height>21</height>
@ -191,10 +191,10 @@
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>350</x>
<x>370</x>
<y>90</y>
<width>81</width>
<height>16</height>
<width>71</width>
<height>21</height>
</rect>
</property>
<property name="text">
@ -216,8 +216,8 @@
<rect>
<x>640</x>
<y>140</y>
<width>71</width>
<height>16</height>
<width>91</width>
<height>20</height>
</rect>
</property>
<property name="text">
@ -247,10 +247,10 @@
<widget class="QLabel" name="label_9">
<property name="geometry">
<rect>
<x>50</x>
<x>60</x>
<y>190</y>
<width>71</width>
<height>16</height>
<height>21</height>
</rect>
</property>
<property name="text">
@ -260,10 +260,10 @@
<widget class="QLabel" name="label_10">
<property name="geometry">
<rect>
<x>350</x>
<x>360</x>
<y>190</y>
<width>71</width>
<height>16</height>
<height>21</height>
</rect>
</property>
<property name="text">
@ -283,7 +283,7 @@
<widget class="QLabel" name="label_11">
<property name="geometry">
<rect>
<x>640</x>
<x>660</x>
<y>190</y>
<width>71</width>
<height>16</height>
@ -296,7 +296,7 @@
<widget class="QLineEdit" name="lineEdit_testItem">
<property name="geometry">
<rect>
<x>720</x>
<x>740</x>
<y>190</y>
<width>161</width>
<height>20</height>
@ -329,10 +329,10 @@
<widget class="QLabel" name="label_13">
<property name="geometry">
<rect>
<x>350</x>
<x>360</x>
<y>250</y>
<width>71</width>
<height>16</height>
<height>21</height>
</rect>
</property>
<property name="text">
@ -365,7 +365,7 @@
<widget class="QLabel" name="label_12">
<property name="geometry">
<rect>
<x>630</x>
<x>660</x>
<y>250</y>
<width>81</width>
<height>21</height>
@ -378,9 +378,9 @@
<widget class="QTextEdit" name="textEdit_testContent">
<property name="geometry">
<rect>
<x>720</x>
<x>740</x>
<y>230</y>
<width>231</width>
<width>221</width>
<height>71</height>
</rect>
</property>
@ -408,31 +408,44 @@
<string>Import</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_delete">
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>150</x>
<x>20</x>
<y>670</y>
<width>141</width>
<height>31</height>
<width>531</width>
<height>41</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="checkBox_selectAll">
<property name="text">
<string>SelectAll</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_delete">
<property name="text">
<string>Delete</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_selectAll">
<property name="geometry">
<rect>
<x>40</x>
<y>680</y>
<width>91</width>
<height>16</height>
</rect>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="text">
<string>SelectAll</string>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
<widget class="QMenuBar" name="menubar">
@ -440,7 +453,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>965</width>
<width>988</width>
<height>22</height>
</rect>
</property>

View File

@ -833,8 +833,19 @@ void Form_mainInterface::on_pbtn_start_clicked()
{
QString title = item->text();
QString name = m_map_title_name.value(title).name;
int correct_value = m_map_title_name.value(title).correct_value;
int dpi = m_map_title_name.value(title).resolution;
int dpi = 0;
if (title == "扫描图像彩色质量确认_200dpi" || title == "扫描图像灰度质量确认_200dpi" || title == "计算畸变修正值_200dpi" || title == "设置畸变修正值_200dpi")
dpi = 200;
else if (title == "扫描图像彩色质量确认_300dpi" || title == "扫描图像灰度质量确认_300dpi" || title == "计算畸变修正值_300dpi" || title == "设置畸变修正值_300dpi")
dpi = 300;
else if (title == "扫描图像彩色质量确认_600dpi" || title == "扫描图像灰度质量确认_600dpi" || title == "计算畸变修正值_600dpi" || title == "设置畸变修正值_600dpi")
dpi = 600;
int correct_value = -1;
if (name == "AUTO_FLAT_FIELD")
correct_value = 0;
wchar_t buf[5] = {0};
if (dpi > 0)
{