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
59
60
61
62
63
64
|
#include <QProgressBar>
#include "fbsplash.h"
fbsplash::fbsplash() :
QMainWindow(){
qDebug() << "fbsplash init";
//ui->setup(this);
createActions();
setupTheme();
_label = new QLabel("<font size=10 color='green'>OpenSLX</font>");
_label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
qDebug() << "center x: " << center.x();
qDebug() << "center y: " << center.y();
QProgressBar* pb = new QProgressBar(this);
//pb->setFormat("Progress: %p%");
pb->setWindowFlags(Qt::FramelessWindowHint);
pb->setRange(0, 100);
pb->setValue(10);
QRect desktopRect = QApplication::desktop()->availableGeometry(this);
QPoint center = desktopRect.center();
pb->move(center.x() - pb->width()*0.5 , center.y() - pb->height()*0.5 + 50);
setCentralWidget(_label);
setAttribute(Qt::WA_QuitOnClose, true);
setWindowFlags(Qt::FramelessWindowHint);
showFullScreen();
}
//-----------------------------------------------------------------------------
void fbsplash::setupTheme() {
// TODO configurable per cmdline
// for now, black as base background color
QPalette pal;
pal.setColor(QPalette::Window, Qt::black);
setPalette(pal);
}
//-----------------------------------------------------------------------------
void fbsplash::createActions() {
// Quit through CTRL + X
_quit = new QAction(tr("&quit"), this);
_quit->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_X));
this->addAction(_quit);
connect(_quit, SIGNAL(triggered()), this, SLOT(close()));
// Test action
_printSize = new QAction(tr("&test"), this);
_printSize->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_W));
this->addAction(_printSize);
connect(_printSize, SIGNAL(triggered()), this, SLOT(printSizeAction()));
}
//-----------------------------------------------------------------------------
void fbsplash::printSizeAction(){
qDebug() << "MW Height: " << _label->size().height();
qDebug() << "MW Width: " << _label->size().width();
}
|