Merge lp:~ahayzen/music-app/toolbar-refactor into lp:music-app/remix

Proposed by Andrew Hayzen
Status: Rejected
Rejected by: Andrew Hayzen
Proposed branch: lp:~ahayzen/music-app/toolbar-refactor
Merge into: lp:music-app/remix
Diff against target: 818 lines (+321/-344)
6 files modified
MusicToolbar.qml (+244/-313)
MusicaddtoPlaylist.qml (+1/-1)
common/AlbumsPage.qml (+1/-1)
common/MusicPage.qml (+2/-2)
common/SongsPage.qml (+2/-2)
music-app.qml (+71/-25)
To merge this branch: bzr merge lp:~ahayzen/music-app/toolbar-refactor
Reviewer Review Type Date Requested Status
Victor Thompson Needs Information
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+247208@code.launchpad.net

Commit message

* Refactor MusicToolbar.qml to remove legacy code
* Move pagestack helpers into mainPageStack

Description of the change

* Refactor MusicToolbar.qml to remove legacy code
* Move pagestack helpers into mainPageStack

This removes the use of Panel (which we don't use anymore), removes various properties that aren't needed. The helpers inside the toolbar have been moved to mainPageStack and anything todo with the pagestack now uses mainPageStack instead of musicToolbar.

This greatly simplifies the toolbar and was started as very early prep work for bottom edge.

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 :

2 inline comments.

Also, I notice that if you pause a song and go to the Queue, the progress indicator isn't shown until you play the song again.

I still need to review further.

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

Actually, that last thing is a bug in the current app as well.

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

I proposed a separate fix for the issue I had mentioned [1]

1 - https://code.launchpad.net/~vthompson/music-app/fix-queue-progress-hint/+merge/247383

803. By Andrew Hayzen

* Use styleMusic for the background colour
* Change property for workaround name

804. By Andrew Hayzen

* Merge of trunk

805. By Andrew Hayzen

* Load the toolbar in async

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
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Victor Thompson (vthompson) wrote :

So far I haven't found anything that might cause a regression. However, should we target this for a separate 'refactor' series and merge back in to trunk as necessary?

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

Agreed, i'll rebase it against the other series.

Unmerged revisions

808. By Andrew Hayzen

* Change actualCurrentPage to currentMusicPage

807. By Andrew Hayzen

* Merge of trunk

806. By Andrew Hayzen

* Merge of trunk

805. By Andrew Hayzen

* Load the toolbar in async

804. By Andrew Hayzen

* Merge of trunk

803. By Andrew Hayzen

* Use styleMusic for the background colour
* Change property for workaround name

802. By Andrew Hayzen

* Refactor MusicToolbar.qml to remove legacy code
* Move pagestack helpers into mainPageStack

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'MusicToolbar.qml'
2--- MusicToolbar.qml 2015-01-23 07:22:52 +0000
3+++ MusicToolbar.qml 2015-01-23 13:45:46 +0000
4@@ -18,335 +18,266 @@
5 */
6
7 import QtQuick 2.3
8-import QtQuick.LocalStorage 2.0
9 import QtMultimedia 5.0
10 import Ubuntu.Components 1.1
11-import Ubuntu.Components.Popups 1.0
12 import "common"
13
14-Item {
15+Rectangle {
16 anchors {
17 bottom: parent.bottom
18 left: parent.left
19 right: parent.right
20 }
21-
22- // Properties storing the current page info
23- property var currentPage: null
24- property var currentTab: null
25-
26- // Properties and signals for the toolbar
27- property alias currentHeight: musicToolbarPanel.height
28- property alias opened: musicToolbarPanel.opened
29-
30- property bool popping: false
31-
32- /* Helper functions */
33-
34- // Back button has been pressed, jump up pageStack or back to parent page
35- function goBack()
36- {
37- if (mainPageStack !== null && mainPageStack.depth > 1) {
38- mainPageStack.pop(currentPage)
39- }
40- }
41-
42- // Pop a specific page in the stack
43- function popPage(page)
44- {
45- var tmpPages = []
46-
47- popping = true
48-
49- while (mainPageStack.currentPage !== page && mainPageStack.depth > 0) {
50- tmpPages.push(mainPageStack.currentPage)
51- mainPageStack.pop()
52- }
53-
54- if (mainPageStack.depth > 0) {
55- mainPageStack.pop()
56- }
57-
58- for (var i=tmpPages.length - 1; i > -1; i--) {
59- mainPageStack.push(tmpPages[i])
60- }
61-
62- popping = false
63- }
64-
65- // Set the current page, and any parent/stacks
66- function setPage(childPage)
67- {
68- if (!popping) {
69- currentPage = childPage;
70- }
71- }
72-
73- Panel {
74- id: musicToolbarPanel
75+ color: styleMusic.common.black
76+ height: units.gu(7.25)
77+ objectName: "musicToolbarObject"
78+
79+ // Hack for autopilot otherwise MusicToolbar appears as QQuickRectangle
80+ // due to bug 1341671 it is required that there is a property so that
81+ // qml doesn't optimise using the parent type
82+ property bool bug1341671workaround: true
83+
84+ /* Toolbar controls */
85+ Item {
86+ id: toolbarControls
87 anchors {
88- left: parent.left
89- right: parent.right
90- bottom: parent.bottom
91- }
92- height: units.gu(7.25)
93- locked: true
94- opened: true
95-
96- /* Expanded toolbar */
97- Item {
98- id: musicToolbarExpandedContainer
99- anchors {
100- fill: parent
101- }
102+ fill: parent
103+ }
104+ state: trackQueue.model.count === 0 ? "disabled" : "enabled"
105+ states: [
106+ State {
107+ name: "disabled"
108+ PropertyChanges {
109+ target: disabledPlayerControlsGroup
110+ visible: true
111+ }
112+ PropertyChanges {
113+ target: enabledPlayerControlsGroup
114+ visible: false
115+ }
116+ },
117+ State {
118+ name: "enabled"
119+ PropertyChanges {
120+ target: disabledPlayerControlsGroup
121+ visible: false
122+ }
123+ PropertyChanges {
124+ target: enabledPlayerControlsGroup
125+ visible: true
126+ }
127+ }
128+ ]
129+
130+ /* Disabled (empty state) controls */
131+ Item {
132+ id: disabledPlayerControlsGroup
133+ anchors {
134+ bottom: playerControlsProgressBar.top
135+ left: parent.left
136+ right: parent.right
137+ top: parent.top
138+ }
139+
140+ Label {
141+ id: noSongsInQueueLabel
142+ anchors {
143+ left: parent.left
144+ leftMargin: units.gu(2)
145+ right: disabledPlayerControlsPlayButton.left
146+ rightMargin: units.gu(2)
147+ verticalCenter: parent.verticalCenter
148+ }
149+ color: styleMusic.playerControls.labelColor
150+ text: i18n.tr("Tap to shuffle music")
151+ fontSize: "large"
152+ visible: !emptyPage.noMusic
153+ wrapMode: Text.WordWrap
154+ maximumLineCount: 2
155+ }
156+
157+ /* Play/Pause button */
158+ Icon {
159+ id: disabledPlayerControlsPlayButton
160+ anchors {
161+ right: parent.right
162+ rightMargin: units.gu(3)
163+ verticalCenter: parent.verticalCenter
164+ }
165+ color: "#FFF"
166+ height: units.gu(2.5)
167+ name: player.playbackState === MediaPlayer.PlayingState ?
168+ "media-playback-pause" : "media-playback-start"
169+ objectName: "disabledSmallPlayShape"
170+ width: height
171+ }
172+
173+ /* Click to shuffle music */
174+ MouseArea {
175+ anchors {
176+ fill: parent
177+ }
178+ onClicked: {
179+ if (emptyPage.noMusic) {
180+ return;
181+ }
182+
183+ if (trackQueue.model.count === 0) {
184+ playRandomSong();
185+ }
186+ else {
187+ player.toggle();
188+ }
189+ }
190+ }
191+ }
192+
193+ /* Enabled (queue > 0) controls */
194+ Item {
195+ id: enabledPlayerControlsGroup
196+ anchors {
197+ bottom: playerControlsProgressBar.top
198+ left: parent.left
199+ right: parent.right
200+ top: parent.top
201+ }
202+
203+ /* Album art in player controls */
204+ CoverGrid {
205+ id: playerControlsImage
206+ anchors {
207+ bottom: parent.bottom
208+ left: parent.left
209+ top: parent.top
210+ }
211+ covers: [{art: player.currentMetaArt, author: player.currentMetaArtist, album: player.currentMetaArt}]
212+ size: parent.height
213+ }
214+
215+ /* Column of meta labels */
216+ Column {
217+ id: playerControlsLabels
218+ anchors {
219+ left: playerControlsImage.right
220+ leftMargin: units.gu(1.5)
221+ right: playerControlsPlayButton.left
222+ rightMargin: units.gu(1)
223+ verticalCenter: parent.verticalCenter
224+ }
225+
226+ /* Title of track */
227+ Label {
228+ id: playerControlsTitle
229+ anchors {
230+ left: parent.left
231+ right: parent.right
232+ }
233+ color: "#FFF"
234+ elide: Text.ElideRight
235+ fontSize: "small"
236+ font.weight: Font.DemiBold
237+ text: player.currentMetaTitle === ""
238+ ? player.source : player.currentMetaTitle
239+ }
240+
241+ /* Artist of track */
242+ Label {
243+ id: playerControlsArtist
244+ anchors {
245+ left: parent.left
246+ right: parent.right
247+ }
248+ color: "#FFF"
249+ elide: Text.ElideRight
250+ fontSize: "small"
251+ opacity: 0.4
252+ text: player.currentMetaArtist
253+ }
254+ }
255+
256+ /* Play/Pause button */
257+ Icon {
258+ id: playerControlsPlayButton
259+ anchors {
260+ right: parent.right
261+ rightMargin: units.gu(3)
262+ verticalCenter: parent.verticalCenter
263+ }
264+ color: "#FFF"
265+ height: units.gu(2.5)
266+ name: player.playbackState === MediaPlayer.PlayingState ?
267+ "media-playback-pause" : "media-playback-start"
268+ objectName: "playShape"
269+ width: height
270+ }
271+
272+ /* Mouse area to jump to now playing */
273+ MouseArea {
274+ anchors {
275+ fill: parent
276+ }
277+ objectName: "jumpNowPlaying"
278+
279+ onClicked: tabs.pushNowPlaying()
280+ }
281+
282+ /* Mouse area for the play button (ontop of the jump to now playing) */
283+ MouseArea {
284+ anchors {
285+ bottom: parent.bottom
286+ horizontalCenter: playerControlsPlayButton.horizontalCenter
287+ top: parent.top
288+ }
289+ onClicked: player.toggle()
290+ width: units.gu(8)
291+
292+ Rectangle {
293+ anchors {
294+ fill: parent
295+ }
296+ color: "#FFF"
297+ opacity: parent.pressed ? 0.1 : 0
298+
299+ Behavior on opacity {
300+ UbuntuNumberAnimation {
301+ duration: UbuntuAnimation.FastDuration
302+ }
303+ }
304+ }
305+ }
306+ }
307+
308+ /* Object which provides the progress bar when toolbar is minimized */
309+ Rectangle {
310+ id: playerControlsProgressBar
311+ anchors {
312+ bottom: parent.bottom
313+ left: parent.left
314+ right: parent.right
315+ }
316+ color: styleMusic.common.black
317+ height: units.gu(0.25)
318
319 Rectangle {
320- id: musicToolbarPlayerControls
321+ id: playerControlsProgressBarHint
322 anchors {
323- fill: parent
324- }
325- color: "#000"
326- state: trackQueue.model.count === 0 ? "disabled" : "enabled"
327- states: [
328- State {
329- name: "disabled"
330- PropertyChanges {
331- target: disabledPlayerControlsGroup
332- visible: true
333- }
334- PropertyChanges {
335- target: enabledPlayerControlsGroup
336- visible: false
337- }
338- },
339- State {
340- name: "enabled"
341- PropertyChanges {
342- target: disabledPlayerControlsGroup
343- visible: false
344- }
345- PropertyChanges {
346- target: enabledPlayerControlsGroup
347- visible: true
348- }
349- }
350- ]
351-
352- /* Disabled (empty state) controls */
353- Item {
354- id: disabledPlayerControlsGroup
355- anchors {
356- bottom: playerControlsProgressBar.top
357- left: parent.left
358- right: parent.right
359- top: parent.top
360- }
361-
362- Label {
363- id: noSongsInQueueLabel
364- anchors {
365- left: parent.left
366- leftMargin: units.gu(2)
367- right: disabledPlayerControlsPlayButton.left
368- rightMargin: units.gu(2)
369- verticalCenter: parent.verticalCenter
370- }
371- color: styleMusic.playerControls.labelColor
372- text: i18n.tr("Tap to shuffle music")
373- fontSize: "large"
374- visible: !emptyPage.noMusic
375- wrapMode: Text.WordWrap
376- maximumLineCount: 2
377- }
378-
379- /* Play/Pause button */
380- Icon {
381- id: disabledPlayerControlsPlayButton
382- anchors {
383- right: parent.right
384- rightMargin: units.gu(3)
385- verticalCenter: parent.verticalCenter
386- }
387- color: "#FFF"
388- height: units.gu(2.5)
389- name: player.playbackState === MediaPlayer.PlayingState ?
390- "media-playback-pause" : "media-playback-start"
391- objectName: "disabledSmallPlayShape"
392- width: height
393- }
394-
395- /* Click to shuffle music */
396- MouseArea {
397- anchors {
398- fill: parent
399- }
400- onClicked: {
401- if (emptyPage.noMusic) {
402- return;
403- }
404-
405- if (trackQueue.model.count === 0) {
406- playRandomSong();
407- }
408- else {
409- player.toggle();
410- }
411- }
412- }
413- }
414-
415- /* Enabled (queue > 0) controls */
416- Item {
417- id: enabledPlayerControlsGroup
418- anchors {
419- bottom: playerControlsProgressBar.top
420- left: parent.left
421- right: parent.right
422- top: parent.top
423- }
424-
425- /* Album art in player controls */
426- CoverGrid {
427- id: playerControlsImage
428- anchors {
429- bottom: parent.bottom
430- left: parent.left
431- top: parent.top
432- }
433- covers: [{art: player.currentMetaArt, author: player.currentMetaArtist, album: player.currentMetaArt}]
434- size: parent.height
435- }
436-
437- /* Column of meta labels */
438- Column {
439- id: playerControlsLabels
440- anchors {
441- left: playerControlsImage.right
442- leftMargin: units.gu(1.5)
443- right: playerControlsPlayButton.left
444- rightMargin: units.gu(1)
445- verticalCenter: parent.verticalCenter
446- }
447-
448- /* Title of track */
449- Label {
450- id: playerControlsTitle
451- anchors {
452- left: parent.left
453- right: parent.right
454- }
455- color: "#FFF"
456- elide: Text.ElideRight
457- fontSize: "small"
458- font.weight: Font.DemiBold
459- text: player.currentMetaTitle === ""
460- ? player.source : player.currentMetaTitle
461- }
462-
463- /* Artist of track */
464- Label {
465- id: playerControlsArtist
466- anchors {
467- left: parent.left
468- right: parent.right
469- }
470- color: "#FFF"
471- elide: Text.ElideRight
472- fontSize: "small"
473- opacity: 0.4
474- text: player.currentMetaArtist
475- }
476- }
477-
478- /* Play/Pause button */
479- Icon {
480- id: playerControlsPlayButton
481- anchors {
482- right: parent.right
483- rightMargin: units.gu(3)
484- verticalCenter: parent.verticalCenter
485- }
486- color: "#FFF"
487- height: units.gu(2.5)
488- name: player.playbackState === MediaPlayer.PlayingState ?
489- "media-playback-pause" : "media-playback-start"
490- objectName: "playShape"
491- width: height
492- }
493-
494- MouseArea {
495- anchors {
496- bottom: parent.bottom
497- horizontalCenter: playerControlsPlayButton.horizontalCenter
498- top: parent.top
499- }
500- onClicked: player.toggle()
501- width: units.gu(8)
502-
503- Rectangle {
504- anchors {
505- fill: parent
506- }
507- color: "#FFF"
508- opacity: parent.pressed ? 0.1 : 0
509-
510- Behavior on opacity {
511- UbuntuNumberAnimation {
512- duration: UbuntuAnimation.FastDuration
513- }
514- }
515- }
516- }
517-
518- /* Mouse area to jump to now playing */
519- Item {
520- anchors {
521- bottom: parent.bottom
522- left: parent.left
523- right: playerControlsLabels.right
524- top: parent.top
525- }
526- objectName: "jumpNowPlaying"
527- function trigger() {
528- tabs.pushNowPlaying();
529- }
530- }
531- }
532-
533- /* Object which provides the progress bar when toolbar is minimized */
534- Rectangle {
535- id: playerControlsProgressBar
536- anchors {
537- bottom: parent.bottom
538- left: parent.left
539- right: parent.right
540- }
541- color: styleMusic.common.black
542- height: units.gu(0.25)
543-
544- Rectangle {
545- id: playerControlsProgressBarHint
546- anchors {
547- left: parent.left
548- top: parent.top
549- }
550- color: UbuntuColors.blue
551- height: parent.height
552- width: player.duration > 0 ? (player.position / player.duration) * playerControlsProgressBar.width : 0
553-
554- Connections {
555- target: player
556- onPositionChanged: {
557- playerControlsProgressBarHint.width = (player.position / player.duration) * playerControlsProgressBar.width
558- }
559- onStopped: {
560- playerControlsProgressBarHint.width = 0;
561- }
562- }
563+ left: parent.left
564+ top: parent.top
565+ }
566+ color: UbuntuColors.blue
567+ height: parent.height
568+ width: player.duration > 0 ? (player.position / player.duration) * playerControlsProgressBar.width : 0
569+
570+ Connections {
571+ target: player
572+ onPositionChanged: {
573+ playerControlsProgressBarHint.width = (player.position / player.duration) * playerControlsProgressBar.width
574+ }
575+ onStopped: {
576+ playerControlsProgressBarHint.width = 0;
577 }
578 }
579 }
580 }
581 }
582 }
583-
584
585=== modified file 'MusicaddtoPlaylist.qml'
586--- MusicaddtoPlaylist.qml 2015-01-21 00:10:33 +0000
587+++ MusicaddtoPlaylist.qml 2015-01-23 13:45:46 +0000
588@@ -132,7 +132,7 @@
589 page.covers = Playlists.getPlaylistCovers(name)
590 }
591
592- musicToolbar.goBack(); // go back to the previous page
593+ mainPageStack.goBack(); // go back to the previous page
594 }
595 }
596 }
597
598=== modified file 'common/AlbumsPage.qml'
599--- common/AlbumsPage.qml 2015-01-17 12:44:57 +0000
600+++ common/AlbumsPage.qml 2015-01-23 13:45:46 +0000
601@@ -137,7 +137,7 @@
602 store: musicStore
603 onStatusChanged: {
604 if (albumsModel.status === SongsModel.Ready && loaded && albumsModel.count === 0) {
605- musicToolbar.popPage(albumStackPage)
606+ mainPageStack.popPage(albumStackPage)
607 }
608 }
609 }
610
611=== modified file 'common/MusicPage.qml'
612--- common/MusicPage.qml 2015-01-10 19:22:08 +0000
613+++ common/MusicPage.qml 2015-01-23 13:45:46 +0000
614@@ -25,7 +25,7 @@
615 Page {
616 id: thisPage
617 anchors {
618- bottomMargin: musicToolbar.visible ? musicToolbar.currentHeight : 0
619+ bottomMargin: musicToolbar.visible ? musicToolbar.height : 0
620 fill: parent
621 }
622
623@@ -56,7 +56,7 @@
624
625 onVisibleChanged: {
626 if (visible) {
627- musicToolbar.setPage(thisPage);
628+ mainPageStack.setPage(thisPage);
629 }
630 }
631 }
632
633=== modified file 'common/SongsPage.qml'
634--- common/SongsPage.qml 2015-01-18 16:46:48 +0000
635+++ common/SongsPage.qml 2015-01-23 13:45:46 +0000
636@@ -239,7 +239,7 @@
637 store: musicStore
638 onStatusChanged: {
639 if (songsModel.status === SongsModel.Ready && loaded && songsModel.count === 0) {
640- musicToolbar.popPage(songStackPage)
641+ mainPageStack.popPage(songStackPage)
642 }
643 }
644 }
645@@ -598,7 +598,7 @@
646 songStackPage.page = undefined
647 PopupUtils.close(dialogRemovePlaylist)
648
649- musicToolbar.goBack()
650+ mainPageStack.goBack()
651 }
652 }
653 Button {
654
655=== modified file 'music-app.qml'
656--- music-app.qml 2015-01-21 13:31:57 +0000
657+++ music-app.qml 2015-01-23 13:45:46 +0000
658@@ -55,10 +55,10 @@
659 focus: true
660 Keys.onPressed: {
661 if(event.key === Qt.Key_Escape) {
662- if (musicToolbar.currentPage.searchable && musicToolbar.currentPage.state === "search") {
663- musicToolbar.currentPage.state = "default"
664+ if (mainPageStack.actualCurrentPage.searchable && mainPageStack.actualCurrentPage.state === "search") {
665+ mainPageStack.actualCurrentPage.state = "default"
666 } else {
667- musicToolbar.goBack(); // Esc Go back
668+ mainPageStack.goBack(); // Esc Go back
669 }
670 }
671 else if(event.modifiers === Qt.AltModifier) {
672@@ -95,8 +95,8 @@
673 player.repeat = !player.repeat
674 break;
675 case Qt.Key_F: // Ctrl+F Show Search popup
676- if (musicToolbar.currentPage.searchable && musicToolbar.currentPage.state === "default") {
677- musicToolbar.currentPage.state = "search"
678+ if (mainPageStack.actualCurrentPage.searchable && mainPageStack.actualCurrentPage.state === "default") {
679+ mainPageStack.actualCurrentPage.state = "search"
680 header.show()
681 }
682
683@@ -159,7 +159,7 @@
684 id: backAction
685 text: i18n.tr("Back")
686 keywords: i18n.tr("Go back to last page")
687- onTriggered: musicToolbar.goBack();
688+ onTriggered: mainPageStack.goBack();
689 }
690
691 // With a default Quit action only the first 4 actions are displayed
692@@ -897,7 +897,7 @@
693
694 if (trackQueue.model.count === 1) {
695 player.stop()
696- musicToolbar.goBack()
697+ mainPageStack.goBack()
698 } else if (index === player.currentIndex) {
699 player.nextSong(player.isPlaying);
700 }
701@@ -936,7 +936,7 @@
702 if (trackQueue.model.count === 0) {
703 // Nothing in the queue so stop and pop the queue
704 player.stop()
705- musicToolbar.goBack()
706+ mainPageStack.goBack()
707 } else if (items.indexOf(player.currentIndex) > -1) {
708 // Current track was removed
709
710@@ -1053,24 +1053,85 @@
711 }
712 }
713
714- MusicToolbar {
715+ Loader {
716 id: musicToolbar
717+ anchors {
718+ bottom: parent.bottom
719+ left: parent.left
720+ right: parent.right
721+ }
722+ asynchronous: true
723+ source: "MusicToolbar.qml"
724 visible: mainPageStack.currentPage.title !== i18n.tr("Now playing") &&
725 mainPageStack.currentPage.title !== i18n.tr("Queue") &&
726 !firstRun
727- objectName: "musicToolbarObject"
728 z: 200 // put on top of everything else
729 }
730
731 PageStack {
732 id: mainPageStack
733
734+ // Properties storing the current page info
735+ property Page actualCurrentPage: null
736+ property bool popping: false
737+
738+ /* Helper functions */
739+
740+ // Go back up the stack if possible
741+ function goBack() {
742+ if (depth > 1) {
743+ pop()
744+ }
745+ }
746+
747+ // Pop a specific page in the stack
748+ function popPage(page) {
749+ var tmpPages = []
750+
751+ popping = true
752+
753+ while (currentPage !== page && depth > 0) {
754+ tmpPages.push(currentPage)
755+ pop()
756+ }
757+
758+ if (depth > 0) {
759+ pop()
760+ }
761+
762+ for (var i=tmpPages.length - 1; i > -1; i--) {
763+ push(tmpPages[i])
764+ }
765+
766+ popping = false
767+ }
768+
769+ // Set the current page, and any parent/stacks
770+ function setPage(childPage) {
771+ if (!popping) {
772+ actualCurrentPage = childPage;
773+ }
774+ }
775+
776 Tabs {
777 id: tabs
778 anchors {
779 fill: parent
780 }
781
782+ property Tab lastTab: selectedTab
783+
784+ onSelectedTabChanged: {
785+ // pause loading of the models in the old tab
786+ if (lastTab !== null && lastTab !== selectedTab) {
787+ allowLoading(lastTab, false);
788+ }
789+
790+ lastTab = selectedTab;
791+
792+ ensurePopulated(selectedTab);
793+ }
794+
795 onSelectedTabIndexChanged: {
796 if (loadedUI) { // store the tab index if changed by the user
797 startupSettings.tabIndex = selectedTabIndex
798@@ -1275,21 +1336,6 @@
799 mainPageStack.currentPage.isListView = false; // ensure full view
800 }
801 }
802-
803- Component.onCompleted: musicToolbar.currentTab = selectedTab
804-
805- onSelectedTabChanged: {
806- // pause loading of the models in the old tab
807- if (musicToolbar.currentTab !== selectedTab &&
808- musicToolbar.currentTab !== null)
809- {
810- allowLoading(musicToolbar.currentTab, false);
811- }
812-
813- musicToolbar.currentTab = selectedTab;
814-
815- ensurePopulated(selectedTab);
816- }
817 } // end of tabs
818 }
819

Subscribers

People subscribed via source and target branches