Skip to content

Commit a73577b

Browse files
committed
Merge #403: Introduce Create Single-Sig wallet flow
a3de255 qml: Introduce Create Wallet Single-Sig flow (johnny9) 0266742 qml: Introduce AddWallet page after onboarding (johnny9) 931d442 qml: Add DISABLED state to ContinueButton (johnny9) 4f11e01 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 [a3de255](a3de255) on WSL Ubuntu 22.04 Tree-SHA512: 9970996d1b26a9db7733b050e13d37494c7f0ebbcb0faa00b3a565a5aaeb634ac1d7ad38c11a0de34d15f28c52be953935d025b979e132990bc7dc70a84964a8
2 parents c065a17 + a3de255 commit a73577b

27 files changed

+767
-9
lines changed

src/Makefile.qt.include

Lines changed: 17 additions & 3 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 \
@@ -126,6 +127,7 @@ BITCOIN_QT_H = \
126127
qml/guiconstants.h \
127128
qml/imageprovider.h \
128129
qml/util.h \
130+
qml/walletcontroller.h \
129131
qt/addressbookpage.h \
130132
qt/addresstablemodel.h \
131133
qt/askpassphrasedialog.h \
@@ -310,13 +312,15 @@ BITCOIN_QML_BASE_CPP = \
310312
qml/models/options_model.cpp \
311313
qml/models/peerlistsortproxy.cpp \
312314
qml/imageprovider.cpp \
313-
qml/util.cpp
315+
qml/util.cpp \
316+
qml/walletcontroller.cpp
314317

315318
QML_RES_FONTS = \
316319
qml/res/fonts/Inter-Regular.otf \
317320
qml/res/fonts/Inter-SemiBold.otf
318321

319322
QML_RES_ICONS = \
323+
qml/res/icons/add-wallet-dark.png \
320324
qml/res/icons/arrow-down.png \
321325
qml/res/icons/arrow-up.png \
322326
qml/res/icons/bitcoin-circle.png \
@@ -331,6 +335,7 @@ QML_RES_ICONS = \
331335
qml/res/icons/export.png \
332336
qml/res/icons/gear.png \
333337
qml/res/icons/gear-outline.png \
338+
qml/res/icons/hidden.png \
334339
qml/res/icons/info.png \
335340
qml/res/icons/network-dark.png \
336341
qml/res/icons/network-light.png \
@@ -339,7 +344,9 @@ QML_RES_ICONS = \
339344
qml/res/icons/storage-dark.png \
340345
qml/res/icons/storage-light.png \
341346
qml/res/icons/tooltip-arrow-dark.png \
342-
qml/res/icons/tooltip-arrow-light.png
347+
qml/res/icons/tooltip-arrow-light.png \
348+
qml/res/icons/wallet.png \
349+
qml/res/icons/visible.png
343350

344351
QML_QRC_CPP = qml/qrc_bitcoin.cpp
345352
QML_QRC = qml/bitcoin_qml.qrc
@@ -348,7 +355,6 @@ QML_RES_QML = \
348355
qml/components/BlockClock.qml \
349356
qml/components/BlockClockDisplayMode.qml \
350357
qml/components/BlockCounter.qml \
351-
qml/controls/CaretRightIcon.qml \
352358
qml/components/ConnectionOptions.qml \
353359
qml/components/ConnectionSettings.qml \
354360
qml/components/DeveloperOptions.qml \
@@ -364,8 +370,10 @@ QML_RES_QML = \
364370
qml/components/ThemeSettings.qml \
365371
qml/components/TotalBytesIndicator.qml \
366372
qml/components/Tooltip.qml \
373+
qml/controls/CaretRightIcon.qml \
367374
qml/controls/ContinueButton.qml \
368375
qml/controls/CoreText.qml \
376+
qml/controls/CoreTextField.qml \
369377
qml/controls/ExternalLink.qml \
370378
qml/controls/FocusBorder.qml \
371379
qml/controls/Header.qml \
@@ -409,6 +417,12 @@ QML_RES_QML = \
409417
qml/pages/settings/SettingsProxy.qml \
410418
qml/pages/settings/SettingsStorage.qml \
411419
qml/pages/settings/SettingsTheme.qml \
420+
qml/pages/wallet/AddWallet.qml \
421+
qml/pages/wallet/CreateBackup.qml \
422+
qml/pages/wallet/CreateConfirm.qml \
423+
qml/pages/wallet/CreateIntro.qml \
424+
qml/pages/wallet/CreateName.qml \
425+
qml/pages/wallet/CreatePassword.qml \
412426
qml/pages/wallet/DesktopWallets.qml
413427

414428
if TARGET_ANDROID

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: 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>

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

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

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

0 commit comments

Comments
 (0)