diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | CMakeLists.txt | 28 | ||||
-rwxr-xr-x | build.sh | 15 | ||||
-rwxr-xr-x | run.sh | 17 | ||||
-rw-r--r-- | src/fbsplash.cpp | 28 | ||||
-rw-r--r-- | src/fbsplash.h | 34 | ||||
-rw-r--r-- | src/main.cpp | 13 |
7 files changed, 137 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dc84959 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +build/ + diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..6ee8d65 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,28 @@ +cmake_minimum_required(VERSION 2.8) + +project(fbsplash) + +find_package(Qt4 REQUIRED) +if (QT4_FOUND) + message(STATUS "QT4 found.") +else(QT4_FOUND) + message(FATAL_ERROR "QT4 not found!") +endif(QT4_FOUND) + +file(GLOB_RECURSE fbsplash_SOURCES src/*.cpp) +file(GLOB_RECURSE fbsplash_MOC_HEADERS src/*.h) + +#set(fbsplash_SOURCES main.cpp fbsplash.cpp) +#set(fbsplash_HEADERS fbsplash.h) + +QT4_WRAP_CPP(fbsplash_MOC_SOURCES ${fbsplash_MOC_HEADERS}) + +include(${QT_USE_FILE}) +add_definitions(${QT_DEFINITIONS}) + +add_executable(fbsplash ${fbsplash_SOURCES} + ${fbsplash_MOC_SOURCES}) + +target_link_libraries(fbsplash ${QT_LIBRARIES}) + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..595709f --- /dev/null +++ b/build.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# fbsplash builder script for cmake + +# make build dir if its not there +[ ! -d ./build ] && mkdir -p build + +cd build +# use cmake to create Makefile +echo "Invoking cmake ..." +cmake "../" +echo "Invoking make ..." +make + +cd .. + @@ -0,0 +1,17 @@ +#!/bin/sh +# 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"` + +# 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}') + +# 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 & +# 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 new file mode 100644 index 0000000..c2f52bb --- /dev/null +++ b/src/fbsplash.cpp @@ -0,0 +1,28 @@ +#include "fbsplash.h" + +fbsplash::fbsplash(){ + + qDebug() << "*fbsplash init*"; + + createQuitAction(); + setupTheme(); + + setAttribute(Qt::WA_QuitOnClose, true); + setWindowFlags(Qt::FramelessWindowHint); + showFullScreen(); +} +//----------------------------------------------------------------------------- +void fbsplash::setupTheme(){ + // TODO configurable per cmdline + // for now, black as base background color + QPalette pal; + pal.setColor(QPalette::Base, Qt::black); + this->setPalette(pal); +} +//----------------------------------------------------------------------------- +void fbsplash::createQuitAction(){ + _quit = new QAction(tr("&quit"), this); + _quit->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_X)); + this->addAction(_quit); + connect(_quit, SIGNAL(triggered()), this, SLOT(close())); +}
\ No newline at end of file diff --git a/src/fbsplash.h b/src/fbsplash.h new file mode 100644 index 0000000..f081906 --- /dev/null +++ b/src/fbsplash.h @@ -0,0 +1,34 @@ + /* + * Copyright (c) 2010,2011 - OpenSLX Project + * + * This program/file is free software distributed under the GPL version 2. + * See http://openslx.org/COPYING + * + * If you have any feedback please consult http://openslx.org/feedback and + * send your feedback to feedback@openslx.org + * + * General information about OpenSLX can be found under http://openslx.org + * + */ + +#ifndef FBSPLASH_H +#define FBSPLASH_H + +#include <QtGui> + +class fbsplash: public QMainWindow{ + Q_OBJECT + +public: + fbsplash(); + +private: + void setupTheme(); + // ** TESTING STUFF ** + void createQuitAction(); + QAction* _quit; + // ** TESTING STUFF ** + +}; + +#endif // FBSPLASH_H
\ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..16c2daf --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,13 @@ +#include <QApplication> +#include "fbsplash.h" + +int main(int argc, char *argv[]) { + + QApplication app(argc, argv, QApplication::GuiServer); + app.setOrganizationName("OpenSLX"); + app.setApplicationName("fbsplash"); + + fbsplash bs; + bs.show(); + app.exec(); +}
\ No newline at end of file |