blob: 0e84c5c7c8588cf789dabdd47148f83beaf012e9 (
plain) (
tree)
|
|
#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();
}
|