|
@@ -1,5 +1,13 @@
|
|
|
package org.cryptomator.ui.mainwindow;
|
|
|
|
|
|
+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;
|
|
|
+import javafx.stage.Stage;
|
|
|
import org.apache.commons.lang3.SystemUtils;
|
|
|
import org.cryptomator.common.LicenseHolder;
|
|
|
import org.cryptomator.common.settings.Settings;
|
|
@@ -13,17 +21,6 @@ import org.slf4j.Logger;
|
|
|
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;
|
|
|
|
|
|
@MainWindowScoped
|
|
|
public class MainWindowController implements FxController {
|
|
@@ -37,12 +34,9 @@ public class MainWindowController implements FxController {
|
|
|
private final UpdateChecker updateChecker;
|
|
|
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;
|
|
|
+ @FXML
|
|
|
+ private StackPane root;
|
|
|
|
|
|
@Inject
|
|
|
public MainWindowController(@MainWindow Stage window, //
|
|
@@ -80,16 +74,12 @@ 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, licenseHolder.validLicenseProperty()));
|
|
|
- updateNotificationHidden.bind(Bindings.createBooleanBinding(() -> updateAvailable.get() && !hideUpdateNotificationClicked.get(), hideUpdateNotificationClicked, updateAvailable));
|
|
|
}
|
|
|
|
|
|
private boolean neverTouched() {
|
|
|
return (settings.windowHeight.get() == 0) && (settings.windowWidth.get() == 0) && (settings.windowXPosition.get() == 0) && (settings.windowYPosition.get() == 0);
|
|
|
}
|
|
|
|
|
|
- @FXML
|
|
|
public void savePositionalSettings() {
|
|
|
settings.windowWidth.setValue(window.getWidth());
|
|
|
settings.windowHeight.setValue(window.getHeight());
|
|
@@ -119,25 +109,11 @@ 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;
|
|
|
- }
|
|
|
-
|
|
|
public ReadOnlyBooleanProperty debugModeEnabledProperty() {
|
|
|
return settings.debugMode;
|
|
|
}
|
|
|
|
|
|
- public boolean isDebugModeEnabled() {
|
|
|
+ public boolean getDebugModeEnabled() {
|
|
|
return debugModeEnabledProperty().get();
|
|
|
}
|
|
|
|
|
@@ -145,40 +121,16 @@ public class MainWindowController implements FxController {
|
|
|
return updateAvailable;
|
|
|
}
|
|
|
|
|
|
- public boolean isUpdateAvailable() {
|
|
|
+ public boolean getUpdateAvailable() {
|
|
|
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 BooleanBinding licenseValidProperty(){
|
|
|
+ return licenseHolder.validLicenseProperty();
|
|
|
}
|
|
|
|
|
|
- public boolean isUpdateNotificationHidden() {
|
|
|
- return updateNotificationHidden.get();
|
|
|
+ public boolean getLicenseValid() {
|
|
|
+ return licenseHolder.isValidLicense();
|
|
|
}
|
|
|
|
|
|
}
|