QTfrontend/main.cpp
changeset 8337 bf237f7f1d94
parent 8323 ab0b618bdf13
child 8339 2154732c65f1
equal deleted inserted replaced
8335:bc948db1273a 8337:bf237f7f1d94
    25 #include <QRegExp>
    25 #include <QRegExp>
    26 #include <QMap>
    26 #include <QMap>
    27 #include <QSettings>
    27 #include <QSettings>
    28 #include <QStringListModel>
    28 #include <QStringListModel>
    29 #include <QDate>
    29 #include <QDate>
       
    30 #include <QDesktopWidget>
       
    31 #include <QLabel>
    30 
    32 
    31 #include "hwform.h"
    33 #include "hwform.h"
    32 #include "hwconsts.h"
    34 #include "hwconsts.h"
    33 #include "newnetclient.h"
    35 #include "newnetclient.h"
    34 
    36 
   134     atexit(releaseCocoaPool);
   136     atexit(releaseCocoaPool);
   135 #endif
   137 #endif
   136 
   138 
   137     HWApplication app(argc, argv);
   139     HWApplication app(argc, argv);
   138 
   140 
       
   141     QLabel *splash = NULL;
       
   142 #ifdef Q_WS_WIN | Q_WS_X11 | Q_WS_MAC //enabled on all platforms, disable if it doesn't look good
       
   143     QPixmap pixmap(":res/splash.png");
       
   144     splash = new QLabel(0, Qt::FramelessWindowHint|Qt::WindowStaysOnTopHint);
       
   145     splash->setAttribute(Qt::WA_TranslucentBackground);
       
   146     const QRect deskSize = QApplication::desktop()->screenGeometry(-1);
       
   147     QPoint splashCenter = QPoint( (deskSize.width() - pixmap.width())/2,
       
   148                                   (deskSize.height() - pixmap.height())/2 );
       
   149     splash->move(splashCenter);
       
   150     splash->setPixmap(pixmap);
       
   151     splash->show();
       
   152 #endif
       
   153 
   139     FileEngineHandler engine(argv[0]);
   154     FileEngineHandler engine(argv[0]);
   140 
   155 
   141     app.setAttribute(Qt::AA_DontShowIconsInMenus,false);
   156     app.setAttribute(Qt::AA_DontShowIconsInMenus,false);
   142 
   157 
   143     QStringList arguments = app.arguments();
   158     QStringList arguments = app.arguments();
   303         case SEASON_HWBDAY :
   318         case SEASON_HWBDAY :
   304             fname = "birthday.css";
   319             fname = "birthday.css";
   305             break;
   320             break;
   306         default :
   321         default :
   307             fname = "qt.css";
   322             fname = "qt.css";
       
   323             break;
   308     }
   324     }
   309 
   325 
   310     // load external stylesheet if there is any
   326     // load external stylesheet if there is any
   311     QFile extFile("physfs://css/" + fname);
   327     QFile extFile("physfs://css/" + fname);
   312 
   328 
   317     if (file.open(QIODevice::ReadOnly | QIODevice::Text))
   333     if (file.open(QIODevice::ReadOnly | QIODevice::Text))
   318         style.append(file.readAll());
   334         style.append(file.readAll());
   319 
   335 
   320     app.form = new HWForm(NULL, style);
   336     app.form = new HWForm(NULL, style);
   321     app.form->show();
   337     app.form->show();
       
   338     if(splash)
       
   339         splash->close();
   322     return app.exec();
   340     return app.exec();
   323 }
   341 }