@@ -1,102 +0,0 @@
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−#include "fake_gsettings.h"
18−
19−#include <QList>
20−
21−GSettingsControllerQml* GSettingsControllerQml::s_controllerInstance = 0;
22−
23−GSettingsControllerQml::GSettingsControllerQml() {
24−}
25−
26−GSettingsControllerQml::~GSettingsControllerQml() {
27− s_controllerInstance = 0;
28−}
29−
30−GSettingsControllerQml* GSettingsControllerQml::instance() {
31− if(!s_controllerInstance) {
32− s_controllerInstance = new GSettingsControllerQml();
33− }
34− return s_controllerInstance;
35−}
36−
37−void GSettingsControllerQml::registerSettingsObject(GSettingsQml *obj) {
38− m_registeredGSettings.append(obj);
39−}
40−
41−void GSettingsControllerQml::unRegisterSettingsObject(GSettingsQml *obj) {
42− m_registeredGSettings.removeOne(obj);
43−}
44−
45−void GSettingsControllerQml::setPictureUri(const QString &str) {
46− Q_FOREACH (GSettingsQml *obj, m_registeredGSettings) {
47− obj->setPictureUri(str);
48− }
49−}
50−
51−GSettingsSchemaQml::GSettingsSchemaQml(QObject *parent): QObject(parent) {
52−}
53−
54−QByteArray GSettingsSchemaQml::id() const {
55− return m_id;
56−}
57−
58−void GSettingsSchemaQml::setId(const QByteArray &id) {
59− if (m_id.isEmpty()) {
60− qWarning("GSettings.schema.id may only be set on construction");
61− return;
62− }
63−
64− m_id = id;
65−}
66−
67−QByteArray GSettingsSchemaQml::path() const {
68− return m_path;
69−}
70−
71−void GSettingsSchemaQml::setPath(const QByteArray &path) {
72− if (m_path.isEmpty()) {
73− qWarning("GSettings.schema.path may only be set on construction");
74− return;
75− }
76−
77− m_path = path;
78−}
79−
80−GSettingsQml::GSettingsQml(QObject *parent): QObject(parent) {
81− m_schema = new GSettingsSchemaQml(this);
82− GSettingsControllerQml::instance()->registerSettingsObject(this);
83−}
84−
85−GSettingsQml::~GSettingsQml() {
86− GSettingsControllerQml::instance()->unRegisterSettingsObject(this);
87−}
88−
89−GSettingsSchemaQml * GSettingsQml::schema() const {
90− return m_schema;
91−}
92−
93−QString GSettingsQml::pictureUri() const {
94− return m_pictureUri;
95−}
96−
97−void GSettingsQml::setPictureUri(const QString &str) {
98− if (str != m_pictureUri) {
99− m_pictureUri = str;
100− Q_EMIT pictureUriChanged(m_pictureUri);
101− }
102−}