Merge lp:~ahayzen/music-app/columnflow-fixes-and-preloading-support into lp:music-app/remix

Proposed by Andrew Hayzen
Status: Merged
Approved by: Victor Thompson
Approved revision: 863
Merged at revision: 863
Proposed branch: lp:~ahayzen/music-app/columnflow-fixes-and-preloading-support
Merge into: lp:music-app/remix
Diff against target: 67 lines (+21/-3)
1 file modified
common/ColumnFlow.qml (+21/-3)
To merge this branch: bzr merge lp:~ahayzen/music-app/columnflow-fixes-and-preloading-support
Reviewer Review Type Date Requested Status
Victor Thompson Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+258103@code.launchpad.net

Commit message

* Fixes and add preloading compatibility to ColumnFlow.qml

Description of the change

* Fixes and add preloading compatibility to ColumnFlow.qml

Preloading is disable for now until we load the pages in async and the thumbnailer is fast enough :)

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 :

lgtm!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'common/ColumnFlow.qml'
2--- common/ColumnFlow.qml 2015-01-11 17:40:13 +0000
3+++ common/ColumnFlow.qml 2015-05-02 17:50:36 +0000
4@@ -40,6 +40,8 @@
5 property bool removing: false
6 property bool restoring: false // is the view restoring?
7 property var restoreItems: ({}) // when rebuilding items are stored here temporarily
8+ // Disable preloading for now until async loading of pages is implemented
9+ property bool preloading: true // when visible has only been false allow loading (as no child objects [eg pages] can have been created on the fly)
10
11 onColumnWidthChanged: {
12 if (restoring) {
13@@ -62,6 +64,10 @@
14 }
15
16 onVisibleChanged: {
17+ if (visible) {
18+ preloading = false;
19+ }
20+
21 if (visible && delayRebuildIndex !== -1) { // restore from count change
22 if (delayRebuildIndex === 0) {
23 reset()
24@@ -86,7 +92,7 @@
25 Connections {
26 target: model === undefined ? fakeModel : model
27 onModelReset: {
28- if (!visible) {
29+ if (!visible && lastIndex > 0 && !preloading) {
30 delayRebuildIndex = 0
31 } else {
32 reset()
33@@ -94,7 +100,7 @@
34 }
35 }
36 onRowsInserted: {
37- if (!visible) {
38+ if (!visible && lastIndex > 0 && !preloading) {
39 setDelayRebuildIndex(first)
40 } else {
41 if (first <= lastIndex) {
42@@ -161,7 +167,8 @@
43 // and
44 // allow if the y position is within the viewport
45 // or if loadBefore is true then allow if the y position is before the viewport
46- if (((count > 0 && lastIndex < count && insertMax === undefined) || (insertMax !== undefined && lastIndex <= insertMax)) && (inViewport(y, 0) || (loadBefore === true && beforeViewport(y)))) {
47+ if (((count > 0 && lastIndex < count && insertMax === undefined) || (insertMax !== undefined && lastIndex <= insertMax))
48+ && (inViewport(y, 0) || (loadBefore === true && beforeViewport(y)))) {
49 incubateObject(lastIndex++, columnsByHeight[i], getMaxInColumn(columnsByHeight[i]), append);
50 workDone = true
51 } else {
52@@ -489,4 +496,15 @@
53 delayRebuildIndex = index
54 }
55 }
56+
57+ Component.onCompleted: {
58+ // Ensure that initial column vars are set
59+ for (var j=0; j < columns; j++) {
60+ columnHeights.push({})
61+ }
62+
63+ cacheColumnHeights()
64+
65+ append(true)
66+ }
67 }

Subscribers

People subscribed via source and target branches