From 7d0d4c04903cafade32be3bf2bf1cad3f33c6c03 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Wed, 11 Aug 2021 19:50:12 +0300 Subject: [PATCH] qt: Add WalletFrame::currentWalletSet signal The connection of the WalletFrame::currentWalletSet signal to the BitcoinGUI::updateWalletStatus is a shorter and more descriptive way to call both the setHDStatus and setEncryptionStatus member functions of the BitcoinGUI class in comparison to using of the WalletView::updateEncryptionStatus slot. --- src/qt/bitcoingui.cpp | 1 + src/qt/walletframe.cpp | 3 ++- src/qt/walletframe.h | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index fe606519afe..61d8be62d7b 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -113,6 +113,7 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty connect(walletFrame, &WalletFrame::message, [this](const QString& title, const QString& message, unsigned int style) { this->message(title, message, style); }); + connect(walletFrame, &WalletFrame::currentWalletSet, [this] { updateWalletStatus(); }); setCentralWidget(walletFrame); } else #endif // ENABLE_WALLET diff --git a/src/qt/walletframe.cpp b/src/qt/walletframe.cpp index 3d8bc0c7c59..30c29eb3565 100644 --- a/src/qt/walletframe.cpp +++ b/src/qt/walletframe.cpp @@ -109,7 +109,8 @@ void WalletFrame::setCurrentWallet(WalletModel* wallet_model) walletView->updateGeometry(); walletStack->setCurrentWidget(walletView); - walletView->updateEncryptionStatus(); + + Q_EMIT currentWalletSet(); } void WalletFrame::removeWallet(WalletModel* wallet_model) diff --git a/src/qt/walletframe.h b/src/qt/walletframe.h index fe42293abc1..cbf6af95ec0 100644 --- a/src/qt/walletframe.h +++ b/src/qt/walletframe.h @@ -49,6 +49,7 @@ public: Q_SIGNALS: void createWalletButtonClicked(); void message(const QString& title, const QString& message, unsigned int style); + void currentWalletSet(); private: QStackedWidget *walletStack;