mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-04-20 09:36:55 -04:00
Added controls to preferences screen
This commit is contained in:
@@ -1,27 +1,24 @@
|
||||
package org.cryptomator.ui.mainwindow;
|
||||
|
||||
import javafx.beans.property.ObjectProperty;
|
||||
import javafx.beans.property.ReadOnlyObjectProperty;
|
||||
import org.cryptomator.ui.FxApplicationScoped;
|
||||
import org.cryptomator.ui.FxController;
|
||||
import org.cryptomator.ui.model.Vault;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@FxApplicationScoped
|
||||
public class VaultDetailController implements FxController {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(VaultDetailController.class);
|
||||
|
||||
private final ObjectProperty<Vault> vault;
|
||||
|
||||
private final ReadOnlyObjectProperty<Vault> vault;
|
||||
|
||||
@Inject
|
||||
VaultDetailController(ObjectProperty<Vault> vault) {
|
||||
this.vault = vault;
|
||||
}
|
||||
|
||||
public ObjectProperty<Vault> vaultProperty() {
|
||||
public ReadOnlyObjectProperty<Vault> vaultProperty() {
|
||||
return vault;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,22 +4,17 @@ import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.property.ObjectProperty;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.ListView;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import org.cryptomator.ui.FxApplicationScoped;
|
||||
import org.cryptomator.ui.FxController;
|
||||
import org.cryptomator.ui.model.Vault;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@FxApplicationScoped
|
||||
public class VaultListController implements FxController {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(VaultListController.class);
|
||||
|
||||
private final ObservableList<Vault> vaults;
|
||||
private final ObjectProperty<Vault> selectedVault;
|
||||
public ListView vaultList;
|
||||
@@ -31,9 +26,7 @@ public class VaultListController implements FxController {
|
||||
this.selectedVault = selectedVault;
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void initialize() {
|
||||
LOG.debug("init VaultListController");
|
||||
onboardingOverlay.visibleProperty().bind(Bindings.isEmpty(vaults));
|
||||
vaultList.setItems(vaults);
|
||||
selectedVault.bind(vaultList.getSelectionModel().selectedItemProperty());
|
||||
|
||||
@@ -1,13 +1,38 @@
|
||||
package org.cryptomator.ui.preferences;
|
||||
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.binding.BooleanBinding;
|
||||
import javafx.scene.control.ChoiceBox;
|
||||
import org.cryptomator.common.settings.Settings;
|
||||
import org.cryptomator.common.settings.VolumeImpl;
|
||||
import org.cryptomator.ui.FxController;
|
||||
import org.cryptomator.ui.model.Volume;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@PreferencesWindow
|
||||
public class PreferencesController implements FxController {
|
||||
|
||||
private final Settings settings;
|
||||
private final BooleanBinding showWebDavSettings;
|
||||
public ChoiceBox<VolumeImpl> volumeTypeChoicBox;
|
||||
|
||||
@Inject
|
||||
PreferencesController() {}
|
||||
PreferencesController(Settings settings) {
|
||||
this.settings = settings;
|
||||
this.showWebDavSettings = Bindings.equal(settings.preferredVolumeImpl(), VolumeImpl.WEBDAV);
|
||||
}
|
||||
|
||||
public void initialize() {
|
||||
volumeTypeChoicBox.getItems().addAll(Volume.getCurrentSupportedAdapters());
|
||||
volumeTypeChoicBox.valueProperty().bindBidirectional(settings.preferredVolumeImpl());
|
||||
}
|
||||
|
||||
public BooleanBinding showWebDavSettingsProperty() {
|
||||
return showWebDavSettings;
|
||||
}
|
||||
|
||||
public Boolean getShowWebDavSettings() {
|
||||
return showWebDavSettings.get();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,42 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.CheckBox?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.control.ChoiceBox?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<VBox xmlns="http://javafx.com/javafx"
|
||||
xmlns:fx="http://javafx.com/fxml"
|
||||
fx:controller="org.cryptomator.ui.preferences.PreferencesController"
|
||||
styleClass="main-window">
|
||||
<Label text="preferences..."/>
|
||||
styleClass="main-window"
|
||||
spacing="6">
|
||||
<padding>
|
||||
<Insets bottom="12" left="12" right="12" top="12"/>
|
||||
</padding>
|
||||
<children>
|
||||
<Label text="TODO preferences..."/>
|
||||
|
||||
<CheckBox fx:id="checkForUpdatesCheckbox" text="%preferences.autoUpdateCheck"/>
|
||||
|
||||
<CheckBox fx:id="debugModeCheckbox" text="%preferences.debugLogging"/>
|
||||
|
||||
<HBox spacing="6" alignment="BASELINE_LEFT">
|
||||
<Label text="%preferences.volumeType"/>
|
||||
<ChoiceBox fx:id="volumeTypeChoicBox"/>
|
||||
</HBox>
|
||||
|
||||
<HBox spacing="6" visible="${controller.showWebDavSettings}">
|
||||
<Label text="TODO WebDAV Port"/>
|
||||
<TextField fx:id="portField"/>
|
||||
<Button text="TODO Apply" fx:id="changePortButton" />
|
||||
</HBox>
|
||||
|
||||
<HBox spacing="6" visible="${controller.showWebDavSettings}">
|
||||
<Label text="TODO WebDAV Scheme"/>
|
||||
<ChoiceBox fx:id="prefGvfsScheme" maxWidth="Infinity"/>
|
||||
</HBox>
|
||||
</children>
|
||||
</VBox>
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
main.closeBtn.tooltip=Close
|
||||
main.settingsBtn.tooltip=Settings
|
||||
preferences.autoUpdateCheck=Check for updates automatically
|
||||
preferences.debugLogging=Enable debug logging
|
||||
preferences.volumeType=Volume type
|
||||
vaultlist.emptyList.onboardingInstruction=Click here to add a vault
|
||||
@@ -1,3 +0,0 @@
|
||||
main.closeBtn.tooltip=Close
|
||||
main.settingsBtn.tooltip=Settings
|
||||
vaultlist.emptyList.onboardingInstruction=Klicken Sie hier, um neue Tresore hinzuzufügen
|
||||
@@ -1,3 +1,6 @@
|
||||
main.closeBtn.tooltip=Close
|
||||
main.settingsBtn.tooltip=Settings
|
||||
preferences.autoUpdateCheck=Check for updates automatically
|
||||
preferences.debugLogging=Enable debug logging
|
||||
preferences.volumeType=Volume type
|
||||
vaultlist.emptyList.onboardingInstruction=Click here to add a vault
|
||||
Reference in New Issue
Block a user