From c1b754c12ac32ed38a561d8b35dcbdf82beea896 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 23 Aug 2020 10:53:25 -0700 Subject: [PATCH] altosui: Improve configuration save feedback Mark window title as (modified) with any unsaved changes. Disable the 'Save' button while the save is happening. Wait for the re-load of configuration values before clearing the '(modified)' state. This lets you see when the flight computer has accepted the updated values. Signed-off-by: Keith Packard --- altosui/AltosConfigFCUI.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/altosui/AltosConfigFCUI.java b/altosui/AltosConfigFCUI.java index 5143b837..5ccb1077 100644 --- a/altosui/AltosConfigFCUI.java +++ b/altosui/AltosConfigFCUI.java @@ -97,6 +97,8 @@ public class AltosConfigFCUI ActionListener listener; + static final String title = "Configure Flight Computer"; + static String[] main_deploy_values_m = { "100", "150", "200", "250", "300", "350", "400", "450", "500" @@ -346,7 +348,7 @@ public class AltosConfigFCUI /* Build the UI using a grid bag */ public AltosConfigFCUI(JFrame in_owner, boolean remote) { - super (in_owner, "Configure Flight Computer", false); + super (in_owner, title, false); owner = in_owner; GridBagConstraints c; @@ -1044,11 +1046,13 @@ public class AltosConfigFCUI public void set_dirty() { dirty = true; + setTitle(title + " (modified)"); save.setEnabled(true); } public void set_clean() { dirty = false; + setTitle(title); save.setEnabled(false); } @@ -1076,13 +1080,13 @@ public class AltosConfigFCUI if (cmd.equals("Close") || cmd.equals("Reboot")) if (!check_dirty(cmd)) return; + if (cmd.equals("Save")) + save.setEnabled(false); listener.actionPerformed(e); if (cmd.equals("Close") || cmd.equals("Reboot")) { setVisible(false); dispose(); } - if (cmd.equals("Save") || cmd.equals("Reset")) - set_clean(); } /* ItemListener interface method */ -- 2.30.2