diff --git a/src/main/java/org/cryptomator/common/settings/Settings.java b/src/main/java/org/cryptomator/common/settings/Settings.java index 04facdcd0..fb09e197c 100644 --- a/src/main/java/org/cryptomator/common/settings/Settings.java +++ b/src/main/java/org/cryptomator/common/settings/Settings.java @@ -60,6 +60,7 @@ public class Settings { public final ObjectProperty userInterfaceOrientation; public final StringProperty licenseKey; public final BooleanProperty showTrayIcon; + public final BooleanProperty compactMode; public final IntegerProperty windowXPosition; public final IntegerProperty windowYPosition; public final IntegerProperty windowWidth; @@ -96,6 +97,7 @@ public class Settings { this.userInterfaceOrientation = new SimpleObjectProperty<>(this, "userInterfaceOrientation", parseEnum(json.uiOrientation, NodeOrientation.class, NodeOrientation.LEFT_TO_RIGHT)); this.licenseKey = new SimpleStringProperty(this, "licenseKey", json.licenseKey); this.showTrayIcon = new SimpleBooleanProperty(this, "showTrayIcon", json.showTrayIcon); + this.compactMode = new SimpleBooleanProperty(this, "compactMode", json.compactMode); this.windowXPosition = new SimpleIntegerProperty(this, "windowXPosition", json.windowXPosition); this.windowYPosition = new SimpleIntegerProperty(this, "windowYPosition", json.windowYPosition); this.windowWidth = new SimpleIntegerProperty(this, "windowWidth", json.windowWidth); @@ -122,6 +124,7 @@ public class Settings { userInterfaceOrientation.addListener(this::somethingChanged); licenseKey.addListener(this::somethingChanged); showTrayIcon.addListener(this::somethingChanged); + compactMode.addListener(this::somethingChanged); windowXPosition.addListener(this::somethingChanged); windowYPosition.addListener(this::somethingChanged); windowWidth.addListener(this::somethingChanged); @@ -175,6 +178,7 @@ public class Settings { json.uiOrientation = userInterfaceOrientation.get().name(); json.licenseKey = licenseKey.get(); json.showTrayIcon = showTrayIcon.get(); + json.compactMode = compactMode.get(); json.windowXPosition = windowXPosition.get(); json.windowYPosition = windowYPosition.get(); json.windowWidth = windowWidth.get(); diff --git a/src/main/java/org/cryptomator/common/settings/SettingsJson.java b/src/main/java/org/cryptomator/common/settings/SettingsJson.java index 1dd68e02a..6479f1d78 100644 --- a/src/main/java/org/cryptomator/common/settings/SettingsJson.java +++ b/src/main/java/org/cryptomator/common/settings/SettingsJson.java @@ -54,6 +54,9 @@ class SettingsJson { @JsonProperty("showTrayIcon") boolean showTrayIcon; + @JsonProperty("compactMode") + boolean compactMode; + @JsonProperty("startHidden") boolean startHidden = Settings.DEFAULT_START_HIDDEN; diff --git a/src/main/java/org/cryptomator/ui/mainwindow/MainWindowSceneFactory.java b/src/main/java/org/cryptomator/ui/mainwindow/MainWindowSceneFactory.java index c297b8f0f..fbc96513b 100644 --- a/src/main/java/org/cryptomator/ui/mainwindow/MainWindowSceneFactory.java +++ b/src/main/java/org/cryptomator/ui/mainwindow/MainWindowSceneFactory.java @@ -30,9 +30,7 @@ public class MainWindowSceneFactory extends DefaultSceneFactory { @Override protected void setupDefaultAccelerators(Scene scene, Stage stage) { - if (SystemUtils.IS_OS_WINDOWS) { - scene.getAccelerators().put(ALT_F4, window::close); - } else { + if (!SystemUtils.IS_OS_WINDOWS) { scene.getAccelerators().put(SHORTCUT_W, window::close); } scene.getAccelerators().put(SHORTCUT_N, vaultListController.get()::didClickAddNewVault); diff --git a/src/main/java/org/cryptomator/ui/mainwindow/VaultListCellController.java b/src/main/java/org/cryptomator/ui/mainwindow/VaultListCellController.java index 6374d7ae3..38d7ed1c7 100644 --- a/src/main/java/org/cryptomator/ui/mainwindow/VaultListCellController.java +++ b/src/main/java/org/cryptomator/ui/mainwindow/VaultListCellController.java @@ -1,5 +1,6 @@ package org.cryptomator.ui.mainwindow; +import org.cryptomator.common.settings.Settings; import org.cryptomator.common.vaults.Vault; import org.cryptomator.common.vaults.VaultState; import org.cryptomator.ui.common.Animations; @@ -18,6 +19,7 @@ public class VaultListCellController implements FxController { private final ObjectProperty vault = new SimpleObjectProperty<>(); private final ObservableValue glyph; + private final ObservableValue compactMode; private AutoAnimator spinAnimation; @@ -25,8 +27,9 @@ public class VaultListCellController implements FxController { public FontAwesome5IconView vaultStateView; @Inject - VaultListCellController() { + VaultListCellController(Settings settings) { this.glyph = vault.flatMap(Vault::stateProperty).map(this::getGlyphForVaultState); + this.compactMode = settings.compactMode; } public void initialize() { @@ -68,6 +71,14 @@ public class VaultListCellController implements FxController { return vault.get(); } + public ObservableValue compactModeProperty() { + return compactMode; + } + + public boolean getCompactMode() { + return compactMode.getValue(); + } + public void setVault(Vault value) { vault.set(value); } diff --git a/src/main/java/org/cryptomator/ui/mainwindow/VaultListController.java b/src/main/java/org/cryptomator/ui/mainwindow/VaultListController.java index 5cd4c38ef..37b9841d0 100644 --- a/src/main/java/org/cryptomator/ui/mainwindow/VaultListController.java +++ b/src/main/java/org/cryptomator/ui/mainwindow/VaultListController.java @@ -1,6 +1,7 @@ package org.cryptomator.ui.mainwindow; import org.apache.commons.lang3.SystemUtils; +import org.cryptomator.common.settings.Settings; import org.cryptomator.common.vaults.Vault; import org.cryptomator.common.vaults.VaultListManager; import org.cryptomator.cryptofs.CryptoFileSystemProvider; @@ -35,7 +36,6 @@ import javafx.scene.input.MouseEvent; import javafx.scene.input.TransferMode; import javafx.scene.layout.HBox; import javafx.scene.layout.StackPane; -import javafx.scene.layout.VBox; import javafx.stage.Stage; import java.io.File; import java.io.IOException; @@ -71,11 +71,11 @@ public class VaultListController implements FxController { private final BooleanProperty draggingVaultOver = new SimpleBooleanProperty(); private final ResourceBundle resourceBundle; private final FxApplicationWindows appWindows; - + private final ObservableValue cellSize; public ListView vaultList; - public VBox vbox; public StackPane root; - public HBox addVaultButton; + @FXML + private HBox addVaultButton; @FXML private ContextMenu addVaultContextMenu; @@ -89,7 +89,8 @@ public class VaultListController implements FxController { RemoveVaultComponent.Builder removeVaultDialogue, // VaultListManager vaultListManager, // ResourceBundle resourceBundle, // - FxApplicationWindows appWindows) { + FxApplicationWindows appWindows, // + Settings settings) { this.mainWindow = mainWindow; this.vaults = vaults; this.selectedVault = selectedVault; @@ -104,6 +105,7 @@ public class VaultListController implements FxController { this.emptyVaultList = Bindings.isEmpty(vaults); selectedVault.addListener(this::selectedVaultDidChange); + cellSize = settings.compactMode.map(compact -> compact ? 30.0 : 60.0); } public void initialize() { @@ -274,5 +276,12 @@ public class VaultListController implements FxController { return draggingVaultOver.get(); } + public ObservableValue cellSizeProperty() { + return cellSize; + } + + public Double getCellSize() { + return cellSize.getValue(); + } } diff --git a/src/main/java/org/cryptomator/ui/preferences/InterfacePreferencesController.java b/src/main/java/org/cryptomator/ui/preferences/InterfacePreferencesController.java index 937431571..573bfc394 100644 --- a/src/main/java/org/cryptomator/ui/preferences/InterfacePreferencesController.java +++ b/src/main/java/org/cryptomator/ui/preferences/InterfacePreferencesController.java @@ -37,6 +37,7 @@ public class InterfacePreferencesController implements FxController { private final SupportedLanguages supportedLanguages; public ChoiceBox themeChoiceBox; public CheckBox showTrayIconCheckbox; + public CheckBox compactModeCheckbox; public ChoiceBox preferredLanguageChoiceBox; public ToggleGroup nodeOrientation; public RadioButton nodeOrientationLtr; @@ -63,6 +64,7 @@ public class InterfacePreferencesController implements FxController { themeChoiceBox.setConverter(new UiThemeConverter(resourceBundle)); showTrayIconCheckbox.selectedProperty().bindBidirectional(settings.showTrayIcon); + compactModeCheckbox.selectedProperty().bindBidirectional(settings.compactMode); preferredLanguageChoiceBox.getItems().addAll(supportedLanguages.getLanguageTags()); preferredLanguageChoiceBox.valueProperty().bindBidirectional(settings.language); diff --git a/src/main/resources/css/light_theme.css b/src/main/resources/css/light_theme.css index 17520cb7f..84df05b10 100644 --- a/src/main/resources/css/light_theme.css +++ b/src/main/resources/css/light_theme.css @@ -177,8 +177,8 @@ /* windows needs an explicit border: */ .main-window.os-windows { - -fx-border-color: TITLE_BG; - -fx-border-width: 1px; + -fx-border-color: CONTROL_BORDER_NORMAL; + -fx-border-width: 1px 0 0 0; } .main-window .button-bar { diff --git a/src/main/resources/fxml/main_window.fxml b/src/main/resources/fxml/main_window.fxml index 7190b5f5c..327e2c470 100644 --- a/src/main/resources/fxml/main_window.fxml +++ b/src/main/resources/fxml/main_window.fxml @@ -10,7 +10,7 @@ fx:id="root" fx:controller="org.cryptomator.ui.mainwindow.MainWindowController" styleClass="main-window"> - + + diff --git a/src/main/resources/fxml/vault_list.fxml b/src/main/resources/fxml/vault_list.fxml index 465ef199d..ae0905d4e 100644 --- a/src/main/resources/fxml/vault_list.fxml +++ b/src/main/resources/fxml/vault_list.fxml @@ -18,7 +18,7 @@ minWidth="206"> - + @@ -32,22 +32,18 @@ - + - - - + - + - - - + diff --git a/src/main/resources/fxml/vault_list_cell.fxml b/src/main/resources/fxml/vault_list_cell.fxml index aedb18b06..c6cc8cf24 100644 --- a/src/main/resources/fxml/vault_list_cell.fxml +++ b/src/main/resources/fxml/vault_list_cell.fxml @@ -23,7 +23,7 @@