mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2025-11-05 11:56:37 +00:00
[feature/1630] Button positioning improvements
This commit is contained in:
parent
0c4b281475
commit
111e4ccf37
3 changed files with 26 additions and 23 deletions
|
|
@ -191,6 +191,10 @@ public class QRDisplayDialog extends Dialog<ButtonType> {
|
||||||
setResultConverter(dialogButton -> dialogButton);
|
setResultConverter(dialogButton -> dialogButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static QRDisplayDialog of(UR ur, BBQR bbqr, boolean addLegacyEncodingOption, boolean addScanButton, boolean selectBbqrButton) {
|
||||||
|
return new QRDisplayDialog(ur, bbqr, addLegacyEncodingOption, addScanButton, selectBbqrButton);
|
||||||
|
}
|
||||||
|
|
||||||
private int getQRSize() {
|
private int getQRSize() {
|
||||||
return AppServices.isReducedWindowHeight() ? REDUCED_QR_SIZE : DEFAULT_QR_SIZE;
|
return AppServices.isReducedWindowHeight() ? REDUCED_QR_SIZE : DEFAULT_QR_SIZE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -229,10 +229,10 @@ public class HeadersController extends TransactionFormController implements Init
|
||||||
private Button broadcastButton;
|
private Button broadcastButton;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private Button saveFinalButton;
|
private Button showTransactionButton;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private Button showTransactionButton;
|
private Button saveFinalButton;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private Button payjoinButton;
|
private Button payjoinButton;
|
||||||
|
|
@ -465,10 +465,10 @@ public class HeadersController extends TransactionFormController implements Init
|
||||||
broadcastProgressBar.visibleProperty().bind(signaturesProgressBar.visibleProperty().not());
|
broadcastProgressBar.visibleProperty().bind(signaturesProgressBar.visibleProperty().not());
|
||||||
|
|
||||||
broadcastButton.managedProperty().bind(broadcastButton.visibleProperty());
|
broadcastButton.managedProperty().bind(broadcastButton.visibleProperty());
|
||||||
saveFinalButton.managedProperty().bind(saveFinalButton.visibleProperty());
|
|
||||||
saveFinalButton.visibleProperty().bind(broadcastButton.visibleProperty().not());
|
|
||||||
showTransactionButton.managedProperty().bind(showTransactionButton.visibleProperty());
|
showTransactionButton.managedProperty().bind(showTransactionButton.visibleProperty());
|
||||||
showTransactionButton.visibleProperty().bind(broadcastButton.visibleProperty().not());
|
showTransactionButton.visibleProperty().bind(broadcastButton.visibleProperty().not());
|
||||||
|
saveFinalButton.managedProperty().bind(saveFinalButton.visibleProperty());
|
||||||
|
saveFinalButton.visibleProperty().bind(broadcastButton.visibleProperty().not());
|
||||||
broadcastButton.visibleProperty().bind(AppServices.onlineProperty());
|
broadcastButton.visibleProperty().bind(AppServices.onlineProperty());
|
||||||
|
|
||||||
BitcoinURI payjoinURI = getPayjoinURI();
|
BitcoinURI payjoinURI = getPayjoinURI();
|
||||||
|
|
@ -1261,6 +1261,19 @@ public class HeadersController extends TransactionFormController implements Init
|
||||||
broadcastTransactionService.start();
|
broadcastTransactionService.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void showTransaction(ActionEvent event) {
|
||||||
|
try {
|
||||||
|
Transaction transaction = headersForm.getPsbt().extractTransaction();
|
||||||
|
byte[] txBytes = transaction.bitcoinSerialize();
|
||||||
|
UR ur = UR.fromBytes(txBytes);
|
||||||
|
BBQR bbqr = new BBQR(BBQRType.TXN, txBytes);
|
||||||
|
QRDisplayDialog.of(ur, bbqr, false, false, false).showAndWait();
|
||||||
|
} catch (Exception exception) {
|
||||||
|
log.error("Error creating UR", exception);
|
||||||
|
AppServices.showErrorDialog("Error displaying transaction QR code", exception.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void saveFinalTransaction(ActionEvent event) {
|
public void saveFinalTransaction(ActionEvent event) {
|
||||||
Stage window = new Stage();
|
Stage window = new Stage();
|
||||||
|
|
||||||
|
|
@ -1286,20 +1299,6 @@ public class HeadersController extends TransactionFormController implements Init
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showTransaction(ActionEvent event) {
|
|
||||||
try {
|
|
||||||
Transaction transaction = headersForm.getPsbt().extractTransaction();
|
|
||||||
byte[] txBytes = transaction.bitcoinSerialize();
|
|
||||||
UR ur = UR.fromBytes(txBytes);
|
|
||||||
BBQR bbqr = new BBQR(BBQRType.TXN, txBytes);
|
|
||||||
QRDisplayDialog qrDisplayDialog = new QRDisplayDialog(ur, bbqr, false, false, false);
|
|
||||||
qrDisplayDialog.showAndWait();
|
|
||||||
} catch (Exception exception) {
|
|
||||||
log.error("Error creating UR", exception);
|
|
||||||
AppServices.showErrorDialog("Error displaying transaction QR code", exception.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void getPayjoinTransaction(ActionEvent event) {
|
public void getPayjoinTransaction(ActionEvent event) {
|
||||||
BitcoinURI payjoinURI = getPayjoinURI();
|
BitcoinURI payjoinURI = getPayjoinURI();
|
||||||
if(payjoinURI == null) {
|
if(payjoinURI == null) {
|
||||||
|
|
|
||||||
|
|
@ -285,6 +285,11 @@
|
||||||
<Glyph fontFamily="Font Awesome 5 Free Solid" fontSize="20" icon="SATELLITE_DISH" />
|
<Glyph fontFamily="Font Awesome 5 Free Solid" fontSize="20" icon="SATELLITE_DISH" />
|
||||||
</graphic>
|
</graphic>
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button fx:id="showTransactionButton" HBox.hgrow="ALWAYS" text="Show Transaction as QR" contentDisplay="TOP" wrapText="true" textAlignment="CENTER" onAction="#showTransaction">
|
||||||
|
<graphic>
|
||||||
|
<Glyph fontFamily="Font Awesome 5 Free Solid" fontSize="20" icon="QRCODE" />
|
||||||
|
</graphic>
|
||||||
|
</Button>
|
||||||
<Button fx:id="saveFinalButton" defaultButton="true" HBox.hgrow="ALWAYS" text="Save Final Transaction" contentDisplay="TOP" wrapText="true" textAlignment="CENTER" onAction="#saveFinalTransaction">
|
<Button fx:id="saveFinalButton" defaultButton="true" HBox.hgrow="ALWAYS" text="Save Final Transaction" contentDisplay="TOP" wrapText="true" textAlignment="CENTER" onAction="#saveFinalTransaction">
|
||||||
<graphic>
|
<graphic>
|
||||||
<Glyph fontFamily="Font Awesome 5 Free Solid" fontSize="20" icon="ARROW_DOWN" />
|
<Glyph fontFamily="Font Awesome 5 Free Solid" fontSize="20" icon="ARROW_DOWN" />
|
||||||
|
|
@ -293,11 +298,6 @@
|
||||||
<Tooltip text="Connect to a server (bottom right toggle) to broadcast a transaction" />
|
<Tooltip text="Connect to a server (bottom right toggle) to broadcast a transaction" />
|
||||||
</tooltip>
|
</tooltip>
|
||||||
</Button>
|
</Button>
|
||||||
<Button fx:id="showTransactionButton" defaultButton="true" HBox.hgrow="ALWAYS" text="Show Transaction as QR" contentDisplay="TOP" wrapText="true" textAlignment="CENTER" onAction="#showTransaction">
|
|
||||||
<graphic>
|
|
||||||
<Glyph fontFamily="Font Awesome 5 Free Solid" fontSize="20" icon="QRCODE" />
|
|
||||||
</graphic>
|
|
||||||
</Button>
|
|
||||||
<Button fx:id="payjoinButton" defaultButton="true" HBox.hgrow="ALWAYS" text="Get Payjoin Transaction" contentDisplay="TOP" wrapText="true" textAlignment="CENTER" onAction="#getPayjoinTransaction">
|
<Button fx:id="payjoinButton" defaultButton="true" HBox.hgrow="ALWAYS" text="Get Payjoin Transaction" contentDisplay="TOP" wrapText="true" textAlignment="CENTER" onAction="#getPayjoinTransaction">
|
||||||
<graphic>
|
<graphic>
|
||||||
<Glyph fontFamily="Font Awesome 5 Free Solid" fontSize="20" icon="RANDOM" />
|
<Glyph fontFamily="Font Awesome 5 Free Solid" fontSize="20" icon="RANDOM" />
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue