Skip to content

Commit e7986c5

Browse files
author
MarcoFalke
committed
Merge bitcoin-core/gui#96: Slight improve create wallet dialog
ac64cec gui: create wallet: add advanced section (Sjors Provoost) c99d6f6 gui: create wallet: name placeholder (Sjors Provoost) 5bff825 [gui] create wallet: smarter checkbox toggling (Sjors Provoost) Pull request description: Previously only users who needed a second wallet had to use to the create wallet dialog. With the merge of bitcoin#15454 now all new users have to. I don't think it was user-friendly enough for that. <img width="403" alt="Schermafbeelding 2020-09-18 om 09 41 44" src="https://user-images.githubusercontent.com/10217/93574129-52ef9680-f998-11ea-9a6f-31144f66d3bf.png"> This PR makes a few simple improvements so that new users don't have to think too much: <img width="369" alt="Schermafbeelding 2020-10-15 om 16 45 22" src="https://user-images.githubusercontent.com/10217/96145959-0c914700-0f06-11eb-9526-cf447d841d7a.png"> It's lightly inspired by #77. It would be better if those changes made it into the upcoming release, but this PR is a good start imo. * wallet encryption is no longer checked by default, because such a change in the default needs a separate discussion (fwiw, I suspect it increases the number of users losing access to coins) * watch-only and descriptor wallet stuff is moved to advanced, so new users know they can safely ignore these check boxes * bonus: when you click on "disable private keys" it disables encrypt wallet and checks blank wallet * label changes: see screenshot * tooltip changes: see code diff Note that a blank wallet name isn't allowed in the dialog; I haven't addressed that. _Update 2020-10-30_, dropped the new strings for now: <img width="450" alt="Schermafbeelding 2020-10-30 om 11 26 55" src="https://user-images.githubusercontent.com/10217/97694591-1b99fc80-1aa3-11eb-8b85-e19f1ad5add4.png"> ACKs for top commit: fjahr: Tested ACK ac64cec jonatack: re-ACK ac64cec, per `git diff d393708 ac64cec` only change since my last review is improving the placeholder from "MyWallet" to "Wallet" and dropping the last commit. Tested creating a dozen wallets in signet with different combinations of options and then verifying/comparing their characteristics in the console with getwalletinfo. My remaining caveats are (1) the need for less user surprise by either (a) improving the user info or (b) with less auto-(un)selecting as mentioned in bitcoin-core/gui#96 (comment) and (2) I prefer the "Encrypt private keys" and "Watch-only" wording and descriptions below over the current ones; hopefully these can be addressed in a follow-up. hebasto: re-ACK ac64cec ryanofsky: Code review ACK ac64cec. Only changes since last review are tweaking placeholder text and dropping "allow nameless" commit Tree-SHA512: a25f84eb66ee4f99af441d73e33928df9d9cf592177398ef48f0037f5913699e47a162cf1301c83b34501546d43ff4ae12607fd078c5c03b92f573bf7604a9f2
2 parents c463f70 + ac64cec commit e7986c5

File tree

2 files changed

+48
-11
lines changed

2 files changed

+48
-11
lines changed

src/qt/createwalletdialog.cpp

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,28 @@ CreateWalletDialog::CreateWalletDialog(QWidget* parent) :
3535
}
3636
});
3737

38-
#ifndef USE_SQLITE
39-
ui->descriptor_checkbox->setToolTip(tr("Compiled without sqlite support (required for descriptor wallets)"));
40-
ui->descriptor_checkbox->setEnabled(false);
41-
ui->descriptor_checkbox->setChecked(false);
42-
#endif
38+
connect(ui->disable_privkeys_checkbox, &QCheckBox::toggled, [this](bool checked) {
39+
// Disable the encrypt_wallet_checkbox when isDisablePrivateKeysChecked is
40+
// set to true, enable it when isDisablePrivateKeysChecked is false.
41+
ui->encrypt_wallet_checkbox->setEnabled(!checked);
42+
43+
// Wallets without private keys start out blank
44+
if (checked) {
45+
ui->blank_wallet_checkbox->setChecked(true);
46+
}
47+
48+
// When the encrypt_wallet_checkbox is disabled, uncheck it.
49+
if (!ui->encrypt_wallet_checkbox->isEnabled()) {
50+
ui->encrypt_wallet_checkbox->setChecked(false);
51+
}
52+
});
53+
54+
#ifndef USE_SQLITE
55+
ui->descriptor_checkbox->setToolTip(tr("Compiled without sqlite support (required for descriptor wallets)"));
56+
ui->descriptor_checkbox->setEnabled(false);
57+
ui->descriptor_checkbox->setChecked(false);
58+
#endif
59+
4360
}
4461

4562
CreateWalletDialog::~CreateWalletDialog()

src/qt/forms/createwalletdialog.ui

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
<height>24</height>
3939
</rect>
4040
</property>
41+
<property name="placeholderText">
42+
<string>Wallet</string>
43+
</property>
4144
</widget>
4245
<widget class="QLabel" name="label">
4346
<property name="geometry">
@@ -68,17 +71,33 @@
6871
<string>Encrypt Wallet</string>
6972
</property>
7073
<property name="checked">
71-
<bool>true</bool>
74+
<bool>false</bool>
75+
</property>
76+
</widget>
77+
<widget class="QLabel" name="advanced_options_label">
78+
<property name="geometry">
79+
<rect>
80+
<x>20</x>
81+
<y>90</y>
82+
<width>130</width>
83+
<height>21</height>
84+
</rect>
85+
</property>
86+
<property name="styleSheet">
87+
<string notr="true">font-weight:bold;</string>
88+
</property>
89+
<property name="text">
90+
<string>Advanced options</string>
7291
</property>
7392
</widget>
7493
<widget class="QCheckBox" name="disable_privkeys_checkbox">
7594
<property name="enabled">
76-
<bool>false</bool>
95+
<bool>true</bool>
7796
</property>
7897
<property name="geometry">
7998
<rect>
8099
<x>20</x>
81-
<y>80</y>
100+
<y>115</y>
82101
<width>171</width>
83102
<height>22</height>
84103
</rect>
@@ -94,8 +113,8 @@
94113
<property name="geometry">
95114
<rect>
96115
<x>20</x>
97-
<y>110</y>
98-
<width>171</width>
116+
<y>135</y>
117+
<width>220</width>
99118
<height>22</height>
100119
</rect>
101120
</property>
@@ -110,7 +129,7 @@
110129
<property name="geometry">
111130
<rect>
112131
<x>20</x>
113-
<y>140</y>
132+
<y>155</y>
114133
<width>171</width>
115134
<height>22</height>
116135
</rect>
@@ -128,6 +147,7 @@
128147
<tabstop>encrypt_wallet_checkbox</tabstop>
129148
<tabstop>disable_privkeys_checkbox</tabstop>
130149
<tabstop>blank_wallet_checkbox</tabstop>
150+
<tabstop>descriptor_checkbox</tabstop>
131151
</tabstops>
132152
<resources/>
133153
<connections>

0 commit comments

Comments
 (0)