BuildmLearn Toolkit  2.0.4
BuildmLearn Toolkit is an easy-to-use program that helps users make mobile apps without any knowledge of application development.
 All Classes Functions Enumerations Groups Pages
skinfactory.h
1 /*
2  Copyright (c) 2012, BuildmLearn Contributors listed at http://buildmlearn.org/people/
3  All rights reserved.
4 
5  Redistribution and use in source and binary forms, with or without
6  modification, are permitted provided that the following conditions are met:
7 
8  * Redistributions of source code must retain the above copyright notice, this
9  list of conditions and the following disclaimer.
10 
11  * Redistributions in binary form must reproduce the above copyright notice,
12  this list of conditions and the following disclaimer in the documentation
13  and/or other materials provided with the distribution.
14 
15  * Neither the name of the BuildmLearn nor the names of its
16  contributors may be used to endorse or promote products derived from
17  this software without specific prior written permission.
18 
19  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30 
31 #ifndef SKINFACTORY_H
32 #define SKINFACTORY_H
33 
34 #include <QObject>
35 
36 #include <QStringList>
37 #include <QMetaType>
38 
39 
40 /// \brief Skin representation.
41 struct Skin {
42  QString m_baseName;
43  QString m_baseFolder;
44  QString m_visibleName;
45  QStringList m_stylesNames;
46  QString m_author;
47  QString m_email;
48  QString m_version;
49  QString m_rawData;
50 
51  QString m_simulatorBackgroundMain;
52  QString m_simulatorStyle;
53 };
54 
55 Q_DECLARE_METATYPE(Skin)
56 
57 ///
58 /// \brief Main features for skinning.
59 class SkinFactory : public QObject {
60  Q_OBJECT
61 
62  public:
63  /// \brief Constructor.
64  explicit SkinFactory(QObject *parent = 0);
65 
66  /// \brief Destructor.
67  virtual ~SkinFactory();
68 
69  /// \brief Loads skin name from settings and sets it as active.
70  void loadCurrentSkin();
71 
72  /// \brief Name of this "activated" skin.
73  /// \return Returns the name of the skin, that should be activated
74  /// after application restart.
75  QString selectedSkinName();
76 
77  /// \brief Gets skin about a particular skin.
78  Skin skinInfo(const QString &skin_name, bool *ok = NULL);
79 
80  /// \brief Returns list of installed skins.
81  QList<Skin> installedSkins();
82 
83  /// \brief Sets the desired skin as the active one if it exists.
84  void setCurrentSkinName(const QString &skin_name);
85 
86  /// \brief Access to activated skin.
87  /// \return Returns Skin instance which holds data of currently
88  /// active skin.
89  inline Skin currentSkin() const {
90  return m_currentSkin;
91  }
92 
93  private:
94  // Loads the skin from give skin_data.
95  bool loadSkinFromData(const Skin &skin);
96 
97  private:
98  // Holds name of the current skin.
99  Skin m_currentSkin;
100 };
101 
102 #endif // SKINFACTORY_H
Main features for skinning.
Definition: skinfactory.h:59
Skin currentSkin() const
Access to activated skin.
Definition: skinfactory.h:89
Skin representation.
Definition: skinfactory.h:41