← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~vthompson/music-app/fix-1478921 into lp:music-app

 

Victor Thompson has proposed merging lp:~vthompson/music-app/fix-1478921 into lp:music-app.

Commit message:
Push the LibraryEmptyState to preserve existing stack

Requested reviews:
  Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot): continuous-integration
  Music App Developers (music-app-dev)
Related bugs:
  Bug #1478921 in Ubuntu Music App: "Header misbehaves in songs page after music is added"
  https://bugs.launchpad.net/music-app/+bug/1478921

For more details, see:
https://code.launchpad.net/~vthompson/music-app/fix-1478921/+merge/266168

Push the LibraryEmptyState to preserve existing stack
-- 
Your team Music App Developers is requested to review the proposed merge of lp:~vthompson/music-app/fix-1478921 into lp:music-app.
=== modified file 'app/components/MusicToolbar.qml'
--- app/components/MusicToolbar.qml	2015-07-08 13:27:20 +0000
+++ app/components/MusicToolbar.qml	2015-07-29 01:29:11 +0000
@@ -30,6 +30,7 @@
     color: styleMusic.common.black
     height: units.gu(7.25)
     objectName: "musicToolbarObject"
+    visible: !noMusic
 
     // Hack for autopilot otherwise MusicToolbar appears as QQuickRectangle
     // due to bug 1341671 it is required that there is a property so that
@@ -90,7 +91,6 @@
                 color: styleMusic.playerControls.labelColor
                 text: i18n.tr("Tap to shuffle music")
                 fontSize: "large"
-                visible: !emptyPageLoader.noMusic
                 wrapMode: Text.WordWrap
                 maximumLineCount: 2
             }
@@ -117,10 +117,6 @@
                     fill: parent
                 }
                 onClicked: {
-                    if (emptyPageLoader.noMusic) {
-                        return;
-                    }
-
                     if (trackQueue.model.count === 0) {
                         playRandomSong();
                     }

=== modified file 'app/components/NowPlayingToolbar.qml'
--- app/components/NowPlayingToolbar.qml	2015-05-03 16:22:31 +0000
+++ app/components/NowPlayingToolbar.qml	2015-07-29 01:29:11 +0000
@@ -29,6 +29,7 @@
         fill: parent
     }
     color: styleMusic.common.black
+    visible: !noMusic
 
     /* Repeat button */
     MouseArea {
@@ -37,7 +38,7 @@
         anchors.rightMargin: units.gu(1)
         anchors.verticalCenter: nowPlayingPlayButton.verticalCenter
         height: units.gu(6)
-        opacity: player.repeat && !emptyPageLoader.noMusic ? 1 : .4
+        opacity: player.repeat ? 1 : .4
         width: height
         onClicked: player.repeat = !player.repeat
 
@@ -50,7 +51,7 @@
             color: "white"
             name: "media-playlist-repeat"
             objectName: "repeatShape"
-            opacity: player.repeat && !emptyPageLoader.noMusic ? 1 : .4
+            opacity: player.repeat ? 1 : .4
         }
     }
 
@@ -92,7 +93,6 @@
             width: height
             anchors.verticalCenter: parent.verticalCenter
             anchors.horizontalCenter: parent.horizontalCenter
-            opacity: emptyPageLoader.noMusic ? .4 : 1
             color: "white"
             name: player.playbackState === MediaPlayer.PlayingState ? "media-playback-pause" : "media-playback-start"
             objectName: "playShape"
@@ -130,7 +130,7 @@
         anchors.leftMargin: units.gu(1)
         anchors.verticalCenter: nowPlayingPlayButton.verticalCenter
         height: units.gu(6)
-        opacity: player.shuffle && !emptyPageLoader.noMusic ? 1 : .4
+        opacity: player.shuffle ? 1 : .4
         width: height
         onClicked: player.shuffle = !player.shuffle
 
@@ -143,7 +143,7 @@
             color: "white"
             name: "media-playlist-shuffle"
             objectName: "shuffleShape"
-            opacity: player.shuffle && !emptyPageLoader.noMusic ? 1 : .4
+            opacity: player.shuffle ? 1 : .4
         }
     }
 

=== modified file 'app/music-app.qml'
--- app/music-app.qml	2015-06-28 03:06:49 +0000
+++ app/music-app.qml	2015-07-29 01:29:11 +0000
@@ -279,6 +279,9 @@
     property bool selectedAlbum: false
     property alias firstRun: startupSettings.firstRun
     property alias queueIndex: startupSettings.queueIndex
+    property bool noMusic: allSongsModel.rowCount === 0 && allSongsModelModel.status === SongsModel.Ready && loadedUI
+    property bool emptyState: noMusic && !firstRun && !contentHub.processing
+    property Page emptyPage: undefined
 
     signal listItemSwiping(int i)
 
@@ -287,6 +290,14 @@
 
     // FUNCTIONS
 
+    onEmptyStateChanged: {
+        if (emptyState) {
+            emptyPage = mainPageStack.push(Qt.resolvedUrl("ui/LibraryEmptyState.qml"), {})
+        } else {
+            mainPageStack.popPage(emptyPage)
+        }
+    }
+
     // Custom debug funtion that's easier to shut off
     function customdebug(text) {
         var debug = true; // set to "0" for not debugging
@@ -985,20 +996,6 @@
         } // end of tabs
     }
 
-    Loader {
-        id: emptyPageLoader
-        // Do not be active if content-hub is importing due to the models resetting
-        // this then causes the empty page loader to partially run then showing a blank header
-        active: noMusic && !firstRun && !contentHub.processing
-        anchors {
-            fill: parent
-        }
-        source: "ui/LibraryEmptyState.qml"
-        visible: active
-
-        property bool noMusic: allSongsModel.rowCount === 0 && allSongsModelModel.status === SongsModel.Ready && loadedUI
-    }
-
     LoadingSpinnerComponent {
         id: loading
     }