2 * Copyright 2013 Canonical Ltd.
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.
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.
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/>.
17#include "fake_gsettings.h"
21GSettingsControllerQml* GSettingsControllerQml::s_controllerInstance = 0;
23GSettingsControllerQml::GSettingsControllerQml()
24 : m_usageMode("Staged")
28GSettingsControllerQml::~GSettingsControllerQml() {
29 s_controllerInstance = 0;
32GSettingsControllerQml* GSettingsControllerQml::instance() {
33 if (!s_controllerInstance) {
34 s_controllerInstance = new GSettingsControllerQml();
36 return s_controllerInstance;
39QString GSettingsControllerQml::pictureUri() const
44void GSettingsControllerQml::setPictureUri(const QString &str)
46 if (str != m_pictureUri) {
48 Q_EMIT pictureUriChanged(m_pictureUri);
52QString GSettingsControllerQml::usageMode() const
57void GSettingsControllerQml::setUsageMode(const QString &usageMode)
59 if (usageMode != m_usageMode) {
60 m_usageMode = usageMode;
61 Q_EMIT usageModeChanged(m_usageMode);
65qint64 GSettingsControllerQml::lockedOutTime() const
67 return m_lockedOutTime;
70void GSettingsControllerQml::setLockedOutTime(qint64 timestamp)
72 if (m_lockedOutTime != timestamp) {
73 m_lockedOutTime = timestamp;
74 Q_EMIT lockedOutTimeChanged(m_lockedOutTime);
78QStringList GSettingsControllerQml::lifecycleExemptAppids() const
80 return m_lifecycleExemptAppids;
83void GSettingsControllerQml::setLifecycleExemptAppids(const QStringList &appIds)
85 if (m_lifecycleExemptAppids != appIds) {
86 m_lifecycleExemptAppids = appIds;
87 Q_EMIT lifecycleExemptAppidsChanged(m_lifecycleExemptAppids);
91GSettingsSchemaQml::GSettingsSchemaQml(QObject *parent): QObject(parent) {
94QByteArray GSettingsSchemaQml::id() const {
98void GSettingsSchemaQml::setId(const QByteArray &id) {
99 if (!m_id.isEmpty()) {
100 qWarning("GSettings.schema.id may only be set on construction");
107QByteArray GSettingsSchemaQml::path() const {
111void GSettingsSchemaQml::setPath(const QByteArray &path) {
112 if (!m_path.isEmpty()) {
113 qWarning("GSettings.schema.path may only be set on construction");
120GSettingsQml::GSettingsQml(QObject *parent)
123 m_schema = new GSettingsSchemaQml(this);
124 connect(GSettingsControllerQml::instance(), &GSettingsControllerQml::pictureUriChanged,
125 this, &GSettingsQml::pictureUriChanged);
126 connect(GSettingsControllerQml::instance(), &GSettingsControllerQml::usageModeChanged,
127 this, &GSettingsQml::usageModeChanged);
128 connect(GSettingsControllerQml::instance(), &GSettingsControllerQml::lockedOutTimeChanged,
129 this, &GSettingsQml::lockedOutTimeChanged);
130 connect(GSettingsControllerQml::instance(), &GSettingsControllerQml::lifecycleExemptAppidsChanged,
131 this, &GSettingsQml::lifecycleExemptAppidsChanged);
134GSettingsSchemaQml * GSettingsQml::schema() const {
138QString GSettingsQml::pictureUri() const
140 if (m_schema->id() == "org.gnome.desktop.background") {
141 return GSettingsControllerQml::instance()->pictureUri();
147void GSettingsQml::setPictureUri(const QString &str)
149 if (m_schema->id() == "org.gnome.desktop.background") {
150 GSettingsControllerQml::instance()->setPictureUri(str);
154QString GSettingsQml::usageMode() const
156 if (m_schema->id() == "com.canonical.Unity8") {
157 return GSettingsControllerQml::instance()->usageMode();
163void GSettingsQml::setUsageMode(const QString &usageMode)
165 if (m_schema->id() == "com.canonical.Unity8") {
166 GSettingsControllerQml::instance()->setUsageMode(usageMode);
170qint64 GSettingsQml::lockedOutTime() const
172 if (m_schema->id() == "com.canonical.Unity8.Greeter") {
173 return GSettingsControllerQml::instance()->lockedOutTime();
179void GSettingsQml::setLockedOutTime(qint64 timestamp)
181 if (m_schema->id() == "com.canonical.Unity8.Greeter") {
182 GSettingsControllerQml::instance()->setLockedOutTime(timestamp);
186QStringList GSettingsQml::lifecycleExemptAppids() const
188 if (m_schema->id() == "com.canonical.qtmir") {
189 return GSettingsControllerQml::instance()->lifecycleExemptAppids();
191 return QStringList();
195void GSettingsQml::setLifecycleExemptAppids(const QStringList &appIds)
197 if (m_schema->id() == "com.canonical.qtmir") {
198 GSettingsControllerQml::instance()->setLifecycleExemptAppids(appIds);
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list