diff --git a/src/main/java/org/cryptomator/ui/mainwindow/MainWindowController.java b/src/main/java/org/cryptomator/ui/mainwindow/MainWindowController.java index a09c3afba..3b73b4338 100644 --- a/src/main/java/org/cryptomator/ui/mainwindow/MainWindowController.java +++ b/src/main/java/org/cryptomator/ui/mainwindow/MainWindowController.java @@ -1,16 +1,22 @@ package org.cryptomator.ui.mainwindow; import org.apache.commons.lang3.SystemUtils; +import org.cryptomator.common.LicenseHolder; import org.cryptomator.common.settings.Settings; import org.cryptomator.common.vaults.Vault; import org.cryptomator.common.vaults.VaultListManager; import org.cryptomator.ui.common.FxController; +import org.cryptomator.ui.fxapp.FxApplicationWindows; +import org.cryptomator.ui.fxapp.UpdateChecker; +import org.cryptomator.ui.preferences.SelectedPreferencesTab; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.inject.Inject; import javafx.beans.Observable; +import javafx.beans.binding.BooleanBinding; import javafx.beans.property.ObjectProperty; +import javafx.beans.property.ReadOnlyBooleanProperty; import javafx.beans.property.ReadOnlyObjectProperty; import javafx.fxml.FXML; import javafx.scene.layout.StackPane; @@ -24,14 +30,25 @@ public class MainWindowController implements FxController { private final Stage window; private final ReadOnlyObjectProperty selectedVault; private final Settings settings; + private final FxApplicationWindows appWindows; + private final BooleanBinding updateAvailable; + private final LicenseHolder licenseHolder; public StackPane root; @Inject - public MainWindowController(@MainWindow Stage window, ObjectProperty selectedVault, Settings settings) { + public MainWindowController(@MainWindow Stage window, // + ObjectProperty selectedVault, // + Settings settings, // + FxApplicationWindows appWindows, // + UpdateChecker updateChecker, // + LicenseHolder licenseHolder) { this.window = window; this.selectedVault = selectedVault; this.settings = settings; + this.appWindows = appWindows; + this.updateAvailable = updateChecker.updateAvailableProperty(); + this.licenseHolder = licenseHolder; } @FXML @@ -48,10 +65,10 @@ public class MainWindowController implements FxController { window.setX(settings.windowXPosition.get()); window.setY(settings.windowYPosition.get()); } - window.widthProperty().addListener((_,_,_) -> savePositionalSettings()); - window.heightProperty().addListener((_,_,_) -> savePositionalSettings()); - window.xProperty().addListener((_,_,_) -> savePositionalSettings()); - window.yProperty().addListener((_,_,_) -> savePositionalSettings()); + window.widthProperty().addListener((_, _, _) -> savePositionalSettings()); + window.heightProperty().addListener((_, _, _) -> savePositionalSettings()); + window.xProperty().addListener((_, _, _) -> savePositionalSettings()); + window.yProperty().addListener((_, _, _) -> savePositionalSettings()); } private boolean neverTouched() { @@ -73,4 +90,39 @@ public class MainWindowController implements FxController { } } + @FXML + public void showGeneralPreferences() { + appWindows.showPreferencesWindow(SelectedPreferencesTab.GENERAL); + } + + @FXML + public void showContributePreferences() { + appWindows.showPreferencesWindow(SelectedPreferencesTab.CONTRIBUTE); + } + + @FXML + public void showUpdatePreferences() { + appWindows.showPreferencesWindow(SelectedPreferencesTab.UPDATES); + } + + public LicenseHolder getLicenseHolder() { + return licenseHolder; + } + + public ReadOnlyBooleanProperty debugModeEnabledProperty() { + return settings.debugMode; + } + + public boolean isDebugModeEnabled() { + return debugModeEnabledProperty().get(); + } + + public BooleanBinding updateAvailableProperty() { + return updateAvailable; + } + + public boolean isUpdateAvailable() { + return updateAvailable.get(); + } + } diff --git a/src/main/resources/css/dark_theme.css b/src/main/resources/css/dark_theme.css index bba91cb11..61270eeab 100644 --- a/src/main/resources/css/dark_theme.css +++ b/src/main/resources/css/dark_theme.css @@ -362,6 +362,35 @@ -fx-border-width: 1px 0 0 0; } +/******************************************************************************* + * * + * NotificationBar * + * * + ******************************************************************************/ + +.notification-label { + -fx-text-fill: white; + -fx-font-weight: bold; +} + +.notification-debug { + -fx-min-height:24px; + -fx-max-height:24px; + -fx-background-color: RED_5; +} + +.notification-update { + -fx-min-height:24px; + -fx-max-height:24px; + -fx-background-color: YELLOW_5; +} + +.notification-support { + -fx-min-height:24px; + -fx-max-height:24px; + -fx-background-color: PRIMARY; +} + /******************************************************************************* * * * ScrollBar * diff --git a/src/main/resources/css/light_theme.css b/src/main/resources/css/light_theme.css index d000c0464..c8b7eaf79 100644 --- a/src/main/resources/css/light_theme.css +++ b/src/main/resources/css/light_theme.css @@ -360,6 +360,35 @@ -fx-border-width: 1px 0 0 0; } +/******************************************************************************* + * * + * NotificationBar * + * * + ******************************************************************************/ + +.notification-label { + -fx-text-fill: white; + -fx-font-weight: bold; +} + +.notification-debug { + -fx-min-height:24px; + -fx-max-height:24px; + -fx-background-color: RED_5; +} + +.notification-update { + -fx-min-height:24px; + -fx-max-height:24px; + -fx-background-color: YELLOW_5; +} + +.notification-support { + -fx-min-height:24px; + -fx-max-height:24px; + -fx-background-color: PRIMARY; +} + /******************************************************************************* * * * ScrollBar * diff --git a/src/main/resources/fxml/main_window.fxml b/src/main/resources/fxml/main_window.fxml index cefa18e58..eed8fc695 100644 --- a/src/main/resources/fxml/main_window.fxml +++ b/src/main/resources/fxml/main_window.fxml @@ -3,15 +3,26 @@ + + + + + + + + diff --git a/src/main/resources/i18n/strings.properties b/src/main/resources/i18n/strings.properties index 4309351b5..5e79550b5 100644 --- a/src/main/resources/i18n/strings.properties +++ b/src/main/resources/i18n/strings.properties @@ -392,6 +392,10 @@ main.vaultlist.contextMenu.reveal=Reveal Drive main.vaultlist.addVaultBtn=Add Vault main.vaultlist.addVaultBtn.menuItemNew=New Vault... main.vaultlist.addVaultBtn.menuItemExisting=Existing Vault... +##Notificaition +main.notification.updateAvailable=Update is available. +main.notification.support=Support Cryptomator. +main.notification.debugMode=DEBUG MODE ## Vault Detail ### Welcome main.vaultDetail.welcomeOnboarding=Thanks for choosing Cryptomator to protect your files. If you need any assistance, check out our getting started guides: