mirror of
https://github.com/cryptomator/cryptomator.git
synced 2024-11-23 03:59:51 +00:00
implement hideable notification bars
This commit is contained in:
parent
d379ada100
commit
8ff06a3efd
@ -14,10 +14,13 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javafx.beans.Observable;
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.binding.BooleanBinding;
|
||||
import javafx.beans.property.BooleanProperty;
|
||||
import javafx.beans.property.ObjectProperty;
|
||||
import javafx.beans.property.ReadOnlyBooleanProperty;
|
||||
import javafx.beans.property.ReadOnlyObjectProperty;
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.stage.Stage;
|
||||
@ -33,6 +36,10 @@ public class MainWindowController implements FxController {
|
||||
private final FxApplicationWindows appWindows;
|
||||
private final BooleanBinding updateAvailable;
|
||||
private final LicenseHolder licenseHolder;
|
||||
private final BooleanProperty hideSupportNotificationClicked = new SimpleBooleanProperty(false);
|
||||
private final BooleanProperty supportNotificationHidden = new SimpleBooleanProperty();
|
||||
private final BooleanProperty hideUpdateNotificationClicked = new SimpleBooleanProperty(false);
|
||||
private final BooleanProperty updateNotificationHidden = new SimpleBooleanProperty();
|
||||
|
||||
public StackPane root;
|
||||
|
||||
@ -69,6 +76,9 @@ public class MainWindowController implements FxController {
|
||||
window.heightProperty().addListener((_, _, _) -> savePositionalSettings());
|
||||
window.xProperty().addListener((_, _, _) -> savePositionalSettings());
|
||||
window.yProperty().addListener((_, _, _) -> savePositionalSettings());
|
||||
|
||||
supportNotificationHidden.bind(Bindings.createBooleanBinding(() -> !licenseHolder.isValidLicense() && !hideSupportNotificationClicked.get(), hideSupportNotificationClicked));
|
||||
updateNotificationHidden.bind(Bindings.createBooleanBinding(() -> updateAvailable.get() && !hideUpdateNotificationClicked.get(), hideUpdateNotificationClicked));
|
||||
}
|
||||
|
||||
private boolean neverTouched() {
|
||||
@ -105,6 +115,16 @@ public class MainWindowController implements FxController {
|
||||
appWindows.showPreferencesWindow(SelectedPreferencesTab.UPDATES);
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void hideSupportNotification() {
|
||||
this.hideSupportNotificationClicked.setValue(true);
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void hideUpdateNotification() {
|
||||
this.hideUpdateNotificationClicked.setValue(true);
|
||||
}
|
||||
|
||||
public LicenseHolder getLicenseHolder() {
|
||||
return licenseHolder;
|
||||
}
|
||||
@ -125,4 +145,36 @@ public class MainWindowController implements FxController {
|
||||
return updateAvailable.get();
|
||||
}
|
||||
|
||||
public BooleanProperty hideSupportNotificationClickedProperty() {
|
||||
return hideSupportNotificationClicked;
|
||||
}
|
||||
|
||||
public boolean isHideSupportNotificationClicked() {
|
||||
return hideSupportNotificationClicked.get();
|
||||
}
|
||||
|
||||
public BooleanProperty supportNotificationHiddenProperty() {
|
||||
return supportNotificationHidden;
|
||||
}
|
||||
|
||||
public boolean isSupportNotificationHidden() {
|
||||
return supportNotificationHidden.get();
|
||||
}
|
||||
|
||||
public BooleanProperty hideUpdateNotificationClickedProperty() {
|
||||
return hideUpdateNotificationClicked;
|
||||
}
|
||||
|
||||
public boolean isHideUpdateNotificationClicked() {
|
||||
return hideUpdateNotificationClicked.get();
|
||||
}
|
||||
|
||||
public BooleanProperty updateNotificationHiddenProperty() {
|
||||
return updateNotificationHidden;
|
||||
}
|
||||
|
||||
public boolean isUpdateNotificationHidden() {
|
||||
return updateNotificationHidden.get();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,24 +5,34 @@
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.layout.Region?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<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}">
|
||||
<HBox onMouseClicked="#showUpdatePreferences" alignment="CENTER" styleClass="notification-update" VBox.vgrow="ALWAYS" visible="${controller.updateNotificationHidden}" managed="${controller.updateNotificationHidden}">
|
||||
<Region minWidth="40"/>
|
||||
<Region HBox.hgrow="ALWAYS"/>
|
||||
<Label text="%main.notification.updateAvailable" styleClass="notification-label" />
|
||||
<Region HBox.hgrow="ALWAYS"/>
|
||||
<Button minWidth="40" text="X" onMouseClicked="#hideUpdateNotification" style="-fx-background-color: transparent; -fx-text-fill: white; -fx-font-weight: bold;"/>
|
||||
</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 onMouseClicked="#showContributePreferences" alignment="CENTER" styleClass="notification-support" VBox.vgrow="ALWAYS" visible="${controller.supportNotificationHidden}" managed="${controller.supportNotificationHidden}">
|
||||
<Region minWidth="40"/>
|
||||
<Region HBox.hgrow="ALWAYS"/>
|
||||
<Label text="%main.notification.support" styleClass="notification-label" />
|
||||
<Region HBox.hgrow="ALWAYS"/>
|
||||
<Button minWidth="40" text="X" onMouseClicked="#hideSupportNotification" style="-fx-background-color: transparent; -fx-text-fill: white; -fx-font-weight: bold;"/>
|
||||
</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"/>
|
||||
<Label text="DEBUG MODE" styleClass="notification-label"/>
|
||||
</HBox>
|
||||
</VBox>
|
||||
</StackPane>
|
||||
|
@ -395,7 +395,6 @@ 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:
|
||||
|
Loading…
Reference in New Issue
Block a user