summaryrefslogtreecommitdiff
path: root/ao-tools/altosui/AltosPreferences.java
diff options
context:
space:
mode:
Diffstat (limited to 'ao-tools/altosui/AltosPreferences.java')
-rw-r--r--ao-tools/altosui/AltosPreferences.java40
1 files changed, 40 insertions, 0 deletions
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;
+ }
}