Files
pay/guis/desktop/NewAccountPane.qml
T

143 lines
4.8 KiB
QML
Raw Permalink Normal View History

2021-10-15 21:01:40 +02:00
/* * This file is part of the Flowee project
2024-05-03 22:15:51 +02:00
* Copyright (C) 2021-2024 Tom Zander <tom@flowee.org>
2021-10-15 21:01:40 +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/>.
*/
2022-11-26 10:46:57 +01:00
import QtQuick
2025-06-18 17:48:29 +02:00
import QtQuick.Controls.Basic as QQC2
2022-11-26 10:46:57 +01:00
import QtQuick.Layouts
2022-11-14 21:19:31 +01:00
import "../Flowee" as Flowee
2021-10-15 21:01:40 +02:00
FocusScope {
2024-05-03 22:15:51 +02:00
id: newAccountsPane
2021-10-15 21:01:40 +02:00
anchors.fill: parent
focus: true
Rectangle {
color: "black"
anchors.fill: parent
opacity: 0.4
MouseArea {
anchors.fill: parent
2024-05-03 22:15:51 +02:00
hoverEnabled: true // to eat the hover events from the guys in the background.
onClicked: newAccountsPane.visible = false
2021-10-15 21:01:40 +02:00
}
}
Rectangle {
2023-02-21 16:40:46 +01:00
color: palette.window
2021-10-15 21:01:40 +02:00
anchors.fill: contentArea
2021-10-28 17:40:10 +02:00
anchors.margins: -10 // have an inset
2021-10-15 21:01:40 +02:00
}
2024-05-03 22:15:51 +02:00
Item {
2021-10-15 21:01:40 +02:00
id: contentArea
2024-05-03 22:15:51 +02:00
x: 50
y: 50
height: Math.min(parent.height - 100, 800);
width: parent.width - 100
2021-10-15 21:01:40 +02:00
clip: true
2024-05-03 22:15:51 +02:00
MouseArea { anchors.fill: parent }
Item {
id: door
width: parent
height: parent
ColumnLayout {
id: verticalTabs
width: Math.min(accountTypePreferred.implicitWidth, 320)
2024-05-03 22:15:51 +02:00
spacing: 10
opacity: mainArea.item === null ? 1 : 0.65
2021-10-30 16:17:02 +02:00
2022-11-21 15:47:12 +01:00
Flowee.CardTypeSelector {
2021-10-15 21:01:40 +02:00
id: accountTypePreferred
2024-05-03 22:15:51 +02:00
title: qsTr("New HD wallet")
checkable: true
Layout.fillWidth: true
onClicked: mainArea.source = "./NewAccountCreateHDAccount.qml"
2021-10-15 21:01:40 +02:00
features: [
2021-11-09 21:34:40 +01:00
qsTr("Seed-phrase based", "Context: wallet type"),
2021-10-15 21:01:40 +02:00
qsTr("Easy to backup", "Context: wallet type"),
2021-10-28 17:40:10 +02:00
qsTr("Most compatible", "The most compatible wallet type")
2021-10-15 21:01:40 +02:00
]
}
2022-11-21 15:47:12 +01:00
Flowee.CardTypeSelector {
2021-10-15 21:01:40 +02:00
id: accountTypeImport
2024-05-03 22:15:51 +02:00
title: qsTr("Import Existing Wallet")
Layout.fillWidth: true
checkable: true
onClicked: mainArea.source = "./NewAccountImportAccount.qml"
2021-10-15 21:01:40 +02:00
features: [
2021-11-09 21:34:40 +01:00
qsTr("Imports seed-phrase"),
2021-11-10 11:07:00 +01:00
qsTr("Imports private key")
2021-10-15 21:01:40 +02:00
]
}
2024-05-03 22:15:51 +02:00
Flowee.CardTypeSelector {
id: accountTypeBasic
Layout.fillWidth: true
title: qsTr("New Basic Wallet")
checkable: true
onClicked: mainArea.source = "./NewAccountCreateBasicAccount.qml"
2021-10-15 21:01:40 +02:00
2024-05-03 22:15:51 +02:00
features: [
qsTr("Private keys based", "Property of a wallet"),
qsTr("Difficult to backup", "Context: wallet type"),
qsTr("Great for brief usage", "Context: wallet type")
]
2021-10-15 21:01:40 +02:00
}
}
2024-05-03 22:15:51 +02:00
Loader {
id: mainArea
x: verticalTabs.width + 10
property double columnWidth: verticalTabs.width * 1.4
2021-10-15 21:01:40 +02:00
2024-05-03 22:15:51 +02:00
width: {
var i = item;
if (i === null)
return door.width - x;
return i.implicitWidth
}
onWidthChanged: {
if (mainArea.item == null) {
door.x = 0;
return;
}
var avail = contentArea.width
var taken = verticalTabs.width + mainArea.item.implicitWidth
if (taken < avail)
door.x = 0;
else
door.x = avail - taken;
}
2021-10-15 21:01:40 +02:00
}
2024-05-03 22:15:51 +02:00
Behavior on x { NumberAnimation { }}
}
Flowee.CloseIcon {
id: closeIcon
anchors.right: parent.right
onClicked: newAccountsPane.visible = false
2021-10-15 21:01:40 +02:00
}
}
Component.onCompleted: forceActiveFocus() // we assume this component is used in a Loader
2022-09-07 20:32:05 +02:00
Keys.onPressed: (event)=> {
2021-10-15 21:01:40 +02:00
if (event.key === Qt.Key_Escape) {
2024-05-03 22:15:51 +02:00
newAccountsPane.visible = false;
2021-10-15 21:01:40 +02:00
event.accepted = true;
}
}
}