diff main/main.cpp @ 969:80c5d98399ec osx-retina

Merge from branch scalable-icons
author Chris Cannam
date Thu, 14 May 2015 15:40:37 +0100
parents 4a8f87c175f7
children 2f8018eb1573
line wrap: on
line diff
--- a/main/main.cpp	Thu May 14 15:39:47 2015 +0100
+++ b/main/main.cpp	Thu May 14 15:40:37 2015 +0100
@@ -14,6 +14,7 @@
 */
 
 #include "MainWindow.h"
+#include "SVSplash.h"
 
 #include "system/System.h"
 #include "system/Init.h"
@@ -36,13 +37,10 @@
 #include <QIcon>
 #include <QSessionManager>
 #include <QDir>
-#include <QSplashScreen>
 #include <QTimer>
 #include <QPainter>
 #include <QFileOpenEvent>
 
-#include "../version.h"
-
 #include <iostream>
 #include <signal.h>
 
@@ -215,7 +213,7 @@
         if (!success) manager.cancel();
     }
 
-    void handleFilepathArgument(QString path, QSplashScreen *splash);
+    void handleFilepathArgument(QString path, SVSplash *splash);
 
     bool m_readyForFiles;
     QStringList m_filepathQueue;
@@ -223,7 +221,6 @@
 protected:
     MainWindow *m_mainWindow;
     bool event(QEvent *);
-
 };
 
 int
@@ -272,22 +269,15 @@
     QApplication::setOrganizationDomain("sonicvisualiser.org");
     QApplication::setApplicationName(QApplication::tr("Sonic Visualiser"));
 
-    QSplashScreen *splash = 0;
+    QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
+
+    SVSplash *splash = 0;
 
     QSettings settings;
 
     settings.beginGroup("Preferences");
     if (settings.value("show-splash", true).toBool()) {
-        QPixmap pixmap(":/icons/sv-splash.png");
-        QPainter painter;
-        painter.begin(&pixmap);
-        QString text = QString("v%1").arg(SV_VERSION);
-        painter.drawText
-            (pixmap.width() - painter.fontMetrics().width(text) - 10,
-             10 + painter.fontMetrics().ascent(),
-             text);
-        painter.end();
-        splash = new QSplashScreen(pixmap);
+        splash = new SVSplash();
         splash->show();
         QTimer::singleShot(5000, splash, SLOT(hide()));
         application.processEvents();
@@ -351,6 +341,8 @@
     TransformUserConfigurator::setParentWidget(gui);
     if (splash) {
         QObject::connect(gui, SIGNAL(hideSplash()), splash, SLOT(hide()));
+        QObject::connect(gui, SIGNAL(hideSplash(QWidget *)),
+                         splash, SLOT(finishSplash(QWidget *)));
     }
 
     QDesktopWidget *desktop = QApplication::desktop();
@@ -418,15 +410,6 @@
     settings.endGroup();
 #endif
 
-    if (splash) splash->finish(gui);
-    delete splash;
-
-/*
-    TipDialog tipDialog;
-    if (tipDialog.isOK()) {
-        tipDialog.exec();
-    }
-*/
     int rv = application.exec();
 
     gui->hide();
@@ -490,7 +473,7 @@
 }
 
 /** Application-global handler for filepaths passed in, e.g. as command-line arguments or apple events */
-void SVApplication::handleFilepathArgument(QString path, QSplashScreen *splash){
+void SVApplication::handleFilepathArgument(QString path, SVSplash *splash){
     static bool haveSession = false;
     static bool haveMainModel = false;
     static bool havePriorCommandLineModel = false;