From 50efdffaa4f096fd4fda812e46765c5c018bb1b4 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Fri, 17 Jun 2011 16:02:53 +0200 Subject: the geometric way to layout label/progress bar, TODO proper central widget... --- CMakeLists.txt | 15 ++++++++------- run.sh | 2 +- src/fbsplash.cpp | 32 ++++++++++++++++++-------------- 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}) diff --git a/run.sh b/run.sh index 098b060..d679a44 100755 --- a/run.sh +++ b/run.sh @@ -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 #include "fbsplash.h" + fbsplash::fbsplash() : - QMainWindow() { + QMainWindow(){ qDebug() << "fbsplash init"; + //ui->setup(this); + createActions(); + setupTheme(); - _label = new QLabel("OpenSLX"); + _label = new QLabel("OpenSLX"); _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 -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(); }; -- cgit v1.2.3-55-g7522