Skip to content

Commit 0523a7d

Browse files
committed
qml: Introduce Create Wallet Single-Sig flow
1 parent 0266742 commit 0523a7d

22 files changed

+618
-7
lines changed

src/Makefile.qt.include

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ QT_MOC_CPP = \
4343
qml/models/moc_options_model.cpp \
4444
qml/models/moc_peerlistsortproxy.cpp \
4545
qml/moc_appmode.cpp \
46+
qml/moc_walletcontroller.cpp \
4647
qt/moc_addressbookpage.cpp \
4748
qt/moc_addresstablemodel.cpp \
4849
qt/moc_askpassphrasedialog.cpp \
@@ -310,7 +311,8 @@ BITCOIN_QML_BASE_CPP = \
310311
qml/models/options_model.cpp \
311312
qml/models/peerlistsortproxy.cpp \
312313
qml/imageprovider.cpp \
313-
qml/util.cpp
314+
qml/util.cpp \
315+
qml/walletcontroller.cpp
314316

315317
QML_RES_FONTS = \
316318
qml/res/fonts/Inter-Regular.otf \
@@ -332,6 +334,7 @@ QML_RES_ICONS = \
332334
qml/res/icons/export.png \
333335
qml/res/icons/gear.png \
334336
qml/res/icons/gear-outline.png \
337+
qml/res/icons/hidden.png \
335338
qml/res/icons/info.png \
336339
qml/res/icons/network-dark.png \
337340
qml/res/icons/network-light.png \
@@ -340,7 +343,9 @@ QML_RES_ICONS = \
340343
qml/res/icons/storage-dark.png \
341344
qml/res/icons/storage-light.png \
342345
qml/res/icons/tooltip-arrow-dark.png \
343-
qml/res/icons/tooltip-arrow-light.png
346+
qml/res/icons/tooltip-arrow-light.png \
347+
qml/res/icons/wallet.png \
348+
qml/res/icons/visible.png
344349

345350
QML_QRC_CPP = qml/qrc_bitcoin.cpp
346351
QML_QRC = qml/bitcoin_qml.qrc
@@ -349,7 +354,6 @@ QML_RES_QML = \
349354
qml/components/BlockClock.qml \
350355
qml/components/BlockClockDisplayMode.qml \
351356
qml/components/BlockCounter.qml \
352-
qml/controls/CaretRightIcon.qml \
353357
qml/components/ConnectionOptions.qml \
354358
qml/components/ConnectionSettings.qml \
355359
qml/components/DeveloperOptions.qml \
@@ -365,8 +369,10 @@ QML_RES_QML = \
365369
qml/components/ThemeSettings.qml \
366370
qml/components/TotalBytesIndicator.qml \
367371
qml/components/Tooltip.qml \
372+
qml/controls/CaretRightIcon.qml \
368373
qml/controls/ContinueButton.qml \
369374
qml/controls/CoreText.qml \
375+
qml/controls/CoreTextField.qml \
370376
qml/controls/ExternalLink.qml \
371377
qml/controls/FocusBorder.qml \
372378
qml/controls/Header.qml \
@@ -410,7 +416,15 @@ QML_RES_QML = \
410416
qml/pages/settings/SettingsProxy.qml \
411417
qml/pages/settings/SettingsStorage.qml \
412418
qml/pages/settings/SettingsTheme.qml \
413-
qml/pages/wallet/DesktopWallets.qml
419+
qml/pages/wallet/AddWallet.qml \
420+
qml/pages/wallet/CreateBackup.qml \
421+
qml/pages/wallet/CreateConfirm.qml \
422+
qml/pages/wallet/CreateIntro.qml \
423+
qml/pages/wallet/CreateName.qml \
424+
qml/pages/wallet/CreatePassword.qml \
425+
qml/pages/wallet/DesktopWallets.qml \
426+
qml/pages/wallet/ImportWallet.qml \
427+
qml/pages/wallet/ImportComplete.qml
414428

415429
if TARGET_ANDROID
416430
BITCOIN_QT_H += qml/androidnotifier.h

src/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);

src/qml/bitcoin_qml.qrc

Lines changed: 9 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>
@@ -66,6 +67,11 @@
6667
<file>pages/settings/SettingsStorage.qml</file>
6768
<file>pages/settings/SettingsTheme.qml</file>
6869
<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>
6975
<file>pages/wallet/DesktopWallets.qml</file>
7076
</qresource>
7177
<qresource prefix="/icons">
@@ -85,6 +91,7 @@
8591
<file alias="export">res/icons/export.png</file>
8692
<file alias="gear">res/icons/gear.png</file>
8793
<file alias="gear-outline">res/icons/gear-outline.png</file>
94+
<file alias="hidden">res/icons/hidden.png</file>
8895
<file alias="info">res/icons/info.png</file>
8996
<file alias="network-dark">res/icons/network-dark.png</file>
9097
<file alias="network-light">res/icons/network-light.png</file>
@@ -94,6 +101,8 @@
94101
<file alias="storage-light">res/icons/storage-light.png</file>
95102
<file alias="tooltip-arrow-dark">res/icons/tooltip-arrow-dark.png</file>
96103
<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>
97106
</qresource>
98107
<qresource prefix="/fonts">
99108
<file alias="inter/regular">res/fonts/Inter-Regular.otf</file>

