2021-11-21 00:29:55 +01:00
|
|
|
/*
|
|
|
|
|
* This file is part of the Flowee project
|
2023-02-22 21:27:31 +01:00
|
|
|
* Copyright (C) 2022-2023 Tom Zander <tom@flowee.org>
|
2021-11-21 00:29:55 +01: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/>.
|
|
|
|
|
*/
|
2022-11-10 16:41:39 +01:00
|
|
|
import QtQuick
|
2022-11-15 15:19:35 +01:00
|
|
|
import QtQuick.Controls as QQC2
|
2022-11-10 16:41:39 +01:00
|
|
|
import QtQuick.Layouts
|
2022-11-14 21:19:31 +01:00
|
|
|
import "../ControlColors.js" as ControlColors
|
2021-11-21 00:29:55 +01:00
|
|
|
|
2022-11-15 15:19:35 +01:00
|
|
|
import QtQuick.Controls.Basic
|
|
|
|
|
|
2021-11-21 00:29:55 +01:00
|
|
|
ApplicationWindow {
|
|
|
|
|
id: mainWindow
|
|
|
|
|
title: "Flowee Pay"
|
|
|
|
|
width: 360
|
|
|
|
|
height: 720
|
2023-05-17 14:28:24 +02:00
|
|
|
minimumWidth: 300
|
|
|
|
|
minimumHeight: 400
|
2021-11-21 00:29:55 +01:00
|
|
|
visible: true
|
2022-11-14 21:19:31 +01:00
|
|
|
onVisibleChanged: if (visible) ControlColors.applySkin(mainWindow)
|
2021-11-21 00:29:55 +01:00
|
|
|
|
|
|
|
|
property bool isLoading: typeof portfolio === "undefined";
|
2022-11-14 21:19:31 +01:00
|
|
|
onIsLoadingChanged: {
|
2022-11-17 23:07:15 +01:00
|
|
|
// only load our UI when the p2p layer is loaded and all
|
|
|
|
|
// variables are available.
|
2023-02-09 18:25:10 +01:00
|
|
|
if (!isLoading) {
|
2022-11-17 23:07:15 +01:00
|
|
|
thePile.replace("./MainView.qml");
|
2023-02-22 21:19:14 +01:00
|
|
|
if (!portfolio.current.isUserOwned)
|
2023-02-09 18:25:10 +01:00
|
|
|
thePile.push("./StartupScreen.qml");
|
|
|
|
|
}
|
2022-11-17 23:07:15 +01:00
|
|
|
}
|
2022-12-15 12:37:21 +01:00
|
|
|
Component.onCompleted: updateFontSize();
|
|
|
|
|
function updateFontSize() {
|
|
|
|
|
// 75% = > 14.25, 100% => 19, 200% => 28
|
|
|
|
|
mainWindow.font.pixelSize = 17 + (11 * (Pay.fontScaling-100) / 100)
|
|
|
|
|
}
|
|
|
|
|
Connections {
|
|
|
|
|
target: Pay
|
|
|
|
|
function onFontScalingChanged() { updateFontSize(); }
|
2022-11-14 21:19:31 +01:00
|
|
|
}
|
2021-11-21 00:29:55 +01:00
|
|
|
|
|
|
|
|
property color floweeSalmon: "#ff9d94"
|
|
|
|
|
property color floweeBlue: "#0b1088"
|
|
|
|
|
property color floweeGreen: "#90e4b5"
|
2023-04-18 21:54:43 +02:00
|
|
|
property color errorRed: Pay.useDarkSkin ? "#ff6568" : "#940000"
|
|
|
|
|
property color errorRedBg: Pay.useDarkSkin ? "#671314" : "#9f1d1f"
|
2021-11-21 00:29:55 +01:00
|
|
|
|
2022-11-14 21:19:31 +01:00
|
|
|
StackView {
|
2022-11-15 11:38:28 +01:00
|
|
|
id: thePile
|
|
|
|
|
anchors.fill: parent
|
2022-11-17 23:07:15 +01:00
|
|
|
initialItem: "./Loading.qml";
|
2022-11-23 10:35:31 +01:00
|
|
|
onCurrentItemChanged: if (currentItem != null) currentItem.takeFocus();
|
2022-12-03 13:44:21 +01:00
|
|
|
enabled: !menuOverlay.open
|
2023-02-22 21:27:31 +01:00
|
|
|
|
|
|
|
|
Keys.onPressed: (event)=> {
|
|
|
|
|
if (event.key === Qt.Key_Back) {
|
|
|
|
|
// We eat this and have nothing happen.
|
|
|
|
|
// This is useful to avoid the app closing on pressing 'back' one time too many on Android
|
|
|
|
|
event.accepted = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-11-21 00:29:55 +01:00
|
|
|
}
|
2022-11-15 15:19:35 +01:00
|
|
|
MenuOverlay {
|
|
|
|
|
id: menuOverlay
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
}
|
2022-12-03 13:44:21 +01:00
|
|
|
|
|
|
|
|
QRScannerOverlay {
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
}
|
2021-11-21 00:29:55 +01:00
|
|
|
}
|