diff options
author | Jonathan Bauer | 2011-06-17 16:02:53 +0200 |
---|---|---|
committer | Jonathan Bauer | 2011-06-17 16:02:53 +0200 |
commit | 50efdffaa4f096fd4fda812e46765c5c018bb1b4 (patch) | |
tree | b51b98be127abcbef36445d00b0e6f4296cad4f6 | |
parent | testing positions and sizes of floating widgets to find the better layout alt... (diff) | |
download | fbsplash-50efdffaa4f096fd4fda812e46765c5c018bb1b4.tar.gz fbsplash-50efdffaa4f096fd4fda812e46765c5c018bb1b4.tar.xz fbsplash-50efdffaa4f096fd4fda812e46765c5c018bb1b4.zip |
the geometric way to layout label/progress bar, TODO proper central widget...
-rw-r--r-- | CMakeLists.txt | 15 | ||||
-rwxr-xr-x | run.sh | 2 | ||||
-rw-r--r-- | src/fbsplash.cpp | 32 | ||||
-rw-r--r-- | src/fbsplash.h | 15 |
4 files changed, 38 insertions, 26 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ee8d65..8cf1160 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,17 +11,18 @@ endif(QT4_FOUND) file(GLOB_RECURSE fbsplash_SOURCES src/*.cpp) file(GLOB_RECURSE fbsplash_MOC_HEADERS src/*.h) +file(GLOB_RECURSE fbsplash_UIS src/*.ui) -#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}) +QT4_WRAP_UI(fbsplash_UI_HEADERS ${fbsplash_UIS}) +QT4_WRAP_CPP(fbsplash_MOC_SOURCES ${fbsplash_MOC_HEADERS}) + +add_executable(fbsplash + ${fbsplash_SOURCES} + ${fbsplash_MOC_SOURCES} + ${fbsplash_UI_HEADERS}) target_link_libraries(fbsplash ${QT_LIBRARIES}) @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # path to script (including script name) script_path="$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")" diff --git a/src/fbsplash.cpp b/src/fbsplash.cpp index ab85245..0e84c5c 100644 --- a/src/fbsplash.cpp +++ b/src/fbsplash.cpp @@ -1,36 +1,40 @@ #include <QProgressBar> #include "fbsplash.h" + fbsplash::fbsplash() : - QMainWindow() { + QMainWindow(){ qDebug() << "fbsplash init"; + //ui->setup(this); + createActions(); + setupTheme(); - _label = new QLabel("OpenSLX"); + _label = new QLabel("<font size=10 color='green'>OpenSLX</font>"); _label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); - QPalette pal; - pal.setColor(QPalette::Base, Qt::black); - _label->setPalette(pal); - setCentralWidget(_label); - //QDockWidget *dock = new QDockWidget(this); - //dock->setAllowedAreas(Qt::BottomDockWidgetArea); + + qDebug() << "center x: " << center.x(); + qDebug() << "center y: " << center.y(); + QProgressBar* pb = new QProgressBar(this); //pb->setFormat("Progress: %p%"); pb->setWindowFlags(Qt::FramelessWindowHint); pb->setRange(0, 100); - pb->setValue(50); - pb->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); - //addDockWidget(Qt::BottomDockWidgetArea, dock); + pb->setValue(10); - //setupTheme(); + QRect desktopRect = QApplication::desktop()->availableGeometry(this); + QPoint center = desktopRect.center(); + pb->move(center.x() - pb->width()*0.5 , center.y() - pb->height()*0.5 + 50); + + setCentralWidget(_label); setAttribute(Qt::WA_QuitOnClose, true); - //setWindowFlags(Qt::FramelessWindowHint); - //showFullScreen(); + setWindowFlags(Qt::FramelessWindowHint); + showFullScreen(); } //----------------------------------------------------------------------------- void fbsplash::setupTheme() { diff --git a/src/fbsplash.h b/src/fbsplash.h index 31bf591..145b92a 100644 --- a/src/fbsplash.h +++ b/src/fbsplash.h @@ -16,22 +16,29 @@ #include <QtGui> -class fbsplash: public QMainWindow { +//#include "ui_fbsplash.h" +//namespace Ui { class fbsplash; } + +class fbsplash: public QMainWindow{ Q_OBJECT public: fbsplash(); private: + void createActions(); void setupTheme(); - // ** TESTING STUFF ** + + // ** TESTING ** + void printSize(); - void createActions(); QAction* _quit; QAction* _printSize; QLabel* _label; + //Ui::fbsplash *ui; + + // ** TESTING ** - // ** TESTING STUFF ** private slots: void printSizeAction(); }; |