qt: Move CreateWalletActivity connection from WalletFrame to BitcoinGUI

This changes remove some pointers to the BitcoinGUI instance that is
required for the next commits.

This commit does not change behavior.
This commit is contained in:
Hennadii Stepanov 2021-05-15 22:58:08 +03:00
parent 20e2e24e90
commit f73e5c972a
No known key found for this signature in database
GPG key ID: 410108112E7EA81F
3 changed files with 8 additions and 7 deletions

View file

@ -104,6 +104,11 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
{
/** Create wallet frame and make it the central widget */
walletFrame = new WalletFrame(_platformStyle, this);
connect(walletFrame, &WalletFrame::createWalletButtonClicked, [this] {
auto activity = new CreateWalletActivity(getWalletController(), this);
connect(activity, &CreateWalletActivity::finished, activity, &QObject::deleteLater);
activity->create();
});
setCentralWidget(walletFrame);
} else
#endif // ENABLE_WALLET

View file

@ -5,9 +5,7 @@
#include <qt/walletframe.h>
#include <qt/bitcoingui.h>
#include <qt/createwalletdialog.h>
#include <qt/overviewpage.h>
#include <qt/walletcontroller.h>
#include <qt/walletmodel.h>
#include <qt/walletview.h>
@ -42,11 +40,7 @@ WalletFrame::WalletFrame(const PlatformStyle* _platformStyle, BitcoinGUI* _gui)
// A button for create wallet dialog
QPushButton* create_wallet_button = new QPushButton(tr("Create a new wallet"), walletStack);
connect(create_wallet_button, &QPushButton::clicked, [this] {
auto activity = new CreateWalletActivity(gui->getWalletController(), this);
connect(activity, &CreateWalletActivity::finished, activity, &QObject::deleteLater);
activity->create();
});
connect(create_wallet_button, &QPushButton::clicked, this, &WalletFrame::createWalletButtonClicked);
no_wallet_layout->addWidget(create_wallet_button, 0, Qt::AlignHCenter | Qt::AlignTop);
no_wallet_group->setLayout(no_wallet_layout);

View file

@ -51,6 +51,8 @@ Q_SIGNALS:
/** Notify that the user has requested more information about the out-of-sync warning */
void requestedSyncWarningInfo();
void createWalletButtonClicked();
private:
QStackedWidget *walletStack;
BitcoinGUI *gui;