2
* Copyright 2011 Sebastian Kügler <sebas@kde.org>
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 as
6
* published by the Free Software Foundation; either version 2, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU Library General Public License for more details
14
* You should have received a copy of the GNU Library General Public
15
* License along with this program; if not, write to the
16
* Free Software Foundation, Inc.,
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
#ifndef SETTINGSMODULE_H
21
#define SETTINGSMODULE_H
23
#include <kdemacros.h>
27
class SettingsModulePrivate;
29
* @class SettingsModule A class to manage settings from declarative UIs.
30
* This class serves two functions:
31
* - Provide a plugin implementation
32
* - Provide a settings module
33
* This is done from one class in order to simplify the code. You can export
34
* any QObject-based class through qmlRegisterType(), however.
36
class KDE_EXPORT SettingsModule : public QObject
40
Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
41
Q_PROPERTY(QString description READ description WRITE setDescription NOTIFY descriptionChanged)
42
Q_PROPERTY(QString module READ module WRITE setModule NOTIFY moduleChanged)
43
Q_PROPERTY(QIcon icon READ icon WRITE setIcon NOTIFY iconChanged)
44
Q_PROPERTY(QString iconName READ iconName WRITE setIconName NOTIFY iconNameChanged)
48
SettingsModule(QObject *parent = 0, const QVariantList &v = QVariantList());
49
virtual ~SettingsModule();
50
/** @name init Set up the internal metadata for the plugin
51
* This function is called from an implementing class once the object
52
* has been instantiated from QML. It loads the metadata through a KService.
53
* Call this class from the end of your empty constructor, but don't forget
54
* to call setModule(org.kde.active.settings.yourPluginName) first.
59
* @return Settings object exported by the plugin, which is made
60
* available to the QML UI parts
62
virtual QObject* settingsObject();
65
* @internal Uses to transfer data and settings between QML package and C++ plugin.
67
void setSettingsObject(QObject *o);
70
QString description();
76
void setName(const QString &name);
77
void setDescription(const QString &description);
78
void setModule(const QString &module);
79
void setIcon(const QIcon &icon);
80
void setIconName(const QString &iconName);
86
void descriptionChanged();
89
void iconNameChanged();
92
SettingsModulePrivate *d;