From: xue <2144439972@qq.com> Date: Sat, 25 Apr 2026 08:42:53 +0000 (+0800) Subject: 优化界面逻辑 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=refs%2Fheads%2F272_FACTORY_TOOL;p=mirrors%2Ffactory_tool.git 优化界面逻辑 --- diff --git a/mainwindow.cpp b/mainwindow.cpp index 29965f2..9cf49f8 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -160,6 +160,13 @@ MainWindow::MainWindow(QWidget *parent) connect(bluetoothTestTimer, &QTimer::timeout, this, &MainWindow::onBluetoothTestTimer); connect(gpsTestTimer, &QTimer::timeout, this, &MainWindow::onGpsTestTimer); connect(gpsPollTimer, &QTimer::timeout, this, &MainWindow::onGpsPollTimer); + + connect(ui->testParamsToggleButton, &QPushButton::toggled, this, [this](bool checked) { + ui->testParamsDetailWidget->setVisible(checked); + ui->testParamsToggleButton->setText(checked ? QStringLiteral("隐藏参数") + : QStringLiteral("显示参数")); + }); + // 初始化G-sensor采集状态 gSensorCollecting = false; gSensorHasStart = false; @@ -4313,56 +4320,6 @@ void MainWindow::clearProductionTestState() qDebug() << "产测状态清空完成"; } -void MainWindow::on_agingTestButton_clicked() -{ - // 清空文本框内容 - ui->recvTextEdit->clear(); // 清空串口接收文本框 - ui->sendTextEdit->clear(); // 清空发送文本框 - ui->statusbar->clearMessage(); // 清空状态栏 - - // 清空设备信息 - ui->VerlineEdit->clear(); // 清空版本信息 - - // 重置弹窗状态 - lcdTestPopupShown = false; - motorTestPopupShown = false; - touchTestPopupShown = false; - brightTestPopupShown = false; - deepsleepTestPopupShown = false; - isWaitingForUserConfirm = false; - keyTestStarted = false; - - // 不清除状态指示器,保留上次测试结果供查看 - // 用户可以一边查看测试结果,一边执行老化测试 - - serial->write("AT^FACTORY=2\r\n"); -} - -void MainWindow::on_agingTestButton_2_clicked() -{ - // 清空文本框内容 - ui->recvTextEdit->clear(); // 清空串口接收文本框 - ui->sendTextEdit->clear(); // 清空发送文本框 - ui->statusbar->clearMessage(); // 清空状态栏 - - // 清空设备信息 - ui->VerlineEdit->clear(); // 清空版本信息 - - // 重置弹窗状态 - lcdTestPopupShown = false; - motorTestPopupShown = false; - touchTestPopupShown = false; - brightTestPopupShown = false; - deepsleepTestPopupShown = false; - isWaitingForUserConfirm = false; - keyTestStarted = false; - - // 不清除状态指示器,保留上次测试结果供查看 - // 用户可以一边查看测试结果,一边执行恢复出厂操作 - - serial->write("AT^RESTORE\r\n"); -} - void MainWindow::on_openButton_3_clicked() { // 清空文本框内容 @@ -4524,20 +4481,6 @@ void MainWindow::on_getVersionInfoButton_clicked() startVersionInfoFetch(); } -// 原「压力测试」按钮:发送关机指令 AT^POWEROFF -void MainWindow::on_pushButtonStressTest_clicked() -{ - if (!serial || !serial->isOpen()) { - QMessageBox::warning(this, "关机", "请先打开串口后再发送关机指令"); - return; - } - ui->recvTextEdit->append(">>> 发送指令: AT^POWEROFF (手动关机)"); - serial->write("AT^POWEROFF\r\n"); - qDebug() << "手动发送关机指令: AT^POWEROFF"; - ui->statusbar->showMessage("已发送关机指令 AT^POWEROFF", 3000); - appendToLogFile("=== 发送关机指令: AT^POWEROFF ===\n"); -} - // 保存测试参数到settings.json void MainWindow::saveTestConfigToSettings() { diff --git a/mainwindow.h b/mainwindow.h index 9c67733..a8d1ab7 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -116,17 +116,10 @@ private slots: void parseWstpPrintData(const QString& data); // 解析wstp_print格式的BTMAC和CyweeChipInfo数据 - void on_agingTestButton_clicked(); - - void on_agingTestButton_2_clicked(); - void on_openButton_3_clicked(); // 版本信息获取按钮 void on_getVersionInfoButton_clicked(); - - // 关机按钮(界面原「压力测试」槽名未改,避免破坏 uic 自动连接) - void on_pushButtonStressTest_clicked(); private: Ui::MainWindow *ui; diff --git a/mainwindow.ui b/mainwindow.ui index 2381a98..90107d3 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -45,106 +45,21 @@ 6 - - - - Qt::Horizontal - - - - - - - - - - Arial Black - 75 - true - - - - 老化测试: - - - - - - - false - - - QPushButton { -background-color: #C62828; -color: white; -border-radius: 4px; -font-weight: bold; -} -QPushButton:hover { -background-color: #B71C1C; -} - - - 关机 - - - - - - - - Agra - 14 - - - - 老化结果 - - - - - - - - Agra - 14 - 75 - true - - - - QPushButton { -background-color: #9C27B0; -color: white; -border-radius: 4px; -font-weight: bold; -} -QPushButton:hover { -background-color: #7B1FA2; -} - - - 老化测试 - - - - - - - + + - Agra + Arial 14 - - 清空数据 + + QComboBox::AdjustToContentsOnFirstShow - - + + Agra @@ -152,7 +67,7 @@ background-color: #7B1FA2; - 获取设备信息 + 打开串口 @@ -169,34 +84,21 @@ background-color: #7B1FA2; - - + + Agra 14 - 75 - true - - QPushButton { -background-color: #9C27B0; -color: white; -border-radius: 4px; -font-weight: bold; -} -QPushButton:hover { -background-color: #7B1FA2; -} - - 恢复出厂 + 清空数据 - - + + Agra @@ -204,31 +106,11 @@ background-color: #7B1FA2; - 打开串口 - - - - - - - - Arial - 14 - - - - QComboBox::AdjustToContentsOnFirstShow - - - - - - - Qt::Horizontal + 获取设备信息 - + @@ -244,6 +126,8 @@ background-color: #FF9800; color: white; border-radius: 4px; font-weight: bold; +padding: 10px 12px; +min-height: 48px; } QPushButton:hover { background-color: #F57C00; @@ -266,21 +150,65 @@ background-color: #F57C00; - - - - Arial Black - 75 - true - - - - 测试参数及通过标准: + + + 6 - + + + + + Arial Black + 75 + true + + + + + 1 + 0 + + + + 测试参数及通过标准: + + + + + + + 隐藏参数 + + + true + + + true + + + + - + + + + 6 + + + 0 + + + 0 + + + 0 + + + 0 + + + 录音音量: @@ -319,19 +247,17 @@ background-color: #F57C00; - - - - - - Qt::Horizontal - - - - - - + + + Qt::Horizontal + + + + + + + 目标固件版本: @@ -625,6 +551,11 @@ background-color: #F57C00; + + + + +