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'
}
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 = [

View file

@ -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;
}

View file

@ -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) {

View file

@ -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;

View file

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

View file

@ -64,7 +64,8 @@
<CheckMenuItem fx:id="showTxHex" mnemonicParsing="false" text="Show Transaction Hex" onAction="#showTxHex"/>
</items>
</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>
</menus>
</MenuBar>