QTfrontend/main.cpp
changeset 13525 873b7d32bc97
parent 13524 d44ca1f04bbe
child 14300 20b08e59730d
equal deleted inserted replaced
13524:d44ca1f04bbe 13525:873b7d32bc97
   159 .arg(HWApplication::tr("Custom path to the game data folder", "command-line"))
   159 .arg(HWApplication::tr("Custom path to the game data folder", "command-line"))
   160 .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));
   160 .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));
   161 }
   161 }
   162 
   162 
   163 int main(int argc, char *argv[]) {
   163 int main(int argc, char *argv[]) {
   164     /* Qt5 Base removed Motif, Plastique. These are now in the Qt style plugins
       
   165     (Ubuntu: qt5-style-plugins, which was NOT backported by Debian/Ubuntu to stable/LTS).
       
   166     Windows appears to render best of the remaining options but still isn't quite right. */
       
   167 
       
   168     // Try setting Plastique if available
       
   169     QStyle* coreStyle;
       
   170     coreStyle = QStyleFactory::create("Plastique");
       
   171     if(coreStyle != 0) {
       
   172         QApplication::setStyle(coreStyle);
       
   173         qDebug("Qt style set: Plastique");
       
   174     } else {
       
   175         // Use Windows as fallback.
       
   176         // FIXME: Under Windows style, some widgets like scrollbars don't render as nicely
       
   177         coreStyle = QStyleFactory::create("Windows");
       
   178         if(coreStyle != 0) {
       
   179             QApplication::setStyle(coreStyle);
       
   180             qDebug("Qt style set: Windows");
       
   181         } else {
       
   182             // Windows style should not be missing in Qt5 Base. If it does, something went terribly wrong!
       
   183             qWarning("No Qt style could be set! Using the default one.");
       
   184         }
       
   185     }
       
   186 
   164 
   187     // Since we're calling this first, closeResources() will be the last thing called after main() returns.
   165     // Since we're calling this first, closeResources() will be the last thing called after main() returns.
   188     atexit(closeResources);
   166     atexit(closeResources);
   189 
   167 
   190 #ifdef __APPLE__
   168 #ifdef __APPLE__
   270         return 1;
   248         return 1;
   271     }
   249     }
   272 
   250 
   273     // end of parameter parsing
   251     // end of parameter parsing
   274 
   252 
       
   253     // Select Qt style
       
   254     /* Qt5 Base removed Motif, Plastique. These are now in the Qt style plugins
       
   255     (Ubuntu: qt5-style-plugins, which was NOT backported by Debian/Ubuntu to stable/LTS).
       
   256     Windows appears to render best of the remaining options but still isn't quite right. */
       
   257 
       
   258     // Try setting Plastique if available
       
   259     QStyle* coreStyle;
       
   260     coreStyle = QStyleFactory::create("Plastique");
       
   261     if(coreStyle != 0) {
       
   262         QApplication::setStyle(coreStyle);
       
   263         qDebug("Qt style set: Plastique");
       
   264     } else {
       
   265         // Use Windows as fallback.
       
   266         // FIXME: Under Windows style, some widgets like scrollbars don't render as nicely
       
   267         coreStyle = QStyleFactory::create("Windows");
       
   268         if(coreStyle != 0) {
       
   269             QApplication::setStyle(coreStyle);
       
   270             qDebug("Qt style set: Windows");
       
   271         } else {
       
   272             // Windows style should not be missing in Qt5 Base. If it does, something went terribly wrong!
       
   273             qWarning("No Qt style could be set! Using the default one.");
       
   274         }
       
   275     }
   275 
   276 
   276 #ifdef Q_OS_WIN
   277 #ifdef Q_OS_WIN
   277     QPixmap pixmap(":/res/splash.png");
   278     QPixmap pixmap(":/res/splash.png");
   278     QSplashScreen splash(pixmap);
   279     QSplashScreen splash(pixmap);
   279     splash.show();
   280     splash.show();