build, versioning and cross-platform about dlg

This commit is contained in:
Craig Raw 2020-08-24 14:52:05 +02:00
parent 8cde670efd
commit c2fb6bcfee
6 changed files with 34 additions and 6 deletions

View file

@ -5,8 +5,10 @@ plugins {
id 'org.beryx.jlink' version '2.17.4' id 'org.beryx.jlink' version '2.17.4'
} }
group 'com.sparrowwallet' def sparrowVersion = '0.9.1'
version '1.0-SNAPSHOT'
group "com.sparrowwallet"
version "${sparrowVersion}"
sourceCompatibility = 1.9 sourceCompatibility = 1.9
@ -16,6 +18,11 @@ repositories {
maven { url 'https://mymavenrepo.com/repo/29EACwkkGcoOKnbx3bxN/' } maven { url 'https://mymavenrepo.com/repo/29EACwkkGcoOKnbx3bxN/' }
} }
tasks.withType(AbstractArchiveTask) {
preserveFileTimestamps = false
reproducibleFileOrder = true
}
javafx { javafx {
version = "14" version = "14"
modules = [ 'javafx.controls', 'javafx.fxml', 'javafx.swing', 'javafx.graphics' ] modules = [ 'javafx.controls', 'javafx.fxml', 'javafx.swing', 'javafx.graphics' ]
@ -118,7 +125,7 @@ jlink {
jpackage { jpackage {
imageName = "Sparrow" imageName = "Sparrow"
installerName = "Sparrow" installerName = "Sparrow"
appVersion = "0.9.1" appVersion = "${sparrowVersion}"
skipInstaller = true skipInstaller = true
imageOptions = [] imageOptions = []
installerOptions = [ installerOptions = [

View file

@ -1,11 +1,20 @@
package com.sparrowwallet.sparrow; package com.sparrowwallet.sparrow;
import javafx.event.ActionEvent; import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.stage.Stage; import javafx.stage.Stage;
public class AboutController { public class AboutController {
private Stage stage; private Stage stage;
@FXML
private Label title;
public void initializeView() {
title.setText(MainApp.APP_NAME + " " + MainApp.APP_VERSION);
}
public void setStage(Stage stage) { public void setStage(Stage stage) {
this.stage = stage; this.stage = stage;
} }

View file

@ -87,6 +87,9 @@ public class AppController implements Initializable {
@FXML @FXML
private Menu fileMenu; private Menu fileMenu;
@FXML
private Menu helpMenu;
@FXML @FXML
private MenuItem openTransactionIdItem; private MenuItem openTransactionIdItem;
@ -344,9 +347,15 @@ public class AppController implements Initializable {
tk.setApplicationMenu(defaultApplicationMenu); tk.setApplicationMenu(defaultApplicationMenu);
fileMenu.getItems().removeIf(item -> item.getStyleClass().contains("macHide")); 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() { private Stage getAboutStage() {
try { try {
FXMLLoader loader = new FXMLLoader(AppController.class.getResource("about.fxml")); FXMLLoader loader = new FXMLLoader(AppController.class.getResource("about.fxml"));
@ -354,11 +363,12 @@ public class AppController implements Initializable {
AboutController controller = loader.getController(); AboutController controller = loader.getController();
Stage stage = new Stage(); Stage stage = new Stage();
stage.setTitle("About Sparrow"); stage.setTitle("About " + MainApp.APP_NAME);
stage.initStyle(StageStyle.UNDECORATED); stage.initStyle(StageStyle.UNDECORATED);
stage.setResizable(false); stage.setResizable(false);
stage.setScene(new Scene(root)); stage.setScene(new Scene(root));
controller.setStage(stage); controller.setStage(stage);
controller.initializeView();
return stage; return stage;
} catch(IOException e) { } catch(IOException e) {

View file

@ -22,6 +22,7 @@ import java.util.Optional;
public class MainApp extends Application { public class MainApp extends Application {
public static final String APP_NAME = "Sparrow"; public static final String APP_NAME = "Sparrow";
public static final String APP_VERSION = "0.9.1";
private Stage mainStage; private Stage mainStage;

View file

@ -12,7 +12,7 @@
<VBox spacing="20"> <VBox spacing="20">
<HBox styleClass="title-area"> <HBox styleClass="title-area">
<HBox alignment="CENTER_LEFT"> <HBox alignment="CENTER_LEFT">
<Label text="Sparrow 0.9.1" styleClass="title-label" /> <Label fx:id="title" text="Sparrow" styleClass="title-label" />
</HBox> </HBox>
<Region HBox.hgrow="ALWAYS"/> <Region HBox.hgrow="ALWAYS"/>
<ImageView AnchorPane.rightAnchor="0"> <ImageView AnchorPane.rightAnchor="0">

View file

@ -64,7 +64,8 @@
<CheckMenuItem fx:id="showTxHex" mnemonicParsing="false" text="Show Transaction Hex" onAction="#showTxHex"/> <CheckMenuItem fx:id="showTxHex" mnemonicParsing="false" text="Show Transaction Hex" onAction="#showTxHex"/>
</items> </items>
</Menu> </Menu>
<Menu mnemonicParsing="false" text="Help"> <Menu fx:id="helpMenu" mnemonicParsing="false" text="Help">
<MenuItem styleClass="macHide" mnemonicParsing="false" text="About Sparrow" onAction="#showAbout"/>
</Menu> </Menu>
</menus> </menus>
</MenuBar> </MenuBar>