From 66a2b541b43ae5b78ad9f1d1e8afe3dd20891818 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Thu, 1 Sep 2011 17:36:25 +0200 Subject: static/dynamic builders --- src/fbsplash.cpp | 31 +++++++++++++++++++++++++++---- src/fbsplash.h | 8 +++++++- 2 files changed, 34 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/fbsplash.cpp b/src/fbsplash.cpp index 292431c..b00f094 100644 --- a/src/fbsplash.cpp +++ b/src/fbsplash.cpp @@ -1,3 +1,4 @@ +#include #include "fbsplash.h" #include "ui_fbsplash.h" @@ -8,6 +9,16 @@ fbsplash::fbsplash(QWidget *parent) : 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); @@ -26,18 +37,30 @@ void fbsplash::setupTheme() { } //----------------------------------------------------------------------------- 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(); - if (currentValue < 100) - ui->progressBar->setValue(currentValue + 1); - else - ui->progressBar->setValue(0); + int newValue; + (currentValue < 100) ? newValue = currentValue + 1 + : newValue = 0; + ui->progressBar->setValue(newValue); } diff --git a/src/fbsplash.h b/src/fbsplash.h index 26b66b0..c26e07f 100644 --- a/src/fbsplash.h +++ b/src/fbsplash.h @@ -15,6 +15,7 @@ #define FBSPLASH_H #include +//#include namespace Ui { class fbsplash; @@ -33,14 +34,19 @@ private: void setupTheme(); // members - QAction* _quit; + //QAction* _quit; Ui::fbsplash *ui; + //QLocalServer *server; + //QLocalSocket *socket; + // ** TESTING ** // ** TESTING ** private slots: void increaseProgressBar(); + void newConnection(); + void newData(); }; #endif // FBSPLASH_H -- cgit v1.2.3-55-g7522