forked from slawkens/otadmin-plus-plus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsplashscreen.cpp
51 lines (40 loc) · 1.32 KB
/
splashscreen.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
#include <QtWidgets>
#include "splashscreen.h"
SplashScreen::SplashScreen()
: QSplashScreen()
{
/*
Up panel
*/
QHBoxLayout *upPanel = new QHBoxLayout;
QLabel *logo = new QLabel;
logo->setAlignment(Qt::AlignCenter);
logo->setPixmap(QPixmap(":/images/otadmin.png"));
QLabel *descLabel = new QLabel;
descLabel->setAlignment(Qt::AlignCenter);
descLabel->setText("Version <b>" + qApp->applicationVersion() + "</b>");
upPanel->addWidget(logo);
upPanel->addWidget(descLabel);
/*
Down panel
*/
QHBoxLayout *downPanel = new QHBoxLayout;
QLabel *infoLabel = new QLabel;
infoLabel->setText(qApp->applicationName() + " comes with ABSOLUTELY NO WARRANTY. This is free software and you are welcome to redisturbe it under certain circumstances.<br>see the GNU General Public License in About menu for details.");
downPanel->addWidget(infoLabel);
/*
Main layout
*/
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addLayout(upPanel);
mainLayout->addLayout(downPanel);
mainLayout->setAlignment(Qt::AlignCenter);
setLayout(mainLayout);
setAttribute(Qt::WA_DeleteOnClose);
setWindowFlags(Qt::SplashScreen | Qt::WindowStaysOnTopHint);
QDesktopWidget *screen = QApplication::desktop();
show();
move(QPoint(screen->width() / 2, screen->height() / 2) -
QPoint(width() / 2,height() / 2 ) );
qApp->processEvents();
}