Merge lp:~ahayzen/music-app/remix-card-view-perf-001 into lp:music-app/remix

Proposed by Andrew Hayzen
Status: Merged
Approved by: Victor Thompson
Approved revision: 706
Merged at revision: 712
Proposed branch: lp:~ahayzen/music-app/remix-card-view-perf-001
Merge into: lp:music-app/remix
Diff against target: 408 lines (+161/-112)
7 files modified
MusicNowPlaying.qml (+8/-0)
MusicTracks.qml (+8/-0)
common/CardView.qml (+8/-0)
common/ListItemWithActions.qml (+129/-109)
common/MusicRow.qml (+0/-1)
common/SongsPage.qml (+8/-0)
music-app.qml (+0/-2)
To merge this branch: bzr merge lp:~ahayzen/music-app/remix-card-view-perf-001
Reviewer Review Type Date Requested Status
Victor Thompson Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+239516@code.launchpad.net

Commit message

* Performance tweaks
* Change scrolling behaviour
* Tweaks to ListItemWithActions.qml

Description of the change

* Performance tweaks
* Change scrolling behaviour
* Tweaks to ListItemWithActions.qml

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Victor Thompson (vthompson) wrote :

A few questions and things to fix:

1. Will your changes sill allow the Recent table in the database to be created in time in all cases? It appears as though the use of isRecentEmpty() in the MainView Component.onCompleted should still allow this to work, but we should verify that there are no cases that this wont work.

2. When I "Tap to shuffle music" there seems to be an issue with the queue or player not working. The duration is 0:00 and the song will not play. Also, any song selected in the queue will not work.

review: Needs Fixing
Revision history for this message
Victor Thompson (vthompson) wrote :

Also, it will need the fix so the empty playlists page is shown in the proper tab. Right now it is shown in the Songs tab when there are no playlists. Perhaps we should look into landing the remember-queue MP? It should be working.

701. By Andrew Hayzen

* Run createRecent() from Component.onCompleted

Revision history for this message
Andrew Hayzen (ahayzen) wrote :

1) Changed to ensure that the createRecent() is always run
2) Wasn't able to reproduce?
3) I agree this should land after the remember mp

Revision history for this message
Victor Thompson (vthompson) wrote :

I think #2 was a glitch in how I was adding files. Files were in the mediascanner db but did not exist at the time on the device. Disregard.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
702. By Andrew Hayzen

* Merge of lp:music-app/remix

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
703. By Andrew Hayzen

* Merge of lp:music-app/remix

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
704. By Andrew Hayzen

* Merge of lp:music-app/remix

705. By Andrew Hayzen

* Merge of lp:music-app/remix

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
706. By Andrew Hayzen

* Merge of lp:music-app/remix

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Victor Thompson (vthompson) wrote :

