QTfrontend/main.cpp
changeset 12661 1dc160048a0c
parent 11851 5edd66c2d422
child 12897 fc47fc4af6bd
child 13086 8d569c7b36a2
equal deleted inserted replaced
12660:d3fb69e31165 12661:1dc160048a0c
    42 
    42 
    43 #ifdef _WIN32
    43 #ifdef _WIN32
    44 #include <Shlobj.h>
    44 #include <Shlobj.h>
    45 #elif defined __APPLE__
    45 #elif defined __APPLE__
    46 #include "CocoaInitializer.h"
    46 #include "CocoaInitializer.h"
       
    47 
       
    48 #endif
       
    49 
       
    50 #ifdef Q_OS_WIN
       
    51 #include <QSplashScreen>
    47 #endif
    52 #endif
    48 
    53 
    49 // Program resources
    54 // Program resources
    50 #ifdef __APPLE__
    55 #ifdef __APPLE__
    51 static CocoaInitializer * cocoaInit = NULL;
    56 static CocoaInitializer * cocoaInit = NULL;
   160     SDLInteraction::instance();
   165     SDLInteraction::instance();
   161 
   166 
   162     HWApplication app(argc, argv);
   167     HWApplication app(argc, argv);
   163     app.setAttribute(Qt::AA_DontShowIconsInMenus,false);
   168     app.setAttribute(Qt::AA_DontShowIconsInMenus,false);
   164 
   169 
   165     // file engine and splash. to be initialized later
   170     // file engine, to be initialized later
   166     engine = NULL;
   171     engine = NULL;
   167     QLabel *splash = NULL;
       
   168 
   172 
   169     // parse arguments
   173     // parse arguments
   170 
   174 
   171     QStringList arguments = app.arguments();
   175     QStringList arguments = app.arguments();
   172     QMap<QString, QString> parsedArgs;
   176     QMap<QString, QString> parsedArgs;
   239         return 1;
   243         return 1;
   240     }
   244     }
   241 
   245 
   242     // end of parameter parsing
   246     // end of parameter parsing
   243 
   247 
   244 #if defined Q_OS_WIN
   248 
   245     QPixmap pixmap(":res/splash.png");
   249 #ifdef Q_OS_WIN
   246     splash = new QLabel(0, Qt::FramelessWindowHint|Qt::WindowStaysOnTopHint);
   250     QPixmap pixmap(":/res/splash.png");
   247     splash->setAttribute(Qt::WA_TranslucentBackground);
   251     QSplashScreen splash(pixmap);
   248     const QRect deskSize = HWApplication::desktop()->screenGeometry(-1);
   252     splash.show();
   249     QPoint splashCenter = QPoint( (deskSize.width() - pixmap.width())/2,
   253 #endif
   250                                   (deskSize.height() - pixmap.height())/2 );
   254 
   251     splash->move(splashCenter);
       
   252     splash->setPixmap(pixmap);
       
   253     splash->show();
       
   254 #endif
       
   255     app.setStyle(new QPlastiqueStyle());
   255     app.setStyle(new QPlastiqueStyle());
   256 
   256 
   257     QDateTime now = QDateTime::currentDateTime();
   257     QDateTime now = QDateTime::currentDateTime();
   258     srand(now.toTime_t());
   258     srand(now.toTime_t());
   259     rand();
   259     rand();
   391         style.append(file.readAll());
   391         style.append(file.readAll());
   392 
   392 
   393     qWarning("Starting Hedgewars %s-r%d (%s)", qPrintable(*cVersionString), cRevisionString->toInt(), qPrintable(*cHashString));
   393     qWarning("Starting Hedgewars %s-r%d (%s)", qPrintable(*cVersionString), cRevisionString->toInt(), qPrintable(*cHashString));
   394 
   394 
   395     app.form = new HWForm(NULL, style);
   395     app.form = new HWForm(NULL, style);
       
   396 #ifdef Q_OS_WIN
       
   397     splash.finish(app.form);
       
   398 #endif
   396     app.form->show();
   399     app.form->show();
   397     if(splash)
   400 
   398         splash->close();
       
   399     if (app.urlString)
   401     if (app.urlString)
   400         app.fakeEvent();
   402         app.fakeEvent();
   401     return app.exec();
   403     return app.exec();
   402 }
   404 }