SplashScreenManager.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/qt/af/SplashScreenManager.cpp
22 
23  \brief A singleton for holding he application splash screen.
24 */
25 
26 // TerraLib
27 #include "SplashScreenManager.h"
28 
29 // Qt
30 #include <QtCore/QCoreApplication>
31 
33 {
34  if(m_sc == nullptr)
35  return;
36 
37  m_sc->showMessage(message, m_msgAlignment, m_msgColor);
38 
39  QCoreApplication::processEvents();
40 }
41 
42 void te::qt::af::SplashScreenManager::set(QSplashScreen* impl, int alignment, const QColor& color)
43 {
44  m_sc = impl;
45  m_msgAlignment = alignment;
46  m_msgColor = color;
47 }
48 
50 {
51  if(m_sc != nullptr)
52  m_sc->setPixmap(pix);
53 }
54 
56 {
57  if(m_sc != nullptr && m_sc->isHidden())
58  m_sc->show();
59 }
60 
62 {
63  if(m_sc != nullptr && m_sc->isVisible())
64  m_sc->hide();
65 }
66 
68 {
69  if(m_sc != nullptr)
70  {
71  m_sc->setParent(w);
72  m_sc->finish(w);
73  }
74 }
75 
77  : m_sc(nullptr),
78  m_msgAlignment(Qt::AlignLeft),
79  m_msgColor(Qt::black)
80 {
81 }
82 
void show()
Shows the splash screen.
QColor m_msgColor
The color used to draw the message text.
A singleton for holding he application splash screen.
SplashScreenManager()
It initializes the singleton.
void showMessage(const QString &message)
This will cause the text to be drawn on the splash screen and a call to Application::processEvents() ...
void hide()
Hide the splash screen.
void finish(QWidget *w)
Finishes the splash screen.
int m_msgAlignment
The alignment used to draw the message text.
void set(QSplashScreen *impl, int alignment=Qt::AlignLeft, const QColor &color=Qt::black)
It sets the splash screen to be used during the application startup.
void setLogo(const QPixmap &pix)
Updates the image to be presented on splash screen.
QSplashScreen * m_sc
A reference to the splash screen.