X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=ao-tools%2Faltosui%2FAltosPreferences.java;h=526275635ff07b90960aa3bd74aeaa8e402a5f13;hb=c89a34d1eb25155405b0036baeadc7bbfeade1c2;hp=690f8f1ed5e60eff6e2f858147d7c66fc5ae4e8f;hpb=e1463d8e265dfd42c824d90088cd2a51b4cf8131;p=fw%2Faltos diff --git a/ao-tools/altosui/AltosPreferences.java b/ao-tools/altosui/AltosPreferences.java index 690f8f1e..52627563 100644 --- a/ao-tools/altosui/AltosPreferences.java +++ b/ao-tools/altosui/AltosPreferences.java @@ -40,6 +40,9 @@ class AltosPreferences { /* callsign preference name */ final static String callsignPreference = "CALLSIGN"; + /* firmware directory preference name */ + final static String firmwaredirPreference = "FIRMWARE"; + /* Default logdir is ~/TeleMetrum */ final static String logdirName = "TeleMetrum"; @@ -55,8 +58,12 @@ class AltosPreferences { /* Voice preference */ static boolean voice; + /* Callsign preference */ static String callsign; + /* Firmware directory */ + static File firmwaredir; + public static void init(Component ui) { preferences = Preferences.userRoot().node("/org/altusmetrum/altosui"); @@ -78,6 +85,12 @@ class AltosPreferences { voice = preferences.getBoolean(voicePreference, true); callsign = preferences.get(callsignPreference,"N0CALL"); + + String firmwaredir_string = preferences.get(firmwaredirPreference, null); + if (firmwaredir_string != null) + firmwaredir = new File(firmwaredir_string); + else + firmwaredir = null; } static void flush_preferences() { @@ -173,4 +186,16 @@ class AltosPreferences { public static String callsign() { return callsign; } + + public static void set_firmwaredir(File new_firmwaredir) { + firmwaredir = new_firmwaredir; + synchronized (preferences) { + preferences.put(firmwaredirPreference, firmwaredir.getPath()); + flush_preferences(); + } + } + + public static File firmwaredir() { + return firmwaredir; + } }