2023-06-30 22:27:27 +02:00
|
|
|
/*
|
|
|
|
|
* This file is part of the Flowee project
|
2025-03-03 15:55:44 +01:00
|
|
|
* Copyright (C) 2023-2025 Tom Zander <tom@flowee.org>
|
2023-06-30 22:27:27 +02:00
|
|
|
*
|
|
|
|
|
* 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
|
2025-06-18 17:48:29 +02:00
|
|
|
import QtQuick.Controls.Basic as QQC2
|
2025-02-05 20:52:38 +01:00
|
|
|
import "../Flowee" as Flowee
|
|
|
|
|
import Flowee.org.pay;
|
2023-06-30 22:27:27 +02:00
|
|
|
|
2023-07-06 11:23:08 +02:00
|
|
|
FocusScope {
|
2025-03-03 15:55:44 +01:00
|
|
|
id: root
|
2023-07-06 11:23:08 +02:00
|
|
|
Rectangle {
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
color: palette.window
|
|
|
|
|
}
|
|
|
|
|
MouseArea { // eat all mouse events.
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
}
|
2023-06-30 22:27:27 +02:00
|
|
|
|
2025-02-05 20:52:38 +01:00
|
|
|
Image {
|
|
|
|
|
source: "qrc:/background.jpg"
|
|
|
|
|
width: parent.width
|
|
|
|
|
height: {
|
|
|
|
|
if (Pay.unlockingKeyboard === FloweePay.FullKeyboard)
|
|
|
|
|
return parent.height;
|
|
|
|
|
if (Pay.unlockingKeyboard === FloweePay.SmallNumbersKeyboard)
|
|
|
|
|
return parent.height - 225;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-06 11:23:08 +02:00
|
|
|
UnlockWidget {
|
|
|
|
|
anchors.fill: parent
|
2025-09-05 12:22:40 +02:00
|
|
|
anchors.topMargin: Pay.screenInsets.y
|
|
|
|
|
anchors.leftMargin: 10 + Pay.screenInsets.x
|
|
|
|
|
anchors.rightMargin: 10 + Pay.screenInsets.width
|
2023-07-06 11:23:08 +02:00
|
|
|
onPasswordEntered: if (!Pay.checkAppPassword(password)) passwordIncorrect();
|
2025-02-07 00:18:44 +01:00
|
|
|
// the above background means the widget should prefer white text
|
|
|
|
|
assumeDarkBackground: Pay.unlockingKeyboard !== FloweePay.BigNumbersKeyboard
|
2023-07-06 11:23:08 +02:00
|
|
|
}
|
|
|
|
|
Keys.onPressed: (event)=> {
|
2025-03-03 15:55:44 +01:00
|
|
|
event.accepted = true;
|
|
|
|
|
if (event.key === Qt.Key_Escape || event.key === Qt.Key_Back)
|
|
|
|
|
mainWindow.close(); // exit app on 'back'.
|
2023-06-30 22:27:27 +02:00
|
|
|
}
|
2025-02-05 20:52:38 +01:00
|
|
|
|
|
|
|
|
Column {
|
|
|
|
|
id: quickReceive
|
2025-09-05 12:22:40 +02:00
|
|
|
x: 60 + Pay.screenInsets.x
|
2025-02-05 20:52:38 +01:00
|
|
|
y: {
|
|
|
|
|
var uk = Pay.unlockingKeyboard;
|
|
|
|
|
if (uk === FloweePay.BigNumbersKeyboard)
|
|
|
|
|
return parent.height + 10;
|
|
|
|
|
if (uk === FloweePay.FullKeyboard)
|
2025-02-10 20:46:35 +01:00
|
|
|
return 300;
|
2025-02-05 20:52:38 +01:00
|
|
|
if (uk === FloweePay.SmallNumbersKeyboard)
|
2025-02-10 20:46:35 +01:00
|
|
|
return parent.height - 270 - height
|
2025-02-05 20:52:38 +01:00
|
|
|
}
|
|
|
|
|
spacing: 6
|
2025-02-10 20:58:54 +01:00
|
|
|
opacity: 0
|
|
|
|
|
property bool havePortfolio: typeof portfolio !== "undefined";
|
|
|
|
|
onHavePortfolioChanged: opacity = portfolio.current.isSingleAddressAccount ? 0 : 1
|
2025-09-05 12:22:40 +02:00
|
|
|
visible: opacity > 0
|
2025-02-10 20:58:54 +01:00
|
|
|
Behavior on opacity { NumberAnimation { } }
|
2025-02-10 16:37:20 +01:00
|
|
|
|
2025-02-05 20:52:38 +01:00
|
|
|
Image {
|
|
|
|
|
source: "qrc:/back-arrow"
|
|
|
|
|
rotation: 270
|
|
|
|
|
width: 30
|
|
|
|
|
height: 30
|
|
|
|
|
}
|
|
|
|
|
Flowee.Label {
|
|
|
|
|
color: "white"
|
|
|
|
|
text: qsTr("Quick Receive")
|
|
|
|
|
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
|
|
|
|
horizontalAlignment: Qt.AlignHCenter
|
|
|
|
|
x: 15 - width / 2
|
|
|
|
|
width: 90
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
MouseArea {
|
2025-03-03 15:55:44 +01:00
|
|
|
id: quickReceiveButton
|
|
|
|
|
focus: true
|
2025-02-10 16:37:20 +01:00
|
|
|
enabled: quickReceive.visible
|
2025-02-05 20:52:38 +01:00
|
|
|
anchors.fill: quickReceive
|
|
|
|
|
onClicked: myLittleStack.push(receive)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FocusScope {
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
Rectangle {
|
2025-02-09 22:57:14 +01:00
|
|
|
id: background
|
2025-02-05 20:52:38 +01:00
|
|
|
anchors.fill: parent
|
|
|
|
|
color: palette.window
|
|
|
|
|
visible: myLittleStack.depth > 0
|
2025-02-09 22:57:14 +01:00
|
|
|
MouseArea { anchors.fill: parent; acceptedButtons: Qt.AllButtons } // catch all
|
2025-02-05 20:52:38 +01:00
|
|
|
|
|
|
|
|
QQC2.StackView {
|
|
|
|
|
id: myLittleStack
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
onCurrentItemChanged: if (currentItem != null) currentItem.takeFocus();
|
2025-09-05 12:22:40 +02:00
|
|
|
|
2025-02-05 20:52:38 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Keys.onPressed: (event)=> {
|
|
|
|
|
if (event.key === Qt.Key_Escape || event.key === Qt.Key_Back) {
|
2025-03-03 15:55:44 +01:00
|
|
|
if (myLittleStack.depth <= 1) {
|
2025-02-05 20:52:38 +01:00
|
|
|
myLittleStack.clear();
|
2025-03-03 15:55:44 +01:00
|
|
|
quickReceiveButton.forceActiveFocus();
|
|
|
|
|
}
|
2025-02-05 20:52:38 +01:00
|
|
|
else
|
|
|
|
|
myLittleStack.pop();
|
|
|
|
|
event.accepted = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Component {
|
|
|
|
|
id: receive
|
|
|
|
|
Page {
|
2025-03-03 14:10:34 +01:00
|
|
|
function takeFocus() {
|
|
|
|
|
receiveTab.verticalTab = 1; // the money input
|
|
|
|
|
receiveTab.forceActiveFocus();
|
|
|
|
|
}
|
2025-02-05 20:52:38 +01:00
|
|
|
backHandler: function handler() { myLittleStack.clear() }
|
2025-02-09 22:57:14 +01:00
|
|
|
headerText: receiveTab.title
|
2025-02-10 16:04:45 +01:00
|
|
|
function switchToTab(tab) {
|
|
|
|
|
myLittleStack.clear();
|
|
|
|
|
}
|
2025-02-05 20:52:38 +01:00
|
|
|
ReceiveTab {
|
|
|
|
|
id: receiveTab
|
|
|
|
|
anchors.fill: parent
|
2025-02-09 22:57:14 +01:00
|
|
|
showInstructions: false
|
2025-02-05 20:52:38 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-06-30 22:27:27 +02:00
|
|
|
}
|