From 2144172c7b961d4112850692ed77b46f1ae5d373 Mon Sep 17 00:00:00 2001
From: 张世豪 <979909237@qq.com>
Date: 星期五, 05 十二月 2025 19:34:53 +0800
Subject: [PATCH] 20251205
---
src/set/Sets.java | 79 +++++++++++++++++++++++++++++++++++++++
1 files changed, 79 insertions(+), 0 deletions(-)
diff --git a/src/set/Sets.java b/src/set/Sets.java
index 30829bd..224795f 100644
--- a/src/set/Sets.java
+++ b/src/set/Sets.java
@@ -2,6 +2,9 @@
import baseStation.BaseStation;
+import zhuye.MapRenderer;
+import zhuye.Shouye;
+
import javax.swing.*;
import javax.swing.filechooser.FileNameExtensionFilter;
@@ -32,12 +35,14 @@
private JLabel baseStationSimLabel;
private JLabel firmwareVersionLabel;
private JLabel appVersionLabel;
+ private JLabel idleTrailDurationLabel;
private JButton mowerIdEditBtn;
private JButton handheldEditBtn;
private JButton checkUpdateBtn;
private JButton systemDebugButton;
private JButton feedbackButton;
+ private JButton idleTrailEditBtn;
// 鏁版嵁妯″瀷
private Setsys setData;
@@ -120,6 +125,11 @@
setData.getFirmwareVersion() != null ? setData.getFirmwareVersion() : "鏈缃�", false);
firmwareVersionLabel = (JLabel) firmwarePanel.getClientProperty("valueLabel");
+ JPanel idleTrailPanel = createSettingItemPanel("杞ㄨ抗鎷栧熬鏃堕暱",
+ formatIdleTrailDurationValue(), true);
+ idleTrailDurationLabel = (JLabel) idleTrailPanel.getClientProperty("valueLabel");
+ idleTrailEditBtn = (JButton) idleTrailPanel.getClientProperty("editButton");
+
JPanel feedbackPanel = createFeedbackPanel();
// APP鐗堟湰
@@ -130,6 +140,7 @@
addRowWithSpacing(panel, simCardPanel);
addRowWithSpacing(panel, baseStationSimPanel);
addRowWithSpacing(panel, firmwarePanel);
+ addRowWithSpacing(panel, idleTrailPanel);
addRowWithSpacing(panel, feedbackPanel);
addRowWithSpacing(panel, appVersionPanel);
panel.add(createDebugPanel());
@@ -137,6 +148,14 @@
return panel;
}
+ private String formatIdleTrailDurationValue() {
+ int seconds = setData != null ? setData.getIdleTrailDurationSeconds() : Setsys.DEFAULT_IDLE_TRAIL_DURATION_SECONDS;
+ if (seconds <= 0) {
+ seconds = Setsys.DEFAULT_IDLE_TRAIL_DURATION_SECONDS;
+ }
+ return seconds + "绉�";
+ }
+
private void addRowWithSpacing(JPanel container, JPanel row) {
container.add(row);
container.add(Box.createRigidArea(new Dimension(0, ROW_SPACING)));
@@ -432,6 +451,10 @@
firmwareVersionLabel.setText(setData.getFirmwareVersion() != null ?
setData.getFirmwareVersion() : "鏈缃�");
}
+
+ if (idleTrailDurationLabel != null) {
+ idleTrailDurationLabel.setText(formatIdleTrailDurationValue());
+ }
// 鏇存柊APP鐗堟湰鏄剧ず
if (appVersionLabel != null) {
@@ -477,6 +500,10 @@
if (systemDebugButton != null) {
systemDebugButton.addActionListener(e -> openSystemDebugDialog());
}
+
+ if (idleTrailEditBtn != null) {
+ idleTrailEditBtn.addActionListener(e -> editIdleTrailDuration());
+ }
}
@@ -532,6 +559,58 @@
}
}
+ private void editIdleTrailDuration() {
+ int currentSeconds = setData != null ? setData.getIdleTrailDurationSeconds() : Setsys.DEFAULT_IDLE_TRAIL_DURATION_SECONDS;
+ if (currentSeconds <= 0) {
+ currentSeconds = Setsys.DEFAULT_IDLE_TRAIL_DURATION_SECONDS;
+ }
+
+ String input = JOptionPane.showInputDialog(this,
+ "璇疯緭鍏ヨ建杩规嫋灏炬椂闀匡紙鍗曚綅锛氱锛�",
+ currentSeconds);
+
+ if (input == null) {
+ return;
+ }
+
+ String trimmed = input.trim();
+ if (trimmed.isEmpty()) {
+ JOptionPane.showMessageDialog(this, "杞ㄨ抗鎷栧熬鏃堕暱涓嶈兘涓虹┖", "鎻愮ず", JOptionPane.WARNING_MESSAGE);
+ return;
+ }
+
+ int parsedSeconds;
+ try {
+ parsedSeconds = Integer.parseInt(trimmed);
+ } catch (NumberFormatException ex) {
+ JOptionPane.showMessageDialog(this, "璇疯緭鍏ユ湁鏁堢殑鏁存暟绉掓暟", "鎻愮ず", JOptionPane.WARNING_MESSAGE);
+ return;
+ }
+
+ if (parsedSeconds < 5 || parsedSeconds > 600) {
+ JOptionPane.showMessageDialog(this, "璇疯緭鍏�5鍒�600涔嬮棿鐨勭鏁�", "鎻愮ず", JOptionPane.WARNING_MESSAGE);
+ return;
+ }
+
+ if (setData.updateProperty("idleTrailDurationSeconds", String.valueOf(parsedSeconds))) {
+ int appliedSeconds = setData.getIdleTrailDurationSeconds();
+ if (idleTrailDurationLabel != null) {
+ idleTrailDurationLabel.setText(appliedSeconds + "绉�");
+ }
+ MapRenderer renderer = null;
+ Shouye shouye = Shouye.getInstance();
+ if (shouye != null) {
+ renderer = shouye.getMapRenderer();
+ }
+ if (renderer != null) {
+ renderer.setIdleTrailDurationSeconds(appliedSeconds);
+ }
+ JOptionPane.showMessageDialog(this, "杞ㄨ抗鎷栧熬鏃堕暱宸叉洿鏂颁负 " + appliedSeconds + " 绉�", "鎴愬姛", JOptionPane.INFORMATION_MESSAGE);
+ } else {
+ JOptionPane.showMessageDialog(this, "杞ㄨ抗鎷栧熬鏃堕暱鏇存柊澶辫触", "閿欒", JOptionPane.ERROR_MESSAGE);
+ }
+ }
+
private void showFeedbackDialog() {
JDialog dialog = new JDialog(this, "闂鍙嶉鍜ㄨ", true);
dialog.setLayout(new BorderLayout(0, 12));
--
Gitblit v1.10.0