From c2fb6bcfee73bf9aa738f0681e27ea9e019f27ed Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Mon, 24 Aug 2020 14:52:05 +0200 Subject: [PATCH] build, versioning and cross-platform about dlg --- build.gradle | 13 ++++++++++--- .../com/sparrowwallet/sparrow/AboutController.java | 9 +++++++++ .../com/sparrowwallet/sparrow/AppController.java | 12 +++++++++++- .../java/com/sparrowwallet/sparrow/MainApp.java | 1 + .../resources/com/sparrowwallet/sparrow/about.fxml | 2 +- .../resources/com/sparrowwallet/sparrow/app.fxml | 3 ++- 6 files changed, 34 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index 64fc57be..e2367bc9 100644 --- a/build.gradle +++ b/build.gradle @@ -5,8 +5,10 @@ plugins { id 'org.beryx.jlink' version '2.17.4' } -group 'com.sparrowwallet' -version '1.0-SNAPSHOT' +def sparrowVersion = '0.9.1' + +group "com.sparrowwallet" +version "${sparrowVersion}" sourceCompatibility = 1.9 @@ -16,6 +18,11 @@ repositories { maven { url 'https://mymavenrepo.com/repo/29EACwkkGcoOKnbx3bxN/' } } +tasks.withType(AbstractArchiveTask) { + preserveFileTimestamps = false + reproducibleFileOrder = true +} + javafx { version = "14" modules = [ 'javafx.controls', 'javafx.fxml', 'javafx.swing', 'javafx.graphics' ] @@ -118,7 +125,7 @@ jlink { jpackage { imageName = "Sparrow" installerName = "Sparrow" - appVersion = "0.9.1" + appVersion = "${sparrowVersion}" skipInstaller = true imageOptions = [] installerOptions = [ diff --git a/src/main/java/com/sparrowwallet/sparrow/AboutController.java b/src/main/java/com/sparrowwallet/sparrow/AboutController.java index 1b6b8cc9..07472f54 100644 --- a/src/main/java/com/sparrowwallet/sparrow/AboutController.java +++ b/src/main/java/com/sparrowwallet/sparrow/AboutController.java @@ -1,11 +1,20 @@ package com.sparrowwallet.sparrow; import javafx.event.ActionEvent; +import javafx.fxml.FXML; +import javafx.scene.control.Label; import javafx.stage.Stage; public class AboutController { private Stage stage; + @FXML + private Label title; + + public void initializeView() { + title.setText(MainApp.APP_NAME + " " + MainApp.APP_VERSION); + } + public void setStage(Stage stage) { this.stage = stage; } diff --git a/src/main/java/com/sparrowwallet/sparrow/AppController.java b/src/main/java/com/sparrowwallet/sparrow/AppController.java index bd7c978f..37d39229 100644 --- a/src/main/java/com/sparrowwallet/sparrow/AppController.java +++ b/src/main/java/com/sparrowwallet/sparrow/AppController.java @@ -87,6 +87,9 @@ public class AppController implements Initializable { @FXML private Menu fileMenu; + @FXML + private Menu helpMenu; + @FXML private MenuItem openTransactionIdItem; @@ -344,9 +347,15 @@ public class AppController implements Initializable { tk.setApplicationMenu(defaultApplicationMenu); fileMenu.getItems().removeIf(item -> item.getStyleClass().contains("macHide")); + helpMenu.getItems().removeIf(item -> item.getStyleClass().contains("macHide")); } } + public void showAbout(ActionEvent event) { + Stage aboutStage = getAboutStage(); + aboutStage.show(); + } + private Stage getAboutStage() { try { FXMLLoader loader = new FXMLLoader(AppController.class.getResource("about.fxml")); @@ -354,11 +363,12 @@ public class AppController implements Initializable { AboutController controller = loader.getController(); Stage stage = new Stage(); - stage.setTitle("About Sparrow"); + stage.setTitle("About " + MainApp.APP_NAME); stage.initStyle(StageStyle.UNDECORATED); stage.setResizable(false); stage.setScene(new Scene(root)); controller.setStage(stage); + controller.initializeView(); return stage; } catch(IOException e) { diff --git a/src/main/java/com/sparrowwallet/sparrow/MainApp.java b/src/main/java/com/sparrowwallet/sparrow/MainApp.java index f8cce20d..c7eae173 100644 --- a/src/main/java/com/sparrowwallet/sparrow/MainApp.java +++ b/src/main/java/com/sparrowwallet/sparrow/MainApp.java @@ -22,6 +22,7 @@ import java.util.Optional; public class MainApp extends Application { public static final String APP_NAME = "Sparrow"; + public static final String APP_VERSION = "0.9.1"; private Stage mainStage; diff --git a/src/main/resources/com/sparrowwallet/sparrow/about.fxml b/src/main/resources/com/sparrowwallet/sparrow/about.fxml index a6d15f27..7ba67d3a 100644 --- a/src/main/resources/com/sparrowwallet/sparrow/about.fxml +++ b/src/main/resources/com/sparrowwallet/sparrow/about.fxml @@ -12,7 +12,7 @@ - diff --git a/src/main/resources/com/sparrowwallet/sparrow/app.fxml b/src/main/resources/com/sparrowwallet/sparrow/app.fxml index ab80b2b9..767968dc 100644 --- a/src/main/resources/com/sparrowwallet/sparrow/app.fxml +++ b/src/main/resources/com/sparrowwallet/sparrow/app.fxml @@ -64,7 +64,8 @@ - + +