-
Notifications
You must be signed in to change notification settings - Fork 38k
gui: Create wallet menu option #15450
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
bc6d8a3
60adb21
78863e2
9b41cbb
613de61
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// Copyright (c) 2019 The Bitcoin Core developers | ||
// Distributed under the MIT software license, see the accompanying | ||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
|
||
#if defined(HAVE_CONFIG_H) | ||
#include <config/bitcoin-config.h> | ||
#endif | ||
|
||
#include <qt/createwalletdialog.h> | ||
#include <qt/forms/ui_createwalletdialog.h> | ||
|
||
#include <QPushButton> | ||
|
||
CreateWalletDialog::CreateWalletDialog(QWidget* parent) : | ||
QDialog(parent), | ||
ui(new Ui::CreateWalletDialog) | ||
{ | ||
ui->setupUi(this); | ||
ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Create")); | ||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); | ||
ui->wallet_name_line_edit->setFocus(Qt::ActiveWindowFocusReason); | ||
|
||
connect(ui->wallet_name_line_edit, &QLineEdit::textEdited, [this](const QString& text) { | ||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!text.isEmpty()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the future this should be moved to a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Something for a followup. |
||
}); | ||
|
||
connect(ui->encrypt_wallet_checkbox, &QCheckBox::toggled, [this](bool checked) { | ||
// Disable disable_privkeys_checkbox when encrypt is set to true, enable it when encrypt is false | ||
ui->disable_privkeys_checkbox->setEnabled(!checked); | ||
|
||
// When the disable_privkeys_checkbox is disabled, uncheck it. | ||
if (!ui->disable_privkeys_checkbox->isEnabled()) { | ||
ui->disable_privkeys_checkbox->setChecked(false); | ||
} | ||
}); | ||
} | ||
achow101 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
CreateWalletDialog::~CreateWalletDialog() | ||
{ | ||
delete ui; | ||
} | ||
|
||
QString CreateWalletDialog::walletName() const | ||
{ | ||
return ui->wallet_name_line_edit->text(); | ||
} | ||
|
||
bool CreateWalletDialog::encrypt() const | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: it would be clearer to name this as |
||
{ | ||
return ui->encrypt_wallet_checkbox->isChecked(); | ||
} | ||
|
||
bool CreateWalletDialog::disablePrivateKeys() const | ||
{ | ||
return ui->disable_privkeys_checkbox->isChecked(); | ||
} | ||
|
||
bool CreateWalletDialog::blank() const | ||
{ | ||
return ui->blank_wallet_checkbox->isChecked(); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright (c) 2019 The Bitcoin Core developers | ||
// Distributed under the MIT software license, see the accompanying | ||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
|
||
#ifndef BITCOIN_QT_CREATEWALLETDIALOG_H | ||
#define BITCOIN_QT_CREATEWALLETDIALOG_H | ||
|
||
#include <QDialog> | ||
|
||
class WalletModel; | ||
|
||
namespace Ui { | ||
class CreateWalletDialog; | ||
} | ||
|
||
/** Dialog for creating wallets | ||
*/ | ||
class CreateWalletDialog : public QDialog | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit CreateWalletDialog(QWidget* parent); | ||
virtual ~CreateWalletDialog(); | ||
|
||
QString walletName() const; | ||
bool encrypt() const; | ||
bool disablePrivateKeys() const; | ||
bool blank() const; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: following my comment above, naming these |
||
|
||
private: | ||
Ui::CreateWalletDialog *ui; | ||
}; | ||
|
||
#endif // BITCOIN_QT_CREATEWALLETDIALOG_H |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused variable
status
. Also it would be more consistent to make the interface method match the new pattern.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed the interface to match the new pattern.