Skip to content

Commit

Permalink
Fix merge conflict, fixes #5
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsstre committed Feb 27, 2020
2 parents bcf8004 + f2fc2ab commit 582c9d5
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 17 deletions.
4 changes: 4 additions & 0 deletions src/main/java/org/jabref/gui/preferences/AppearanceTab.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,9 @@
<Label styleClass="sectionHeader" text="%Visual theme"/>
<RadioButton fx:id="themeLight" text="%Light theme" toggleGroup="$theme"/>
<RadioButton fx:id="themeDark" text="%Dark theme" toggleGroup="$theme"/>
<<<<<<< HEAD
<RadioButton fx:id="customTheme" text="%Custom theme" toggleGroup="$theme" />
=======
<RadioButton fx:id="customTheme" text="%Custom theme" toggleGroup="$theme"/>
>>>>>>> fixCustomCSSFile
</fx:root>
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ public void initialize () {
themeLight.selectedProperty().bindBidirectional(viewModel.themeLightProperty());
themeDark.selectedProperty().bindBidirectional(viewModel.themeDarkProperty());
customTheme.selectedProperty().bindBidirectional(viewModel.customThemeProperty());

customTheme.setDisable(preferences.getPathToCustomTheme().isBlank());

validationVisualizer.setDecoration(new IconValidationDecorator());
Platform.runLater(() -> validationVisualizer.initVisualization(viewModel.fontSizeValidationStatus(), fontSize));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,20 @@ public void setValues() {
fontOverrideProperty.setValue(preferences.getBoolean(JabRefPreferences.OVERRIDE_DEFAULT_FONT_SIZE));
fontSizeProperty.setValue(String.valueOf(preferences.getInt(JabRefPreferences.MAIN_FONT_SIZE)));

switch (preferences.get(JabRefPreferences.FX_THEME)) {
case ThemeLoader.DARK_CSS:
themeLightProperty.setValue(false);
themeDarkProperty.setValue(true);
themeCustomProperty.setValue(false);
break;
case ThemeLoader.MAIN_CSS:
themeLightProperty.setValue(true);
themeDarkProperty.setValue(false);
themeCustomProperty.setValue(false);
break;
default:
themeLightProperty.setValue(false);
themeDarkProperty.setValue(false);
themeCustomProperty.setValue(true);
String currentTheme = preferences.get(JabRefPreferences.FX_THEME);

if (ThemeLoader.DARK_CSS.equals(currentTheme)) {
themeLightProperty.setValue(false);
themeDarkProperty.setValue(true);
themeCustomProperty.setValue(false);
} else if (ThemeLoader.MAIN_CSS.equals(currentTheme) || currentTheme.isBlank() || currentTheme.isEmpty()) {
themeLightProperty.setValue(true);
themeDarkProperty.setValue(false);
themeCustomProperty.setValue(false);
} else {
themeLightProperty.setValue(false);
themeDarkProperty.setValue(false);
themeCustomProperty.setValue(true);
}
}

Expand All @@ -94,7 +93,7 @@ public void storeSettings() {
} else if (themeDarkProperty.getValue() && !preferences.get(JabRefPreferences.FX_THEME).equals(ThemeLoader.DARK_CSS)) {
restartWarnings.add(Localization.lang("Theme changed to dark theme."));
preferences.put(JabRefPreferences.FX_THEME, ThemeLoader.DARK_CSS);
} else if (themeCustomProperty.getValue()) {
} else if (themeCustomProperty.getValue() && !preferences.get(JabRefPreferences.FX_THEME).equals(ThemeLoader.CUSTOM_CSS)) {
restartWarnings.add(Localization.lang("Theme change to a custom theme."));
preferences.put(JabRefPreferences.FX_THEME, preferences.getPathToCustomTheme());
}
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/jabref/gui/util/ThemeLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +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 final Logger LOGGER = LoggerFactory.getLogger(ThemeLoader.class);
private final Optional<URL> additionalCssToLoad;
Expand Down Expand Up @@ -68,8 +69,9 @@ public ThemeLoader(FileUpdateMonitor fileUpdateMonitor, JabRefPreferences jabRef
} else {
try {
cssResource = Optional.of(new File(cssPreferences).toURI().toURL());
CUSTOM_CSS = cssPreferences;
} catch (MalformedURLException e) {
LOGGER.warn("Cannot load css {}", cssResource);
LOGGER.warn("Cannot load css {}", cssPreferences);
}
}

Expand Down

0 comments on commit 582c9d5

Please sign in to comment.