comparison main/main.cpp @ 331:067a57de45e2

* Add version number to splash screen
author Chris Cannam
date Wed, 29 Jul 2009 15:03:21 +0000
parents cb189d3816e5
children b168df820681
comparison
equal deleted inserted replaced
330:cfdc07e4e0d5 331:067a57de45e2
33 #include <QIcon> 33 #include <QIcon>
34 #include <QSessionManager> 34 #include <QSessionManager>
35 #include <QDir> 35 #include <QDir>
36 #include <QSplashScreen> 36 #include <QSplashScreen>
37 #include <QTimer> 37 #include <QTimer>
38 #include <QPainter>
39
40 #include "../version.h"
38 41
39 #include <iostream> 42 #include <iostream>
40 #include <signal.h> 43 #include <signal.h>
41 44
42 #ifdef HAVE_FFTW3F 45 #ifdef HAVE_FFTW3F
206 int 209 int
207 main(int argc, char **argv) 210 main(int argc, char **argv)
208 { 211 {
209 #ifdef Q_WS_X11 212 #ifdef Q_WS_X11
210 #if QT_VERSION >= 0x040500 213 #if QT_VERSION >= 0x040500
211 std::cerr << "raster" << std::endl;
212 QApplication::setGraphicsSystem("raster"); 214 QApplication::setGraphicsSystem("raster");
213 #endif 215 #endif
214 #endif 216 #endif
215 217
216 SVApplication application(argc, argv); 218 SVApplication application(argc, argv);
241 243
242 QApplication::setOrganizationName("sonic-visualiser"); 244 QApplication::setOrganizationName("sonic-visualiser");
243 QApplication::setOrganizationDomain("sonicvisualiser.org"); 245 QApplication::setOrganizationDomain("sonicvisualiser.org");
244 QApplication::setApplicationName(QApplication::tr("Sonic Visualiser")); 246 QApplication::setApplicationName(QApplication::tr("Sonic Visualiser"));
245 247
246 QPixmap pixmap(":/icons/sv-splash.png");
247 QSplashScreen *splash = 0; 248 QSplashScreen *splash = 0;
248 249
249 QSettings settings; 250 QSettings settings;
250 251
251 settings.beginGroup("Preferences"); 252 settings.beginGroup("Preferences");
252 if (settings.value("show-splash", true).toBool()) { 253 if (settings.value("show-splash", true).toBool()) {
254 QPixmap pixmap(":/icons/sv-splash.png");
255 QPainter painter;
256 painter.begin(&pixmap);
257 QString text = QString("v%1").arg(SV_VERSION);
258 painter.drawText
259 (pixmap.width() - painter.fontMetrics().width(text) - 10,
260 10 + painter.fontMetrics().ascent(),
261 text);
262 painter.end();
253 splash = new QSplashScreen(pixmap); 263 splash = new QSplashScreen(pixmap);
254 splash->show(); 264 splash->show();
255 QTimer::singleShot(5000, splash, SLOT(hide())); 265 QTimer::singleShot(5000, splash, SLOT(hide()));
256 application.processEvents(); 266 application.processEvents();
257 } 267 }