From 4177c4672d9504475101c2e4662c74d9d72d1989 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Mon, 11 Feb 2019 05:13:31 +0300 Subject: [PATCH] Styles fixing; code cleanup --- src/main/java/nsusbloader/NSLMain.java | 55 ++++++++++--------------- src/main/resources/locale_en.properties | 2 - src/main/resources/locale_ru.properties | 2 - src/main/resources/res/app.css | 19 +++++++-- 4 files changed, 38 insertions(+), 40 deletions(-) diff --git a/src/main/java/nsusbloader/NSLMain.java b/src/main/java/nsusbloader/NSLMain.java index 54a2eee..9e56bc9 100644 --- a/src/main/java/nsusbloader/NSLMain.java +++ b/src/main/java/nsusbloader/NSLMain.java @@ -27,47 +27,36 @@ public class NSLMain extends Application { else rb = ResourceBundle.getBundle("locale", new Locale("en")); - // If it's windows, refuse to work - /* - if (System.getProperty("os.name").toLowerCase().startsWith("win")){ - ServiceWindow.getErrorNotification(rb.getString("windowErrorHeader"), rb.getString("windowItsWindowsMessage")); - } - else{ - /*/ - // If it's not, go ahead - FXMLLoader loader = new FXMLLoader(getClass().getResource("/NSLMain.fxml")); + FXMLLoader loader = new FXMLLoader(getClass().getResource("/NSLMain.fxml")); - loader.setResources(rb); - Parent root = loader.load(); + loader.setResources(rb); + Parent root = loader.load(); - primaryStage.getIcons().addAll( - new Image(getClass().getResourceAsStream("/res/app_icon32x32.png")), - new Image(getClass().getResourceAsStream("/res/app_icon48x48.png")), - new Image(getClass().getResourceAsStream("/res/app_icon64x64.png")), - new Image(getClass().getResourceAsStream("/res/app_icon128x128.png")) - ); + primaryStage.getIcons().addAll( + new Image(getClass().getResourceAsStream("/res/app_icon32x32.png")), + new Image(getClass().getResourceAsStream("/res/app_icon48x48.png")), + new Image(getClass().getResourceAsStream("/res/app_icon64x64.png")), + new Image(getClass().getResourceAsStream("/res/app_icon128x128.png")) + ); - primaryStage.setTitle("NS-USBloader"); - primaryStage.setMinWidth(600); - primaryStage.setMinHeight(375); - Scene mainScene = new Scene(root, 800, 400); - mainScene.getStylesheets().add("/res/app.css"); - primaryStage.setScene(mainScene); - primaryStage.show(); + primaryStage.setTitle("NS-USBloader"); + primaryStage.setMinWidth(600); + primaryStage.setMinHeight(375); + Scene mainScene = new Scene(root, 800, 400); + mainScene.getStylesheets().add("/res/app.css"); + primaryStage.setScene(mainScene); + primaryStage.show(); - primaryStage.setOnCloseRequest(e->{ - if (MediatorControl.getInstance().getTransferActive()) - if(! ServiceWindow.getConfirmationWindow(rb.getString("windowTitleConfirmExit"), rb.getString("windowBodyConfirmExit"))) - e.consume(); - }); - } - /*/ + primaryStage.setOnCloseRequest(e->{ + if (MediatorControl.getInstance().getTransferActive()) + if(! ServiceWindow.getConfirmationWindow(rb.getString("windowTitleConfirmExit"), rb.getString("windowBodyConfirmExit"))) + e.consume(); + }); } - /*/ public static void main(String[] args) { if ((args.length == 1) && (args[0].equals("-v") || args[0].equals("--version"))){ - System.out.println(NSLMain.appVersion); + System.out.println("NS-USBloader "+NSLMain.appVersion); } else launch(args); diff --git a/src/main/resources/locale_en.properties b/src/main/resources/locale_en.properties index b1080ec..0df04a1 100644 --- a/src/main/resources/locale_en.properties +++ b/src/main/resources/locale_en.properties @@ -1,14 +1,12 @@ btnFileOpen=Select .NSP files btnUpload=Upload to NS FilesChooserFileChooser=Selecting single .NSP file: -windowItsWindowsMessage=You're on Windows host machine!\nI refuse to work!\n logsEnteredAsMsg1=You have been entered as: logsEnteredAsMsg2=You should be root or have configured 'udev' rules for this user to avoid any issues. logsFilesToUploadTitle=Files to upload: logsGreetingsMessage=Welcome to NS-USBloader logsNoFolderFileSelected=No files selected: nothing to upload. windowBodyConfirmExit=Data transfer is in progress and closing this application will interrupt it.\nIt's the worse thing you can do now.\nInterrupt proccess and exit? -windowErrorHeader=Error windowTitleConfirmExit=No, don't do this! btnStop=Interrupt logsGreetingsMessage2=--\n\ diff --git a/src/main/resources/locale_ru.properties b/src/main/resources/locale_ru.properties index f41f9fc..e03c48e 100644 --- a/src/main/resources/locale_ru.properties +++ b/src/main/resources/locale_ru.properties @@ -1,14 +1,12 @@ btnFileOpen=\u0412\u044B\u0431\u0440\u0430\u0442\u044C .NSP \u0444\u0430\u0439\u043B\u044B btnUpload=\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C \u0432 NS FilesChooserFileChooser=\u0412\u044B\u0431\u043E\u0440 \u043E\u0434\u043D\u043E\u0433\u043E .NSP \u0444\u0430\u0439\u043B\u0430: -windowItsWindowsMessage=\u042D\u0442\u043E \u0436\u0435 Windows!\n\u0422\u0443\u0442 \u044F \u0440\u0430\u0431\u043E\u0442\u0430\u0442\u044C \u043D\u0435 \u0431\u0443\u0434\u0443! logsEnteredAsMsg1=\u0412\u044B \u0432\u043E\u0448\u043B\u0438 \u043A\u0430\u043A: logsEnteredAsMsg2=\u0427\u0442\u043E\u0431\u044B \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044C \u043E\u0448\u0438\u0431\u043E\u043A, \u0432\u044B \u0434\u043E\u043B\u0436\u043D\u044B \u0431\u044B\u0442\u044C root \u0438\u043B\u0438 \u043D\u0430\u0441\u0442\u0440\u043E\u0438\u0442\u044C \u043F\u0440\u0430\u0432\u0438\u043B\u0430 'udev' \u0434\u043B\u044F \u044D\u0442\u043E\u0433\u043E \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F. logsFilesToUploadTitle=\u0424\u0430\u0439\u043B\u044B \u0434\u043B\u044F \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0438: logsGreetingsMessage=\u0414\u043E\u0431\u0440\u043E \u043F\u043E\u0436\u0430\u043B\u043E\u0432\u0430\u0442\u044C \u0432 NS-USBloader logsNoFolderFileSelected=\u041D\u0435 \u0432\u044B\u0431\u0440\u0430\u043D\u043E \u043D\u0438 \u0435\u0434\u0438\u043D\u043E\u0433\u043E \u0444\u0430\u0439\u043B\u0430: \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044C \u043D\u0435\u0447\u0435\u0433\u043E. windowBodyConfirmExit=\u0421\u0435\u0439\u0447\u0430\u0441 \u043F\u0440\u043E\u0438\u0441\u0445\u043E\u0434\u0438\u0442 \u043F\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0434\u0430\u043D\u043D\u044B\u0445 \u0438 \u0437\u0430\u043A\u0440\u044B\u0442\u0438\u0435 \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u044F \u043F\u0440\u0435\u0440\u0432\u0451\u0442 \u043F\u0435\u0440\u0435\u0434\u0430\u0447\u0443.\n\u042D\u0442\u043E \u0445\u0443\u0434\u0448\u0435\u0435 \u0447\u0442\u043E \u0442\u044B \u043C\u043E\u0436\u0435\u0448\u044C \u0441\u0435\u0439\u0447\u0430\u0441 \u0441\u0434\u0435\u043B\u0430\u0442\u044C.\n\u041F\u0440\u0435\u0440\u0432\u0430\u0442\u044C \u043F\u0440\u043E\u0446\u0435\u0441\u0441 \u0438 \u0432\u044B\u0439\u0442\u0438? -windowErrorHeader=\u041E\u0448\u0438\u0431\u043A\u0430 windowTitleConfirmExit=\u041D\u0435\u0442, \u043E\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0441\u044C! btnStop=\u041F\u0440\u0435\u0440\u0432\u0430\u0442\u044C logsGreetingsMessage2=--\n\ diff --git a/src/main/resources/res/app.css b/src/main/resources/res/app.css index befaffa..b68dee0 100644 --- a/src/main/resources/res/app.css +++ b/src/main/resources/res/app.css @@ -24,7 +24,7 @@ -fx-background-color: #6a6a6a; } -.button:pressed, .dialog-pane .button:pressed{ +.button:pressed{ -fx-background-color: #4f4f4f; -fx-border-color: #289de8; -fx-border-radius: 3; @@ -59,7 +59,6 @@ .progress-bar { -fx-background-color: transparent; -fx-box-border: transparent; - -fx-max-height: 10px; } .progress-bar > .track { -fx-background-color: transparent; @@ -67,10 +66,24 @@ } .progress-bar > .bar { -fx-background-color: linear-gradient(to right, #00bce4, #ff5f53); - -fx-background-insets: 3 3 4 3; -fx-background-radius: 2; + -fx-background-insets: 1 1 2 1; + -fx-padding: 0.23em; } +.dialog-pane { + -fx-background-color: #4f4f4f; +} +.dialog-pane > .button-bar > .container{ + -fx-background-color: #2d2d2d; +} + +.dialog-pane > .label{ + -fx-padding: 10 5 10 5; +} + + + .regionUpload{ -fx-shape: "M8,21V19H16V21H8M8,17V15H16V17H8M8,13V11H16V13H8M19,9H5L12,2L19,9Z"; -fx-background-color: #a2e019;