src/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+
}

src/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

src/qml/pages/wallet/AddWallet.qml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ StackView {
5757
Layout.bottomMargin: 20
5858
Layout.alignment: Qt.AlignCenter
5959
text: qsTr("Create wallet")
60+
onClicked: {
61+
addWalletStack.push("qrc:/qml/pages/wallet/CreateIntro.qml");
62+
}
6063
}
6164

6265
ContinueButton {

src/qml/pages/wallet/CreateBackup.qml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
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+
9+
import "../../controls"
10+
import "../../components"
11+
import "../settings"
12+
13+
Page {
14+
id: root
15+
background: null
16+
17+
header: NavigationBar2 {
18+
id: navbar
19+
leftItem: NavButton {
20+
iconSource: "image://images/caret-left"
21+
text: qsTr("Back")
22+
onClicked: {
23+
root.StackView.view.pop()
24+
}
25+
}
26+
}
27+
28+
ColumnLayout {
29+
id: columnLayout
30+
width: Math.min(parent.width, 450)
31+
anchors.horizontalCenter: parent.horizontalCenter
32+
33+
Item {
34+
Layout.alignment: Qt.AlignCenter
35+
Layout.preferredHeight: circle.height
36+
Layout.preferredWidth: circle.width
37+
Rectangle {
38+
id: circle
39+
width: 60
40+
height: width
41+
radius: width / 2
42+
color: Theme.color.blue
43+
}
44+
Icon {
45+
source: "image://images/wallet"
46+
color: Theme.color.white
47+
width: 30
48+
height: width
49+
anchors.centerIn: circle
50+
}
51+
}
52+
53+
Header {
54+
Layout.topMargin: 20
55+
Layout.leftMargin: 20
56+
Layout.rightMargin: 20
57+
header: qsTr("Back up your wallet")
58+
description: qsTr("Your wallet is a file stored on your hard disk.\nTo prevent accidental loss, it is recommended you keep a copy of your wallet file in a secure place, like a dedicated USB Drive.")
59+
}
60+
61+
ContinueButton {
62+
Layout.preferredWidth: Math.min(300, parent.width - 2 * Layout.leftMargin)
63+
Layout.topMargin: 30
64+
Layout.leftMargin: 20
65+
Layout.rightMargin: Layout.leftMargin
66+
Layout.alignment: Qt.AlignCenter
67+
text: qsTr("View file")
68+
borderColor: Theme.color.neutral6
69+
borderHoverColor: Theme.color.orangeLight1
70+
borderPressedColor: Theme.color.orangeLight2
71+
textColor: Theme.color.orange
72+
backgroundColor: "transparent"
73+
backgroundHoverColor: "transparent"
74+
backgroundPressedColor: "transparent"
75+
}
76+
77+
ContinueButton {
78+
Layout.preferredWidth: Math.min(300, parent.width - 2 * Layout.leftMargin)
79+
Layout.topMargin: 30
80+
Layout.leftMargin: 20
81+
Layout.rightMargin: Layout.leftMargin
82+
Layout.alignment: Qt.AlignCenter
83+
text: qsTr("Done")
84+
onClicked: {
85+
root.StackView.view.finished()
86+
}
87+
}
88+
}
89+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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+
9+
import "../../controls"
10+
import "../../components"
11+
import "../settings"
12+
13+
Page {
14+
id: root
15+
background: null
16+
17+
header: NavigationBar2 {
18+
id: navbar
19+
leftItem: NavButton {
20+
iconSource: "image://images/caret-left"
21+
text: qsTr("Back")
22+
onClicked: {
23+
root.StackView.view.pop()
24+
}
25+
}
26+
}
27+
28+
ColumnLayout {
29+
id: columnLayout
30+
width: Math.min(parent.width, 450)
31+
anchors.horizontalCenter: parent.horizontalCenter
32+
33+
Item {
34+
Layout.alignment: Qt.AlignCenter
35+
Layout.preferredHeight: circle.height
36+
Layout.preferredWidth: circle.width
37+
Rectangle {
38+
id: circle
39+
width: 60
40+
height: width
41+
radius: width / 2
42+
color: Theme.color.green
43+
}
44+
Icon {
45+
source: "image://images/wallet"
46+
color: Theme.color.white
47+
width: 30
48+
height: width
49+
anchors.centerIn: circle
50+
}
51+
}
52+
53+
Header {
54+
Layout.topMargin: 20
55+
Layout.leftMargin: 20
56+
Layout.rightMargin: 20
57+
header: qsTr("Your wallet has been created")
58+
description: qsTr("It is good practice to make a small test transaction before you actively use this wallet for larger amounts.")
59+
}
60+
61+
ContinueButton {
62+
Layout.preferredWidth: Math.min(300, parent.width - 2 * Layout.leftMargin)
63+
Layout.topMargin: 30
64+
Layout.leftMargin: 20
65+
Layout.rightMargin: Layout.leftMargin
66+
Layout.alignment: Qt.AlignCenter
67+
text: qsTr("Next")
68+
onClicked: {
69+
root.StackView.view.push("qrc:/qml/pages/wallet/CreateBackup.qml")
70+
}
71+
}
72+
}
73+
}

0 commit comments

Comments
 (0)