diff --git a/src/main/java/org/jabref/gui/preferences/AppearanceTabViewModel.java b/src/main/java/org/jabref/gui/preferences/AppearanceTabViewModel.java index 8491f8ee8e8..6c55a346c11 100644 --- a/src/main/java/org/jabref/gui/preferences/AppearanceTabViewModel.java +++ b/src/main/java/org/jabref/gui/preferences/AppearanceTabViewModel.java @@ -63,7 +63,7 @@ public void setValues() { themeLightProperty.setValue(false); themeDarkProperty.setValue(true); themeCustomProperty.setValue(false); - } else if (ThemeLoader.MAIN_CSS.equals(currentTheme) || currentTheme.isBlank() || currentTheme.isEmpty()) { + } else if (ThemeLoader.MAIN_CSS.equals(currentTheme) || currentTheme.isBlank()) { themeLightProperty.setValue(true); themeDarkProperty.setValue(false); themeCustomProperty.setValue(false); @@ -94,7 +94,7 @@ public void storeSettings() { restartWarnings.add(Localization.lang("Theme changed to dark theme.")); preferences.put(JabRefPreferences.FX_THEME, ThemeLoader.DARK_CSS); } else if (themeCustomProperty.getValue() && !preferences.get(JabRefPreferences.FX_THEME).equals(ThemeLoader.getCustomCss())) { - restartWarnings.add(Localization.lang("Theme change to a custom theme.")); + restartWarnings.add(Localization.lang("Theme changed to a custom theme.")); preferences.put(JabRefPreferences.FX_THEME, preferences.getPathToCustomTheme()); } } diff --git a/src/main/java/org/jabref/gui/preferences/ExportThemeDialog.java b/src/main/java/org/jabref/gui/preferences/ExportThemeDialog.java index f779334338f..38f8baddcd3 100644 --- a/src/main/java/org/jabref/gui/preferences/ExportThemeDialog.java +++ b/src/main/java/org/jabref/gui/preferences/ExportThemeDialog.java @@ -1,7 +1,5 @@ package org.jabref.gui.preferences; -import com.airhacks.afterburner.views.ViewLoader; - import javafx.beans.property.SimpleStringProperty; import javafx.collections.FXCollections; import javafx.collections.ObservableList; @@ -22,6 +20,7 @@ import org.jabref.logic.util.StandardFileType; import org.jabref.preferences.JabRefPreferences; +import com.airhacks.afterburner.views.ViewLoader; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -59,7 +58,7 @@ public void initialize() { ObservableList data = FXCollections.observableArrayList(new Theme("Light theme", ThemeLoader.MAIN_CSS), new Theme("Dark theme", ThemeLoader.DARK_CSS)); - if (!(ThemeLoader.getCustomCss().isBlank() || ThemeLoader.getCustomCss().isEmpty())) { + if (!(ThemeLoader.getCustomCss().isBlank())) { data.add(new Theme("Custom theme", ThemeLoader.getCustomCss())); } @@ -106,22 +105,4 @@ private void exportCSSFile(String theme) { } }); } - - public static class Theme { - private SimpleStringProperty name; - private SimpleStringProperty path; - - public Theme(String name, String path) { - this.name = new SimpleStringProperty(name); - this.path = new SimpleStringProperty(path); - } - - public String getName() { - return name.get(); - } - - public String getPath() { - return path.get(); - } - } } diff --git a/src/main/java/org/jabref/gui/preferences/Theme.java b/src/main/java/org/jabref/gui/preferences/Theme.java new file mode 100644 index 00000000000..11b9d97f0a5 --- /dev/null +++ b/src/main/java/org/jabref/gui/preferences/Theme.java @@ -0,0 +1,21 @@ +package org.jabref.gui.preferences; + +import javafx.beans.property.SimpleStringProperty; + +public class Theme { + private SimpleStringProperty name; + private SimpleStringProperty path; + + public Theme(String name, String path) { + this.name = new SimpleStringProperty(name); + this.path = new SimpleStringProperty(path); + } + + public String getName() { + return name.get(); + } + + public String getPath() { + return path.get(); + } +} diff --git a/src/main/java/org/jabref/gui/util/ThemeLoader.java b/src/main/java/org/jabref/gui/util/ThemeLoader.java index 063fa9459e1..ad86a272dd7 100644 --- a/src/main/java/org/jabref/gui/util/ThemeLoader.java +++ b/src/main/java/org/jabref/gui/util/ThemeLoader.java @@ -39,7 +39,7 @@ public class ThemeLoader { public static final String MAIN_CSS = "Base.css"; public static final String DARK_CSS = "Dark.css"; - public static String CUSTOM_CSS = ""; + private static String CUSTOM_CSS = ""; private static final Logger LOGGER = LoggerFactory.getLogger(ThemeLoader.class); private final Optional additionalCssToLoad; diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index f24eb0b9adc..e9ad163957a 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -456,12 +456,6 @@ Importing=Importing Importing\ in\ unknown\ format=Importing in unknown format -Import\ CSS=Import CSS - -Import\ custom\ CSS\ file=Import custom CSS file - -Theme\ change\ to\ a\ custom\ theme.=Theme change to a custom theme. - Include\ subgroups\:\ When\ selected,\ view\ entries\ contained\ in\ this\ group\ or\ its\ subgroups=Include subgroups: When selected, view entries contained in this group or its subgroups Independent\ group\:\ When\ selected,\ view\ only\ this\ group's\ entries=Independent group: When selected, view only this group's entries @@ -2126,14 +2120,13 @@ Field\ cannot\ be\ empty.\ Please\ enter\ a\ name.=Field cannot be empty. Please Shared\ database=Shared database Lookup=Lookup -Import\ theme=Import theme - -Export\ theme=Export theme - Export\ theme\ as\ CSS=Export theme as CSS - Could\ not\ export\ theme=Could not export theme - Path\ to\ theme=Path to theme - Theme\ name=Theme name +Theme\ changed\ to\ a\ custom\ theme.=Theme changed to a custom theme. +Import\ theme=Import theme +Export\ Theme=Export Theme + +Import\ CSS=Import CSS +Import\ custom\ CSS\ file=Import custom CSS file