diff --git a/build.gradle b/build.gradle index de04f3ea..7cbc2fb1 100644 --- a/build.gradle +++ b/build.gradle @@ -44,7 +44,9 @@ dependencies { mainClassName = 'com.sparrowwallet.sparrow.MainApp' - +run { + applicationDefaultJvmArgs = ["-Xdock:name=Sparrow", "-Xdock:icon=/Users/scy/git/sparrow/src/main/resources/sparrow.png"] +} jlink { mergedModule { @@ -59,4 +61,21 @@ jlink { name = 'sparrow' } addExtraDependencies("javafx") + jpackage { + imageName = "Sparrow" + installerName = "Sparrow" + appVersion = "0.1" + imageOptions = [] + installerOptions = [ + '--file-associations', 'src/main/resources/associations.properties', + ] + if (org.gradle.internal.os.OperatingSystem.current().windows) { + installerOptions += ['--win-per-user-install', '--win-dir-chooser', '--win-menu'] + } + if (org.gradle.internal.os.OperatingSystem.current().macOsX) { + imageOptions += ['--icon', 'src/main/resources/sparrow.icns'] + + installerType = "dmg" + } + } } diff --git a/drongo b/drongo index c7fe1822..8c4e6f4a 160000 --- a/drongo +++ b/drongo @@ -1 +1 @@ -Subproject commit c7fe182241226be5a5e9d587267e810a786d1e19 +Subproject commit 8c4e6f4ac831ad613be5d52481db6097da5a981b diff --git a/src/main/java/com/sparrowwallet/sparrow/AppController.java b/src/main/java/com/sparrowwallet/sparrow/AppController.java index 4c4dc5d3..1ec01d74 100644 --- a/src/main/java/com/sparrowwallet/sparrow/AppController.java +++ b/src/main/java/com/sparrowwallet/sparrow/AppController.java @@ -5,6 +5,7 @@ import com.sparrowwallet.drongo.protocol.Transaction; import com.sparrowwallet.drongo.psbt.PSBT; import com.sparrowwallet.drongo.psbt.PSBTParseException; import com.sparrowwallet.sparrow.transaction.TransactionController; +import com.sparrowwallet.sparrow.transaction.TransactionListener; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; @@ -28,6 +29,16 @@ public class AppController implements Initializable { @Override public void initialize(URL location, ResourceBundle resources) { + + } + + void initializeView() { + tabs.getSelectionModel().selectedItemProperty().addListener((observable, old_val, new_val) -> { + String tabName = new_val.getText(); + Stage tabStage = (Stage)tabs.getScene().getWindow(); + tabStage.setTitle("Sparrow - " + tabName); + }); + addExampleTxTabs(); } diff --git a/src/main/java/com/sparrowwallet/sparrow/MainApp.java b/src/main/java/com/sparrowwallet/sparrow/MainApp.java index ea7a1d92..aa83800b 100644 --- a/src/main/java/com/sparrowwallet/sparrow/MainApp.java +++ b/src/main/java/com/sparrowwallet/sparrow/MainApp.java @@ -4,19 +4,24 @@ import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; +import javafx.scene.image.Image; import javafx.stage.Stage; public class MainApp extends Application { @Override public void start(Stage stage) throws Exception { - Parent root = FXMLLoader.load(getClass().getResource("app.fxml")); + FXMLLoader transactionLoader = new FXMLLoader(getClass().getResource("app.fxml")); + Parent root = transactionLoader.load(); + AppController appController = transactionLoader.getController(); + appController.initializeView(); Scene scene = new Scene(root); scene.getStylesheets().add(getClass().getResource("app.css").toExternalForm()); stage.setTitle("Sparrow"); stage.setScene(scene); + stage.getIcons().add(new Image(MainApp.class.getResourceAsStream("/sparrow.png"))); stage.show(); } diff --git a/src/main/resources/associations.properties b/src/main/resources/associations.properties new file mode 100644 index 00000000..717f3943 --- /dev/null +++ b/src/main/resources/associations.properties @@ -0,0 +1,3 @@ +extension=psbt +mime-type=application/octet-stream +description=Partially Signed Bitcoin Transaction \ No newline at end of file diff --git a/src/main/resources/com/sparrowwallet/sparrow/app.fxml b/src/main/resources/com/sparrowwallet/sparrow/app.fxml index a66800e8..78e7c2a2 100644 --- a/src/main/resources/com/sparrowwallet/sparrow/app.fxml +++ b/src/main/resources/com/sparrowwallet/sparrow/app.fxml @@ -5,7 +5,7 @@ - + diff --git a/src/main/resources/sparrow-small.png b/src/main/resources/sparrow-small.png new file mode 100644 index 00000000..0309f3f9 Binary files /dev/null and b/src/main/resources/sparrow-small.png differ diff --git a/src/main/resources/sparrow.icns b/src/main/resources/sparrow.icns new file mode 100644 index 00000000..43c0dc9c Binary files /dev/null and b/src/main/resources/sparrow.icns differ diff --git a/src/main/resources/sparrow.png b/src/main/resources/sparrow.png new file mode 100644 index 00000000..e3d7c012 Binary files /dev/null and b/src/main/resources/sparrow.png differ