From 0effa74477f5669ea5d50b6f55e9da9033ea08bd Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Tue, 20 Sep 2022 00:38:33 +0300 Subject: [PATCH] Few small but cute UI enhancements, add contributors list to 'About' section, update readme, let application version visible in application to be taken directly from POM --- README.md | 11 +- pom.xml | 18 ++- .../java/logiledus/About/AboutWindow.java | 9 +- .../logiledus/Controllers/MainController.java | 3 +- src/main/java/logiledus/MainFx.java | 20 ++- src/main/resources-filtered/app.properties | 1 + src/main/resources/AboutLayout.fxml | 15 ++- src/main/resources/KeysLedsPane.fxml | 2 +- src/main/resources/dark.css | 121 +++++++++++++++++- src/main/resources/locale.properties | 2 + src/main/resources/locale_kor.properties | 1 + src/main/resources/locale_rus.properties | 3 + 12 files changed, 172 insertions(+), 34 deletions(-) create mode 100644 src/main/resources-filtered/app.properties diff --git a/README.md b/README.md index 188a438..35a4c0c 100644 --- a/README.md +++ b/README.md @@ -42,20 +42,20 @@ SUBSYSTEM=="usb", ATTRS{idVendor}=="046D", ATTRS{idProduct}=="c33c", GROUP="plug root # udevadm control --reload-rules && udevadm trigger ``` -### Building +### Build `$ mvn package` +#### Thanks + +* [DDinghoya](https://github.com/DDinghoya), who translated this application to Korean! + ## Support this app If you like this app, just give a star. Want to support development? Make a donation* (see below): -Donate using Liberapay - -PayPal Logo - [ЮMoney](https://yoomoney.ru/to/410014301951665) *Please note: this is non-commercial application. @@ -63,6 +63,5 @@ Want to support development? Make a donation* (see below): #### TODO * [ ] Tray support: tray icon size checks -* [ ] Autoload option in settings * [ ] Headless mode (CLI) * [x] Add opened file name to info pane \ No newline at end of file diff --git a/pom.xml b/pom.xml index 2d4dcb7..ceea83d 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ loper LogiLedus - 1.4-SNAPSHOT + 1.5-SNAPSHOT @@ -148,21 +148,21 @@ com.fasterxml.jackson.core jackson-core - 2.10.0 + 2.13.4 compile com.fasterxml.jackson.core jackson-annotations - 2.10.0 + 2.13.4 compile com.fasterxml.jackson.core jackson-databind - 2.12.6.1 + 2.13.4 compile @@ -177,6 +177,16 @@ ${project.artifactId}-${project.version}-${maven.build.timestamp} + + + src/main/resources + false + + + src/main/resources-filtered + true + + org.apache.maven.plugins diff --git a/src/main/java/logiledus/About/AboutWindow.java b/src/main/java/logiledus/About/AboutWindow.java index fb07ccc..2cb81d1 100644 --- a/src/main/java/logiledus/About/AboutWindow.java +++ b/src/main/java/logiledus/About/AboutWindow.java @@ -9,6 +9,7 @@ import java.io.IOException; import java.util.Locale; +import java.util.Objects; import java.util.ResourceBundle; public class AboutWindow { @@ -31,10 +32,10 @@ public AboutWindow(){ stageAbout.setTitle(resourceBundle.getString("menu_item_about")); stageAbout.getIcons().addAll( - new Image(getClass().getResourceAsStream("/ico/appIcon_32.png")), - new Image(getClass().getResourceAsStream("/ico/appIcon_48.png")), - new Image(getClass().getResourceAsStream("/ico/appIcon_64.png")), - new Image(getClass().getResourceAsStream("/ico/appIcon_128.png")) + new Image(Objects.requireNonNull(getClass().getResourceAsStream("/ico/appIcon_32.png"))), + new Image(Objects.requireNonNull(getClass().getResourceAsStream("/ico/appIcon_48.png"))), + new Image(Objects.requireNonNull(getClass().getResourceAsStream("/ico/appIcon_64.png"))), + new Image(Objects.requireNonNull(getClass().getResourceAsStream("/ico/appIcon_128.png"))) ); Scene scene = new Scene(parentAbout, 500, 500); scene.getStylesheets().add(Mediator.getInstance().getPreferences().getTheme()); diff --git a/src/main/java/logiledus/Controllers/MainController.java b/src/main/java/logiledus/Controllers/MainController.java index 5a2aef9..7730d40 100644 --- a/src/main/java/logiledus/Controllers/MainController.java +++ b/src/main/java/logiledus/Controllers/MainController.java @@ -17,6 +17,7 @@ import java.io.*; import java.net.URL; +import java.nio.file.Files; import java.util.HashMap; import java.util.List; import java.util.ResourceBundle; @@ -113,7 +114,7 @@ private void openConfig(File configFile){ ObjectMapper mapper = new ObjectMapper(); SettingsFileFormat setup; try{ - setup = mapper.readerFor(SettingsFileFormat.class).readValue(new FileInputStream(configFile)); + setup = mapper.readerFor(SettingsFileFormat.class).readValue(Files.newInputStream(configFile.toPath())); KeysLedsController.setConfig(setup.getKeyLedRule()); EffectsController.setConfig(setup.getEffectHumanReadable()); diff --git a/src/main/java/logiledus/MainFx.java b/src/main/java/logiledus/MainFx.java index 589b14d..eabd34e 100644 --- a/src/main/java/logiledus/MainFx.java +++ b/src/main/java/logiledus/MainFx.java @@ -14,10 +14,11 @@ import java.awt.*; import java.io.IOException; import java.util.Locale; +import java.util.Objects; import java.util.ResourceBundle; public class MainFx extends Application { - public static final String appVersion = "v1.4"; + public static final String appVersion = ResourceBundle.getBundle("app").getString("_version");; private static boolean traySupport = true; @@ -29,12 +30,9 @@ public class MainFx extends Application { @Override public void start(Stage primaryStage) throws Exception{ - //if (! getParameters().getUnnamed().isEmpty()) - // System.out.println(getParameters().getUnnamed().get(0)); - AppPreferences appPreferences = new AppPreferences(); - if (traySupport) // By default it's enabled, but in case it disabled from CLI, don't touch. - traySupport = appPreferences.getUseTray(); // Otherwise, check against preferences + if (traySupport) // By default, it's enabled, but in case it disabled from CLI, don't touch. + traySupport = appPreferences.getUseTray(); // Otherwise, check against preferences //-----------------------Tray support--------------------- this.stage = primaryStage; if (traySupport){ @@ -54,10 +52,10 @@ public void start(Stage primaryStage) throws Exception{ Parent root = loader.load(); primaryStage.getIcons().addAll( - new Image(getClass().getResourceAsStream("/ico/appIcon_32.png")), - new Image(getClass().getResourceAsStream("/ico/appIcon_48.png")), - new Image(getClass().getResourceAsStream("/ico/appIcon_64.png")), - new Image(getClass().getResourceAsStream("/ico/appIcon_128.png")) + new Image(Objects.requireNonNull(getClass().getResourceAsStream("/ico/appIcon_32.png"))), + new Image(Objects.requireNonNull(getClass().getResourceAsStream("/ico/appIcon_48.png"))), + new Image(Objects.requireNonNull(getClass().getResourceAsStream("/ico/appIcon_64.png"))), + new Image(Objects.requireNonNull(getClass().getResourceAsStream("/ico/appIcon_128.png"))) ); // NOTE: tray leftovers if (traySupport) { @@ -106,7 +104,7 @@ private void addAppToTray(){ tray = SystemTray.getSystemTray(); - trayIcon = new TrayIcon(ImageIO.read(getClass().getResourceAsStream("/ico/appIcon_24.png"))); + trayIcon = new TrayIcon(ImageIO.read(Objects.requireNonNull(getClass().getResourceAsStream("/ico/appIcon_24.png")))); trayIcon.addActionListener(ActionEvent -> Platform.runLater(this::showStage)); diff --git a/src/main/resources-filtered/app.properties b/src/main/resources-filtered/app.properties new file mode 100644 index 0000000..fc2f1ed --- /dev/null +++ b/src/main/resources-filtered/app.properties @@ -0,0 +1 @@ +_version=v${project.version} \ No newline at end of file diff --git a/src/main/resources/AboutLayout.fxml b/src/main/resources/AboutLayout.fxml index f837cbb..773eba8 100644 --- a/src/main/resources/AboutLayout.fxml +++ b/src/main/resources/AboutLayout.fxml @@ -9,11 +9,10 @@ - - + @@ -44,17 +43,21 @@ - + -