~unity-team/ubuntu-settings-components/trunk

« back to all changes in this revision

Viewing changes to tests/qmltests/mocks/GSettings.1.0/fake_gsettings.h

  • Committer: Bileto Bot
  • Date: 2016-06-20 14:01:03 UTC
  • mfrom: (103.6.69 fingerprint)
  • Revision ID: ci-train-bot@canonical.com-20160620140103-q57lulbze89e6yyd
jonas-drange
* Add components for Fingerprint management.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2013 Canonical Ltd.
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU Lesser General Public License as published by
 
6
 * the Free Software Foundation; version 3.
 
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 Lesser General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU Lesser General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 */
 
16
 
 
17
#ifndef FAKE_GSETTINGS_H
 
18
#define FAKE_GSETTINGS_H
 
19
 
 
20
#include <QList>
 
21
#include <QObject>
 
22
#include <QQmlParserStatus>
 
23
#include <QStringList>
 
24
#include <QVariant>
 
25
 
 
26
class GSettingsSchemaQml: public QObject
 
27
{
 
28
    Q_OBJECT
 
29
 
 
30
    Q_PROPERTY(QByteArray id READ id WRITE setId)
 
31
public:
 
32
    GSettingsSchemaQml(QObject *parent = nullptr);
 
33
 
 
34
    QByteArray id() const;
 
35
    void setId(const QByteArray &id);
 
36
 
 
37
    QByteArray path() const;
 
38
    void setPath(const QByteArray &path);
 
39
 
 
40
private:
 
41
    QByteArray m_id;
 
42
    QByteArray m_path;
 
43
};
 
44
 
 
45
class GSettingsQml: public QObject, public QQmlParserStatus
 
46
{
 
47
    Q_OBJECT
 
48
    Q_INTERFACES(QQmlParserStatus)
 
49
 
 
50
    Q_PROPERTY(GSettingsSchemaQml* schema READ schema NOTIFY schemaChanged)
 
51
    Q_PROPERTY(QVariantMap fingerprintNames
 
52
               READ fingerprintNames
 
53
               WRITE setFingerprintNames
 
54
               NOTIFY fingerprintNamesChanged)
 
55
 
 
56
public:
 
57
    GSettingsQml(QObject *parent = nullptr);
 
58
 
 
59
    void classBegin() override;
 
60
    void componentComplete() override;
 
61
 
 
62
    GSettingsSchemaQml * schema() const;
 
63
 
 
64
    QVariantMap fingerprintNames() const;
 
65
    void setFingerprintNames(const QVariantMap &map);
 
66
 
 
67
Q_SIGNALS:
 
68
    void fingerprintNamesChanged();
 
69
    void schemaChanged();
 
70
 
 
71
private:
 
72
    GSettingsSchemaQml* m_schema;
 
73
    bool m_valid;
 
74
 
 
75
    friend class GSettingsSchemaQml;
 
76
};
 
77
 
 
78
class GSettingsControllerQml: public QObject
 
79
{
 
80
    Q_OBJECT
 
81
 
 
82
public:
 
83
    static GSettingsControllerQml* instance();
 
84
    ~GSettingsControllerQml();
 
85
 
 
86
    Q_INVOKABLE QVariantMap fingerprintNames() const;
 
87
    Q_INVOKABLE void setFingerprintNames(QVariantMap map);
 
88
 
 
89
Q_SIGNALS:
 
90
    void fingerprintNamesChanged();
 
91
 
 
92
private:
 
93
    GSettingsControllerQml();
 
94
 
 
95
    QVariantMap m_fingerprintNames;
 
96
 
 
97
    static GSettingsControllerQml* s_controllerInstance;
 
98
    QList<GSettingsQml *> m_registeredGSettings;
 
99
};
 
100
 
 
101
#endif // FAKE_GSETTINGS_H