mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-06-25 07:10:48 -04:00
copy monero payment uri to clipboard in qr code window
This commit is contained in:
parent
61a62a1d94
commit
03a1132c2f
2 changed files with 13 additions and 6 deletions
|
@ -765,9 +765,7 @@ public abstract class Overlay<T extends Overlay<T>> {
|
||||||
FormBuilder.getIconForLabel(AwesomeIcon.COPY, copyIcon, "1.1em");
|
FormBuilder.getIconForLabel(AwesomeIcon.COPY, copyIcon, "1.1em");
|
||||||
copyIcon.addEventHandler(MOUSE_CLICKED, mouseEvent -> {
|
copyIcon.addEventHandler(MOUSE_CLICKED, mouseEvent -> {
|
||||||
if (message != null) {
|
if (message != null) {
|
||||||
String forClipboard = headLineLabel.getText() + System.lineSeparator() + message
|
Utilities.copyToClipboard(getClipboardText());
|
||||||
+ System.lineSeparator() + (messageHyperlinks == null ? "" : messageHyperlinks.toString());
|
|
||||||
Utilities.copyToClipboard(forClipboard);
|
|
||||||
Tooltip tp = new Tooltip(Res.get("shared.copiedToClipboard"));
|
Tooltip tp = new Tooltip(Res.get("shared.copiedToClipboard"));
|
||||||
Node node = (Node) mouseEvent.getSource();
|
Node node = (Node) mouseEvent.getSource();
|
||||||
UserThread.runAfter(() -> tp.hide(), 1);
|
UserThread.runAfter(() -> tp.hide(), 1);
|
||||||
|
@ -1083,6 +1081,11 @@ public abstract class Overlay<T extends Overlay<T>> {
|
||||||
return isDisplayed;
|
return isDisplayed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getClipboardText() {
|
||||||
|
return headLineLabel.getText() + System.lineSeparator() + message
|
||||||
|
+ System.lineSeparator() + (messageHyperlinks == null ? "" : messageHyperlinks.toString());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Popup{" +
|
return "Popup{" +
|
||||||
|
|
|
@ -37,10 +37,10 @@ import java.io.ByteArrayInputStream;
|
||||||
public class QRCodeWindow extends Overlay<QRCodeWindow> {
|
public class QRCodeWindow extends Overlay<QRCodeWindow> {
|
||||||
private static final Logger log = LoggerFactory.getLogger(QRCodeWindow.class);
|
private static final Logger log = LoggerFactory.getLogger(QRCodeWindow.class);
|
||||||
private final ImageView qrCodeImageView;
|
private final ImageView qrCodeImageView;
|
||||||
private final String bitcoinURI;
|
private final String moneroUri;
|
||||||
|
|
||||||
public QRCodeWindow(String bitcoinURI) {
|
public QRCodeWindow(String bitcoinURI) {
|
||||||
this.bitcoinURI = bitcoinURI;
|
this.moneroUri = bitcoinURI;
|
||||||
final byte[] imageBytes = QRCode
|
final byte[] imageBytes = QRCode
|
||||||
.from(bitcoinURI)
|
.from(bitcoinURI)
|
||||||
.withSize(300, 300)
|
.withSize(300, 300)
|
||||||
|
@ -70,7 +70,7 @@ public class QRCodeWindow extends Overlay<QRCodeWindow> {
|
||||||
GridPane.setHalignment(qrCodeImageView, HPos.CENTER);
|
GridPane.setHalignment(qrCodeImageView, HPos.CENTER);
|
||||||
gridPane.getChildren().add(qrCodeImageView);
|
gridPane.getChildren().add(qrCodeImageView);
|
||||||
|
|
||||||
String request = bitcoinURI.replace("%20", " ").replace("?", "\n?").replace("&", "\n&");
|
String request = moneroUri.replace("%20", " ").replace("?", "\n?").replace("&", "\n&");
|
||||||
Label infoLabel = new AutoTooltipLabel(Res.get("qRCodeWindow.request", request));
|
Label infoLabel = new AutoTooltipLabel(Res.get("qRCodeWindow.request", request));
|
||||||
infoLabel.setMouseTransparent(true);
|
infoLabel.setMouseTransparent(true);
|
||||||
infoLabel.setWrapText(true);
|
infoLabel.setWrapText(true);
|
||||||
|
@ -87,4 +87,8 @@ public class QRCodeWindow extends Overlay<QRCodeWindow> {
|
||||||
applyStyles();
|
applyStyles();
|
||||||
display();
|
display();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getClipboardText() {
|
||||||
|
return moneroUri;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue