From df3af2be38e0412ffc228acfbda9ad9a7f983fdb Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Fri, 1 Jul 2011 15:35:13 +0200 Subject: progress bar animated (increases by 1% every 0.1 second) --- .gitignore | 1 - build.sh | 11 ++++------- src/fbsplash.cpp | 18 +++++++++++++----- src/fbsplash.h | 2 ++ src/fbsplash.ui | 2 +- 5 files changed, 20 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 524b093..378eac2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ build -core diff --git a/build.sh b/build.sh index dacc56e..9aa411d 100755 --- a/build.sh +++ b/build.sh @@ -1,9 +1,9 @@ -#!/bin/sh +#!/bin/bash # fbsplash builder script for cmake DIR=$(pwd) BUILDDIR=build -# if --clean, remove build dir +# if -c option was given, remove build dir if [ "$1" = "-c" ] then rm -rf $BUILDDIR @@ -21,10 +21,7 @@ fi [ ! -d $BUILDDIR ] && mkdir -p $BUILDDIR cd $BUILDDIR -# use cmake to create Makefile -echo "Invoking cmake ..." -cmake "$DIR" -echo "Invoking make ..." -make + +cmake "$DIR" && make cd $DIR diff --git a/src/fbsplash.cpp b/src/fbsplash.cpp index 7e97d91..292431c 100644 --- a/src/fbsplash.cpp +++ b/src/fbsplash.cpp @@ -1,15 +1,16 @@ -#include #include "fbsplash.h" #include "ui_fbsplash.h" //----------------------------------------------------------------------------- fbsplash::fbsplash(QWidget *parent) : QWidget(parent), ui(new Ui::fbsplash) { - ui->setupUi(this); createActions(); - //setupTheme(); + + QTimer *timer = new QTimer(this); + connect(timer, SIGNAL(timeout()), this, SLOT(increaseProgressBar())); + timer->start(100); setWindowFlags(Qt::FramelessWindowHint); showFullScreen(); @@ -21,8 +22,7 @@ fbsplash::~fbsplash() { } //----------------------------------------------------------------------------- void fbsplash::setupTheme() { - // TODO configurable per cmdline - // TODO set per css + // TODO: set styles from config file (or default theme) } //----------------------------------------------------------------------------- void fbsplash::createActions() { @@ -33,3 +33,11 @@ void fbsplash::createActions() { connect(_quit, SIGNAL(triggered()), this, SLOT(close())); // per default, QT closes the app when the last widget is closed } + +void fbsplash::increaseProgressBar() { + int currentValue = ui->progressBar->value(); + if (currentValue < 100) + ui->progressBar->setValue(currentValue + 1); + else + ui->progressBar->setValue(0); +} diff --git a/src/fbsplash.h b/src/fbsplash.h index 69ef69a..26b66b0 100644 --- a/src/fbsplash.h +++ b/src/fbsplash.h @@ -39,6 +39,8 @@ private: // ** TESTING ** // ** TESTING ** +private slots: + void increaseProgressBar(); }; #endif // FBSPLASH_H diff --git a/src/fbsplash.ui b/src/fbsplash.ui index a5ed56b..0710b35 100644 --- a/src/fbsplash.ui +++ b/src/fbsplash.ui @@ -69,7 +69,7 @@ border-radius: 8px; } - 24 + 0 -- cgit v1.2.3-55-g7522