Files

77 lines
2.6 KiB
QML
Raw Permalink Normal View History

2024-12-22 14:41:46 +01:00
/*
* This file is part of the Flowee project
* Copyright (C) 2024 Tom Zander <tom@flowee.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick
import QtQuick.Layouts
2025-06-18 17:48:29 +02:00
import QtQuick.Controls.Basic as QQC2
2024-12-22 14:41:46 +01:00
import "../Flowee" as Flowee
2026-03-14 21:14:42 +01:00
import Flowee.org.pay
2024-12-22 14:41:46 +01:00
import "WorkflowStarter.js" as WorkflowStarter
Page {
id: root
Item { // data
QRScanner {
id: scanner
autostart: true
2024-12-22 17:37:04 +01:00
isPayment: true // well, thats the main intent anyway
2024-12-22 14:41:46 +01:00
onFinished: {
2026-03-14 21:14:42 +01:00
var type = scanType
2024-12-22 14:41:46 +01:00
if (type === QRScanner.InvalidType) { // scanning interrupted
2026-03-14 21:14:42 +01:00
thePile.pop()
2024-12-22 14:41:46 +01:00
}
else if (type === QRScanner.Seed || type === QRScanner.PrivateKeyWIF) {
if (WorkflowStarter.startSweep(scanResult))
2026-03-14 21:14:42 +01:00
return
2024-12-22 14:41:46 +01:00
// plugin missing, proceed to start the import page flow.
2026-03-14 21:14:42 +01:00
WorkflowStarter.startImportWithSecret(scanResult)
2024-12-22 14:41:46 +01:00
}
else if (type === QRScanner.PaymentDetails) {
2026-03-14 21:14:42 +01:00
var item = thePile.replace("PayWithQR.qml")
item.start(scanResult)
2024-12-22 14:41:46 +01:00
}
else if (type === QRScanner.PaymentDetailsTestnet) {
// TODO if we end up supporting the testnet, this may be useful
2026-03-14 21:14:42 +01:00
shrug.visible = true
detectedText.text = scanResult
2024-12-22 14:41:46 +01:00
}
}
}
}
Image {
id: shrug
y: 200
visible: false
anchors.horizontalCenter: parent.horizontalCenter
width: 200
height: 170
2026-03-14 21:14:42 +01:00
source: "qrc:/shrug" + (Pay.useDarkSkin ? "-light.svg" : ".svg")
2024-12-22 14:41:46 +01:00
}
Flowee.Label {
id: detectedText
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: shrug.bottom
anchors.topMargin: 10
width: root.width - 20
x: 10
wrapMode: Text.WrapAnywhere
}
}