forked from wangtseng/pmup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
58 lines (49 loc) · 2.06 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include "pmupMainWindow.h"
#include "pissCommunicationStack.h"
#include "GlobalTime.h"
#include <QApplication>
#include <QPixmap>
#include <QSplashScreen>
#include <QThread>
#include <QDesktopWidget>
#include <QRect>
#include <QPainter>
/**
* @brief main :
* @param argc :
* @param argv :
* @return
*/
int main(int argc, char *argv[]){
QApplication a(argc, argv);
//! ----------------------------------------------------------------------
//! get the screen size
//! ----------------------------------------------------------------------
QDesktopWidget* desktop = QApplication::desktop();
const QRect desktopRect = desktop->screenGeometry();
int appWidth = desktopRect.width();
int appHeight = desktopRect.height();
//! ----------------------------------------------------------------------
//! generate image resources and fit it with screen size
//! ----------------------------------------------------------------------
QPixmap splashSourcePixmap(":/images/labelBackground.png");
QPixmap splashPixmap = splashSourcePixmap.scaled(appWidth, appHeight);
QSplashScreen splash(splashPixmap);
splash.showFullScreen();
//! ----------------------------------------------------------------------
//! simulate task to request informations from server side
//! ----------------------------------------------------------------------
GlobalTime *time = new GlobalTime();
pissCommunicationStack *communicationStack = new pissCommunicationStack(time);
communicationStack->launch();
//! ----------------------------------------------------------------------
//! main page
//! ----------------------------------------------------------------------
pmupMainWindow* enterPage = new pmupMainWindow(appWidth,appHeight);
enterPage->show();
//! ----------------------------------------------------------------------
//! finish splash page and turn into enter page
//! ----------------------------------------------------------------------
splash.finish(enterPage);
return a.exec();
}