mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2026-08-12 01:27:33 +00:00
build, versioning and cross-platform about dlg
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user