Bitcoin Core  0.20.99
P2P Digital Currency
createwalletdialog.cpp
Go to the documentation of this file.
1 // Copyright (c) 2019 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 #if defined(HAVE_CONFIG_H)
7 #endif
8 
10 #include <qt/forms/ui_createwalletdialog.h>
11 
12 #include <QPushButton>
13 
15  QDialog(parent),
16  ui(new Ui::CreateWalletDialog)
17 {
18  ui->setupUi(this);
19  ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Create"));
20  ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
21  ui->wallet_name_line_edit->setFocus(Qt::ActiveWindowFocusReason);
22 
23  connect(ui->wallet_name_line_edit, &QLineEdit::textEdited, [this](const QString& text) {
24  ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!text.isEmpty());
25  });
26 
27  connect(ui->encrypt_wallet_checkbox, &QCheckBox::toggled, [this](bool checked) {
28  // Disable the disable_privkeys_checkbox when isEncryptWalletChecked is
29  // set to true, enable it when isEncryptWalletChecked is false.
30  ui->disable_privkeys_checkbox->setEnabled(!checked);
31 
32  // When the disable_privkeys_checkbox is disabled, uncheck it.
33  if (!ui->disable_privkeys_checkbox->isEnabled()) {
34  ui->disable_privkeys_checkbox->setChecked(false);
35  }
36  });
37 
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
43 }
44 
46 {
47  delete ui;
48 }
49 
51 {
52  return ui->wallet_name_line_edit->text();
53 }
54 
56 {
57  return ui->encrypt_wallet_checkbox->isChecked();
58 }
59 
61 {
62  return ui->disable_privkeys_checkbox->isChecked();
63 }
64 
66 {
67  return ui->blank_wallet_checkbox->isChecked();
68 }
69 
71 {
72  return ui->descriptor_checkbox->isChecked();
73 }
bool isDescriptorWalletChecked() const
bool isEncryptWalletChecked() const
QString walletName() const
bool isDisablePrivateKeysChecked() const
CreateWalletDialog(QWidget *parent)
Ui::CreateWalletDialog * ui
bool isMakeBlankWalletChecked() const
Dialog for creating wallets.