aboutsummaryrefslogtreecommitdiff
path: root/src/qt/splashscreen.cpp
diff options
context:
space:
mode:
authorRussell Yanofsky <russ@yanofsky.org>2017-04-17 15:10:47 -0400
committerJohn Newbery <john@johnnewbery.com>2018-04-04 16:52:40 -0400
commit5fba3af21e44ab7552c57782de430c1f4cfd6697 (patch)
treedd34ef0bbf69f24f9bd4cc2a615a0398e6cf79a9 /src/qt/splashscreen.cpp
parentc2f672fb1960399389dea9cdd8f76d7156c2c88b (diff)
downloadbitcoin-5fba3af21e44ab7552c57782de430c1f4cfd6697.tar.xz
Remove direct bitcoin calls from qt/splashscreen.cpp
Diffstat (limited to 'src/qt/splashscreen.cpp')
-rw-r--r--src/qt/splashscreen.cpp40
1 files changed, 19 insertions, 21 deletions
diff --git a/src/qt/splashscreen.cpp b/src/qt/splashscreen.cpp
index 66e9dd0465..2475a82ef9 100644
--- a/src/qt/splashscreen.cpp
+++ b/src/qt/splashscreen.cpp
@@ -12,22 +12,21 @@
#include <clientversion.h>
#include <init.h>
+#include <interface/handler.h>
+#include <interface/node.h>
+#include <interface/wallet.h>
#include <util.h>
#include <ui_interface.h>
#include <version.h>
-#ifdef ENABLE_WALLET
-#include <wallet/wallet.h>
-#endif
-
#include <QApplication>
#include <QCloseEvent>
#include <QDesktopWidget>
#include <QPainter>
#include <QRadialGradient>
-SplashScreen::SplashScreen(Qt::WindowFlags f, const NetworkStyle *networkStyle) :
- QWidget(0, f), curAlignment(0)
+SplashScreen::SplashScreen(interface::Node& node, Qt::WindowFlags f, const NetworkStyle *networkStyle) :
+ QWidget(0, f), curAlignment(0), m_node(node)
{
// set reference point, paddings
int paddingRight = 50;
@@ -143,7 +142,7 @@ bool SplashScreen::eventFilter(QObject * obj, QEvent * ev) {
if (ev->type() == QEvent::KeyPress) {
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(ev);
if(keyEvent->text()[0] == 'q') {
- StartShutdown();
+ m_node.startShutdown();
}
}
return QObject::eventFilter(obj, ev);
@@ -177,35 +176,34 @@ static void ShowProgress(SplashScreen *splash, const std::string &title, int nPr
: _("press q to shutdown")) +
strprintf("\n%d", nProgress) + "%");
}
-
#ifdef ENABLE_WALLET
-void SplashScreen::ConnectWallet(CWallet* wallet)
+void SplashScreen::ConnectWallet(std::unique_ptr<interface::Wallet> wallet)
{
- wallet->ShowProgress.connect(boost::bind(ShowProgress, this, _1, _2, false));
- connectedWallets.push_back(wallet);
+ m_connected_wallet_handlers.emplace_back(wallet->handleShowProgress(boost::bind(ShowProgress, this, _1, _2, false)));
+ m_connected_wallets.emplace_back(std::move(wallet));
}
#endif
void SplashScreen::subscribeToCoreSignals()
{
// Connect signals to client
- uiInterface.InitMessage.connect(boost::bind(InitMessage, this, _1));
- uiInterface.ShowProgress.connect(boost::bind(ShowProgress, this, _1, _2, _3));
+ m_handler_init_message = m_node.handleInitMessage(boost::bind(InitMessage, this, _1));
+ m_handler_show_progress = m_node.handleShowProgress(boost::bind(ShowProgress, this, _1, _2, _3));
#ifdef ENABLE_WALLET
- uiInterface.LoadWallet.connect(boost::bind(&SplashScreen::ConnectWallet, this, _1));
+ m_handler_load_wallet = m_node.handleLoadWallet([this](std::unique_ptr<interface::Wallet> wallet) { ConnectWallet(std::move(wallet)); });
#endif
}
void SplashScreen::unsubscribeFromCoreSignals()
{
// Disconnect signals from client
- uiInterface.InitMessage.disconnect(boost::bind(InitMessage, this, _1));
- uiInterface.ShowProgress.disconnect(boost::bind(ShowProgress, this, _1, _2, _3));
-#ifdef ENABLE_WALLET
- for (CWallet* const & pwallet : connectedWallets) {
- pwallet->ShowProgress.disconnect(boost::bind(ShowProgress, this, _1, _2, false));
+ m_handler_init_message->disconnect();
+ m_handler_show_progress->disconnect();
+ for (auto& handler : m_connected_wallet_handlers) {
+ handler->disconnect();
}
-#endif
+ m_connected_wallet_handlers.clear();
+ m_connected_wallets.clear();
}
void SplashScreen::showMessage(const QString &message, int alignment, const QColor &color)
@@ -227,6 +225,6 @@ void SplashScreen::paintEvent(QPaintEvent *event)
void SplashScreen::closeEvent(QCloseEvent *event)
{
- StartShutdown(); // allows an "emergency" shutdown during startup
+ m_node.startShutdown(); // allows an "emergency" shutdown during startup
event->ignore();
}