QtUI code cleanup / comment improvements
[novacoin.git] / src / qt / bitcoin.cpp
index bc652d3..cdd69e3 100644 (file)
 #include <QThread>
 #include <QLocale>
 #include <QTranslator>
+#include <QSplashScreen>
 
 // 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 +92,15 @@ void MainFrameRepaint()
 {
 }
 
+void InitMessage(const std::string &message)
+{
+    if(splashref)
+    {
+        splashref->showMessage(QString::fromStdString(message), Qt::AlignBottom|Qt::AlignHCenter, QColor(255,255,200));
+        QApplication::instance()->processEvents();
+    }
+}
+
 /*
    Translate string to current locale using Qt.
  */
@@ -109,6 +120,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
@@ -117,8 +135,9 @@ int main(int argc, char *argv[])
         {
             {
                 // Put this in a block, so that BitcoinGUI is cleaned up properly before
-                // calling shutdown.
+                // calling Shutdown().
                 BitcoinGUI window;
+                splash.finish(&window);
                 OptionsModel optionsModel(pwalletMain);
                 ClientModel clientModel(&optionsModel);
                 WalletModel walletModel(pwalletMain, &optionsModel);