2022-09-23 12:14:19 +02:00
|
|
|
import QtQuick 2.6
|
|
|
|
|
import QtQuick.Controls 2.14
|
|
|
|
|
import QtQuick.Layouts 1.0
|
|
|
|
|
import QtQuick.Controls.Material 2.0
|
|
|
|
|
|
|
|
|
|
import org.electrum 1.0
|
|
|
|
|
|
|
|
|
|
import "controls"
|
|
|
|
|
|
|
|
|
|
ElDialog {
|
|
|
|
|
id: dialog
|
|
|
|
|
|
|
|
|
|
property InvoiceParser invoiceParser
|
|
|
|
|
|
2022-10-27 23:12:39 +02:00
|
|
|
signal txFound(data: string)
|
2023-03-14 10:20:42 +01:00
|
|
|
signal channelBackupFound(data: string)
|
2022-10-27 23:12:39 +02:00
|
|
|
|
2023-04-24 13:34:05 +02:00
|
|
|
header: null
|
2022-09-23 12:14:19 +02:00
|
|
|
padding: 0
|
2022-10-19 14:15:24 +02:00
|
|
|
topPadding: 0
|
2022-09-23 12:14:19 +02:00
|
|
|
|
2022-09-27 15:09:06 +02:00
|
|
|
function restart() {
|
|
|
|
|
qrscan.restart()
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-27 23:12:39 +02:00
|
|
|
function dispatch(data) {
|
2023-07-09 11:55:06 +02:00
|
|
|
data = data.trim()
|
2022-10-27 23:12:39 +02:00
|
|
|
if (bitcoin.isRawTx(data)) {
|
|
|
|
|
txFound(data)
|
2023-03-14 10:20:42 +01:00
|
|
|
} else if (Daemon.currentWallet.isValidChannelBackup(data)) {
|
|
|
|
|
channelBackupFound(data)
|
2022-10-27 23:12:39 +02:00
|
|
|
} else {
|
|
|
|
|
invoiceParser.recipient = data
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-23 12:14:19 +02:00
|
|
|
ColumnLayout {
|
|
|
|
|
anchors.fill: parent
|
2022-10-19 14:15:24 +02:00
|
|
|
spacing: 0
|
2022-09-23 12:14:19 +02:00
|
|
|
|
|
|
|
|
QRScan {
|
2022-09-27 15:09:06 +02:00
|
|
|
id: qrscan
|
2023-04-24 13:34:05 +02:00
|
|
|
Layout.fillWidth: true
|
2022-09-23 12:14:19 +02:00
|
|
|
Layout.fillHeight: true
|
|
|
|
|
|
2023-04-24 13:34:05 +02:00
|
|
|
hint: qsTr('Scan an Invoice, an Address, an LNURL-pay, a PSBT or a Channel backup')
|
2022-10-27 23:12:39 +02:00
|
|
|
onFound: dialog.dispatch(scanData)
|
2022-09-23 12:14:19 +02:00
|
|
|
}
|
|
|
|
|
|
2023-02-03 13:33:17 +01:00
|
|
|
ButtonContainer {
|
2022-09-23 12:14:19 +02:00
|
|
|
Layout.fillWidth: true
|
2023-02-03 13:33:17 +01:00
|
|
|
|
|
|
|
|
FlatButton {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.preferredWidth: 1
|
2023-03-30 12:26:35 +02:00
|
|
|
icon.source: '../../icons/copy_bw.png'
|
|
|
|
|
text: qsTr('Paste')
|
2023-02-03 13:33:17 +01:00
|
|
|
onClicked: dialog.dispatch(AppController.clipboardToText())
|
|
|
|
|
}
|
2022-09-23 12:14:19 +02:00
|
|
|
}
|
2023-02-03 13:33:17 +01:00
|
|
|
|
2022-09-23 12:14:19 +02:00
|
|
|
}
|
|
|
|
|
|
2022-10-27 23:12:39 +02:00
|
|
|
Bitcoin {
|
|
|
|
|
id: bitcoin
|
|
|
|
|
}
|
2022-09-23 12:14:19 +02:00
|
|
|
}
|