Merge lp:~michael-sheldon/content-hub/loader-fixes into lp:content-hub

Proposed by Michael Sheldon
Status: Merged
Approved by: Ken VanDine
Approved revision: 149
Merged at revision: 85
Proposed branch: lp:~michael-sheldon/content-hub/loader-fixes
Merge into: lp:content-hub
Prerequisite: lp:~ken-vandine/content-hub/no_unknown
Diff against target: 141 lines (+52/-21)
2 files modified
import/Ubuntu/Content/ContentPeerPicker.qml (+39/-10)
import/Ubuntu/Content/contentpeermodel.cpp (+13/-11)
To merge this branch: bzr merge lp:~michael-sheldon/content-hub/loader-fixes
Reviewer Review Type Date Requested Status
Ken VanDine Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+212406@code.launchpad.net

Commit message

Fixes updating of the ContentPeerModel when using Loader and changing ContentType or ContentHandler dynamically and ensures that ContentPeerModel Loader doesn't begin loading the model until the peer picker becomes visible (avoiding delaying app start-up time).

Description of the change

Fixes updating of the ContentPeerModel when using Loader and changing ContentType or ContentHandler dynamically and ensures that ContentPeerModel Loader doesn't begin loading the model until the peer picker becomes visible (avoiding delaying app start-up time).

To post a comment you must log in.
Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

Are there any related MPs required for this MP to build/function as expected? Please list.

 * The following MRs are required to make the Gallery, Address Book and System Settings apps compatible with the new API:

 https://code.launchpad.net/~ken-vandine/gallery-app/content_hub/+merge/211091
 https://code.launchpad.net/~michael-sheldon/address-book-app/new-content-hub-api/+merge/211093
 https://code.launchpad.net/~ken-vandine/ubuntu-system-settings/content_hub_qml_api_changes/+merge/211094

Is your branch in sync with latest trunk (e.g. bzr pull lp:trunk -> no changes)

 * Yes

Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator?

 * Yes

Did you successfully run all tests found in your component's Test Plan (https://wiki.ubuntu.com/Process/Merges/TestPlan/content-hub) on device or emulator?

 * Yes

If you changed the UI, was the change specified/approved by design?

 * No change

If you changed the packaging (debian), did you subscribe a core-dev to this MP?

 * No change

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
147. By Michael Sheldon

Merge from trunk

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ken VanDine (ken-vandine) wrote :

I'm not sure why, testing with my hub-importer, hub-exporter and hub-share test apps I'm seeing each source listed twice in the ContentPeerPicker. But only sources, I'm only seeing destinations and share handlers once.

For example, hub-importer shows 2 entries for Gallery and Hub Exporter. hub-exporter only shows hub-importer and hub-share once in ContentPeerPicker.

148. By Michael Sheldon

Process findPeers immediately upon component completion, rather than adding it to the end of the event queue

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ken VanDine (ken-vandine) wrote :

Great, commit 148 fixed the dupe issue.

Revision history for this message
Ken VanDine (ken-vandine) wrote :

The change to the title, adding "Export to", perhaps "Open with" might be better?

review: Needs Information
149. By Michael Sheldon

Change 'Export to' header to 'Open with'

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ken VanDine (ken-vandine) wrote :

Looks great!

review: Approve
Revision history for this message
Ken VanDine (ken-vandine) wrote :

Did you perform an exploratory manual test run of the code change and any related functionality on device or emulator?

 * Yes

Did CI run pass? If not, please explain why.

 * Yes