LGTM!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'MusicNowPlaying.qml'
2--- MusicNowPlaying.qml 2014-10-28 00:57:09 +0000
3+++ MusicNowPlaying.qml 2014-10-28 04:28:44 +0000
4@@ -573,6 +573,14 @@
5 }
6 }
7
8+ Component.onCompleted: {
9+ // FIXME: workaround for qtubuntu not returning values depending on the grid unit definition
10+ // for Flickable.maximumFlickVelocity and Flickable.flickDeceleration
11+ var scaleFactor = units.gridUnit / 8;
12+ maximumFlickVelocity = maximumFlickVelocity * scaleFactor;
13+ flickDeceleration = flickDeceleration * scaleFactor;
14+ }
15+
16 Component {
17 id: queueDelegate
18 ListItemWithActions {
19
20=== modified file 'MusicTracks.qml'
21--- MusicTracks.qml 2014-10-28 00:00:26 +0000
22+++ MusicTracks.qml 2014-10-28 04:28:44 +0000
23@@ -119,6 +119,14 @@
24 sort.order: Qt.AscendingOrder
25 }
26
27+ Component.onCompleted: {
28+ // FIXME: workaround for qtubuntu not returning values depending on the grid unit definition
29+ // for Flickable.maximumFlickVelocity and Flickable.flickDeceleration
30+ var scaleFactor = units.gridUnit / 8;
31+ maximumFlickVelocity = maximumFlickVelocity * scaleFactor;
32+ flickDeceleration = flickDeceleration * scaleFactor;
33+ }
34+
35 // Requirements for ListItemWithActions
36 property var selectedItems: []
37
38
39=== modified file 'common/CardView.qml'
40--- common/CardView.qml 2014-10-27 22:32:47 +0000
41+++ common/CardView.qml 2014-10-28 04:28:44 +0000
42@@ -65,4 +65,12 @@
43 columns: parseInt(width / itemWidth)
44 }
45 }
46+
47+ Component.onCompleted: {
48+ // FIXME: workaround for qtubuntu not returning values depending on the grid unit definition
49+ // for Flickable.maximumFlickVelocity and Flickable.flickDeceleration
50+ var scaleFactor = units.gridUnit / 8;
51+ maximumFlickVelocity = maximumFlickVelocity * scaleFactor;
52+ flickDeceleration = flickDeceleration * scaleFactor;
53+ }
54 }
55
56=== modified file 'common/ListItemWithActions.qml'
57--- common/ListItemWithActions.qml 2014-10-22 19:47:39 +0000
58+++ common/ListItemWithActions.qml 2014-10-28 04:28:44 +0000
59@@ -98,7 +98,7 @@
60 }
61
62 for (var j=0; j < main.children.length; j++) {
63- main.children[j].anchors.rightMargin = reorderable && selectionMode ? actionReorder.width + units.gu(2) : 0
64+ main.children[j].anchors.rightMargin = reorderable && selectionMode ? actionReorderLoader.width + units.gu(2) : 0
65 }
66
67 parent.parent.state = selectionMode ? "multiselectable" : "normal"
68@@ -151,7 +151,7 @@
69 updatePosition(finalX)
70
71 if (leftSideAction !== null) { // CUSTOM
72- leftActionIcon.primed = main.x > (finalX * root.threshold)
73+ leftActionViewLoader.item.primed = main.x > (finalX * root.threshold)
74 }
75 }
76
77@@ -176,7 +176,7 @@
78
79 function getActionAt(point)
80 {
81- if (contains(leftActionView, point, 0)) {
82+ if (leftSideAction && contains(leftActionViewLoader.item, point, 0)) {
83 return leftSideAction
84 } else if (contains(rightActionsView, point, 0)) {
85 var newPoint = root.mapToItem(rightActionsView, point.x, point.y)
86@@ -211,7 +211,7 @@
87 function resetPrimed() // CUSTOM
88 {
89 if (leftSideAction !== null) {
90- leftActionIcon.primed = false
91+ leftActionViewLoader.item.primed = false
92 }
93
94 for (var j=0; j < rightSideActions.length; j++) {
95@@ -339,31 +339,41 @@
96 height: defaultHeight
97 //clip: height !== defaultHeight // CUSTOM
98
99- Rectangle {
100- id: leftActionView
101-
102+ Loader { // CUSTOM
103+ id: leftActionViewLoader
104 anchors {
105 top: parent.top
106 bottom: parent.bottom
107 right: main.left
108 }
109- width: root.leftActionWidth + actionThreshold
110- visible: leftSideAction
111- color: UbuntuColors.red
112-
113- Icon {
114- id: leftActionIcon
115- anchors {
116- centerIn: parent
117- horizontalCenterOffset: actionThreshold / 2
118+ asynchronous: true
119+ sourceComponent: leftSideAction ? leftActionViewComponent : undefined
120+ }
121+
122+ Component { // CUSTOM
123+ id: leftActionViewComponent
124+
125+ Rectangle {
126+ id: leftActionView
127+ width: root.leftActionWidth + actionThreshold
128+ color: UbuntuColors.red
129+
130+ property alias primed: leftActionIcon.primed // CUSTOM
131+
132+ Icon {
133+ id: leftActionIcon
134+ anchors {
135+ centerIn: parent
136+ horizontalCenterOffset: actionThreshold / 2
137+ }
138+ objectName: "swipeDeleteAction" // CUSTOM
139+ name: leftSideAction && _showActions ? leftSideAction.iconName : ""
140+ color: Theme.palette.selected.field
141+ height: units.gu(3)
142+ width: units.gu(3)
143+
144+ property bool primed: false // CUSTOM
145 }
146- objectName: "swipeDeleteAction" // CUSTOM
147- name: leftSideAction && _showActions ? leftSideAction.iconName : ""
148- color: Theme.palette.selected.field
149- height: units.gu(3)
150- width: units.gu(3)
151-
152- property bool primed: false // CUSTOM
153 }
154 }
155
156@@ -374,7 +384,7 @@
157 anchors {
158 top: main.top
159 left: main.right
160- leftMargin: reordering ? actionReorder.width : units.gu(1) // CUSTOM
161+ leftMargin: reordering ? actionReorder.width : 0 // CUSTOM
162 bottom: main.bottom
163 }
164 visible: _visibleRightSideActions.length > 0
165@@ -487,96 +497,106 @@
166 }
167
168 /* CUSTOM Reorder Component */
169- Item {
170- id: actionReorder
171+ Loader {
172+ id: actionReorderLoader
173 anchors {
174 bottom: parent.bottom
175 right: main.right
176 rightMargin: units.gu(1)
177 top: parent.top
178 }
179- width: units.gu(4)
180- visible: reorderable && selectionMode && root.parent.parent.selectedItems.length === 0
181-
182- Icon {
183- anchors {
184- horizontalCenter: parent.horizontalCenter
185- verticalCenter: parent.verticalCenter
186- }
187- name: "navigation-menu" // TODO: use proper image
188- height: width
189- width: units.gu(3)
190- }
191-
192- MouseArea {
193- id: actionReorderMouseArea
194- anchors {
195- fill: parent
196- }
197- property int startY: 0
198- property int startContentY: 0
199-
200- onPressed: {
201- root.parent.parent.interactive = false; // stop scrolling of listview
202- startY = root.y;
203- startContentY = root.parent.parent.contentY;
204- root.z += 10; // force ontop of other elements
205-
206- console.debug("Reorder listitem pressed", root.y)
207- }
208- onMouseYChanged: root.y += mouse.y - (root.height / 2);
209- onReleased: {
210- console.debug("Reorder diff by position", getDiff());
211-
212- var diff = getDiff();
213-
214- // Remove the height of the actual item if moved down
215- if (diff > 0) {
216- diff -= 1;
217- }
218-
219- root.parent.parent.interactive = true; // reenable scrolling
220-
221- if (diff === 0) {
222- // Nothing has changed so reset the item
223- // z index is restored after animation
224- resetListItemYAnimation.start();
225- }
226- else {
227- var newIndex = index + diff;
228-
229- if (newIndex < 0) {
230- newIndex = 0;
231- }
232- else if (newIndex > root.parent.parent.count - 1) {
233- newIndex = root.parent.parent.count - 1;
234- }
235-
236- root.z -= 10; // restore z index
237- reorder(index, newIndex)
238- }
239- }
240-
241- function getDiff() {
242- // Get the amount of items that have been passed over (by centre)
243- return Math.round((((root.y - startY) + (root.parent.parent.contentY - startContentY)) / root.height) + 0.5);
244- }
245- }
246-
247- SequentialAnimation {
248- id: resetListItemYAnimation
249- UbuntuNumberAnimation {
250- target: root;
251- property: "y";
252- to: actionReorderMouseArea.startY
253- }
254- ScriptAction {
255- script: {
256- root.z -= 10; // restore z index
257- }
258- }
259- }
260- }
261+ asynchronous: true
262+ sourceComponent: reordering ? actionReorderComponent : undefined
263+ }
264+
265+ Component {
266+ id: actionReorderComponent
267+ Item {
268+ id: actionReorder
269+ width: units.gu(4)
270+ visible: reorderable && selectionMode && root.parent.parent.selectedItems.length === 0
271+
272+ Icon {
273+ anchors {
274+ horizontalCenter: parent.horizontalCenter
275+ verticalCenter: parent.verticalCenter
276+ }
277+ name: "navigation-menu" // TODO: use proper image
278+ height: width
279+ width: units.gu(3)
280+ }
281+
282+ MouseArea {
283+ id: actionReorderMouseArea
284+ anchors {
285+ fill: parent
286+ }
287+ property int startY: 0
288+ property int startContentY: 0
289+
290+ onPressed: {
291+ root.parent.parent.interactive = false; // stop scrolling of listview
292+ startY = root.y;
293+ startContentY = root.parent.parent.contentY;
294+ root.z += 10; // force ontop of other elements
295+
296+ console.debug("Reorder listitem pressed", root.y)
297+ }
298+ onMouseYChanged: root.y += mouse.y - (root.height / 2);
299+ onReleased: {
300+ console.debug("Reorder diff by position", getDiff());
301+
302+ var diff = getDiff();
303+
304+ // Remove the height of the actual item if moved down
305+ if (diff > 0) {
306+ diff -= 1;
307+ }
308+
309+ root.parent.parent.interactive = true; // reenable scrolling
310+
311+ if (diff === 0) {
312+ // Nothing has changed so reset the item
313+ // z index is restored after animation
314+ resetListItemYAnimation.start();
315+ }
316+ else {
317+ var newIndex = index + diff;
318+
319+ if (newIndex < 0) {
320+ newIndex = 0;
321+ }
322+ else if (newIndex > root.parent.parent.count - 1) {
323+ newIndex = root.parent.parent.count - 1;
324+ }
325+
326+ root.z -= 10; // restore z index
327+ reorder(index, newIndex)
328+ }
329+ }
330+
331+ function getDiff() {
332+ // Get the amount of items that have been passed over (by centre)
333+ return Math.round((((root.y - startY) + (root.parent.parent.contentY - startContentY)) / root.height) + 0.5);
334+ }
335+ }
336+
337+ SequentialAnimation {
338+ id: resetListItemYAnimation
339+ UbuntuNumberAnimation {
340+ target: root;
341+ property: "y";
342+ to: actionReorderMouseArea.startY
343+ }
344+ ScriptAction {
345+ script: {
346+ root.z -= 10; // restore z index
347+ }
348+ }
349+ }
350+ }
351+ }
352+
353
354 SequentialAnimation {
355 id: triggerAction
356@@ -641,7 +661,7 @@
357 target: locked ? null : main
358 axis: Drag.XAxis
359 minimumX: rightActionsView.visible ? -(rightActionsView.width) : 0
360- maximumX: leftActionView.visible ? leftActionView.width : 0
361+ maximumX: leftSideAction ? leftActionViewLoader.item.width : 0
362 threshold: root.actionThreshold
363 }
364
365
366=== modified file 'common/MusicRow.qml'
367--- common/MusicRow.qml 2014-10-22 19:47:39 +0000
368+++ common/MusicRow.qml 2014-10-28 04:28:44 +0000
369@@ -66,7 +66,6 @@
370 anchors {
371 verticalCenter: parent.verticalCenter
372 }
373- asynchronous: true
374 width: imageSource === undefined ? parent.width - parent.spacing
375 : parent.width - image.width - parent.spacing
376
377
378=== modified file 'common/SongsPage.qml'
379--- common/SongsPage.qml 2014-10-28 02:07:49 +0000
380+++ common/SongsPage.qml 2014-10-28 04:28:44 +0000
381@@ -214,6 +214,14 @@
382 }
383 }
384
385+ Component.onCompleted: {
386+ // FIXME: workaround for qtubuntu not returning values depending on the grid unit definition
387+ // for Flickable.maximumFlickVelocity and Flickable.flickDeceleration
388+ var scaleFactor = units.gridUnit / 8;
389+ maximumFlickVelocity = maximumFlickVelocity * scaleFactor;
390+ flickDeceleration = flickDeceleration * scaleFactor;
391+ }
392+
393 header: BlurredHeader {
394 rightColumn: Column {
395 spacing: units.gu(2)
396
397=== modified file 'music-app.qml'
398--- music-app.qml 2014-10-28 03:39:35 +0000
399+++ music-app.qml 2014-10-28 04:28:44 +0000
400@@ -551,8 +551,6 @@
401 customdebug("Version "+appVersion) // print the curren version
402 customdebug("Arguments on startup: Debug: "+args.values.debug)
403
404- customdebug("Arguments on startup: Debug: "+args.values.debug+ " and file: ")
405-
406 Library.createRecent() // initialize recent
407
408 // initialize playlists

Subscribers

People subscribed via source and target branches