diff options
author | Jonathan Bauer | 2011-06-19 18:27:48 +0200 |
---|---|---|
committer | Jonathan Bauer | 2011-06-19 18:27:48 +0200 |
commit | ed226848f447ab4a5aed93b1acf95390a6ac856d (patch) | |
tree | d86280d2b80d61369d9b5dbe0dadecb18184e608 | |
parent | typo, sortof (diff) | |
download | fbsplash-ed226848f447ab4a5aed93b1acf95390a6ac856d.tar.gz fbsplash-ed226848f447ab4a5aed93b1acf95390a6ac856d.tar.xz fbsplash-ed226848f447ab4a5aed93b1acf95390a6ac856d.zip |
Layout using QT's external UI definition file
-rwxr-xr-x | build.sh | 26 | ||||
-rwxr-xr-x | run.sh | 7 | ||||
-rw-r--r-- | src/fbsplash.cpp | 13 | ||||
-rw-r--r-- | src/fbsplash.h | 15 | ||||
-rw-r--r-- | src/fbsplash.ui | 59 |
5 files changed, 106 insertions, 14 deletions
@@ -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 @@ -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 <QProgressBar> #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 <QtGui> +#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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>fbsplash</class> + <widget class="QWidget" name="fbsplash"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>1024</width> + <height>768</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <property name="styleSheet"> + <string notr="true"/> + </property> + <widget class="QLabel" name="label"> + <property name="geometry"> + <rect> + <x>390</x> + <y>300</y> + <width>201</width> + <height>61</height> + </rect> + </property> + <property name="font"> + <font> + <pointsize>20</pointsize> + </font> + </property> + <property name="styleSheet"> + <string notr="true"/> + </property> + <property name="text"> + <string>TextLabel</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + <widget class="QProgressBar" name="progressBar"> + <property name="geometry"> + <rect> + <x>420</x> + <y>380</y> + <width>181</width> + <height>21</height> + </rect> + </property> + <property name="value"> + <number>24</number> + </property> + </widget> + </widget> + <resources/> + <connections/> +</ui> |