Merge lp:~ken-vandine/content-hub/creatable_content_peer into lp:~content-hub-team/content-hub/trunk

Proposed by Ken VanDine
Status: Merged
Approved by: Ken VanDine
Approved revision: 67
Merged at revision: 68
Proposed branch: lp:~ken-vandine/content-hub/creatable_content_peer
Merge into: lp:~content-hub-team/content-hub/trunk
Diff against target: 60 lines (+25/-2)
3 files modified
examples/import-qml/import.qml (+1/-1)
import/Ubuntu/Content/contenthub.cpp (+23/-0)
import/Ubuntu/Content/contenthubplugin.cpp (+1/-1)
To merge this branch: bzr merge lp:~ken-vandine/content-hub/creatable_content_peer
Reviewer Review Type Date Requested Status
Thomas Voß (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+194597@code.launchpad.net

Commit message

allow ContentPeer to be creatable in QML, this makes it more obvious
how to deal with the list returned by knownSourcesForType.

Description of the change

allow ContentPeer to be creatable in QML, this makes it more obvious
how to deal with the list returned by knownSourcesForType.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Thomas Voß (thomas-voss) wrote :

LGTM.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'examples/import-qml/import.qml'
2--- examples/import-qml/import.qml 2013-10-22 17:36:14 +0000
3+++ examples/import-qml/import.qml 2013-11-08 21:19:44 +0000
4@@ -12,7 +12,7 @@
5
6 property list<ContentItem> importItems
7 property var activeTransfer
8- property var peers
9+ property list<ContentPeer> peers
10
11
12 function _importFromPeer(peer) {
13
14=== modified file 'import/Ubuntu/Content/contenthub.cpp'
15--- import/Ubuntu/Content/contenthub.cpp 2013-11-07 20:12:56 +0000
16+++ import/Ubuntu/Content/contenthub.cpp 2013-11-08 21:19:44 +0000
17@@ -149,6 +149,29 @@
18 * \qmlmethod ContentHub::knownSourcesForType(ContentType)
19 *
20 * Returns all possible peers for the given ContentType
21+ *
22+ * \qml
23+ * import QtQuick 2.0
24+ * import Ubuntu.Components 0.1
25+ * import Ubuntu.Components.ListItems 0.1 as ListItem
26+ * import Ubuntu.Content 0.1
27+ *
28+ * MainView {
29+ * property list<ContentPeer> peers
30+ *
31+ * Component.onCompleted: {
32+ * peers = ContentHub.knownSourcesForType(ContentType.Pictures);
33+ * }
34+ * ListView {
35+ * anchors.fill: parent
36+ * height: childrenRect.height
37+ * model: peers
38+ * delegate: ListItem.Standard {
39+ * text: modelData.name
40+ * }
41+ * }
42+ * }
43+ * \endqml
44 */
45 QVariantList ContentHub::knownSourcesForType(int type)
46 {
47
48=== modified file 'import/Ubuntu/Content/contenthubplugin.cpp'
49--- import/Ubuntu/Content/contenthubplugin.cpp 2013-10-21 16:36:02 +0000
50+++ import/Ubuntu/Content/contenthubplugin.cpp 2013-11-08 21:19:44 +0000
51@@ -52,8 +52,8 @@
52
53 qmlRegisterSingletonType<ContentHub>(uri, versionMajor, versionMinor, "ContentHub", qml_content_hub);
54 qmlRegisterType<ContentItem>(uri, versionMajor, versionMinor, "ContentItem");
55+ qmlRegisterType<ContentPeer>(uri, versionMajor, versionMinor, "ContentPeer");
56 qmlRegisterUncreatableType<ContentStore>(uri, versionMajor, versionMinor, "ContentStore", "created by hub");
57- qmlRegisterUncreatableType<ContentPeer>(uri, versionMajor, versionMinor, "ContentPeer", "created by hub");
58 qmlRegisterUncreatableType<ContentTransfer>(uri, versionMajor, versionMinor, "ContentTransfer", "created by hub");
59 qmlRegisterUncreatableType<ContentType>(uri, versionMajor, versionMinor, "ContentType", "Use only the type");
60 }

Subscribers

People subscribed via source and target branches