add splash screen

This commit is contained in:
Wladimir J. van der Laan 2011-08-02 21:48:59 +02:00
parent d8f5c59a59
commit 10d680cff4
5 changed files with 27 additions and 0 deletions

View File

@ -370,18 +370,21 @@ bool AppInit2(int argc, char* argv[])
strErrors = ""; strErrors = "";
int64 nStart; int64 nStart;
InitMessage("Loading addresses...");
printf("Loading addresses...\n"); printf("Loading addresses...\n");
nStart = GetTimeMillis(); nStart = GetTimeMillis();
if (!LoadAddresses()) if (!LoadAddresses())
strErrors += _("Error loading addr.dat \n"); strErrors += _("Error loading addr.dat \n");
printf(" addresses %15"PRI64d"ms\n", GetTimeMillis() - nStart); printf(" addresses %15"PRI64d"ms\n", GetTimeMillis() - nStart);
InitMessage("Loading block index...");
printf("Loading block index...\n"); printf("Loading block index...\n");
nStart = GetTimeMillis(); nStart = GetTimeMillis();
if (!LoadBlockIndex()) if (!LoadBlockIndex())
strErrors += _("Error loading blkindex.dat \n"); strErrors += _("Error loading blkindex.dat \n");
printf(" block index %15"PRI64d"ms\n", GetTimeMillis() - nStart); printf(" block index %15"PRI64d"ms\n", GetTimeMillis() - nStart);
InitMessage("Loading wallet...");
printf("Loading wallet...\n"); printf("Loading wallet...\n");
nStart = GetTimeMillis(); nStart = GetTimeMillis();
bool fFirstRun; bool fFirstRun;
@ -412,12 +415,14 @@ bool AppInit2(int argc, char* argv[])
} }
if (pindexBest != pindexRescan) if (pindexBest != pindexRescan)
{ {
InitMessage("Rescanning...");
printf("Rescanning last %i blocks (from block %i)...\n", pindexBest->nHeight - pindexRescan->nHeight, pindexRescan->nHeight); printf("Rescanning last %i blocks (from block %i)...\n", pindexBest->nHeight - pindexRescan->nHeight, pindexRescan->nHeight);
nStart = GetTimeMillis(); nStart = GetTimeMillis();
pwalletMain->ScanForWalletTransactions(pindexRescan, true); pwalletMain->ScanForWalletTransactions(pindexRescan, true);
printf(" rescan %15"PRI64d"ms\n", GetTimeMillis() - nStart); printf(" rescan %15"PRI64d"ms\n", GetTimeMillis() - nStart);
} }
InitMessage("Done loading");
printf("Done loading\n"); printf("Done loading\n");
//// debug print //// debug print

View File

@ -15,9 +15,12 @@
#include <QThread> #include <QThread>
#include <QLocale> #include <QLocale>
#include <QTranslator> #include <QTranslator>
#include <QSplashScreen>
#include <QDebug>
// Need a global reference for the notifications to find the GUI // Need a global reference for the notifications to find the GUI
BitcoinGUI *guiref; BitcoinGUI *guiref;
QSplashScreen *splashref;
int MyMessageBox(const std::string& message, const std::string& caption, int style, wxWindow* parent, int x, int y) 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. Translate string to current locale using Qt.
*/ */
@ -109,6 +121,13 @@ int main(int argc, char *argv[])
translator.load("bitcoin_"+locale); translator.load("bitcoin_"+locale);
app.installTranslator(&translator); app.installTranslator(&translator);
QSplashScreen splash(QPixmap(":/images/splash"), Qt::WindowStaysOnTopHint);
splash.show();
splash.setAutoFillBackground(true);
splashref = &splash;
app.processEvents();
app.setQuitOnLastWindowClosed(false); app.setQuitOnLastWindowClosed(false);
try try
@ -119,6 +138,7 @@ int main(int argc, char *argv[])
// Put this in a block, so that BitcoinGUI is cleaned up properly before // Put this in a block, so that BitcoinGUI is cleaned up properly before
// calling shutdown. // calling shutdown.
BitcoinGUI window; BitcoinGUI window;
splash.finish(&window);
OptionsModel optionsModel(pwalletMain); OptionsModel optionsModel(pwalletMain);
ClientModel clientModel(&optionsModel); ClientModel clientModel(&optionsModel);
WalletModel walletModel(pwalletMain, &optionsModel); WalletModel walletModel(pwalletMain, &optionsModel);

View File

@ -37,6 +37,7 @@
</qresource> </qresource>
<qresource prefix="/images"> <qresource prefix="/images">
<file alias="about">res/images/about.png</file> <file alias="about">res/images/about.png</file>
<file alias="splash">res/images/splash2.jpg</file>
</qresource> </qresource>
<qresource prefix="/movies"> <qresource prefix="/movies">
<file alias="update_spinner">res/movies/update_spinner.mng</file> <file alias="update_spinner">res/movies/update_spinner.mng</file>

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@ -43,6 +43,7 @@ extern bool ThreadSafeAskFee(int64 nFeeRequired, const std::string& strCaption,
extern void CalledSetStatusBar(const std::string& strText, int nField); extern void CalledSetStatusBar(const std::string& strText, int nField);
extern void UIThreadCall(boost::function0<void> fn); extern void UIThreadCall(boost::function0<void> fn);
extern void MainFrameRepaint(); extern void MainFrameRepaint();
extern void InitMessage(const std::string &message);
extern std::string _(const char* psz); extern std::string _(const char* psz);
#endif #endif