diff --git a/drongo b/drongo index 59d610f5..c7e16a29 160000 --- a/drongo +++ b/drongo @@ -1 +1 @@ -Subproject commit 59d610f5395cab69a33cf675b3fb116f7e09394c +Subproject commit c7e16a29e33d802ac209c046eddb5e040b76f704 diff --git a/src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java b/src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java index 2c4ecd77..b8ca9036 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java @@ -270,10 +270,11 @@ public class TransactionDiagram extends GridPane { outputsBox.setAlignment(Pos.CENTER_LEFT); outputsBox.getChildren().add(createSpacer()); + boolean isConsolidation = walletTx.isConsolidationSend(); String recipientDesc = walletTx.getRecipientAddress().toString().substring(0, 8) + "..."; - Label recipientLabel = new Label(recipientDesc, getSendGlyph()); + Label recipientLabel = new Label(recipientDesc, isConsolidation ? getConsolidationGlyph() : getPaymentGlyph()); recipientLabel.getStyleClass().addAll("output-label", "recipient-label"); - Tooltip recipientTooltip = new Tooltip("Send " + getSatsValue(walletTx.getRecipientAmount()) + " sats to\n" + walletTx.getRecipientAddress().toString()); + Tooltip recipientTooltip = new Tooltip((isConsolidation ? "Consolidate " : "Pay ") + getSatsValue(walletTx.getRecipientAmount()) + " sats to\n" + walletTx.getRecipientAddress().toString()); recipientLabel.setTooltip(recipientTooltip); outputsBox.getChildren().add(recipientLabel); outputsBox.getChildren().add(createSpacer()); @@ -323,14 +324,21 @@ public class TransactionDiagram extends GridPane { return spacer; } - private Glyph getSendGlyph() { - Glyph sendGlyph = new Glyph("FontAwesome", FontAwesome.Glyph.SEND); - sendGlyph.getStyleClass().add("send-icon"); - sendGlyph.setFontSize(12); - return sendGlyph; + public static Glyph getPaymentGlyph() { + Glyph paymentGlyph = new Glyph("FontAwesome", FontAwesome.Glyph.SEND); + paymentGlyph.getStyleClass().add("payment-icon"); + paymentGlyph.setFontSize(12); + return paymentGlyph; } - private Glyph getChangeGlyph() { + public static Glyph getConsolidationGlyph() { + Glyph consolidationGlyph = new Glyph("Font Awesome 5 Free Solid", FontAwesome5.Glyph.REPLY_ALL); + consolidationGlyph.getStyleClass().add("consolidation-icon"); + consolidationGlyph.setFontSize(12); + return consolidationGlyph; + } + + public static Glyph getChangeGlyph() { Glyph changeGlyph = new Glyph("Font Awesome 5 Free Solid", FontAwesome5.Glyph.COINS); changeGlyph.getStyleClass().add("change-icon"); changeGlyph.setFontSize(12); diff --git a/src/main/java/com/sparrowwallet/sparrow/glyphfont/FontAwesome5.java b/src/main/java/com/sparrowwallet/sparrow/glyphfont/FontAwesome5.java index 3f9ab3ea..9b14c73a 100644 --- a/src/main/java/com/sparrowwallet/sparrow/glyphfont/FontAwesome5.java +++ b/src/main/java/com/sparrowwallet/sparrow/glyphfont/FontAwesome5.java @@ -36,6 +36,7 @@ public class FontAwesome5 extends GlyphFont { PEN_FANCY('\uf5ac'), QRCODE('\uf029'), QUESTION_CIRCLE('\uf059'), + REPLY_ALL('\uf122'), SATELLITE_DISH('\uf7c0'), SD_CARD('\uf7c2'), SEARCH('\uf002'), diff --git a/src/main/java/com/sparrowwallet/sparrow/transaction/OutputController.java b/src/main/java/com/sparrowwallet/sparrow/transaction/OutputController.java index 5c0dda33..900efd50 100644 --- a/src/main/java/com/sparrowwallet/sparrow/transaction/OutputController.java +++ b/src/main/java/com/sparrowwallet/sparrow/transaction/OutputController.java @@ -9,10 +9,7 @@ import com.sparrowwallet.drongo.protocol.TransactionOutput; import com.sparrowwallet.drongo.wallet.BlockTransaction; import com.sparrowwallet.drongo.wallet.Wallet; import com.sparrowwallet.sparrow.EventManager; -import com.sparrowwallet.sparrow.control.AddressLabel; -import com.sparrowwallet.sparrow.control.CoinLabel; -import com.sparrowwallet.sparrow.control.CopyableLabel; -import com.sparrowwallet.sparrow.control.ScriptArea; +import com.sparrowwallet.sparrow.control.*; import com.sparrowwallet.sparrow.event.BitcoinUnitChangedEvent; import com.sparrowwallet.sparrow.event.BlockTransactionOutputsFetchedEvent; import com.sparrowwallet.sparrow.event.ViewTransactionEvent; @@ -40,9 +37,6 @@ public class OutputController extends TransactionFormController implements Initi @FXML private CopyableLabel to; - @FXML - private CopyableLabel walletType; - @FXML private AddressLabel address; @@ -69,7 +63,10 @@ public class OutputController extends TransactionFormController implements Initi public void initializeView() { TransactionOutput txOutput = outputForm.getTransactionOutput(); - outputFieldset.setText("Output #" + txOutput.getIndex()); + outputForm.signingWalletProperty().addListener((observable, oldValue, signingWallet) -> { + updateOutputLegendFromWallet(txOutput, signingWallet); + }); + updateOutputLegendFromWallet(txOutput, outputForm.getSigningWallet()); value.setValue(txOutput.getValue()); to.setVisible(false); @@ -85,13 +82,6 @@ public class OutputController extends TransactionFormController implements Initi //ignore } - walletType.managedProperty().bind(walletType.visibleProperty()); - walletType.setVisible(false); - outputForm.signingWalletProperty().addListener((observable, oldValue, signingWallet) -> { - updateWalletType(txOutput, signingWallet); - }); - updateWalletType(txOutput, outputForm.getSigningWallet()); - spentField.managedProperty().bind(spentField.visibleProperty()); spentByField.managedProperty().bind(spentByField.visibleProperty()); spentByField.setVisible(false); @@ -109,18 +99,26 @@ public class OutputController extends TransactionFormController implements Initi scriptPubKeyArea.appendScript(txOutput.getScript(), null, null); } - private void updateWalletType(TransactionOutput txOutput, Wallet signingWallet) { + private String getLegendText(TransactionOutput txOutput) { + return "Output #" + txOutput.getIndex(); + } + + private void updateOutputLegendFromWallet(TransactionOutput txOutput, Wallet signingWallet) { + String baseText = getLegendText(txOutput); if(signingWallet != null) { - walletType.setVisible(true); if(signingWallet.getWalletOutputScripts(KeyPurpose.RECEIVE).containsKey(txOutput.getScript())) { - walletType.setText("(Consolidation)"); + outputFieldset.setText(baseText + " - Consolidation"); + outputFieldset.setIcon(TransactionDiagram.getConsolidationGlyph()); } else if(signingWallet.getWalletOutputScripts(KeyPurpose.CHANGE).containsKey(txOutput.getScript())) { - walletType.setText("(Change)"); + outputFieldset.setText(baseText + " - Change"); + outputFieldset.setIcon(TransactionDiagram.getChangeGlyph()); } else { - walletType.setText("(Payment)"); + outputFieldset.setText(baseText + " - Payment"); + outputFieldset.setIcon(TransactionDiagram.getPaymentGlyph()); } } else { - walletType.setVisible(false); + outputFieldset.setText(baseText); + outputFieldset.setIcon(null); } } diff --git a/src/main/resources/com/sparrowwallet/sparrow/transaction/output.css b/src/main/resources/com/sparrowwallet/sparrow/transaction/output.css index 094ee21a..c7b1c4d8 100644 --- a/src/main/resources/com/sparrowwallet/sparrow/transaction/output.css +++ b/src/main/resources/com/sparrowwallet/sparrow/transaction/output.css @@ -28,4 +28,9 @@ #spentByField .input-container { -fx-alignment: center-left; +} + +.legend { + -fx-content-display: RIGHT; + -fx-graphic-text-gap: 5px; } \ No newline at end of file diff --git a/src/main/resources/com/sparrowwallet/sparrow/transaction/output.fxml b/src/main/resources/com/sparrowwallet/sparrow/transaction/output.fxml index 32692734..fe7a7e66 100644 --- a/src/main/resources/com/sparrowwallet/sparrow/transaction/output.fxml +++ b/src/main/resources/com/sparrowwallet/sparrow/transaction/output.fxml @@ -34,7 +34,6 @@ -