7 changed files with 210 additions and 8 deletions
@ -0,0 +1,52 @@
|
||||
import QtQuick |
||||
import QtQuick.Controls |
||||
import QtQuick.Layouts |
||||
|
||||
import "controls" |
||||
|
||||
// currently not used on android, kept for future use when qt6 camera stops crashing |
||||
ElDialog { |
||||
id: scanDialog |
||||
|
||||
property string scanData |
||||
property string error |
||||
property string hint |
||||
|
||||
signal found |
||||
|
||||
width: parent.width |
||||
height: parent.height |
||||
padding: 0 |
||||
|
||||
header: null |
||||
topPadding: 0 // dialog needs topPadding override |
||||
|
||||
function doClose() { |
||||
qrscan.stop() |
||||
Qt.callLater(doReject) |
||||
} |
||||
|
||||
ColumnLayout { |
||||
anchors.fill: parent |
||||
spacing: 0 |
||||
|
||||
QRScan { |
||||
id: qrscan |
||||
Layout.fillWidth: true |
||||
Layout.fillHeight: true |
||||
hint: scanDialog.hint |
||||
onFound: { |
||||
scanDialog.scanData = scanData |
||||
scanDialog.found() |
||||
} |
||||
} |
||||
|
||||
FlatButton { |
||||
id: button |
||||
Layout.fillWidth: true |
||||
text: qsTr('Cancel') |
||||
icon.source: '../../icons/closebutton.png' |
||||
onClicked: doReject() |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,83 @@
|
||||
import QtQuick |
||||
import QtQuick.Controls |
||||
import QtQuick.Layouts |
||||
import QtQuick.Controls.Material |
||||
|
||||
import org.electrum 1.0 |
||||
|
||||
import "controls" |
||||
|
||||
// currently not used on android, kept for future use when qt6 camera stops crashing |
||||
ElDialog { |
||||
id: dialog |
||||
|
||||
property InvoiceParser invoiceParser |
||||
|
||||
signal txFound(data: string) |
||||
signal channelBackupFound(data: string) |
||||
|
||||
header: null |
||||
padding: 0 |
||||
topPadding: 0 |
||||
|
||||
onAboutToHide: { |
||||
console.log('about to hide') |
||||
qrscan.stop() |
||||
} |
||||
|
||||
function restart() { |
||||
qrscan.restart() |
||||
} |
||||
|
||||
function dispatch(data) { |
||||
data = data.trim() |
||||
if (bitcoin.isRawTx(data)) { |
||||
txFound(data) |
||||
} else if (Daemon.currentWallet.isValidChannelBackup(data)) { |
||||
channelBackupFound(data) |
||||
} else { |
||||
invoiceParser.recipient = data |
||||
} |
||||
} |
||||
|
||||
// override |
||||
function doClose() { |
||||
console.log('SendDialog doClose override') // doesn't trigger when going back?? |
||||
qrscan.stop() |
||||
Qt.callLater(doReject) |
||||
} |
||||
|
||||
ColumnLayout { |
||||
anchors.fill: parent |
||||
spacing: 0 |
||||
|
||||
QRScan { |
||||
id: qrscan |
||||
Layout.fillWidth: true |
||||
Layout.fillHeight: true |
||||
|
||||
hint: qsTr('Scan an Invoice, an Address, an LNURL-pay, a PSBT or a Channel backup') |
||||
onFound: dialog.dispatch(scanData) |
||||
} |
||||
|
||||
ButtonContainer { |
||||
Layout.fillWidth: true |
||||
|
||||
FlatButton { |
||||
Layout.fillWidth: true |
||||
Layout.preferredWidth: 1 |
||||
icon.source: '../../icons/copy_bw.png' |
||||
text: qsTr('Paste') |
||||
onClicked: { |
||||
qrscan.stop() |
||||
dialog.dispatch(AppController.clipboardToText()) |
||||
} |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
Bitcoin { |
||||
id: bitcoin |
||||
} |
||||
} |
||||
Loading…
Reference in new issue