summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Bauer2011-06-24 16:06:30 +0200
committerJonathan Bauer2011-06-24 16:06:30 +0200
commitea78d18c21d3d5862cf7bae40fa7bf8f1e321438 (patch)
tree0c82552d8218de271ed01f76818898f0af74c928
parentstarted command line parsing.. (diff)
downloadfbsplash-ea78d18c21d3d5862cf7bae40fa7bf8f1e321438.tar.gz
fbsplash-ea78d18c21d3d5862cf7bae40fa7bf8f1e321438.tar.xz
fbsplash-ea78d18c21d3d5862cf7bae40fa7bf8f1e321438.zip
scripts changes
-rw-r--r--README4
-rwxr-xr-xbuild.sh3
-rwxr-xr-xrun.sh19
-rw-r--r--src/fbsplash.cpp2
-rw-r--r--src/main.cpp12
5 files changed, 24 insertions, 16 deletions
diff --git a/README b/README
index 1fe335e..810ec31 100644
--- a/README
+++ b/README
@@ -6,11 +6,11 @@ To compile, use:
./build.sh
-(this will generate the binary in the build/ subdirectory)
+This script will compile the source code in the build/ subdirectory.
+(with the option "-c" can the build directory be cleaned before rebuilding)
Note: Make sure qmake (from QtEmbedded) is in your PATH variable.
-
To run the program (on the qvfb), use:
./run.sh
diff --git a/build.sh b/build.sh
index cda70f2..dacc56e 100755
--- a/build.sh
+++ b/build.sh
@@ -4,11 +4,10 @@ DIR=$(pwd)
BUILDDIR=build
# if --clean, remove build dir
-if [ "$1" = "--clean" ]
+if [ "$1" = "-c" ]
then
rm -rf $BUILDDIR
echo "$BUILDDIR removed."
- exit 1
fi
if [ ! -f CMakeLists.txt ]
diff --git a/run.sh b/run.sh
index 3baee26..61edfcd 100755
--- a/run.sh
+++ b/run.sh
@@ -1,12 +1,17 @@
#!/bin/bash
# All args are passed to fbsplash.
-# Set your QT version here
-QT_VERSION=4.7.2
+# Set the QT version of the qvfb here
+QT_VERSION=Qt-4.7.2
-# qvfb's width
-QVFB_WIDTH=800
-# qvfb's height
-QVFB_HEIGHT=600
+if [ $# -eq 2 ]
+then
+ QVFB_WIDTH=$1
+ QVFB_HEIGHT=$2
+else
+ # qvfb's size
+ QVFB_WIDTH=800
+ QVFB_HEIGHT=600
+fi
# path to script (including script name)
script_path="$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")"
@@ -18,7 +23,7 @@ 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-$QT_VERSION/bin/qvfb -width $QVFB_WIDTH -height $QVFB_HEIGHT -qwsdisplay :$display_id &
+/usr/local/Trolltech/$QT_VERSION/bin/qvfb -width $QVFB_WIDTH -height $QVFB_HEIGHT -qwsdisplay :$display_id &
# quick sleep to wait for qvfb loading
sleep 0.2
diff --git a/src/fbsplash.cpp b/src/fbsplash.cpp
index c30cd5a..7e97d91 100644
--- a/src/fbsplash.cpp
+++ b/src/fbsplash.cpp
@@ -2,6 +2,7 @@
#include "fbsplash.h"
#include "ui_fbsplash.h"
+//-----------------------------------------------------------------------------
fbsplash::fbsplash(QWidget *parent) :
QWidget(parent), ui(new Ui::fbsplash) {
@@ -14,6 +15,7 @@ fbsplash::fbsplash(QWidget *parent) :
showFullScreen();
}
+//-----------------------------------------------------------------------------
fbsplash::~fbsplash() {
delete ui;
}
diff --git a/src/main.cpp b/src/main.cpp
index cd1f5e0..d598271 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2,13 +2,13 @@
#include <getopt.h>
#include "fbsplash.h"
-void printHelp(){
+void printHelp() {
QTextStream qout(stdout);
qout << "Usage: ./fbsplash [OPTIONS]\n";
qout << "Options:\n";
qout << "-h, --help " << "Prints this help.\n";
qout.flush();
- exit(EXIT_SUCCESS);
+ exit( EXIT_SUCCESS);
}
int main(int argc, char *argv[]) {
@@ -19,9 +19,12 @@ int main(int argc, char *argv[]) {
// Command line arguements parsing
QMap<QString, QString> clOpts;
+
+ static const char *optString = "h";
+ static const struct option
+ longOpts[] = { { "help", no_argument, NULL, 'h' } };
+
int longIndex = 0;
- static const char *optString = "c:u:d:s:t:D:hl:";
- static const struct option longOpts[] = { { "help", no_argument, NULL, 'h' } };
int opt = getopt_long(argc, argv, optString, longOpts, &longIndex);
while (opt != -1) {
switch (opt) {
@@ -35,7 +38,6 @@ int main(int argc, char *argv[]) {
if (clOpts.contains("help"))
printHelp();
-
// fbsplash init
fbsplash bs;
app.exec();