Skip to content

Commit 6b83663

Browse files
committed
gui: remove legacy wallet creation
1 parent 634b68f commit 6b83663

File tree

6 files changed

+70
-50
lines changed

6 files changed

+70
-50
lines changed

src/qt/bitcoingui.cpp

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,7 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
109109
{
110110
/** Create wallet frame and make it the central widget */
111111
walletFrame = new WalletFrame(_platformStyle, this);
112-
connect(walletFrame, &WalletFrame::createWalletButtonClicked, [this] {
113-
auto activity = new CreateWalletActivity(getWalletController(), this);
114-
activity->create();
115-
});
112+
connect(walletFrame, &WalletFrame::createWalletButtonClicked, this, &BitcoinGUI::createWallet);
116113
connect(walletFrame, &WalletFrame::message, [this](const QString& title, const QString& message, unsigned int style) {
117114
this->message(title, message, style);
118115
});
@@ -453,12 +450,7 @@ void BitcoinGUI::createActions()
453450
connect(m_close_wallet_action, &QAction::triggered, [this] {
454451
m_wallet_controller->closeWallet(walletFrame->currentWalletModel(), this);
455452
});
456-
connect(m_create_wallet_action, &QAction::triggered, [this] {
457-
auto activity = new CreateWalletActivity(m_wallet_controller, this);
458-
connect(activity, &CreateWalletActivity::created, this, &BitcoinGUI::setCurrentWallet);
459-
connect(activity, &CreateWalletActivity::created, rpcConsole, &RPCConsole::setCurrentWallet);
460-
activity->create();
461-
});
453+
connect(m_create_wallet_action, &QAction::triggered, this, &BitcoinGUI::createWallet);
462454
connect(m_close_all_wallets_action, &QAction::triggered, [this] {
463455
m_wallet_controller->closeAllWallets(this);
464456
});
@@ -1191,6 +1183,21 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer
11911183
progressBar->setToolTip(tooltip);
11921184
}
11931185

1186+
void BitcoinGUI::createWallet()
1187+
{
1188+
#ifdef ENABLE_WALLET
1189+
#ifndef USE_SQLITE
1190+
// Compiled without sqlite support (required for descriptor wallets)
1191+
message(tr("Error creating wallet"), tr("Cannot create new wallet, the software was compiled without sqlite support (required for descriptor wallets)"), CClientUIInterface::MSG_ERROR);
1192+
return;
1193+
#endif // USE_SQLITE
1194+
auto activity = new CreateWalletActivity(getWalletController(), this);
1195+
connect(activity, &CreateWalletActivity::created, this, &BitcoinGUI::setCurrentWallet);
1196+
connect(activity, &CreateWalletActivity::created, rpcConsole, &RPCConsole::setCurrentWallet);
1197+
activity->create();
1198+
#endif // ENABLE_WALLET
1199+
}
1200+
11941201
void BitcoinGUI::message(const QString& title, QString message, unsigned int style, bool* ret, const QString& detailed_message)
11951202
{
11961203
// Default title. On macOS, the window title is ignored (as required by the macOS Guidelines).

src/qt/bitcoingui.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,8 @@ public Q_SLOTS:
230230
void setNetworkActive(bool network_active);
231231
/** Set number of blocks and last block date shown in the UI */
232232
void setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, SyncType synctype, SynchronizationState sync_state);
233+
/** Launch the wallet creation modal (no-op if wallet is not compiled) **/
234+
void createWallet();
233235

