Merge lp:~larsu/gsettings-qt/add-changed-signal into lp:gsettings-qt

Proposed by Lars Karlitski
Status: Merged
Approved by: Iain Lane
Approved revision: 19
Merged at revision: 19
Proposed branch: lp:~larsu/gsettings-qt/add-changed-signal
Merge into: lp:gsettings-qt
Diff against target: 59 lines (+10/-4)
2 files modified
GSettings/gsettings-qml.cpp (+6/-3)
GSettings/gsettings-qml.h (+4/-1)
To merge this branch: bzr merge lp:~larsu/gsettings-qt/add-changed-signal
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Iain Lane Approve
Review via email: mp+174392@code.launchpad.net

Commit message

Add 'changed' signal

There's a 'valueChanged' on QQmlPropertyMap, but that is not emitted when values are inserted via insert().

'changed' is always emitted, except when the values are first read.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:19
http://jenkins.qa.ubuntu.com/job/gsettings-qt-ci/1/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/gsettings-qt-saucy-amd64-ci/1

Click here to trigger a rebuild:
http://s-jenkins:8080/job/gsettings-qt-ci/1/rebuild

review: Approve (continuous-integration)
Revision history for this message
Iain Lane (laney) wrote :

Cool, thanks, it works great.

Could you write a simple testcase for this?

Revision history for this message
Iain Lane (laney) wrote :

Let's get it in - I'll write a testcase for it now.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
http://jenkins.qa.ubuntu.com/job/gsettings-qt-autolanding/2/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/gsettings-qt-saucy-amd64-autolanding/2/console

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'GSettings/gsettings-qml.cpp'
2--- GSettings/gsettings-qml.cpp 2013-06-21 18:28:09 +0000
3+++ GSettings/gsettings-qml.cpp 2013-07-12 12:06:26 +0000
4@@ -122,7 +122,7 @@
5 return g_string_free(str, FALSE);
6 }
7
8-void GSettingsQml::updateKey(const gchar *gkey)
9+void GSettingsQml::updateKey(const gchar *gkey, bool emitChanged)
10 {
11 QString qkey;
12 GVariant *value;
13@@ -133,6 +133,9 @@
14 qvalue = qconf_types_to_qvariant(value);
15 this->insert(qkey, qvalue);
16
17+ if (emitChanged)
18+ Q_EMIT (changed (qkey, qvalue));
19+
20 g_variant_unref(value);
21 }
22
23@@ -144,7 +147,7 @@
24 {
25 GSettingsQml *self = (GSettingsQml *)user_data;
26
27- self->updateKey(key);
28+ self->updateKey(key, true);
29 }
30
31 void GSettingsQml::componentComplete()
32@@ -161,7 +164,7 @@
33
34 keys = g_settings_list_keys(priv->settings);
35 for (i = 0; keys[i]; i++)
36- this->updateKey(keys[i]);
37+ this->updateKey(keys[i], false);
38 g_strfreev(keys);
39 }
40
41
42=== modified file 'GSettings/gsettings-qml.h'
43--- GSettings/gsettings-qml.h 2013-06-21 18:28:09 +0000
44+++ GSettings/gsettings-qml.h 2013-07-12 12:06:26 +0000
45@@ -36,11 +36,14 @@
46 QByteArray path() const;
47 void setPath(const QByteArray &path);
48
49- void updateKey(const char *gkey);
50+ void updateKey(const char *gkey, bool emitChanged);
51
52 void classBegin();
53 void componentComplete();
54
55+Q_SIGNALS:
56+ void changed (const QString &key, const QVariant &value);
57+
58 private:
59 struct GSettingsQmlPrivate *priv;
60

Subscribers

People subscribed via source and target branches

to all changes: