changeset 953:4a8f87c175f7 scalable-icons

Fixes to scaling of splash screen
author Chris Cannam
date Wed, 06 May 2015 13:00:57 +0100
parents 45bb2eaf7fe1
children 74b3eaa684d3
files .hgsubstate main/main.cpp sv.pro
diffstat 3 files changed, 11 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/.hgsubstate	Wed May 06 10:44:19 2015 +0100
+++ b/.hgsubstate	Wed May 06 13:00:57 2015 +0100
@@ -1,6 +1,6 @@
 d16f0fd6db6104d87882bc43788a3bb1b0f8c528 dataquay
-886bc1927f683ff757adaa51b9398d086abbea96 icons/scalable
+5327d8078a7bd9b834008da352d1edf9b257fba0 icons/scalable
 55ece8862b6d3a54aad271a53f9c1615e5d3bcf8 sv-dependency-builds
-dc1a360f2b694d73d4bc858b708db44249e2cddc svapp
+c651a736ebc497cf4104fe2db6a8f97efc412de1 svapp
 32ab6c48efaa23d24a67315bccdc27f3ba1a18d5 svcore
 85b39667e9cf544206c3f68bd14692678770656c svgui
--- a/main/main.cpp	Wed May 06 10:44:19 2015 +0100
+++ b/main/main.cpp	Wed May 06 13:00:57 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
@@ -274,22 +271,13 @@
 
     QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
 
-    QSplashScreen *splash = 0;
+    SVSplash *splash = 0;
 
     QSettings settings;
 
     settings.beginGroup("Preferences");
     if (settings.value("show-splash", true).toBool()) {
-        QPixmap pixmap(":/icons/scalable/sv-splash@2x.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();
@@ -353,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();
@@ -420,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();
@@ -492,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;
--- a/sv.pro	Wed May 06 10:44:19 2015 +0100
+++ b/sv.pro	Wed May 06 13:00:57 2015 +0100
@@ -86,12 +86,14 @@
 HEADERS += main/MainWindow.h \
            main/NetworkPermissionTester.h \
            main/Surveyer.h \
+           main/SVSplash.h \
            main/PreferencesDialog.h
 SOURCES += main/main.cpp \
            main/OSCHandler.cpp \
            main/MainWindow.cpp \
            main/NetworkPermissionTester.cpp \
            main/Surveyer.cpp \
+           main/SVSplash.cpp \
            main/PreferencesDialog.cpp 
 
 # for mac integration