mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-08-17 20:56:02 +00:00
addded debug, update and support notification bar
This commit is contained in:
@@ -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<Vault> 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<Vault> selectedVault, Settings settings) {
|
||||
public MainWindowController(@MainWindow Stage window, //
|
||||
ObjectProperty<Vault> 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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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 *
|
||||
|
||||
@@ -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 *
|
||||
|
||||
@@ -3,15 +3,26 @@
|
||||
<?import javafx.scene.control.SplitPane?>
|
||||
<?import javafx.scene.layout.StackPane?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<StackPane xmlns:fx="http://javafx.com/fxml"
|
||||
xmlns="http://javafx.com/javafx"
|
||||
fx:id="root"
|
||||
fx:controller="org.cryptomator.ui.mainwindow.MainWindowController"
|
||||
styleClass="main-window">
|
||||
<VBox minWidth="650">
|
||||
<HBox onMouseClicked="#showUpdatePreferences" alignment="CENTER" styleClass="notification-update" VBox.vgrow="ALWAYS" visible="${controller.updateAvailable}" managed="${controller.updateAvailable}">
|
||||
<Label text="%main.notification.updateAvailable" styleClass="notification-label" />
|
||||
</HBox>
|
||||
<HBox onMouseClicked="#showContributePreferences" alignment="CENTER" styleClass="notification-support" VBox.vgrow="ALWAYS" visible="${!controller.licenseHolder.validLicense}" managed="${!controller.licenseHolder.validLicense}">
|
||||
<Label text="%main.notification.support" styleClass="notification-label"/>
|
||||
</HBox>
|
||||
<SplitPane dividerPositions="0.33" orientation="HORIZONTAL" VBox.vgrow="ALWAYS">
|
||||
<fx:include source="vault_list.fxml" SplitPane.resizableWithParent="false"/>
|
||||
<fx:include source="vault_detail.fxml" SplitPane.resizableWithParent="true"/>
|
||||
</SplitPane>
|
||||
<HBox onMouseClicked="#showGeneralPreferences" alignment="CENTER" styleClass="notification-debug" VBox.vgrow="ALWAYS" visible="${controller.debugModeEnabled}" managed="${controller.debugModeEnabled}">
|
||||
<Label text="%main.notification.debugMode" styleClass="notification-label"/>
|
||||
</HBox>
|
||||
</VBox>
|
||||
</StackPane>
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user