234236
/** Notify the user of an event from the core network or transaction handling code.
235237
@param[in] title the message box / notification title

src/qt/createwalletdialog.cpp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,10 @@ CreateWalletDialog::CreateWalletDialog(QWidget* parent) :
5050
ui->encrypt_wallet_checkbox->setEnabled(!checked);
5151
ui->blank_wallet_checkbox->setEnabled(!checked);
5252
ui->disable_privkeys_checkbox->setEnabled(!checked);
53-
ui->descriptor_checkbox->setEnabled(!checked);
5453

5554
// The external signer checkbox is only enabled when a device is detected.
5655
// In that case it is checked by default. Toggling it restores the other
5756
// options to their default.
58-
ui->descriptor_checkbox->setChecked(checked);
5957
ui->encrypt_wallet_checkbox->setChecked(false);
6058
ui->disable_privkeys_checkbox->setChecked(checked);
6159
ui->blank_wallet_checkbox->setChecked(false);
@@ -87,19 +85,6 @@ CreateWalletDialog::CreateWalletDialog(QWidget* parent) :
8785
}
8886
});
8987

90-
#ifndef USE_SQLITE
91-
ui->descriptor_checkbox->setToolTip(tr("Compiled without sqlite support (required for descriptor wallets)"));
92-
ui->descriptor_checkbox->setEnabled(false);
93-
ui->descriptor_checkbox->setChecked(false);
94-
ui->external_signer_checkbox->setEnabled(false);
95-
ui->external_signer_checkbox->setChecked(false);
96-
#endif
97-
98-
#ifndef USE_BDB
99-
ui->descriptor_checkbox->setEnabled(false);
100-
ui->descriptor_checkbox->setChecked(true);
101-
#endif
102-
10388
#ifndef ENABLE_EXTERNAL_SIGNER
10489
//: "External signing" means using devices such as hardware wallets.
10590
ui->external_signer_checkbox->setToolTip(tr("Compiled without external signing support (required for external signing)"));
@@ -155,11 +140,6 @@ bool CreateWalletDialog::isMakeBlankWalletChecked() const
155140
return ui->blank_wallet_checkbox->isChecked();
156141
}
157142

158-
bool CreateWalletDialog::isDescriptorWalletChecked() const
159-
{
160-
return ui->descriptor_checkbox->isChecked();
161-
}
162-
163143
bool CreateWalletDialog::isExternalSignerChecked() const
164144
{
165145
return ui->external_signer_checkbox->isChecked();

src/qt/createwalletdialog.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ class CreateWalletDialog : public QDialog
3535
bool isEncryptWalletChecked() const;
3636
bool isDisablePrivateKeysChecked() const;
3737
bool isMakeBlankWalletChecked() const;
38-
bool isDescriptorWalletChecked() const;
3938
bool isExternalSignerChecked() const;
4039

4140
private:

src/qt/forms/createwalletdialog.ui

Lines changed: 49 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>364</width>
10-
<height>249</height>
9+
<width>371</width>
10+
<height>298</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
@@ -17,6 +17,41 @@
1717
<bool>true</bool>
1818
</property>
1919
<layout class="QVBoxLayout" name="verticalLayout">
20+
<item alignment="Qt::AlignHCenter">
21+
<widget class="QLabel" name="label">
22+
<property name="sizePolicy">
23+
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
24+
<horstretch>0</horstretch>
25+
<verstretch>0</verstretch>
26+
</sizepolicy>
27+
</property>
28+
<property name="text">
29+
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;You are one step away from creating your new descriptors wallet!&lt;/p&gt;&lt;p&gt;Please enter the name and, if desired, enable any custom options&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
30+
</property>
31+
<property name="alignment">
32+
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
33+
</property>
34+
<property name="wordWrap">
35+
<bool>false</bool>
36+
</property>
37+
</widget>
38+
</item>
39+
<item>
40+
<spacer name="verticalSpacer">
41+
<property name="orientation">
42+
<enum>Qt::Vertical</enum>
43+
</property>
44+
<property name="sizeType">
45+
<enum>QSizePolicy::Fixed</enum>
46+
</property>
47+
<property name="sizeHint" stdset="0">
48+
<size>
49+
<width>20</width>
50+
<height>3</height>
51+
</size>
52+
</property>
53+
</spacer>
54+
</item>
2055
<item>
2156
<layout class="QHBoxLayout" name="horizontalLayout">
2257
<item>
@@ -75,7 +110,19 @@
75110
<property name="title">
76111
<string>Advanced Options</string>
77112
</property>
113+
<property name="alignment">
114+
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
115+
</property>
116+
<property name="flat">
117+
<bool>false</bool>
118+
</property>
119+
<property name="checkable">
120+
<bool>false</bool>
121+
</property>
78122
<layout class="QVBoxLayout" name="verticalLayout_groupbox">
123+
<property name="spacing">
124+
<number>9</number>
125+
</property>
79126
<item>
80127
<widget class="QCheckBox" name="disable_privkeys_checkbox">
81128
<property name="enabled">
@@ -99,19 +146,6 @@
99146
</property>
100147
</widget>
101148
</item>
102-
<item>
103-
<widget class="QCheckBox" name="descriptor_checkbox">
104-
<property name="toolTip">
105-
<string>Use descriptors for scriptPubKey management</string>
106-
</property>
107-
<property name="text">
108-
<string>Descriptor Wallet</string>
109-
</property>
110-
<property name="checked">
111-
<bool>true</bool>
112-
</property>
113-
</widget>
114-
</item>
115149
<item>
116150
<widget class="QCheckBox" name="external_signer_checkbox">
117151
<property name="toolTip">
@@ -155,7 +189,6 @@
155189
<tabstop>encrypt_wallet_checkbox</tabstop>
156190
<tabstop>disable_privkeys_checkbox</tabstop>
157191
<tabstop>blank_wallet_checkbox</tabstop>
158-
<tabstop>descriptor_checkbox</tabstop>
159192
<tabstop>external_signer_checkbox</tabstop>
160193
</tabstops>
161194
<resources/>

src/qt/walletcontroller.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,15 +250,14 @@ void CreateWalletActivity::createWallet()
250250

251251
std::string name = m_create_wallet_dialog->walletName().toStdString();
252252
uint64_t flags = 0;
253+
// Enable descriptors by default.
254+
flags |= WALLET_FLAG_DESCRIPTORS;
253255
if (m_create_wallet_dialog->isDisablePrivateKeysChecked()) {
254256
flags |= WALLET_FLAG_DISABLE_PRIVATE_KEYS;
255257
}
256258
if (m_create_wallet_dialog->isMakeBlankWalletChecked()) {
257259
flags |= WALLET_FLAG_BLANK_WALLET;
258260
}
259-
if (m_create_wallet_dialog->isDescriptorWalletChecked()) {
260-
flags |= WALLET_FLAG_DESCRIPTORS;
261-
}
262261
if (m_create_wallet_dialog->isExternalSignerChecked()) {
263262
flags |= WALLET_FLAG_EXTERNAL_SIGNER;
264263
}

0 commit comments

Comments
 (0)