mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-13 11:25:02 -05:00
gui: remove legacy wallet creation
This commit is contained in:
parent
634b68f0dc
commit
b442580ed2
6 changed files with 77 additions and 50 deletions
|
@ -109,10 +109,7 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
|
||||||
{
|
{
|
||||||
/** Create wallet frame and make it the central widget */
|
/** Create wallet frame and make it the central widget */
|
||||||
walletFrame = new WalletFrame(_platformStyle, this);
|
walletFrame = new WalletFrame(_platformStyle, this);
|
||||||
connect(walletFrame, &WalletFrame::createWalletButtonClicked, [this] {
|
connect(walletFrame, &WalletFrame::createWalletButtonClicked, this, &BitcoinGUI::createWallet);
|
||||||
auto activity = new CreateWalletActivity(getWalletController(), this);
|
|
||||||
activity->create();
|
|
||||||
});
|
|
||||||
connect(walletFrame, &WalletFrame::message, [this](const QString& title, const QString& message, unsigned int style) {
|
connect(walletFrame, &WalletFrame::message, [this](const QString& title, const QString& message, unsigned int style) {
|
||||||
this->message(title, message, style);
|
this->message(title, message, style);
|
||||||
});
|
});
|
||||||
|
@ -453,12 +450,7 @@ void BitcoinGUI::createActions()
|
||||||
connect(m_close_wallet_action, &QAction::triggered, [this] {
|
connect(m_close_wallet_action, &QAction::triggered, [this] {
|
||||||
m_wallet_controller->closeWallet(walletFrame->currentWalletModel(), this);
|
m_wallet_controller->closeWallet(walletFrame->currentWalletModel(), this);
|
||||||
});
|
});
|
||||||
connect(m_create_wallet_action, &QAction::triggered, [this] {
|
connect(m_create_wallet_action, &QAction::triggered, this, &BitcoinGUI::createWallet);
|
||||||
auto activity = new CreateWalletActivity(m_wallet_controller, this);
|
|
||||||
connect(activity, &CreateWalletActivity::created, this, &BitcoinGUI::setCurrentWallet);
|
|
||||||
connect(activity, &CreateWalletActivity::created, rpcConsole, &RPCConsole::setCurrentWallet);
|
|
||||||
activity->create();
|
|
||||||
});
|
|
||||||
connect(m_close_all_wallets_action, &QAction::triggered, [this] {
|
connect(m_close_all_wallets_action, &QAction::triggered, [this] {
|
||||||
m_wallet_controller->closeAllWallets(this);
|
m_wallet_controller->closeAllWallets(this);
|
||||||
});
|
});
|
||||||
|
@ -1191,6 +1183,21 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer
|
||||||
progressBar->setToolTip(tooltip);
|
progressBar->setToolTip(tooltip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BitcoinGUI::createWallet()
|
||||||
|
{
|
||||||
|
#ifdef ENABLE_WALLET
|
||||||
|
#ifndef USE_SQLITE
|
||||||
|
// Compiled without sqlite support (required for descriptor wallets)
|
||||||
|
message(tr("Error creating wallet"), tr("Cannot create new wallet, the software was compiled without sqlite support (required for descriptor wallets)"), CClientUIInterface::MSG_ERROR);
|
||||||
|
return;
|
||||||
|
#endif // USE_SQLITE
|
||||||
|
auto activity = new CreateWalletActivity(getWalletController(), this);
|
||||||
|
connect(activity, &CreateWalletActivity::created, this, &BitcoinGUI::setCurrentWallet);
|
||||||
|
connect(activity, &CreateWalletActivity::created, rpcConsole, &RPCConsole::setCurrentWallet);
|
||||||
|
activity->create();
|
||||||
|
#endif // ENABLE_WALLET
|
||||||
|
}
|
||||||
|
|
||||||
void BitcoinGUI::message(const QString& title, QString message, unsigned int style, bool* ret, const QString& detailed_message)
|
void BitcoinGUI::message(const QString& title, QString message, unsigned int style, bool* ret, const QString& detailed_message)
|
||||||
{
|
{
|
||||||
// Default title. On macOS, the window title is ignored (as required by the macOS Guidelines).
|
// Default title. On macOS, the window title is ignored (as required by the macOS Guidelines).
|
||||||
|
|
|
@ -230,6 +230,8 @@ public Q_SLOTS:
|
||||||
void setNetworkActive(bool network_active);
|
void setNetworkActive(bool network_active);
|
||||||
/** Set number of blocks and last block date shown in the UI */
|
/** Set number of blocks and last block date shown in the UI */
|
||||||
void setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, SyncType synctype, SynchronizationState sync_state);
|
void setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, SyncType synctype, SynchronizationState sync_state);
|
||||||
|
/** Launch the wallet creation modal (no-op if wallet is not compiled) **/
|
||||||
|
void createWallet();
|
||||||
|
|
||||||
/** Notify the user of an event from the core network or transaction handling code.
|
/** Notify the user of an event from the core network or transaction handling code.
|
||||||
@param[in] title the message box / notification title
|
@param[in] title the message box / notification title
|
||||||
|
|
|
@ -50,12 +50,10 @@ CreateWalletDialog::CreateWalletDialog(QWidget* parent) :
|
||||||
ui->encrypt_wallet_checkbox->setEnabled(!checked);
|
ui->encrypt_wallet_checkbox->setEnabled(!checked);
|
||||||
ui->blank_wallet_checkbox->setEnabled(!checked);
|
ui->blank_wallet_checkbox->setEnabled(!checked);
|
||||||
ui->disable_privkeys_checkbox->setEnabled(!checked);
|
ui->disable_privkeys_checkbox->setEnabled(!checked);
|
||||||
ui->descriptor_checkbox->setEnabled(!checked);
|
|
||||||
|
|
||||||
// The external signer checkbox is only enabled when a device is detected.
|
// The external signer checkbox is only enabled when a device is detected.
|
||||||
// In that case it is checked by default. Toggling it restores the other
|
// In that case it is checked by default. Toggling it restores the other
|
||||||
// options to their default.
|
// options to their default.
|
||||||
ui->descriptor_checkbox->setChecked(checked);
|
|
||||||
ui->encrypt_wallet_checkbox->setChecked(false);
|
ui->encrypt_wallet_checkbox->setChecked(false);
|
||||||
ui->disable_privkeys_checkbox->setChecked(checked);
|
ui->disable_privkeys_checkbox->setChecked(checked);
|
||||||
ui->blank_wallet_checkbox->setChecked(false);
|
ui->blank_wallet_checkbox->setChecked(false);
|
||||||
|
@ -87,19 +85,6 @@ CreateWalletDialog::CreateWalletDialog(QWidget* parent) :
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
#ifndef USE_SQLITE
|
|
||||||
ui->descriptor_checkbox->setToolTip(tr("Compiled without sqlite support (required for descriptor wallets)"));
|
|
||||||
ui->descriptor_checkbox->setEnabled(false);
|
|
||||||
ui->descriptor_checkbox->setChecked(false);
|
|
||||||
ui->external_signer_checkbox->setEnabled(false);
|
|
||||||
ui->external_signer_checkbox->setChecked(false);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef USE_BDB
|
|
||||||
ui->descriptor_checkbox->setEnabled(false);
|
|
||||||
ui->descriptor_checkbox->setChecked(true);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENABLE_EXTERNAL_SIGNER
|
#ifndef ENABLE_EXTERNAL_SIGNER
|
||||||
//: "External signing" means using devices such as hardware wallets.
|
//: "External signing" means using devices such as hardware wallets.
|
||||||
ui->external_signer_checkbox->setToolTip(tr("Compiled without external signing support (required for external signing)"));
|
ui->external_signer_checkbox->setToolTip(tr("Compiled without external signing support (required for external signing)"));
|
||||||
|
@ -155,11 +140,6 @@ bool CreateWalletDialog::isMakeBlankWalletChecked() const
|
||||||
return ui->blank_wallet_checkbox->isChecked();
|
return ui->blank_wallet_checkbox->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CreateWalletDialog::isDescriptorWalletChecked() const
|
|
||||||
{
|
|
||||||
return ui->descriptor_checkbox->isChecked();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CreateWalletDialog::isExternalSignerChecked() const
|
bool CreateWalletDialog::isExternalSignerChecked() const
|
||||||
{
|
{
|
||||||
return ui->external_signer_checkbox->isChecked();
|
return ui->external_signer_checkbox->isChecked();
|
||||||
|
|
|
@ -35,7 +35,6 @@ public:
|
||||||
bool isEncryptWalletChecked() const;
|
bool isEncryptWalletChecked() const;
|
||||||
bool isDisablePrivateKeysChecked() const;
|
bool isDisablePrivateKeysChecked() const;
|
||||||
bool isMakeBlankWalletChecked() const;
|
bool isMakeBlankWalletChecked() const;
|
||||||
bool isDescriptorWalletChecked() const;
|
|
||||||
bool isExternalSignerChecked() const;
|
bool isExternalSignerChecked() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>364</width>
|
<width>371</width>
|
||||||
<height>249</height>
|
<height>298</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -17,6 +17,48 @@
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_description">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>You are one step away from creating your new wallet!</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_subdescription">
|
||||||
|
<property name="text">
|
||||||
|
<string>Please provide a name and, if desired, enable any advanced options</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>3</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
|
@ -75,7 +117,19 @@
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Advanced Options</string>
|
<string>Advanced Options</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_groupbox">
|
<layout class="QVBoxLayout" name="verticalLayout_groupbox">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="disable_privkeys_checkbox">
|
<widget class="QCheckBox" name="disable_privkeys_checkbox">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
|
@ -99,19 +153,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="descriptor_checkbox">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Use descriptors for scriptPubKey management</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Descriptor Wallet</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="external_signer_checkbox">
|
<widget class="QCheckBox" name="external_signer_checkbox">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
|
@ -155,7 +196,6 @@
|
||||||
<tabstop>encrypt_wallet_checkbox</tabstop>
|
<tabstop>encrypt_wallet_checkbox</tabstop>
|
||||||
<tabstop>disable_privkeys_checkbox</tabstop>
|
<tabstop>disable_privkeys_checkbox</tabstop>
|
||||||
<tabstop>blank_wallet_checkbox</tabstop>
|
<tabstop>blank_wallet_checkbox</tabstop>
|
||||||
<tabstop>descriptor_checkbox</tabstop>
|
|
||||||
<tabstop>external_signer_checkbox</tabstop>
|
<tabstop>external_signer_checkbox</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
|
|
@ -250,15 +250,14 @@ void CreateWalletActivity::createWallet()
|
||||||
|
|
||||||
std::string name = m_create_wallet_dialog->walletName().toStdString();
|
std::string name = m_create_wallet_dialog->walletName().toStdString();
|
||||||
uint64_t flags = 0;
|
uint64_t flags = 0;
|
||||||
|
// Enable descriptors by default.
|
||||||
|
flags |= WALLET_FLAG_DESCRIPTORS;
|
||||||
if (m_create_wallet_dialog->isDisablePrivateKeysChecked()) {
|
if (m_create_wallet_dialog->isDisablePrivateKeysChecked()) {
|
||||||
flags |= WALLET_FLAG_DISABLE_PRIVATE_KEYS;
|
flags |= WALLET_FLAG_DISABLE_PRIVATE_KEYS;
|
||||||
}
|
}
|
||||||
if (m_create_wallet_dialog->isMakeBlankWalletChecked()) {
|
if (m_create_wallet_dialog->isMakeBlankWalletChecked()) {
|
||||||
flags |= WALLET_FLAG_BLANK_WALLET;
|
flags |= WALLET_FLAG_BLANK_WALLET;
|
||||||
}
|
}
|
||||||
if (m_create_wallet_dialog->isDescriptorWalletChecked()) {
|
|
||||||
flags |= WALLET_FLAG_DESCRIPTORS;
|
|
||||||
}
|
|
||||||
if (m_create_wallet_dialog->isExternalSignerChecked()) {
|
if (m_create_wallet_dialog->isExternalSignerChecked()) {
|
||||||
flags |= WALLET_FLAG_EXTERNAL_SIGNER;
|
flags |= WALLET_FLAG_EXTERNAL_SIGNER;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue