QTfrontend/main.cpp
branchqt5transition
changeset 13178 b4f48e7a4953
parent 12897 fc47fc4af6bd
child 13179 ddfb4a73524b
equal deleted inserted replaced
13177:85c8c149ef82 13178:b4f48e7a4953
    26 #include <QStringListModel>
    26 #include <QStringListModel>
    27 #include <QDate>
    27 #include <QDate>
    28 #include <QDesktopWidget>
    28 #include <QDesktopWidget>
    29 #include <QLabel>
    29 #include <QLabel>
    30 #include <QLibraryInfo>
    30 #include <QLibraryInfo>
       
    31 #include <QStyle>
       
    32 #include <QStyleFactory>
    31 
    33 
    32 #include "hwform.h"
    34 #include "hwform.h"
    33 #include "hwconsts.h"
    35 #include "hwconsts.h"
    34 #include "newnetclient.h"
    36 #include "newnetclient.h"
    35 
    37 
   150 .arg(HWApplication::tr("Custom path for configuration data and user data", "command-line"))
   152 .arg(HWApplication::tr("Custom path for configuration data and user data", "command-line"))
   151 .arg(HWApplication::tr("Custom path to the game data folder", "command-line"))
   153 .arg(HWApplication::tr("Custom path to the game data folder", "command-line"))
   152 .arg(HWApplication::tr("Hedgewars can use a %1 (e.g. \"%2\") to connect on start.", "command-line").arg(HWApplication::tr("CONNECTSTRING", "command-line")).arg(QString("hwplay://") + NETGAME_DEFAULT_SERVER));
   154 .arg(HWApplication::tr("Hedgewars can use a %1 (e.g. \"%2\") to connect on start.", "command-line").arg(HWApplication::tr("CONNECTSTRING", "command-line")).arg(QString("hwplay://") + NETGAME_DEFAULT_SERVER));
   153 }
   155 }
   154 
   156 
   155 int main(int argc, char *argv[])
   157 int main(int argc, char *argv[]) {
   156 {
   158 	/* Qt5 removed motif, plastique.  These are now in qt5-style-plugins which was NOT backported by debian/ubuntu to stable/LTS - windows appears to render best of the remaining options */
       
   159 	QApplication::setStyle(QStyleFactory::create("windows"));
   157     // Since we're calling this first, closeResources() will be the last thing called after main() returns.
   160     // Since we're calling this first, closeResources() will be the last thing called after main() returns.
   158     atexit(closeResources);
   161     atexit(closeResources);
   159 
   162 
   160 #ifdef __APPLE__
   163 #ifdef __APPLE__
   161     cocoaInit = new CocoaInitializer(); // Creates the autoreleasepool preventing cocoa object leaks on OS X.
   164     cocoaInit = new CocoaInitializer(); // Creates the autoreleasepool preventing cocoa object leaks on OS X.
   162 #endif
   165 #endif
   163 
   166 
   164     SDLInteraction::instance();
   167     SDLInteraction::instance();
   165 
   168 
   166     HWApplication app(argc, argv);
   169     HWApplication app(argc, argv);
       
   170 	//qDebug() << app.style();
   167     app.setAttribute(Qt::AA_DontShowIconsInMenus,false);
   171     app.setAttribute(Qt::AA_DontShowIconsInMenus,false);
   168 
   172 
   169     // file engine, to be initialized later
   173     // file engine, to be initialized later
   170     engine = NULL;
   174     engine = NULL;
   171 
   175 
   249     QPixmap pixmap(":/res/splash.png");
   253     QPixmap pixmap(":/res/splash.png");
   250     QSplashScreen splash(pixmap);
   254     QSplashScreen splash(pixmap);
   251     splash.show();
   255     splash.show();
   252 #endif
   256 #endif
   253 
   257 
   254     //app.setStyle(new QPlastiqueStyle());
       
   255 
       
   256     QDateTime now = QDateTime::currentDateTime();
   258     QDateTime now = QDateTime::currentDateTime();
   257     srand(now.toTime_t());
   259     srand(now.toTime_t());
   258     rand();
   260     rand();
   259 
   261 
   260     Q_INIT_RESOURCE(hedgewars);
   262     Q_INIT_RESOURCE(hedgewars);