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