@@ -1,28 +1,105 @@
2− * Copyright (C) 2013 Canonical, Ltd.
2+ * Copyright 2013 Canonical Ltd.
4 * This program is free software; you can redistribute it and/or modify
4 * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
5+ * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
11+ * GNU Lesser General Public License for more details.
13− * You should have received a copy of the GNU General Public License
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/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17#include "fake_gsettings.h"
17#include "fake_gsettings.h"
18−#include "fake_schema.h"
20−GSettings::GSettings(QObject *parent) :
19+struct GSettingsSchemaQmlPrivate {
24+struct GSettingsQmlPrivate {
25+ GSettingsSchemaQml *schema;
28+bool GSettingsControllerQml::instance_exists;
29+GSettingsControllerQml* GSettingsControllerQml::_controllerInstance;
31+GSettingsControllerQml::GSettingsControllerQml() {
34+GSettingsControllerQml::~GSettingsControllerQml() {
35+ instance_exists = false;
38+GSettingsControllerQml* GSettingsControllerQml::getInstance() {
39+ if(!instance_exists) {
40+ _controllerInstance = new GSettingsControllerQml();
41+ instance_exists = true;
42+ return _controllerInstance;
44+ return _controllerInstance;
48+GSettingsSchemaQml::GSettingsSchemaQml(QObject *parent): QObject(parent) {
49+ priv = new GSettingsSchemaQmlPrivate;
52+GSettingsSchemaQml::~GSettingsSchemaQml() {
56+QByteArray GSettingsSchemaQml::id() const {
60+void GSettingsSchemaQml::setId(const QByteArray &id) {
61+ if (!priv->id.isEmpty()) {
62+ qWarning("GSettings.schema.id may only be set on construction");
69+QByteArray GSettingsSchemaQml::path() const {
73+void GSettingsSchemaQml::setPath(const QByteArray &path) {
74+ if (!priv->path.isEmpty()) {
75+ qWarning("GSettings.schema.path may only be set on construction");
21− QObject(parent)
82+GSettingsQml::GSettingsQml(QObject *parent): QObject(parent) {
22−{
83+ GSettingsControllerQml::getInstance();
23− m_schema = new Schema();
84+ priv = new GSettingsQmlPrivate;
85+ priv->schema = new GSettingsSchemaQml(this);
88+GSettingsQml::~GSettingsQml() {
92+GSettingsSchemaQml * GSettingsQml::schema() const {
96+QString GSettingsQml::pictureUri() const {
26−QObject GSettings::schema() const {
100+void GSettingsQml::setPictureUri(const QString &str) {
27− return m_schema;
101+ if (str != m_pictureUri) {
103+ Q_EMIT pictureUriChanged(m_pictureUri);