integration of the fuseNioAdapter, including all the gui (controller & fxml) and settings wiring. english localization fitted and enriched for fuse

This commit is contained in:
infeo
2018-02-03 17:26:59 +01:00
parent 39d1d9c561
commit d170e87c1b
14 changed files with 469 additions and 28 deletions
@@ -30,6 +30,8 @@ public class Settings {
public static final int DEFAULT_NUM_TRAY_NOTIFICATIONS = 3;
public static final String DEFAULT_GVFS_SCHEME = "dav";
public static final boolean DEFAULT_DEBUG_MODE = false;
public static final String DEFAULT_DEFAULT_MOUNT_DIR = System.getProperty("user.home");
public static final String DEFAULT_NIO_ADAPTER = "WEBDAV";
private final ObservableList<VaultSettings> directories = FXCollections.observableArrayList(VaultSettings::observables);
private final BooleanProperty checkForUpdates = new SimpleBooleanProperty(DEFAULT_CHECK_FOR_UDPATES);
@@ -37,6 +39,9 @@ public class Settings {
private final IntegerProperty numTrayNotifications = new SimpleIntegerProperty(DEFAULT_NUM_TRAY_NOTIFICATIONS);
private final StringProperty preferredGvfsScheme = new SimpleStringProperty(DEFAULT_GVFS_SCHEME);
private final BooleanProperty debugMode = new SimpleBooleanProperty(DEFAULT_DEBUG_MODE);
private final StringProperty nioAdapterImpl = new SimpleStringProperty(DEFAULT_NIO_ADAPTER);
private final StringProperty defaultMountDir = new SimpleStringProperty(DEFAULT_DEFAULT_MOUNT_DIR);
private Consumer<Settings> saveCmd;
/**
@@ -49,6 +54,8 @@ public class Settings {
numTrayNotifications.addListener(this::somethingChanged);
preferredGvfsScheme.addListener(this::somethingChanged);
debugMode.addListener(this::somethingChanged);
nioAdapterImpl.addListener(this::somethingChanged);
defaultMountDir.addListener(this::somethingChanged);
}
void setSaveCmd(Consumer<Settings> saveCmd) {
@@ -91,4 +98,11 @@ public class Settings {
return debugMode;
}
public StringProperty usedNioAdapterImpl() {
return nioAdapterImpl;
}
public StringProperty defaultMountDir() {
return defaultMountDir;
}
}
@@ -33,6 +33,8 @@ public class SettingsJsonAdapter extends TypeAdapter<Settings> {
out.name("numTrayNotifications").value(value.numTrayNotifications().get());
out.name("preferredGvfsScheme").value(value.preferredGvfsScheme().get());
out.name("debugMode").value(value.debugMode().get());
out.name("nioAdapterImpl").value(value.usedNioAdapterImpl().get());
out.name("defaultMountDir").value(value.defaultMountDir().get());
out.endObject();
}
@@ -70,6 +72,12 @@ public class SettingsJsonAdapter extends TypeAdapter<Settings> {
case "debugMode":
settings.debugMode().set(in.nextBoolean());
break;
case "nioAdapterImpl":
settings.usedNioAdapterImpl().set(in.nextString());
break;
case "defaultMountDir":
settings.defaultMountDir().set(in.nextString());
break;
default:
LOG.warn("Unsupported vault setting found in JSON: " + name);
in.skipValue();
@@ -36,6 +36,7 @@ public class VaultSettings {
private final BooleanProperty unlockAfterStartup = new SimpleBooleanProperty(DEFAULT_UNLOCK_AFTER_STARTUP);
private final BooleanProperty mountAfterUnlock = new SimpleBooleanProperty(DEFAULT_MOUNT_AFTER_UNLOCK);
private final BooleanProperty revealAfterMount = new SimpleBooleanProperty(DEFAULT_REAVEAL_AFTER_MOUNT);
private final StringProperty mountPath = new SimpleStringProperty(Settings.DEFAULT_DEFAULT_MOUNT_DIR);
public VaultSettings(String id) {
this.id = Objects.requireNonNull(id);
@@ -123,6 +124,10 @@ public class VaultSettings {
return revealAfterMount;
}
public StringProperty mountPath() {
return mountPath;
}
/* Hashcode/Equals */
@Override
@@ -34,6 +34,7 @@ class VaultSettingsJsonAdapter {
String id = null;
String path = null;
String mountName = null;
String mountPath = null;
String winDriveLetter = null;
boolean unlockAfterStartup = VaultSettings.DEFAULT_UNLOCK_AFTER_STARTUP;
boolean mountAfterUnlock = VaultSettings.DEFAULT_MOUNT_AFTER_UNLOCK;
@@ -64,6 +65,8 @@ class VaultSettingsJsonAdapter {
case "revealAfterMount":
revealAfterMount = in.nextBoolean();
break;
case "mountPath":
mountPath = in.nextString();
default:
LOG.warn("Unsupported vault setting found in JSON: " + name);
in.skipValue();
@@ -78,6 +81,7 @@ class VaultSettingsJsonAdapter {
vaultSettings.unlockAfterStartup().set(unlockAfterStartup);
vaultSettings.mountAfterUnlock().set(mountAfterUnlock);
vaultSettings.revealAfterMount().set(revealAfterMount);
vaultSettings.mountPath().set(mountPath);
return vaultSettings;
}