Skip to content

Commit

Permalink
qt: Move CreateWalletActivity connection from WalletFrame to BitcoinGUI
Browse files Browse the repository at this point in the history
This changes remove some pointers to the BitcoinGUI instance that is
required for the next commits.

This commit does not change behavior.
  • Loading branch information
hebasto committed May 29, 2021
1 parent 20e2e24 commit f73e5c9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
5 changes: 5 additions & 0 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 1 addition & 7 deletions src/qt/walletframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -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);

Expand Down
2 changes: 2 additions & 0 deletions src/qt/walletframe.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class WalletFrame : public QFrame
/** Notify that the user has requested more information about the out-of-sync warning */
void requestedSyncWarningInfo();

void createWalletButtonClicked();

private:
QStackedWidget *walletStack;
BitcoinGUI *gui;
Expand Down

0 comments on commit f73e5c9

Please sign in to comment.