mirror of
https://github.com/cryptomator/cryptomator.git
synced 2024-11-23 03:59:51 +00:00
added "unlock themes" hyperlink in general preferences if no valid license has been found
This commit is contained in:
parent
99315f8038
commit
b5a8442ed2
@ -1,6 +1,7 @@
|
||||
package org.cryptomator.ui.preferences;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.property.ObjectProperty;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.fxml.FXML;
|
||||
@ -31,6 +32,7 @@ public class GeneralPreferencesController implements FxController {
|
||||
private final Settings settings;
|
||||
private final boolean trayMenuSupported;
|
||||
private final Optional<AutoStartStrategy> autoStartStrategy;
|
||||
private final ObjectProperty<SelectedPreferencesTab> selectedTabProperty;
|
||||
private final LicenseHolder licenseHolder;
|
||||
private final ExecutorService executor;
|
||||
public ChoiceBox<UiTheme> themeChoiceBox;
|
||||
@ -42,10 +44,11 @@ public class GeneralPreferencesController implements FxController {
|
||||
public RadioButton nodeOrientationRtl;
|
||||
|
||||
@Inject
|
||||
GeneralPreferencesController(Settings settings, @Named("trayMenuSupported") boolean trayMenuSupported, Optional<AutoStartStrategy> autoStartStrategy, LicenseHolder licenseHolder, ExecutorService executor) {
|
||||
GeneralPreferencesController(Settings settings, @Named("trayMenuSupported") boolean trayMenuSupported, Optional<AutoStartStrategy> autoStartStrategy, ObjectProperty<SelectedPreferencesTab> selectedTabProperty, LicenseHolder licenseHolder, ExecutorService executor) {
|
||||
this.settings = settings;
|
||||
this.trayMenuSupported = trayMenuSupported;
|
||||
this.autoStartStrategy = autoStartStrategy;
|
||||
this.selectedTabProperty = selectedTabProperty;
|
||||
this.licenseHolder = licenseHolder;
|
||||
this.executor = executor;
|
||||
}
|
||||
@ -103,6 +106,12 @@ public class GeneralPreferencesController implements FxController {
|
||||
return licenseHolder;
|
||||
}
|
||||
|
||||
|
||||
@FXML
|
||||
public void showDonationTab() {
|
||||
selectedTabProperty.set(SelectedPreferencesTab.DONATION_KEY);
|
||||
}
|
||||
|
||||
/* Helper classes */
|
||||
|
||||
private static class UiThemeConverter extends StringConverter<UiTheme> {
|
||||
|
@ -1,9 +1,7 @@
|
||||
package org.cryptomator.ui.preferences;
|
||||
|
||||
import javafx.beans.Observable;
|
||||
import javafx.beans.binding.BooleanBinding;
|
||||
import javafx.beans.property.ObjectProperty;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Tab;
|
||||
import javafx.scene.control.TabPane;
|
||||
@ -11,12 +9,16 @@ import javafx.stage.Stage;
|
||||
import javafx.stage.WindowEvent;
|
||||
import org.cryptomator.ui.common.FxController;
|
||||
import org.cryptomator.ui.fxapp.UpdateChecker;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@PreferencesScoped
|
||||
public class PreferencesController implements FxController {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(PreferencesController.class);
|
||||
|
||||
private final Stage window;
|
||||
private final ObjectProperty<SelectedPreferencesTab> selectedTabProperty;
|
||||
private final BooleanBinding updateAvailable;
|
||||
@ -37,6 +39,7 @@ public class PreferencesController implements FxController {
|
||||
public void initialize() {
|
||||
window.setOnShowing(this::windowWillAppear);
|
||||
selectedTabProperty.addListener(observable -> this.selectChosenTab());
|
||||
tabPane.getSelectionModel().selectedItemProperty().addListener(observable -> this.selectedTabChanged());
|
||||
}
|
||||
|
||||
private void selectChosenTab() {
|
||||
@ -60,6 +63,16 @@ public class PreferencesController implements FxController {
|
||||
}
|
||||
}
|
||||
|
||||
private void selectedTabChanged() {
|
||||
Tab selectedTab = tabPane.getSelectionModel().getSelectedItem();
|
||||
try {
|
||||
SelectedPreferencesTab selectedPreferencesTab = SelectedPreferencesTab.valueOf(selectedTab.getId());
|
||||
selectedTabProperty.set(selectedPreferencesTab);
|
||||
} catch (IllegalArgumentException e) {
|
||||
LOG.error("Unknown preferences tab id: {}", selectedTab.getId());
|
||||
}
|
||||
}
|
||||
|
||||
private void windowWillAppear(@SuppressWarnings("unused") WindowEvent windowEvent) {
|
||||
selectChosenTab();
|
||||
}
|
||||
|
@ -567,6 +567,10 @@
|
||||
-fx-graphic-text-gap: 6px;
|
||||
}
|
||||
|
||||
.hyperlink.hyperlink-underline {
|
||||
-fx-underline: true;
|
||||
}
|
||||
|
||||
.hyperlink.hyperlink-secondary {
|
||||
-fx-text-fill: TEXT_FILL_MUTED;
|
||||
}
|
||||
|
@ -566,6 +566,10 @@
|
||||
-fx-graphic-text-gap: 6px;
|
||||
}
|
||||
|
||||
.hyperlink.hyperlink-underline {
|
||||
-fx-underline: true;
|
||||
}
|
||||
|
||||
.hyperlink.hyperlink-secondary {
|
||||
-fx-text-fill: TEXT_FILL_MUTED;
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
tabClosingPolicy="UNAVAILABLE"
|
||||
tabDragPolicy="FIXED">
|
||||
<tabs>
|
||||
<Tab fx:id="generalTab" text="%preferences.general">
|
||||
<Tab fx:id="generalTab" id="GENERAL" text="%preferences.general">
|
||||
<graphic>
|
||||
<FontAwesome5IconView glyph="WRENCH"/>
|
||||
</graphic>
|
||||
@ -22,7 +22,7 @@
|
||||
<fx:include source="/fxml/preferences_general.fxml"/>
|
||||
</content>
|
||||
</Tab>
|
||||
<Tab fx:id="volumeTab" text="%preferences.volume">
|
||||
<Tab fx:id="volumeTab" id="VOLUME" text="%preferences.volume">
|
||||
<graphic>
|
||||
<FontAwesome5IconView glyph="HDD"/>
|
||||
</graphic>
|
||||
@ -30,7 +30,7 @@
|
||||
<fx:include source="/fxml/preferences_volume.fxml"/>
|
||||
</content>
|
||||
</Tab>
|
||||
<Tab fx:id="updatesTab" text="%preferences.updates">
|
||||
<Tab fx:id="updatesTab" id="UPDATES" text="%preferences.updates">
|
||||
<graphic>
|
||||
<FontAwesome5IconView glyph="SYNC"/>
|
||||
</graphic>
|
||||
@ -38,7 +38,7 @@
|
||||
<fx:include source="/fxml/preferences_updates.fxml"/>
|
||||
</content>
|
||||
</Tab>
|
||||
<Tab fx:id="donationKeyTab" text="%preferences.donationKey">
|
||||
<Tab fx:id="donationKeyTab" id="DONATION_KEY" text="%preferences.donationKey">
|
||||
<graphic>
|
||||
<FontAwesome5IconView glyph="HEART"/>
|
||||
</graphic>
|
||||
|
@ -3,11 +3,12 @@
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.CheckBox?>
|
||||
<?import javafx.scene.control.ChoiceBox?>
|
||||
<?import javafx.scene.control.Hyperlink?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.control.RadioButton?>
|
||||
<?import javafx.scene.control.ToggleGroup?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<VBox xmlns="http://javafx.com/javafx"
|
||||
xmlns:fx="http://javafx.com/fxml"
|
||||
fx:controller="org.cryptomator.ui.preferences.GeneralPreferencesController"
|
||||
@ -22,6 +23,7 @@
|
||||
<HBox spacing="6" alignment="CENTER_LEFT">
|
||||
<Label text="%preferences.general.theme"/>
|
||||
<ChoiceBox fx:id="themeChoiceBox" disable="${!controller.licenseHolder.validLicense}"/>
|
||||
<Hyperlink styleClass="hyperlink-underline,hyperlink-secondary" text="%preferences.general.unlockThemes" onAction="#showDonationTab" visible="${!controller.licenseHolder.validLicense}" managed="${!controller.licenseHolder.validLicense}"/>
|
||||
</HBox>
|
||||
|
||||
<HBox spacing="6" alignment="CENTER_LEFT">
|
||||
|
@ -116,6 +116,7 @@ preferences.title=Preferences
|
||||
## General
|
||||
preferences.general=General
|
||||
preferences.general.theme=Look & Feel
|
||||
preferences.general.unlockThemes=Unlock dark mode
|
||||
preferences.general.startHidden=Hide window when starting Cryptomator
|
||||
preferences.general.debugLogging=Enable debug logging
|
||||
preferences.general.autoStart=Launch Cryptomator on system start
|
||||
|
Loading…
Reference in New Issue
Block a user