Have you checked that submitter has accurately filled out the submitter checklist and has taken no shortcut?

 * Yes

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'import/Ubuntu/Content/ContentPeerPicker.qml'
2--- import/Ubuntu/Content/ContentPeerPicker.qml 2014-03-20 13:04:57 +0000
3+++ import/Ubuntu/Content/ContentPeerPicker.qml 2014-03-26 13:47:51 +0000
4@@ -68,6 +68,8 @@
5 */
6 property var customPeerModelLoader
7
8+ property var completed: false
9+
10 /*! \qmlsignal peerSelected
11 \brief Emitted when a user selects a peer.
12
13@@ -88,26 +90,53 @@
14
15 Header {
16 id: header
17- title: (handler === ContentHandler.Source) ? i18n.tr("Choose from") : i18n.tr("Share to")
18+ title: (handler === ContentHandler.Source) ? i18n.tr("Choose from") : (handler === ContentHandler.Destination ? i18n.tr("Open with") : i18n.tr("Share to"))
19 }
20
21 Loader {
22 id: peerModelLoader
23 active: false
24- sourceComponent: ContentPeerModel {
25- id: peerModel
26- }
27+ sourceComponent: ContentPeerModel { }
28 onLoaded: {
29- item.handler = root.handler
30- item.contentType = root.contentType
31+ item.handler = root.handler;
32+ item.contentType = root.contentType;
33 }
34 }
35
36 Component.onCompleted: {
37- if(customPeerModelLoader) {
38- customPeerModelLoader.active = true;
39- } else {
40- peerModelLoader.active = true;
41+ if (root.visible) {
42+ if (customPeerModelLoader) {
43+ customPeerModelLoader.active = true;
44+ } else {
45+ peerModelLoader.active = true;
46+ }
47+ }
48+ completed = true;
49+ }
50+
51+ onVisibleChanged: {
52+ if (completed) {
53+ if (customPeerModelLoader) {
54+ customPeerModelLoader.active = true;
55+ } else {
56+ peerModelLoader.active = true;
57+ }
58+ }
59+ }
60+
61+ onHandlerChanged: {
62+ if (!customPeerModelLoader && peerModelLoader.item) {
63+ appPeers.model = undefined; // Clear grid view
64+ peerModelLoader.item.handler = root.handler;
65+ appPeers.model = peerModelLoader.item.peers;
66+ }
67+ }
68+
69+ onContentTypeChanged: {
70+ if (!customPeerModelLoader && peerModelLoader.item) {
71+ appPeers.model = undefined; // Clear grid view
72+ peerModelLoader.item.contentType = root.contentType;
73+ appPeers.model = peerModelLoader.item.peers;
74 }
75 }
76
77
78=== modified file 'import/Ubuntu/Content/contentpeermodel.cpp'
79--- import/Ubuntu/Content/contentpeermodel.cpp 2014-03-20 23:44:21 +0000
80+++ import/Ubuntu/Content/contentpeermodel.cpp 2014-03-26 13:47:51 +0000
81@@ -58,7 +58,7 @@
82 void ContentPeerModel::componentComplete()
83 {
84 m_complete = true;
85- QTimer::singleShot(0, this, SLOT(findPeers()));
86+ findPeers();
87 }
88
89 /*!
90@@ -79,11 +79,13 @@
91 void ContentPeerModel::setContentType(ContentType::Type contentType)
92 {
93 TRACE() << Q_FUNC_INFO;
94- m_contentType = contentType;
95- if (m_complete) {
96- findPeers();
97+ if (m_contentType != contentType) {
98+ m_contentType = contentType;
99+ if (m_complete) {
100+ findPeers();
101+ }
102+ Q_EMIT contentTypeChanged();
103 }
104- Q_EMIT contentTypeChanged();
105 }
106
107 /*!
108@@ -95,7 +97,6 @@
109 m_peers.clear();
110 QCoreApplication::processEvents();
111 if(m_contentType == ContentType::All) {
112- appendPeersForContentType(ContentType::Unknown);
113 appendPeersForContentType(ContentType::Documents);
114 appendPeersForContentType(ContentType::Pictures);
115 appendPeersForContentType(ContentType::Music);
116@@ -139,7 +140,6 @@
117 }
118 Q_EMIT peersChanged();
119 }
120- QCoreApplication::processEvents();
121 }
122 }
123
124@@ -161,11 +161,13 @@
125 void ContentPeerModel::setHandler(ContentHandler::Handler handler)
126 {
127 TRACE() << Q_FUNC_INFO;
128- m_handler = handler;
129- if (m_complete) {
130- findPeers();
131+ if (m_handler != handler) {
132+ m_handler = handler;
133+ if (m_complete) {
134+ findPeers();
135+ }
136+ Q_EMIT handlerChanged();
137 }
138- Q_EMIT handlerChanged();
139 }
140
141 /*!

Subscribers

People subscribed via source and target branches