SplashScreenManager.h
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.h
22 
23  \brief A singleton for holding he application splash screen.
24 */
25 
26 #ifndef __TERRALIB_QT_AF_INTERNAL_SPLASHSCREENMANAGER_H
27 #define __TERRALIB_QT_AF_INTERNAL_SPLASHSCREENMANAGER_H
28 
29 // TerraLib
30 #include "../../common/Singleton.h"
31 #include "Config.h"
32 
33 // Qt
34 #include <QSplashScreen>
35 
36 namespace te
37 {
38  namespace qt
39  {
40  namespace af
41  {
42  /*!
43  \class SplashScreenManager
44 
45  \brief A singleton for holding the application splash screen.
46  */
47  class TEQTAFEXPORT SplashScreenManager : public te::common::Singleton<SplashScreenManager>
48  {
50 
51  public:
52 
53  /*!
54  \brief This will cause the text to be drawn on the splash screen and a call to Application::processEvents() will be made.
55 
56  \param message The message to be drawn.
57  */
58  void showMessage(const QString& message);
59 
60  /*!
61  \brief It sets the splash screen to be used during the application startup.
62 
63  \param impl Any splash screen widget.
64  \param alignment The alignment of the text.
65  \param color The text color.
66 
67  \note The caller is responsible for keeping the splash screen alive until the application is fully initialized.
68 
69  \note The application will use the splash screen implementation only during the application startup.
70 
71  \note The manager will not take the ownership of the splash screen.
72  */
73  void set(QSplashScreen* impl, int alignment = Qt::AlignLeft, const QColor& color = Qt::black);
74 
75  /*!
76  \brief Updates the image to be presented on splash screen.
77 
78  \param pix New image to be presented.
79  */
80  void setLogo(const QPixmap& pix);
81 
82  /*!
83  \brief Shows the splash screen.
84 
85  This function can be used when the splash screen is hidden.
86  */
87  void show();
88 
89  /*!
90  \brief Hide the splash screen.
91 
92  This function can be used when something fails and the splash screen is visible.
93  */
94  void hide();
95 
96  /*!
97  \brief Finishes the splash screen.
98 
99  This function makes the splash screen wait until the widget mainWin is displayed before calling close() on itself.
100  */
101  void finish(QWidget* w);
102 
103  protected:
104 
105  /*! \brief It initializes the singleton. */
107 
108  /*! \brief Destructor. */
110 
111  private:
112 
113  QSplashScreen* m_sc; //!< A reference to the splash screen.
114  int m_msgAlignment; //!< The alignment used to draw the message text.
115  QColor m_msgColor; //!< The color used to draw the message text.
116  };
117 
118  } // end namespace af
119  } // end namespace qt
120 } // end namespace te
121 
122 #endif // __TERRALIB_QT_AF_INTERNAL_SPLASHSCREENMANAGER_H
QColor m_msgColor
The color used to draw the message text.
Configuration flags for the TerraLib Application Framework.
URI C++ Library.
#define TEQTAFEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:71
int m_msgAlignment
The alignment used to draw the message text.
QSplashScreen * m_sc
A reference to the splash screen.
A singleton for holding the application splash screen.
Template support for singleton pattern.
Definition: Singleton.h:100