summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Bauer2011-06-19 18:27:48 +0200
committerJonathan Bauer2011-06-19 18:27:48 +0200
commited226848f447ab4a5aed93b1acf95390a6ac856d (patch)
treed86280d2b80d61369d9b5dbe0dadecb18184e608
parenttypo, sortof (diff)
downloadfbsplash-ed226848f447ab4a5aed93b1acf95390a6ac856d.tar.gz
fbsplash-ed226848f447ab4a5aed93b1acf95390a6ac856d.tar.xz
fbsplash-ed226848f447ab4a5aed93b1acf95390a6ac856d.zip
Layout using QT's external UI definition file
-rwxr-xr-xbuild.sh26
-rwxr-xr-xrun.sh7
-rw-r--r--src/fbsplash.cpp13
-rw-r--r--src/fbsplash.h15
-rw-r--r--src/fbsplash.ui59
5 files changed, 106 insertions, 14 deletions
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 <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>