on xenial help sign in
Remove unused mock setting and add missing oskSwitchVisible setting.
commitc0be8c5380658c7ed46588bf92a771a47aa55e90 authorRodney Dawes <dobey@ubports.com> dateMon 26 Oct 2020, 13:18 (6 years ago) parente2c7d7f
2 files changed+30−11
tests/mocks/GSettings.1.0/fake_gsettings.cpp+22−5 tests/mocks/GSettings.1.0/fake_gsettings.h+8−6
tests/mocks/GSettings.1.0/fake_gsettings.cpp+22−5
@@ -28,7 +28,7 @@ GSettingsControllerQml::GSettingsControllerQml()
2828 , m_launcherWidth(8)
2929 , m_edgeDragWidth(2)
3030 , m_enableIndicatorMenu(true)
31− , m_appstoreUri("http://uappexplorer.com")
31+ , m_oskSwitchVisible(false)
3232{
3333}
3434
@@ -160,9 +160,17 @@ void GSettingsControllerQml::setEnableIndicatorMenu(bool enableIndicatorMenu)
160160 }
161161}
162162
163−QString GSettingsControllerQml::appstoreUri() const
163+bool GSettingsControllerQml::oskSwitchVisible() const
164164{
165− return m_appstoreUri;
165+ return m_oskSwitchVisible;
166+}
167+
168+void GSettingsControllerQml::setOskSwitchVisible(bool oskSwitchVisible)
169+{
170+ if (m_oskSwitchVisible != oskSwitchVisible) {
171+ m_oskSwitchVisible = oskSwitchVisible;
172+ Q_EMIT oskSwitchVisibleChanged(oskSwitchVisible);
173+ }
166174}
167175
168176GSettingsSchemaQml::GSettingsSchemaQml(QObject *parent): QObject(parent) {
@@ -231,6 +239,8 @@ void GSettingsQml::componentComplete()
231239 this, &GSettingsQml::edgeDragWidthChanged);
232240 connect(GSettingsControllerQml::instance(), &GSettingsControllerQml::enableIndicatorMenuChanged,
233241 this, &GSettingsQml::enableIndicatorMenuChanged);
242+ connect(GSettingsControllerQml::instance(), &GSettingsControllerQml::oskSwitchVisibleChanged,
243+ this, &GSettingsQml::oskSwitchVisibleChanged);
234244
235245 Q_EMIT disableHeightChanged();
236246 Q_EMIT pictureUriChanged();
@@ -356,10 +366,10 @@ QVariant GSettingsQml::enableIndicatorMenu() const
356366 }
357367}
358368
359−QVariant GSettingsQml::appstoreUri() const
369+QVariant GSettingsQml::oskSwitchVisible() const
360370{
361371 if (m_valid && m_schema->id() == "com.canonical.Unity8") {
362− return GSettingsControllerQml::instance()->appstoreUri();
372+ return GSettingsControllerQml::instance()->oskSwitchVisible();
363373 }
364374 return QVariant();
365375}
@@ -398,3 +408,10 @@ void GSettingsQml::setEnableIndicatorMenu(const QVariant &enableIndicatorMenu)
398408 GSettingsControllerQml::instance()->setEnableIndicatorMenu(enableIndicatorMenu.toBool());
399409 }
400410}
411+
412+void GSettingsQml::setOskSwitchVisible(const QVariant &oskSwitchVisible)
413+{
414+ if (m_valid && m_schema->id() == "com.canonical.Unity8") {
415+ GSettingsControllerQml::instance()->setOskSwitchVisible(oskSwitchVisible.toBool());
416+ }
417+}
tests/mocks/GSettings.1.0/fake_gsettings.h+8−6
@@ -58,7 +58,7 @@ class GSettingsQml: public QObject, public QQmlParserStatus
5858 Q_PROPERTY(QVariant launcherWidth READ launcherWidth WRITE setLauncherWidth NOTIFY launcherWidthChanged)
5959 Q_PROPERTY(QVariant edgeDragWidth READ edgeDragWidth WRITE setEdgeDragWidth NOTIFY edgeDragWidthChanged)
6060 Q_PROPERTY(QVariant enableIndicatorMenu READ enableIndicatorMenu WRITE setEnableIndicatorMenu NOTIFY enableIndicatorMenuChanged)
61− Q_PROPERTY(QVariant appstoreUri READ appstoreUri NOTIFY appstoreUriChanged)
61+ Q_PROPERTY(QVariant oskSwitchVisible READ oskSwitchVisible WRITE setOskSwitchVisible NOTIFY oskSwitchVisibleChanged)
6262
6363public:
6464 GSettingsQml(QObject *parent = nullptr);
@@ -76,7 +76,7 @@ public:
7676 QVariant launcherWidth() const;
7777 QVariant edgeDragWidth() const;
7878 QVariant enableIndicatorMenu() const;
79− QVariant appstoreUri() const;
79+ QVariant oskSwitchVisible() const;
8080
8181 void setDisableHeight(const QVariant &val);
8282 void setPictureUri(const QVariant &str);
@@ -87,6 +87,7 @@ public:
8787 void setLauncherWidth(const QVariant &launcherWidth);
8888 void setEdgeDragWidth(const QVariant &edgeDragWidth);
8989 void setEnableIndicatorMenu(const QVariant &enableIndicatorMenu);
90+ void setOskSwitchVisible(const QVariant &oskSwitchVisible);
9091
9192Q_SIGNALS:
9293 void disableHeightChanged();
@@ -99,7 +100,7 @@ Q_SIGNALS:
99100 void launcherWidthChanged();
100101 void edgeDragWidthChanged();
101102 void enableIndicatorMenuChanged();
102− void appstoreUriChanged();
103+ void oskSwitchVisibleChanged();
103104
104105private:
105106 GSettingsSchemaQml* m_schema;
@@ -143,7 +144,8 @@ public:
143144 bool enableIndicatorMenu() const;
144145 Q_INVOKABLE void setEnableIndicatorMenu(bool enableIndicatorMenu);
145146
146− QString appstoreUri() const;
147+ bool oskSwitchVisible() const;
148+ Q_INVOKABLE void setOskSwitchVisible(bool oskSwitchVisible);
147149
148150Q_SIGNALS:
149151 void disableHeightChanged();
@@ -155,7 +157,7 @@ Q_SIGNALS:
155157 void launcherWidthChanged(int launcherWidth);
156158 void edgeDragWidthChanged(uint edgeDragWidth);
157159 void enableIndicatorMenuChanged(bool enableIndicatorMenu);
158− void appstoreUriChanged(const QString &appstoreUri);
160+ void oskSwitchVisibleChanged(bool oskSwitchVisible);
159161
160162private:
161163 GSettingsControllerQml();
@@ -169,7 +171,7 @@ private:
169171 int m_launcherWidth;
170172 uint m_edgeDragWidth;
171173 bool m_enableIndicatorMenu;
172− QString m_appstoreUri;
174+ bool m_oskSwitchVisible;
173175
174176 static GSettingsControllerQml* s_controllerInstance;
175177 QList<GSettingsQml *> m_registeredGSettings;