~ubuntu-branches/ubuntu/raring/plasma-mobile/raring-proposed

« back to all changes in this revision

Viewing changes to applications/settings/src/settingsmodule.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2012-07-17 12:04:43 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20120717120443-q3ig9u2fnltx67yg
Tags: 2.0+git2012071701-0ubuntu1
* New upstream snapshot
* Remove build-dep on kde-runtime-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *   Copyright 2011 Sebastian Kügler <sebas@kde.org>
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 as
6
 
 *   published by the Free Software Foundation; either version 2, or
7
 
 *   (at your option) any later version.
8
 
 *
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
13
 
 *
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.
18
 
 */
19
 
 
20
 
#ifndef SETTINGSMODULE_H
21
 
#define SETTINGSMODULE_H
22
 
 
23
 
#include <kdemacros.h>
24
 
#include <QObject>
25
 
#include <QVariant>
26
 
 
27
 
class SettingsModulePrivate;
28
 
/**
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.
35
 
 */
36
 
class KDE_EXPORT SettingsModule : public QObject
37
 
{
38
 
    Q_OBJECT
39
 
 
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)
45
 
 
46
 
 
47
 
    public:
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.
55
 
         */
56
 
        void init();
57
 
 
58
 
        /**
59
 
         * @return Settings object exported by the plugin, which is made
60
 
         * available to the QML UI parts
61
 
         */
62
 
        virtual QObject* settingsObject();
63
 
 
64
 
        /**
65
 
         * @internal Uses to transfer data and settings between QML package and C++ plugin.
66
 
         */
67
 
        void setSettingsObject(QObject *o);
68
 
 
69
 
        QString name();
70
 
        QString description();
71
 
        QString iconName();
72
 
        QString module();
73
 
        QIcon icon();
74
 
 
75
 
    public Q_SLOTS:
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);
81
 
 
82
 
    Q_SIGNALS:
83
 
        void dataChanged();
84
 
 
85
 
        void nameChanged();
86
 
        void descriptionChanged();
87
 
        void moduleChanged();
88
 
        void iconChanged();
89
 
        void iconNameChanged();
90
 
 
91
 
    private:
92
 
        SettingsModulePrivate *d;
93
 
 
94
 
};
95
 
 
96
 
#endif