mirror of
https://github.com/monero-project/monero-gui.git
synced 2025-01-22 10:44:46 +00:00
AddressBook: add Grab QR code inline button
Co-authored-by: selsta <selsta@users.noreply.github.com>
This commit is contained in:
parent
b6682330a6
commit
faf9ec3027
1 changed files with 24 additions and 1 deletions
|
@ -345,6 +345,29 @@ Rectangle {
|
||||||
onEnterPressed: addButton.enabled ? addButton.clicked() : ""
|
onEnterPressed: addButton.enabled ? addButton.clicked() : ""
|
||||||
onReturnPressed: addButton.enabled ? addButton.clicked() : ""
|
onReturnPressed: addButton.enabled ? addButton.clicked() : ""
|
||||||
|
|
||||||
|
MoneroComponents.InlineButton {
|
||||||
|
fontFamily: FontAwesome.fontFamilySolid
|
||||||
|
fontStyleName: "Solid"
|
||||||
|
fontPixelSize: 18
|
||||||
|
text: FontAwesome.desktop
|
||||||
|
tooltip: qsTr("Grab QR code from screen") + translationManager.emptyString
|
||||||
|
onClicked: {
|
||||||
|
clearFields();
|
||||||
|
const codes = oshelper.grabQrCodesFromScreen();
|
||||||
|
for (var index = 0; index < codes.length; ++index) {
|
||||||
|
const parsed = walletManager.parse_uri_to_object(codes[index]);
|
||||||
|
if (!parsed.error) {
|
||||||
|
addressLine.text = parsed.address
|
||||||
|
descriptionLine.text = parsed.recipient_name
|
||||||
|
break;
|
||||||
|
} else if (walletManager.addressValid(codes[index], appWindow.persistentSettings.nettype)) {
|
||||||
|
addressLine.text = codes[index];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MoneroComponents.InlineButton {
|
MoneroComponents.InlineButton {
|
||||||
buttonColor: MoneroComponents.Style.orange
|
buttonColor: MoneroComponents.Style.orange
|
||||||
fontFamily: FontAwesome.fontFamily
|
fontFamily: FontAwesome.fontFamily
|
||||||
|
@ -509,7 +532,7 @@ Rectangle {
|
||||||
function updateFromQrCode(address, payment_id, amount, tx_description, recipient_name) {
|
function updateFromQrCode(address, payment_id, amount, tx_description, recipient_name) {
|
||||||
console.log("updateFromQrCode")
|
console.log("updateFromQrCode")
|
||||||
addressLine.text = address
|
addressLine.text = address
|
||||||
descriptionLine.text = recipient_name + " " + tx_description
|
descriptionLine.text = recipient_name
|
||||||
cameraUi.qrcode_decoded.disconnect(updateFromQrCode)
|
cameraUi.qrcode_decoded.disconnect(updateFromQrCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue