X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=ao-tools%2Faltosui%2FAltosPreferences.java;h=297e1aae77ba0819a71af5ef53718a648cf2f727;hp=0296d9355db7a2086ade1aa97ce737c028ed58d2;hb=71da54a5ce255395376a44586782ab8b6f3b289f;hpb=e76b9cc32bbcc5176d9bdd6f8d79778024627382 diff --git a/ao-tools/altosui/AltosPreferences.java b/ao-tools/altosui/AltosPreferences.java index 0296d935..297e1aae 100644 --- a/ao-tools/altosui/AltosPreferences.java +++ b/ao-tools/altosui/AltosPreferences.java @@ -31,6 +31,12 @@ class AltosPreferences { /* logdir preference name */ final static String logdirPreference = "LOGDIR"; + /* channel preference name */ + final static String channelPreference = "CHANNEL"; + + /* voice preference name */ + final static String voicePreference = "VOICE"; + /* Default logdir is ~/TeleMetrum */ final static String logdirName = "TeleMetrum"; @@ -40,6 +46,12 @@ class AltosPreferences { /* Log directory */ static File logdir; + /* Telemetry channel */ + static int channel; + + /* Voice preference */ + static boolean voice; + public static void init(Component ui) { preferences = Preferences.userRoot().node("/org/altusmetrum/altosui"); @@ -55,6 +67,10 @@ class AltosPreferences { if (!logdir.exists()) logdir.mkdirs(); } + + channel = preferences.getInt(channelPreference, 0); + + voice = preferences.getBoolean(voicePreference, true); } static void flush_preferences() { @@ -114,4 +130,28 @@ class AltosPreferences { public static File logdir() { return logdir; } + + public static void set_channel(int new_channel) { + channel = new_channel; + synchronized (preferences) { + preferences.putInt(channelPreference, channel); + flush_preferences(); + } + } + + public static int channel() { + return channel; + } + + public static void set_voice(boolean new_voice) { + voice = new_voice; + synchronized (preferences) { + preferences.putBoolean(voicePreference, voice); + flush_preferences(); + } + } + + public static boolean voice() { + return voice; + } }