summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJonathan Bauer2011-09-01 17:36:25 +0200
committerJonathan Bauer2011-09-01 17:36:25 +0200
commit66a2b541b43ae5b78ad9f1d1e8afe3dd20891818 (patch)
tree23d24b2d0b83385b074c6ae14a316413c44ed1fa /src
parentprogress bar animated (increases by 1% every 0.1 second) (diff)
downloadfbsplash-66a2b541b43ae5b78ad9f1d1e8afe3dd20891818.tar.gz
fbsplash-66a2b541b43ae5b78ad9f1d1e8afe3dd20891818.tar.xz
fbsplash-66a2b541b43ae5b78ad9f1d1e8afe3dd20891818.zip
static/dynamic builders
Diffstat (limited to 'src')
-rw-r--r--src/fbsplash.cpp31
-rw-r--r--src/fbsplash.h8
2 files changed, 34 insertions, 5 deletions
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 <QTimer>
#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 <QtGui>
+//#include <QtNetwork>
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