QTfrontend/main.cpp
changeset 8337 bf237f7f1d94
parent 8323 ab0b618bdf13
child 8339 2154732c65f1
--- a/QTfrontend/main.cpp	Thu Dec 27 15:56:02 2012 +0100
+++ b/QTfrontend/main.cpp	Thu Dec 27 17:01:02 2012 +0100
@@ -27,6 +27,8 @@
 #include <QSettings>
 #include <QStringListModel>
 #include <QDate>
+#include <QDesktopWidget>
+#include <QLabel>
 
 #include "hwform.h"
 #include "hwconsts.h"
@@ -136,6 +138,19 @@
 
     HWApplication app(argc, argv);
 
+    QLabel *splash = NULL;
+#ifdef Q_WS_WIN | Q_WS_X11 | Q_WS_MAC //enabled on all platforms, disable if it doesn't look good
+    QPixmap pixmap(":res/splash.png");
+    splash = new QLabel(0, Qt::FramelessWindowHint|Qt::WindowStaysOnTopHint);
+    splash->setAttribute(Qt::WA_TranslucentBackground);
+    const QRect deskSize = QApplication::desktop()->screenGeometry(-1);
+    QPoint splashCenter = QPoint( (deskSize.width() - pixmap.width())/2,
+                                  (deskSize.height() - pixmap.height())/2 );
+    splash->move(splashCenter);
+    splash->setPixmap(pixmap);
+    splash->show();
+#endif
+
     FileEngineHandler engine(argv[0]);
 
     app.setAttribute(Qt::AA_DontShowIconsInMenus,false);
@@ -305,6 +320,7 @@
             break;
         default :
             fname = "qt.css";
+            break;
     }
 
     // load external stylesheet if there is any
@@ -319,5 +335,7 @@
 
     app.form = new HWForm(NULL, style);
     app.form->show();
+    if(splash)
+        splash->close();
     return app.exec();
 }