summaryrefslogtreecommitdiffstats
path: root/src/fbsplash.cpp
blob: b00f094c42fcf280aa5f1120df423423ed72c288 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include <QTimer>
#include "fbsplash.h"
#include "ui_fbsplash.h"

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

   createActions();

   /*
   server = new QLocalServer(this);
   if (!server->listen("/tmp/foo")){
      qDebug() << "Cannot listen...";
      exit(1);
   }
   */
   // listening
   //connect(server, SIGNAL(newConnection()), this, SLOT(newConnection()));

   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::newConnection(){
   //socket = server->nextPendingConnection();
   //connect(socket, SIGNAL(readyRead()), this, SLOT(newData()));
}

void fbsplash::newData(){
   //QByteArray data = socket->readAll();
   //int newProgress = data.toInt();
}

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