From ab0f175edf57f811b7a97afa51af42b7b53e35c5 Mon Sep 17 00:00:00 2001 From: Martin Beyer Date: Tue, 12 May 2020 11:59:22 +0200 Subject: [PATCH] Implemented hyperlink in preferences to reveal log files (#1184) --- .../preferences/GeneralPreferencesController.java | 13 ++++++++++++- .../main/resources/fxml/preferences_general.fxml | 5 ++++- main/ui/src/main/resources/i18n/strings.properties | 1 + 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/main/ui/src/main/java/org/cryptomator/ui/preferences/GeneralPreferencesController.java b/main/ui/src/main/java/org/cryptomator/ui/preferences/GeneralPreferencesController.java index 1d4ec34ac..30f06b166 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/preferences/GeneralPreferencesController.java +++ b/main/ui/src/main/java/org/cryptomator/ui/preferences/GeneralPreferencesController.java @@ -12,9 +12,11 @@ import javafx.scene.control.RadioButton; import javafx.scene.control.Toggle; import javafx.scene.control.ToggleGroup; import javafx.util.StringConverter; +import javafx.application.Application; import org.cryptomator.common.LicenseHolder; import org.cryptomator.common.settings.Settings; import org.cryptomator.common.settings.UiTheme; +import org.cryptomator.common.Environment; import org.cryptomator.ui.common.FxController; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -37,6 +39,8 @@ public class GeneralPreferencesController implements FxController { private final LicenseHolder licenseHolder; private final ExecutorService executor; private final ResourceBundle resourceBundle; + private final Application application; + private final Environment environment; public ChoiceBox themeChoiceBox; public CheckBox startHiddenCheckbox; public CheckBox debugModeCheckbox; @@ -46,7 +50,7 @@ public class GeneralPreferencesController implements FxController { public RadioButton nodeOrientationRtl; @Inject - GeneralPreferencesController(Settings settings, @Named("trayMenuSupported") boolean trayMenuSupported, Optional autoStartStrategy, ObjectProperty selectedTabProperty, LicenseHolder licenseHolder, ExecutorService executor, ResourceBundle resourceBundle) { + GeneralPreferencesController(Settings settings, @Named("trayMenuSupported") boolean trayMenuSupported, Optional autoStartStrategy, ObjectProperty selectedTabProperty, LicenseHolder licenseHolder, ExecutorService executor, ResourceBundle resourceBundle, Application application, Environment environment) { this.settings = settings; this.trayMenuSupported = trayMenuSupported; this.autoStartStrategy = autoStartStrategy; @@ -54,6 +58,8 @@ public class GeneralPreferencesController implements FxController { this.licenseHolder = licenseHolder; this.executor = executor; this.resourceBundle = resourceBundle; + this.application = application; + this.environment = environment; } @FXML @@ -115,6 +121,11 @@ public class GeneralPreferencesController implements FxController { selectedTabProperty.set(SelectedPreferencesTab.DONATION_KEY); } + @FXML + public void showLogfileDirectory(){ + environment.getLogDir().ifPresent(logDirPath -> application.getHostServices().showDocument(logDirPath.toUri().toString())); + } + /* Helper classes */ private static class UiThemeConverter extends StringConverter { diff --git a/main/ui/src/main/resources/fxml/preferences_general.fxml b/main/ui/src/main/resources/fxml/preferences_general.fxml index 04b8ce9b0..e3ace69f6 100644 --- a/main/ui/src/main/resources/fxml/preferences_general.fxml +++ b/main/ui/src/main/resources/fxml/preferences_general.fxml @@ -34,7 +34,10 @@ - + + + + diff --git a/main/ui/src/main/resources/i18n/strings.properties b/main/ui/src/main/resources/i18n/strings.properties index 2fb761cd2..f04b71a8c 100644 --- a/main/ui/src/main/resources/i18n/strings.properties +++ b/main/ui/src/main/resources/i18n/strings.properties @@ -135,6 +135,7 @@ preferences.general.theme.dark=Dark preferences.general.unlockThemes=Unlock dark mode preferences.general.startHidden=Hide window when starting Cryptomator preferences.general.debugLogging=Enable debug logging +preferences.general.debugDirectory=Reveal log files preferences.general.autoStart=Launch Cryptomator on system start preferences.general.interfaceOrientation=Interface Orientation preferences.general.interfaceOrientation.ltr=Left to Right