From ed226848f447ab4a5aed93b1acf95390a6ac856d Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Sun, 19 Jun 2011 18:27:48 +0200 Subject: Layout using QT's external UI definition file --- build.sh | 26 ++++++++++++++++++++----- run.sh | 7 ++++++- src/fbsplash.cpp | 13 ++++++++++--- src/fbsplash.h | 15 +++++++++----- src/fbsplash.ui | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 106 insertions(+), 14 deletions(-) create mode 100644 src/fbsplash.ui diff --git a/build.sh b/build.sh index 6e3b391..cda70f2 100755 --- a/build.sh +++ b/build.sh @@ -1,15 +1,31 @@ #!/bin/sh # fbsplash builder script for cmake +DIR=$(pwd) +BUILDDIR=build + +# if --clean, remove build dir +if [ "$1" = "--clean" ] +then + rm -rf $BUILDDIR + echo "$BUILDDIR removed." + exit 1 +fi + +if [ ! -f CMakeLists.txt ] +then + echo "No CMakeLists.txt found." + echo "Run this script from the folder containing CMakeLists.txt." + exit 1 +fi # make build dir if its not there -[ ! -d ./build ] && mkdir -p build +[ ! -d $BUILDDIR ] && mkdir -p $BUILDDIR -cd build +cd $BUILDDIR # use cmake to create Makefile echo "Invoking cmake ..." -cmake "../" +cmake "$DIR" echo "Invoking make ..." make -cd .. - +cd $DIR diff --git a/run.sh b/run.sh index d679a44..856da9e 100755 --- a/run.sh +++ b/run.sh @@ -1,4 +1,7 @@ #!/bin/bash +# set your QT version here +QT_VERSION=4.7.2 + # path to script (including script name) script_path="$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")" @@ -9,9 +12,11 @@ working_path=`dirname "$script_path"` display_id=$(grep -n $(whoami) /etc/passwd| head -n 1|awk -F : '{print $1}') # Start QT's virtual framebuffer with proper display_id -/usr/local/Trolltech/Qt-4.7.2/bin/qvfb -width 1024 -height 768 -qwsdisplay :$display_id & +/usr/local/Trolltech/Qt-$QT_VERSION/bin/qvfb -width 1024 -height 768 -qwsdisplay :$display_id & + # quick sleep to wait for qvfb loading sleep 0.2 + # Start fbsplash connected to QVFb with display_id from above. $working_path/build/fbsplash -display QVFb:$display_id $@ killall qvfb diff --git a/src/fbsplash.cpp b/src/fbsplash.cpp index d22cbbc..6815c61 100644 --- a/src/fbsplash.cpp +++ b/src/fbsplash.cpp @@ -1,15 +1,18 @@ #include #include "fbsplash.h" +#include "ui_fbsplash.h" -fbsplash::fbsplash() : - QMainWindow(){ +fbsplash::fbsplash(QWidget *parent) : + QWidget(parent), ui(new Ui::fbsplash){ qDebug() << "fbsplash init"; - //ui->setup(this); + ui->setupUi(this); createActions(); + + /* setupTheme(); @@ -33,6 +36,10 @@ fbsplash::fbsplash() : setAttribute(Qt::WA_QuitOnClose, true); setWindowFlags(Qt::FramelessWindowHint); showFullScreen(); + */ +} +fbsplash::~fbsplash(){ + delete ui; } //----------------------------------------------------------------------------- void fbsplash::setupTheme() { diff --git a/src/fbsplash.h b/src/fbsplash.h index 145b92a..efbaeb1 100644 --- a/src/fbsplash.h +++ b/src/fbsplash.h @@ -15,15 +15,20 @@ #define FBSPLASH_H #include +#include "ui_fbsplash.h" -//#include "ui_fbsplash.h" -//namespace Ui { class fbsplash; } -class fbsplash: public QMainWindow{ +namespace Ui { +class fbsplash; +} + + +class fbsplash: public QWidget { Q_OBJECT public: - fbsplash(); + fbsplash(QWidget *parent = 0); + virtual ~fbsplash(); private: void createActions(); @@ -35,7 +40,7 @@ private: QAction* _quit; QAction* _printSize; QLabel* _label; - //Ui::fbsplash *ui; + Ui::fbsplash *ui; // ** TESTING ** diff --git a/src/fbsplash.ui b/src/fbsplash.ui new file mode 100644 index 0000000..bee2404 --- /dev/null +++ b/src/fbsplash.ui @@ -0,0 +1,59 @@ + + + fbsplash + + + + 0 + 0 + 1024 + 768 + + + + Form + + + + + + + + 390 + 300 + 201 + 61 + + + + + 20 + + + + + + + TextLabel + + + Qt::AlignCenter + + + + + + 420 + 380 + 181 + 21 + + + + 24 + + + + + + -- cgit v1.2.3-55-g7522