summaryrefslogtreecommitdiffstats
path: root/src/fbsplash.cpp
blob: 292431ca8c0c303cad70285382acda77f2cabca8 (plain) (blame)
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
#include "fbsplash.h"
#include "ui_fbsplash.h"

//-----------------------------------------------------------------------------
fbsplash::fbsplash(QWidget *parent) :
   QWidget(parent), ui(new Ui::fbsplash) {
   ui->setupUi(this);

   createActions();

   QTimer *timer = new QTimer(this);
   connect(timer, SIGNAL(timeout()), this, SLOT(increaseProgressBar()));
   timer->start(100);

   setWindowFlags(Qt::FramelessWindowHint);
   showFullScreen();

}
//-----------------------------------------------------------------------------
fbsplash::~fbsplash() {
   delete ui;
}
//-----------------------------------------------------------------------------
void fbsplash::setupTheme() {
   // TODO: set styles from config file (or default theme)
}
//-----------------------------------------------------------------------------
void fbsplash::createActions() {
   // For testing: 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()));
   // per default, QT closes the app when the last widget is closed
}

void fbsplash::increaseProgressBar() {
   int currentValue = ui->progressBar->value();
   if (currentValue < 100)
      ui->progressBar->setValue(currentValue + 1);
   else
      ui->progressBar->setValue(0);
}