Skip to content

Commit 6df72f8

Browse files
committed
Merge #403: Introduce Create Single-Sig wallet flow
d1f7ea6 qml: Introduce Create Wallet Single-Sig flow (johnny9) 72716f6 qml: Introduce AddWallet page after onboarding (johnny9) 98d6d46 qml: Add DISABLED state to ContinueButton (johnny9) d807ae9 qml: Add color properties to ContinueButton (johnny9) Pull request description: These changes add more pages after the initial onboarding. To test, run the application with the `-resetguisettings` option. Link to github actions build artifacts. [![Build Artifacts](https://img.shields.io/badge/Build%20Artifacts-green )](https://github.com/bitcoin-core/gui-qml/actions/runs/9263281845) ACKs for top commit: D33r-Gee: tACK [d1f7ea6](d1f7ea6) on WSL Ubuntu 22.04 Tree-SHA512: 9970996d1b26a9db7733b050e13d37494c7f0ebbcb0faa00b3a565a5aaeb634ac1d7ad38c11a0de34d15f28c52be953935d025b979e132990bc7dc70a84964a8
2 parents 6a5bb5e + d1f7ea6 commit 6df72f8

25 files changed

+749
-5
lines changed

qml/bitcoin.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@
2020
#endif
2121
#include <qml/components/blockclockdial.h>
2222
#include <qml/controls/linegraph.h>
23+
#include <qml/guiconstants.h>
2324
#include <qml/models/chainmodel.h>
2425
#include <qml/models/networktraffictower.h>
2526
#include <qml/models/nodemodel.h>
2627
#include <qml/models/options_model.h>
2728
#include <qml/models/peerlistsortproxy.h>
2829
#include <qml/imageprovider.h>
2930
#include <qml/util.h>
30-
#include <qml/guiconstants.h>
31+
#include <qml/walletcontroller.h>
3132
#include <qt/guiutil.h>
3233
#include <qt/initexecutor.h>
3334
#include <qt/networkstyle.h>
@@ -286,6 +287,8 @@ int QmlGuiMain(int argc, char* argv[])
286287
GUIUtil::LoadFont(":/fonts/inter/regular");
287288
GUIUtil::LoadFont(":/fonts/inter/semibold");
288289

290+
WalletController wallet_controller(*node);
291+
289292
QQmlApplicationEngine engine;
290293

291294
QScopedPointer<const NetworkStyle> network_style{NetworkStyle::instantiate(Params().GetChainType())};
@@ -297,6 +300,7 @@ int QmlGuiMain(int argc, char* argv[])
297300
engine.rootContext()->setContextProperty("chainModel", &chain_model);
298301
engine.rootContext()->setContextProperty("peerTableModel", &peer_model);
299302
engine.rootContext()->setContextProperty("peerListModelProxy", &peer_model_sort_proxy);
303+
engine.rootContext()->setContextProperty("walletController", &wallet_controller);
300304

301305
OptionsQmlModel options_model(*node, !need_onboarding.toBool());
302306
engine.rootContext()->setContextProperty("optionsModel", &options_model);

qml/bitcoin_qml.qrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<file>components/Tooltip.qml</file>
2323
<file>controls/ContinueButton.qml</file>
2424
<file>controls/CoreText.qml</file>
25+
<file>controls/CoreTextField.qml</file>
2526
<file>controls/ExternalLink.qml</file>
2627
<file>controls/FocusBorder.qml</file>
2728
<file>controls/Header.qml</file>
@@ -65,9 +66,16 @@
6566
<file>pages/settings/SettingsProxy.qml</file>
6667
<file>pages/settings/SettingsStorage.qml</file>
6768
<file>pages/settings/SettingsTheme.qml</file>
69+
<file>pages/wallet/AddWallet.qml</file>
70+
<file>pages/wallet/CreateBackup.qml</file>
71+
<file>pages/wallet/CreateConfirm.qml</file>
72+
<file>pages/wallet/CreateIntro.qml</file>
73+
<file>pages/wallet/CreateName.qml</file>
74+
<file>pages/wallet/CreatePassword.qml</file>
6875
<file>pages/wallet/DesktopWallets.qml</file>
6976
</qresource>
7077
<qresource prefix="/icons">
78+
<file alias="add-wallet-dark">res/icons/add-wallet-dark.png</file>
7179
<file alias="arrow-down">res/icons/arrow-down.png</file>
7280
<file alias="arrow-up">res/icons/arrow-up.png</file>
7381
<file alias="bitcoin-circle">res/icons/bitcoin-circle.png</file>
@@ -83,6 +91,7 @@
8391
<file alias="export">res/icons/export.png</file>
8492
<file alias="gear">res/icons/gear.png</file>
8593
<file alias="gear-outline">res/icons/gear-outline.png</file>
94+
<file alias="hidden">res/icons/hidden.png</file>
8695
<file alias="info">res/icons/info.png</file>
8796
<file alias="network-dark">res/icons/network-dark.png</file>
8897
<file alias="network-light">res/icons/network-light.png</file>
@@ -92,6 +101,8 @@
92101
<file alias="storage-light">res/icons/storage-light.png</file>
93102
<file alias="tooltip-arrow-dark">res/icons/tooltip-arrow-dark.png</file>
94103
<file alias="tooltip-arrow-light">res/icons/tooltip-arrow-light.png</file>
104+
<file alias="wallet">res/icons/wallet.png</file>
105+
<file alias="visible">res/icons/visible.png</file>
95106
</qresource>
96107
<qresource prefix="/fonts">
97108
<file alias="inter/regular">res/fonts/Inter-Regular.otf</file>

qml/controls/ContinueButton.qml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,44 @@ import org.bitcoincore.qt 1.0
99
Button {
1010
id: root
1111
hoverEnabled: AppMode.isDesktop
12+
13+
property color textColor: Theme.color.white
14+
property color backgroundColor: Theme.color.orange
15+
property color backgroundHoverColor: Theme.color.orangeLight1
16+
property color backgroundPressedColor: Theme.color.orangeLight2
17+
property color borderColor: "transparent"
18+
property color borderHoverColor: "transparent"
19+
property color borderPressedColor: "transparent"
20+
1221
contentItem: CoreText {
1322
text: parent.text
23+
color: root.textColor
1424
bold: true
1525
font.pixelSize: 18
1626
}
1727
background: Rectangle {
1828
id: bg
1929
implicitHeight: 46
20-
color: Theme.color.orange
30+
color: backgroundColor
31+
border.color: borderColor
2132
radius: 5
2233

2334
states: [
35+
State {
36+
name: "DISABLED"; when: !root.enabled
37+
PropertyChanges { target: bg; color: Theme.color.neutral2 }
38+
PropertyChanges { target: bg; border.color: Theme.color.neutral2 }
39+
PropertyChanges { target: root; textColor: Theme.color.neutral5 }
40+
},
2441
State {
2542
name: "PRESSED"; when: root.pressed
26-
PropertyChanges { target: bg; color: Theme.color.orangeLight2 }
43+
PropertyChanges { target: bg; color: backgroundPressedColor }
44+
PropertyChanges { target: bg; border.color: borderPressedColor }
2745
},
2846
State {
2947
name: "HOVER"; when: root.hovered
30-
PropertyChanges { target: bg; color: Theme.color.orangeLight1 }
48+
PropertyChanges { target: bg; color: backgroundHoverColor }
49+
PropertyChanges { target: bg; border.color: borderHoverColor }
3150
}
3251
]
3352

qml/controls/CoreTextField.qml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Copyright (c) 2022 The Bitcoin Core developers
2+
// Distributed under the MIT software license, see the accompanying
3+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
5+
import QtQuick 2.15
6+
import QtQuick.Controls 2.15
7+
8+
TextField {
9+
id: root
10+
11+
property bool hideText: false
12+
13+
implicitHeight: 56
14+
implicitWidth: 450
15+
font.family: "Inter"
16+
font.styleName: "Regular"
17+
font.pixelSize: 18
18+
color: Theme.color.neutral9
19+
placeholderTextColor: Theme.color.neutral5
20+
echoMode: hideText ? TextInput.Password : TextInput.Normal
21+
rightPadding: hideText ? 46 : 20
22+
leftPadding: 20
23+
background: Rectangle {
24+
border.color: Theme.color.neutral5
25+
border.width: 1
26+
color: "transparent"
27+
radius: 5
28+
29+
Icon {
30+
id: visibleIcon
31+
enabled: hideText
32+
visible: hideText
33+
anchors.right: parent.right
34+
anchors.rightMargin: 12
35+
size: 24
36+
anchors.verticalCenter: parent.verticalCenter
37+
source: "qrc:/icons/visible"
38+
color: Theme.color.neutral5
39+
onClicked: {
40+
if (root.echoMode == TextInput.Password) {
41+
root.echoMode = TextInput.Normal
42+
visibleIcon.source = "qrc:/icons/hidden"
43+
} else {
44+
root.echoMode = TextInput.Password
45+
visibleIcon.source = "qrc:/icons/visible"
46+
}
47+
}
48+
}
49+
}
50+
}

qml/controls/Setting.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import org.bitcoincore.qt 1.0
1010

1111
AbstractButton {
1212
id: root
13-
required property string header
13+
property string header
1414
property alias actionItem: action_loader.sourceComponent
1515
property alias loadedItem: action_loader.item
1616
property string description

qml/imageprovider.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,5 +142,25 @@ QPixmap ImageProvider::requestPixmap(const QString& id, QSize* size, const QSize
142142
return QIcon(":/icons/tooltip-arrow-light").pixmap(requested_size);
143143
}
144144

145+
if (id == "add-wallet-dark") {
146+
*size = requested_size;
147+
return QIcon(":/icons/add-wallet-dark").pixmap(requested_size);
148+
}
149+
150+
if (id == "wallet") {
151+
*size = requested_size;
152+
return QIcon(":/icons/wallet").pixmap(requested_size);
153+
}
154+
155+
if (id == "visible") {
156+
*size = requested_size;
157+
return QIcon(":/icons/visible").pixmap(requested_size);
158+
}
159+
160+
if (id == "hidden") {
161+
*size = requested_size;
162+
return QIcon(":/icons/hidden").pixmap(requested_size);
163+
}
164+
145165
return {};
146166
}

qml/pages/main.qml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ ApplicationWindow {
8181
optionsModel.onboard()
8282
if (AppMode.walletEnabled && AppMode.isDesktop) {
8383
main.push(desktopWallets)
84+
main.push(addWallet)
8485
} else {
8586
main.push(node)
8687
}
@@ -93,6 +94,15 @@ ApplicationWindow {
9394
DesktopWallets {}
9495
}
9596

97+
Component {
98+
id: addWallet
99+
AddWallet {
100+
onFinished: {
101+
main.pop()
102+
}
103+
}
104+
}
105+
96106
Component {
97107
id: shutdown
98108
Shutdown {}

qml/pages/wallet/AddWallet.qml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
// Copyright (c) 2024 The Bitcoin Core developers
2+
// Distributed under the MIT software license, see the accompanying
3+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
5+
import QtQuick 2.15
6+
import QtQuick.Controls 2.15
7+
import QtQuick.Layouts 1.15
8+
import "../../controls"
9+
import "../../components"
10+
import "../settings"
11+
import "../wallet"
12+
13+
StackView {
14+
id: addWalletStack
15+
16+
signal finished()
17+
18+
initialItem: Page {
19+
background: null
20+
21+
header: NavigationBar2 {
22+
id: navbar
23+
rightItem: NavButton {
24+
text: qsTr("Skip")
25+
onClicked: {
26+
addWalletStack.finished()
27+
}
28+
}
29+
}
30+
31+
ColumnLayout {
32+
id: columnLayout
33+
width: Math.min(parent.width, 450)
34+
anchors.horizontalCenter: parent.horizontalCenter
35+
36+
Image {
37+
Layout.alignment: Qt.AlignCenter
38+
source: "image://images/add-wallet-dark"
39+
40+
sourceSize.width: 200
41+
sourceSize.height: 200
42+
}
43+
44+
Header {
45+
Layout.fillWidth: true
46+
Layout.leftMargin: 20
47+
Layout.rightMargin: 20
48+
header: qsTr("Add a wallet")
49+
description: qsTr("In this early stage of development, only wallet.dat files are supported.")
50+
}
51+
52+
ContinueButton {
53+
Layout.preferredWidth: Math.min(300, parent.width - 2 * Layout.leftMargin)
54+
Layout.topMargin: 40
55+
Layout.leftMargin: 20
56+
Layout.rightMargin: Layout.leftMargin
57+
Layout.bottomMargin: 20
58+
Layout.alignment: Qt.AlignCenter
59+
text: qsTr("Create wallet")
60+
onClicked: {
61+
addWalletStack.push("qrc:/qml/pages/wallet/CreateIntro.qml");
62+
}
63+
}
64+
65+
ContinueButton {
66+
Layout.preferredWidth: Math.min(300, parent.width - 2 * Layout.leftMargin)
67+
Layout.leftMargin: 20
68+
Layout.rightMargin: Layout.leftMargin
69+
Layout.alignment: Qt.AlignCenter
70+
text: qsTr("Import wallet")
71+
borderColor: Theme.color.neutral6
72+
borderHoverColor: Theme.color.orangeLight1
73+
borderPressedColor: Theme.color.orangeLight2
74+
textColor: Theme.color.orange
75+
backgroundColor: "transparent"
76+
backgroundHoverColor: "transparent"
77+
backgroundPressedColor: "transparent"
78+
}
79+
}
80+
}
81+
}
82+

0 commit comments

Comments
 (0)