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
=== modified file 'examples/import-qml/import.qml'
--- examples/import-qml/import.qml 2013-10-22 17:36:14 +0000
+++ examples/import-qml/import.qml 2013-11-08 21:19:44 +0000
@@ -12,7 +12,7 @@
1212
13 property list<ContentItem> importItems13 property list<ContentItem> importItems
14 property var activeTransfer14 property var activeTransfer
15 property var peers15 property list<ContentPeer> peers
1616
1717
18 function _importFromPeer(peer) {18 function _importFromPeer(peer) {
1919
=== modified file 'import/Ubuntu/Content/contenthub.cpp'
--- import/Ubuntu/Content/contenthub.cpp 2013-11-07 20:12:56 +0000
+++ import/Ubuntu/Content/contenthub.cpp 2013-11-08 21:19:44 +0000
@@ -149,6 +149,29 @@
149 * \qmlmethod ContentHub::knownSourcesForType(ContentType)149 * \qmlmethod ContentHub::knownSourcesForType(ContentType)
150 *150 *
151 * Returns all possible peers for the given ContentType151 * Returns all possible peers for the given ContentType
152 *
153 * \qml
154 * import QtQuick 2.0
155 * import Ubuntu.Components 0.1
156 * import Ubuntu.Components.ListItems 0.1 as ListItem
157 * import Ubuntu.Content 0.1
158 *
159 * MainView {
160 * property list<ContentPeer> peers
161 *
162 * Component.onCompleted: {
163 * peers = ContentHub.knownSourcesForType(ContentType.Pictures);
164 * }
165 * ListView {
166 * anchors.fill: parent
167 * height: childrenRect.height
168 * model: peers
169 * delegate: ListItem.Standard {
170 * text: modelData.name
171 * }
172 * }
173 * }
174 * \endqml
152 */175 */
153QVariantList ContentHub::knownSourcesForType(int type)176QVariantList ContentHub::knownSourcesForType(int type)
154{177{
155178
=== modified file 'import/Ubuntu/Content/contenthubplugin.cpp'
--- import/Ubuntu/Content/contenthubplugin.cpp 2013-10-21 16:36:02 +0000
+++ import/Ubuntu/Content/contenthubplugin.cpp 2013-11-08 21:19:44 +0000
@@ -52,8 +52,8 @@
5252
53 qmlRegisterSingletonType<ContentHub>(uri, versionMajor, versionMinor, "ContentHub", qml_content_hub);53 qmlRegisterSingletonType<ContentHub>(uri, versionMajor, versionMinor, "ContentHub", qml_content_hub);
54 qmlRegisterType<ContentItem>(uri, versionMajor, versionMinor, "ContentItem");54 qmlRegisterType<ContentItem>(uri, versionMajor, versionMinor, "ContentItem");
55 qmlRegisterType<ContentPeer>(uri, versionMajor, versionMinor, "ContentPeer");
55 qmlRegisterUncreatableType<ContentStore>(uri, versionMajor, versionMinor, "ContentStore", "created by hub");56 qmlRegisterUncreatableType<ContentStore>(uri, versionMajor, versionMinor, "ContentStore", "created by hub");
56 qmlRegisterUncreatableType<ContentPeer>(uri, versionMajor, versionMinor, "ContentPeer", "created by hub");
57 qmlRegisterUncreatableType<ContentTransfer>(uri, versionMajor, versionMinor, "ContentTransfer", "created by hub");57 qmlRegisterUncreatableType<ContentTransfer>(uri, versionMajor, versionMinor, "ContentTransfer", "created by hub");
58 qmlRegisterUncreatableType<ContentType>(uri, versionMajor, versionMinor, "ContentType", "Use only the type");58 qmlRegisterUncreatableType<ContentType>(uri, versionMajor, versionMinor, "ContentType", "Use only the type");
59}59}

Subscribers

People subscribed via source and target branches