summaryrefslogblamecommitdiffstats
path: root/src/fbsplash.cpp
blob: 292431ca8c0c303cad70285382acda77f2cabca8 (plain) (tree)
1
2
3
4
5
6
7
8
9
                     
                        
 
                                                                               
                                     
                                          
                     
 
                   



                                                                        
 


                                           
 
                                                                               
                       
             

                                                                               
                             
                                                          

                                                                               
                                
                                        


                                                          

                                                                   
 







                                                  
#include "fbsplash.h"
#include "ui_fbsplash.h"

//-----------------------------------------------------------------------------
fbsplash::fbsplash(QWidget *parent) :
   QWidget(parent), ui(new Ui::fbsplash) {
   ui->setupUi(this);

   createActions();

   QTimer *timer = new QTimer(this);
   connect(timer, SIGNAL(timeout()), this, SLOT(increaseProgressBar()));
   timer->start(100);

   setWindowFlags(Qt::FramelessWindowHint);
   showFullScreen();

}
//-----------------------------------------------------------------------------
fbsplash::~fbsplash() {
   delete ui;
}
//-----------------------------------------------------------------------------
void fbsplash::setupTheme() {
   // TODO: set styles from config file (or default theme)
}
//-----------------------------------------------------------------------------
void fbsplash::createActions() {
   // For testing: quit through CTRL + X
   _quit = new QAction(tr("&quit"), this);
   _quit->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_X));
   this->addAction(_quit);
   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);
}