From 202d853bbea8ecb2164b9c9dc69e2129b45f05f8 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Tue, 7 Jan 2014 11:30:17 +0100 Subject: qt: Move initialization/shutdown to a thread Move AppInit2 and Shutdown to a thread. This allows a more responsive splash screen, prevents 'process does not respond' messages from the window system and will allow for showing a user friendly window while shutting down. --- src/qt/splashscreen.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/qt/splashscreen.cpp') diff --git a/src/qt/splashscreen.cpp b/src/qt/splashscreen.cpp index 6fb834c04..0e998c6d7 100644 --- a/src/qt/splashscreen.cpp +++ b/src/qt/splashscreen.cpp @@ -13,6 +13,8 @@ SplashScreen::SplashScreen(const QPixmap &pixmap, Qt::WindowFlags f, bool isTestNet) : QSplashScreen(pixmap, f) { + setAutoFillBackground(true); + // set reference point, paddings int paddingRight = 50; int paddingTop = 50; -- cgit v1.2.3 From 35ecf854c084c248ad640c6af030a9d1ed726c47 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Wed, 8 Jan 2014 08:59:24 +0100 Subject: qt: Remove global references in bitcoin.cpp Remove the need for global references `guiref` and `splashref` by making the BitcoinGUI and SplashScreen classes register for the UI interface signals themselves. --- src/qt/splashscreen.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src/qt/splashscreen.cpp') diff --git a/src/qt/splashscreen.cpp b/src/qt/splashscreen.cpp index 0e998c6d7..8b16496c1 100644 --- a/src/qt/splashscreen.cpp +++ b/src/qt/splashscreen.cpp @@ -6,6 +6,7 @@ #include "clientversion.h" #include "util.h" +#include "ui_interface.h" #include #include @@ -85,4 +86,37 @@ SplashScreen::SplashScreen(const QPixmap &pixmap, Qt::WindowFlags f, bool isTest pixPaint.end(); this->setPixmap(newPixmap); + + subscribeToCoreSignals(); +} + +SplashScreen::~SplashScreen() +{ + unsubscribeFromCoreSignals(); +} + +void SplashScreen::slotFinish(QWidget *mainWin) +{ + finish(mainWin); +} + +static void InitMessage(SplashScreen *splash, const std::string &message) +{ + QMetaObject::invokeMethod(splash, "showMessage", + Qt::QueuedConnection, + Q_ARG(QString, QString::fromStdString(message)), + Q_ARG(int, Qt::AlignBottom|Qt::AlignHCenter), + Q_ARG(QColor, QColor(55,55,55))); +} + +void SplashScreen::subscribeToCoreSignals() +{ + // Connect signals to client + uiInterface.InitMessage.connect(boost::bind(InitMessage, this, _1)); +} + +void SplashScreen::unsubscribeFromCoreSignals() +{ + // Disconnect signals from client + uiInterface.InitMessage.disconnect(boost::bind(InitMessage, this, _1)); } -- cgit v1.2.3