1
0
Fork 0
mirror of https://gitlab.com/kauron/jstudy synced 2024-12-22 08:23:33 +01:00

Settings: moved preference to package

This commit is contained in:
Carlos Galindo 2019-09-10 19:21:56 +02:00
parent dd50ffdcff
commit 3d41dbf779
Signed by: kauron
GPG key ID: 83E68706DEE119A3

View file

@ -1,5 +1,6 @@
package es.kauron.jstudy.model;
import es.kauron.jstudy.Main;
import javafx.beans.property.SimpleBooleanProperty;
import java.io.File;
@ -7,7 +8,7 @@ import java.util.prefs.BackingStoreException;
import java.util.prefs.Preferences;
public class AppPrefs {
private static final Preferences prefs = Preferences.userRoot();
private static final Preferences prefs = Preferences.userNodeForPackage(Main.class);
public static final BooleanPref repeatWrong = new BooleanPref(false, "repeatWrong");
public static final BooleanPref showFeedback = new BooleanPref(true, "showFeedback");
public static final BooleanPref repeatImmediately = new BooleanPref(false, "repeatImmediately");
@ -28,15 +29,10 @@ public class AppPrefs {
}
public static void save() {
Preferences prefs = Preferences.userRoot();
prefs.put("lastDir", lastDir == null ? "" : lastDir.getAbsolutePath());
flushPrefs();
}
public static String printValues() {
return String.format("repeatWrong=%b\nshowFeedback=%b", repeatWrong, showFeedback);
}
public static class BooleanPref extends SimpleBooleanProperty {
private final String name;