diff --git a/drongo b/drongo index efaa6a06..b0d37fe8 160000 --- a/drongo +++ b/drongo @@ -1 +1 @@ -Subproject commit efaa6a066d2b7d7f982086060aa8f014ca89a190 +Subproject commit b0d37fe8fe6a4bec756e8c24bee562d1a377cf10 diff --git a/src/main/java/com/sparrowwallet/sparrow/wallet/ReceiveController.java b/src/main/java/com/sparrowwallet/sparrow/wallet/ReceiveController.java index 1f6d9cba..a6333d75 100644 --- a/src/main/java/com/sparrowwallet/sparrow/wallet/ReceiveController.java +++ b/src/main/java/com/sparrowwallet/sparrow/wallet/ReceiveController.java @@ -7,11 +7,9 @@ import com.google.zxing.client.j2se.MatrixToImageConfig; import com.google.zxing.client.j2se.MatrixToImageWriter; import com.google.zxing.common.BitMatrix; import com.google.zxing.qrcode.QRCodeWriter; -import com.sparrowwallet.drongo.KeyDerivation; import com.sparrowwallet.drongo.KeyPurpose; import com.sparrowwallet.drongo.OutputDescriptor; import com.sparrowwallet.drongo.wallet.BlockTransactionHashIndex; -import com.sparrowwallet.drongo.wallet.Keystore; import com.sparrowwallet.drongo.wallet.KeystoreSource; import com.sparrowwallet.drongo.wallet.Wallet; import com.sparrowwallet.sparrow.AppServices; @@ -23,6 +21,7 @@ import com.sparrowwallet.sparrow.io.Device; import com.sparrowwallet.sparrow.io.Hwi; import javafx.application.Platform; import javafx.event.ActionEvent; +import javafx.event.EventHandler; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.Button; @@ -30,6 +29,7 @@ import javafx.scene.control.Label; import javafx.scene.control.TextField; import javafx.scene.image.Image; import javafx.scene.image.ImageView; +import javafx.scene.input.MouseEvent; import org.controlsfx.glyphfont.Glyph; import org.fxmisc.richtext.CodeArea; import org.slf4j.Logger; @@ -88,6 +88,15 @@ public class ReceiveController extends WalletFormController implements Initializ displayAddress.managedProperty().bind(displayAddress.visibleProperty()); displayAddress.setVisible(false); + + qrCode.setOnMouseClicked(event -> { + if(currentEntry != null) { + QRDisplayDialog qrDisplayDialog = new QRDisplayDialog(currentEntry.getAddress().toString()); + qrDisplayDialog.showAndWait(); + } + }); + + Platform.runLater(this::refreshAddress); } public void setNodeEntry(NodeEntry nodeEntry) { @@ -138,7 +147,7 @@ public class ReceiveController extends WalletFormController implements Initializ } } else { lastUsed.setText("Unknown"); - lastUsed.setGraphic(null); + lastUsed.setGraphic(getUnknownGlyph()); address.getStyleClass().remove("error"); address.setDisable(false); } @@ -189,6 +198,10 @@ public class ReceiveController extends WalletFormController implements Initializ } public void getNewAddress(ActionEvent event) { + refreshAddress(); + } + + public void refreshAddress() { NodeEntry freshEntry = getWalletForm().getFreshNodeEntry(KeyPurpose.RECEIVE, currentEntry); setNodeEntry(freshEntry); } @@ -252,6 +265,12 @@ public class ReceiveController extends WalletFormController implements Initializ return duplicateGlyph; } + public static Glyph getUnknownGlyph() { + Glyph duplicateGlyph = new Glyph(FontAwesome5.FONT_NAME, FontAwesome5.Glyph.QUESTION_CIRCLE); + duplicateGlyph.setFontSize(12); + return duplicateGlyph; + } + @Subscribe public void walletAddressesChanged(WalletAddressesChangedEvent event) { displayAddress.setUserData(null); @@ -267,7 +286,8 @@ public class ReceiveController extends WalletFormController implements Initializ @Subscribe public void walletNodesChanged(WalletNodesChangedEvent event) { if(event.getWallet().equals(walletForm.getWallet())) { - clear(); + currentEntry = null; + refreshAddress(); } } @@ -275,7 +295,7 @@ public class ReceiveController extends WalletFormController implements Initializ public void walletHistoryChanged(WalletHistoryChangedEvent event) { if(event.getWallet().equals(walletForm.getWallet())) { if(currentEntry != null && event.getHistoryChangedNodes().contains(currentEntry.getNode())) { - updateLastUsed(); + refreshAddress(); } } } diff --git a/src/main/resources/com/sparrowwallet/sparrow/wallet/receive.fxml b/src/main/resources/com/sparrowwallet/sparrow/wallet/receive.fxml index 1338ba97..3930ecad 100644 --- a/src/main/resources/com/sparrowwallet/sparrow/wallet/receive.fxml +++ b/src/main/resources/com/sparrowwallet/sparrow/wallet/receive.fxml @@ -44,7 +44,7 @@ -