KDEGames

kgtheme.h
1 /***************************************************************************
2  * Copyright 2012 Stefan Majewsky <[email protected]> *
3  * *
4  * This program is free software; you can redistribute it and/or modify *
5  * it under the terms of the GNU Library General Public License *
6  * version 2 as published by the Free Software Foundation *
7  * *
8  * This program is distributed in the hope that it will be useful, *
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
11  * GNU Library General Public License for more details. *
12  * *
13  * You should have received a copy of the GNU Library General Public *
14  * License along with this program; if not, write to the *
15  * Free Software Foundation, Inc., *
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
17  ***************************************************************************/
18 
19 #ifndef KGTHEME_H
20 #define KGTHEME_H
21 
22 //The complete API needs to be there when compiling libkdegames.
23 #ifdef MAKE_KDEGAMES_LIB
24 #define KGTHEME_PROVIDE_COMPATIBILITY_API
25 #endif //MAKE_KDEGAMES_LIB
26 
27 #include <QMetaType>
28 #include <QObject>
29 #include <QLoggingCategory>
30 #include <QPixmap>
31 
32 #include <libkdegames_export.h>
33 
70 Q_DECLARE_LOGGING_CATEGORY(GAMES_LIB)
71 
72 class KDEGAMES_EXPORT KgTheme : public QObject
73 {
74  Q_OBJECT
75  Q_PROPERTY(QByteArray identifier READ identifier NOTIFY readOnlyProperty)
76  //it is not intended to allow these properties to change after the initial
77  //setup (note how KgThemeProvider returns only const KgTheme*), hence
78  //a dummy NOTIFY signal is enough
79  Q_PROPERTY(QString name READ name WRITE setName NOTIFY readOnlyProperty)
80  Q_PROPERTY(QString description READ description WRITE setDescription NOTIFY readOnlyProperty)
81  Q_PROPERTY(QString author READ author WRITE setAuthor NOTIFY readOnlyProperty)
82  Q_PROPERTY(QString authorEmail READ authorEmail WRITE setAuthorEmail NOTIFY readOnlyProperty)
83  Q_PROPERTY(QString graphicsPath READ graphicsPath WRITE setGraphicsPath NOTIFY readOnlyProperty)
84  Q_PROPERTY(QString previewPath READ previewPath WRITE setPreviewPath NOTIFY readOnlyProperty)
85  Q_DISABLE_COPY(KgTheme)
86  public:
88  explicit KgTheme(const QByteArray& identifier, QObject* parent = nullptr);
90  virtual ~KgTheme();
91 
99  virtual bool readFromDesktopFile(const QString& path);
100 
101 #ifdef KGTHEME_PROVIDE_COMPATIBILITY_API
102  static void addConfigGroupName(const QString& name);
106 #endif
107 
110  QByteArray identifier() const;
111 
113  QString name() const;
115  void setName(const QString& name);
117  QString description() const;
119  void setDescription(const QString& description);
121  QString author() const;
123  void setAuthor(const QString& author);
125  QString authorEmail() const;
127  void setAuthorEmail(const QString& authorEmail);
128 
130  QString graphicsPath() const;
132  void setGraphicsPath(const QString& path);
135  QString previewPath() const;
137  void setPreviewPath(const QString& path);
138 
143  QMap<QString, QString> customData() const;
145  QString customData(const QString& key, const QString& defaultValue = QString()) const;
147  void setCustomData(const QMap<QString, QString>& customData);
148  Q_SIGNALS:
151  void readOnlyProperty();
152  private:
153  class Private;
154  Private* const d;
155 };
156 
157 Q_DECLARE_METATYPE(const KgTheme*)
158 
159 #endif // KGTHEME_H
A theme describes the visual appearance of a game.
Definition: kgtheme.h:72
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Nov 30 2020 22:37:54 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.