diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-08-02 21:48:59 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-08-02 21:48:59 +0200 |
commit | 10d680cff4d0086bd9621438e5ac04740a38d106 (patch) | |
tree | 39da447f8515d39e6fd424bad962b815d3fa7144 | |
parent | d8f5c59a594f25d2e03616284068a1034fc5875b (diff) |
add splash screen
-rw-r--r-- | src/init.cpp | 5 | ||||
-rw-r--r-- | src/qt/bitcoin.cpp | 20 | ||||
-rw-r--r-- | src/qt/bitcoin.qrc | 1 | ||||
-rw-r--r-- | src/qt/res/images/splash2.jpg | bin | 0 -> 5816 bytes | |||
-rw-r--r-- | src/qtui.h | 1 |
5 files changed, 27 insertions, 0 deletions
diff --git a/src/init.cpp b/src/init.cpp index fcb0c83340..c328ca37d7 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -370,18 +370,21 @@ bool AppInit2(int argc, char* argv[]) strErrors = ""; int64 nStart; + InitMessage("Loading addresses..."); printf("Loading addresses...\n"); nStart = GetTimeMillis(); if (!LoadAddresses()) strErrors += _("Error loading addr.dat \n"); printf(" addresses %15"PRI64d"ms\n", GetTimeMillis() - nStart); + InitMessage("Loading block index..."); printf("Loading block index...\n"); nStart = GetTimeMillis(); if (!LoadBlockIndex()) strErrors += _("Error loading blkindex.dat \n"); printf(" block index %15"PRI64d"ms\n", GetTimeMillis() - nStart); + InitMessage("Loading wallet..."); printf("Loading wallet...\n"); nStart = GetTimeMillis(); bool fFirstRun; @@ -412,12 +415,14 @@ bool AppInit2(int argc, char* argv[]) } if (pindexBest != pindexRescan) { + InitMessage("Rescanning..."); printf("Rescanning last %i blocks (from block %i)...\n", pindexBest->nHeight - pindexRescan->nHeight, pindexRescan->nHeight); nStart = GetTimeMillis(); pwalletMain->ScanForWalletTransactions(pindexRescan, true); printf(" rescan %15"PRI64d"ms\n", GetTimeMillis() - nStart); } + InitMessage("Done loading"); printf("Done loading\n"); //// debug print diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index bc652d31b0..749afb4bc2 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -15,9 +15,12 @@ #include <QThread> #include <QLocale> #include <QTranslator> +#include <QSplashScreen> +#include <QDebug> // Need a global reference for the notifications to find the GUI BitcoinGUI *guiref; +QSplashScreen *splashref; int MyMessageBox(const std::string& message, const std::string& caption, int style, wxWindow* parent, int x, int y) { @@ -90,6 +93,15 @@ void MainFrameRepaint() { } +void InitMessage(const std::string &message) +{ + if(splashref) + { + splashref->showMessage(QString::fromStdString(message), Qt::AlignBottom, QColor(255,255,255)); + QApplication::instance()->processEvents(); + } +} + /* Translate string to current locale using Qt. */ @@ -109,6 +121,13 @@ int main(int argc, char *argv[]) translator.load("bitcoin_"+locale); app.installTranslator(&translator); + QSplashScreen splash(QPixmap(":/images/splash"), Qt::WindowStaysOnTopHint); + splash.show(); + splash.setAutoFillBackground(true); + splashref = &splash; + + app.processEvents(); + app.setQuitOnLastWindowClosed(false); try @@ -119,6 +138,7 @@ int main(int argc, char *argv[]) // Put this in a block, so that BitcoinGUI is cleaned up properly before // calling shutdown. BitcoinGUI window; + splash.finish(&window); OptionsModel optionsModel(pwalletMain); ClientModel clientModel(&optionsModel); WalletModel walletModel(pwalletMain, &optionsModel); diff --git a/src/qt/bitcoin.qrc b/src/qt/bitcoin.qrc index 8d4bab5462..e56536199b 100644 --- a/src/qt/bitcoin.qrc +++ b/src/qt/bitcoin.qrc @@ -37,6 +37,7 @@ </qresource> <qresource prefix="/images"> <file alias="about">res/images/about.png</file> + <file alias="splash">res/images/splash2.jpg</file> </qresource> <qresource prefix="/movies"> <file alias="update_spinner">res/movies/update_spinner.mng</file> diff --git a/src/qt/res/images/splash2.jpg b/src/qt/res/images/splash2.jpg Binary files differnew file mode 100644 index 0000000000..3846e6f68d --- /dev/null +++ b/src/qt/res/images/splash2.jpg diff --git a/src/qtui.h b/src/qtui.h index a3b9eb0148..17fc44e94b 100644 --- a/src/qtui.h +++ b/src/qtui.h @@ -43,6 +43,7 @@ extern bool ThreadSafeAskFee(int64 nFeeRequired, const std::string& strCaption, extern void CalledSetStatusBar(const std::string& strText, int nField); extern void UIThreadCall(boost::function0<void> fn); extern void MainFrameRepaint(); +extern void InitMessage(const std::string &message); extern std::string _(const char* psz); #endif |