diff options
author | Jonathan Bauer | 2011-09-01 17:36:25 +0200 |
---|---|---|
committer | Jonathan Bauer | 2011-09-01 17:36:25 +0200 |
commit | 66a2b541b43ae5b78ad9f1d1e8afe3dd20891818 (patch) | |
tree | 23d24b2d0b83385b074c6ae14a316413c44ed1fa | |
parent | progress bar animated (increases by 1% every 0.1 second) (diff) | |
download | fbsplash-66a2b541b43ae5b78ad9f1d1e8afe3dd20891818.tar.gz fbsplash-66a2b541b43ae5b78ad9f1d1e8afe3dd20891818.tar.xz fbsplash-66a2b541b43ae5b78ad9f1d1e8afe3dd20891818.zip |
static/dynamic builders
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rw-r--r-- | README | 4 | ||||
-rwxr-xr-x | build.sh | 9 | ||||
-rwxr-xr-x | run.sh | 12 | ||||
-rw-r--r-- | src/fbsplash.cpp | 31 | ||||
-rw-r--r-- | src/fbsplash.h | 8 |
7 files changed, 56 insertions, 16 deletions
@@ -1 +1,5 @@ build +bin +.cproject +.project +Makefile diff --git a/CMakeLists.txt b/CMakeLists.txt index 98d9d3a..0f1d554 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,9 @@ else(QT4_FOUND) message(FATAL_ERROR "QT4 not found!") endif(QT4_FOUND) +set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/../bin) +set(QT_USE_QTNETWORK TRUE) + file(GLOB_RECURSE FBSPLASH_SOURCES src/*.cpp) file(GLOB_RECURSE FBSPLASH_MOC_HEADERS src/*.h) file(GLOB_RECURSE FBSPLASH_UIS src/*.ui) @@ -27,6 +30,7 @@ add_executable(fbsplash ${FBSPLASH_UI_HEADERS} ${FBSPLASH_RC_SOURCES}) +message(${QT_LIBRARIES}) target_link_libraries(fbsplash ${QT_LIBRARIES}) include_directories(${CMAKE_CURRENT_BINARY_DIR}) @@ -6,8 +6,8 @@ To compile, use: ./build.sh -This script will compile the source code in the build/ subdirectory. -(with the option "-c" can the build directory be cleaned before rebuilding) +The binary will end up in bin/ +(use "-c" to make a clean build) Note: Make sure qmake (from QtEmbedded) is in your PATH variable. @@ -1,5 +1,9 @@ #!/bin/bash -# fbsplash builder script for cmake +######################################### +# # +# fbsplash builder with CMake # +# # +######################################### DIR=$(pwd) BUILDDIR=build @@ -21,7 +25,6 @@ fi [ ! -d $BUILDDIR ] && mkdir -p $BUILDDIR cd $BUILDDIR - +# create Makefile from CMakeLists.txt and run make cmake "$DIR" && make - cd $DIR @@ -3,6 +3,9 @@ # Set the QT version of the qvfb here QT_VERSION=Qt-4.7.2 +# clear socket, needed? crashes without... +rm /tmp/foo >/dev/null + if [ $# -eq 2 ] then QVFB_WIDTH=$1 @@ -13,11 +16,8 @@ else QVFB_HEIGHT=600 fi -# path to script (including script name) -script_path="$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")" - -# to get the path only: use dirname which strips the filename from a path -working_path=`dirname "$script_path"` +# path to script +script_path=$(dirname $(readlink -f $0)) # construct unique display_id based on user, needed for multi-user qvfb usage display_id=$(grep -n $(whoami) /etc/passwd| head -n 1|awk -F : '{print $1}') @@ -29,5 +29,5 @@ display_id=$(grep -n $(whoami) /etc/passwd| head -n 1|awk -F : '{print $1}') sleep 0.2 # Start fbsplash connected to QVFb with display_id from above. -$working_path/build/fbsplash -display QVFb:$display_id $@ +$script_path/bin/fbsplash -display QVFb:$display_id $@ killall qvfb 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 |