mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-20 04:36:08 +01:00
Merge bitcoin-core/gui#29: refactor: Optimize signal-slot connections logic
62cb8d98d2qt: Drop BitcoinGUI* WalletFrame data member (Hennadii Stepanov)f73e5c972aqt: Move CreateWalletActivity connection from WalletFrame to BitcoinGUI (Hennadii Stepanov)20e2e24e90qt: Move WalletView connections from WalletFrame to BitcoinGUI (Hennadii Stepanov) Pull request description: This PR: - implements an idea from https://github.com/bitcoin/bitcoin/pull/17937#issuecomment-575991765 - simplifies `WalletFrame` class interface - as a side effect, removes `bitcoingui` -> `walletframe` -> `bitcoingui` circular dependency - is an alternative to https://github.com/bitcoin/bitcoin/pull/17500 ACKs for top commit: promag: Tested ACK62cb8d98d2on macos 11.2.3 with depends build. jarolrod: ACK62cb8d98d2Tree-SHA512: 633b526a8499ba9ab4b16928daf4de4f6d610284bb9fa51891cad35300a03bde740df3466a71b46e87a62121330fcc9e606eac7666ea5e45fa6d5785b60dcbbd
This commit is contained in:
@@ -105,6 +105,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
|
||||
@@ -671,7 +676,10 @@ WalletController* BitcoinGUI::getWalletController()
|
||||
void BitcoinGUI::addWallet(WalletModel* walletModel)
|
||||
{
|
||||
if (!walletFrame) return;
|
||||
if (!walletFrame->addWallet(walletModel)) return;
|
||||
|
||||
WalletView* wallet_view = new WalletView(platformStyle, walletFrame);
|
||||
if (!walletFrame->addWallet(walletModel, wallet_view)) return;
|
||||
|
||||
rpcConsole->addWallet(walletModel);
|
||||
if (m_wallet_selector->count() == 0) {
|
||||
setWalletActionsEnabled(true);
|
||||
@@ -681,6 +689,18 @@ void BitcoinGUI::addWallet(WalletModel* walletModel)
|
||||
}
|
||||
const QString display_name = walletModel->getDisplayName();
|
||||
m_wallet_selector->addItem(display_name, QVariant::fromValue(walletModel));
|
||||
|
||||
connect(wallet_view, &WalletView::outOfSyncWarningClicked, walletFrame, &WalletFrame::outOfSyncWarningClicked);
|
||||
connect(wallet_view, &WalletView::transactionClicked, this, &BitcoinGUI::gotoHistoryPage);
|
||||
connect(wallet_view, &WalletView::coinsSent, this, &BitcoinGUI::gotoHistoryPage);
|
||||
connect(wallet_view, &WalletView::message, [this](const QString& title, const QString& message, unsigned int style) {
|
||||
this->message(title, message, style);
|
||||
});
|
||||
connect(wallet_view, &WalletView::encryptionStatusChanged, this, &BitcoinGUI::updateWalletStatus);
|
||||
connect(wallet_view, &WalletView::incomingTransaction, this, &BitcoinGUI::incomingTransaction);
|
||||
connect(wallet_view, &WalletView::hdEnabledStatusChanged, this, &BitcoinGUI::updateWalletStatus);
|
||||
connect(this, &BitcoinGUI::setPrivacy, wallet_view, &WalletView::setPrivacy);
|
||||
wallet_view->setPrivacy(isPrivacyModeActivated());
|
||||
}
|
||||
|
||||
void BitcoinGUI::removeWallet(WalletModel* walletModel)
|
||||
|
||||
Reference in New Issue
Block a user