diff main/main.cpp @ 231:e8a7a935128e

* add splash screen
author Chris Cannam
date Wed, 23 Jan 2008 11:38:34 +0000
parents a3011df6ddad
children 99fa3387dfef
line wrap: on
line diff
--- a/main/main.cpp	Wed Jan 09 17:09:44 2008 +0000
+++ b/main/main.cpp	Wed Jan 23 11:38:34 2008 +0000
@@ -32,6 +32,7 @@
 #include <QIcon>
 #include <QSessionManager>
 #include <QDir>
+#include <QSplashScreen>
 
 #include <iostream>
 #include <signal.h>
@@ -229,6 +230,17 @@
     QApplication::setOrganizationDomain("sonicvisualiser.org");
     QApplication::setApplicationName(QApplication::tr("Sonic Visualiser"));
 
+    QPixmap pixmap(":/icons/sv-splash.png");
+    QSplashScreen splash(pixmap);
+
+    QSettings settings;
+    settings.beginGroup("MainWindow");
+    
+    if (settings.value("showsplash", true).toBool()) {
+        splash.show();
+        application.processEvents();
+    }
+
     QIcon icon;
     int sizes[] = { 16, 22, 24, 32, 48, 64, 128 };
     for (int i = 0; i < sizeof(sizes)/sizeof(sizes[0]); ++i) {
@@ -277,8 +289,6 @@
     if (height < 450) height = available.height() * 2 / 3;
     if (width > height * 2) width = height * 2;
 
-    QSettings settings;
-    settings.beginGroup("MainWindow");
     QSize size = settings.value("size", QSize(width, height)).toSize();
     gui->resize(size);
     if (settings.contains("position")) {
@@ -351,6 +361,7 @@
     settings.endGroup();
 #endif
 
+    splash.finish(gui);
 
 /*
     TipDialog tipDialog;