Skip to content

Commit

Permalink
Add fixes from code review, JabRef#5790
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsstre committed Feb 27, 2020
1 parent a8feb94 commit 8c1e2c2
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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());
}
}
Expand Down
23 changes: 2 additions & 21 deletions src/main/java/org/jabref/gui/preferences/ExportThemeDialog.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -59,7 +58,7 @@ public void initialize() {
ObservableList<Theme> 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()));
}

Expand Down Expand Up @@ -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();
}
}
}
21 changes: 21 additions & 0 deletions src/main/java/org/jabref/gui/preferences/Theme.java
Original file line number Diff line number Diff line change
@@ -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();
}
}
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/util/ThemeLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<URL> additionalCssToLoad;
Expand Down
19 changes: 6 additions & 13 deletions src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 8c1e2c2

Please # to comment.