← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~vthompson/music-app/prototype-page-head-sections into lp:music-app

 

Victor Thompson has proposed merging lp:~vthompson/music-app/prototype-page-head-sections into lp:music-app.

Commit message:
* Prototype PageHeadSections

Requested reviews:
  Music App Developers (music-app-dev)

For more details, see:
https://code.launchpad.net/~vthompson/music-app/prototype-page-head-sections/+merge/257209

Proposed only to see the diff. Recommend we find a way to change the section color from Ubuntu.orange to Ubuntu.blue/green.
-- 
Your team Music App Developers is requested to review the proposed merge of lp:~vthompson/music-app/prototype-page-head-sections into lp:music-app.
=== modified file 'MusicNowPlaying.qml'
--- MusicNowPlaying.qml	2015-01-28 02:30:43 +0000
+++ MusicNowPlaying.qml	2015-04-23 02:42:22 +0000
@@ -32,14 +32,12 @@
     id: nowPlaying
     flickable: isListView ? queueListLoader.item : null  // Ensures that the header is shown in fullview
     objectName: "nowPlayingPage"
-    title: isListView ? queueTitle : nowPlayingTitle
+    title: nowPlayingTitle
     visible: false
 
     property bool isListView: false
     // TRANSLATORS: this appears in the header with limited space (around 20 characters)
     property string nowPlayingTitle: i18n.tr("Now playing") 
-    // TRANSLATORS: this appears in the header with limited space (around 20 characters)
-    property string queueTitle: i18n.tr("Queue") 
 
     onIsListViewChanged: {
         if (isListView) {  // When changing to the queue positionAt the currentIndex
@@ -82,13 +80,6 @@
             name: "default"
             actions: [
                 Action {
-                    objectName: "toggleView"
-                    iconName: isListView ? "stock_image" : "view-list-symbolic"
-                    onTriggered: {
-                        isListView = !isListView
-                    }
-                },
-                Action {
                     enabled: trackQueue.model.count > 0
                     iconName: "add-to-playlist"
                     // TRANSLATORS: this action appears in the overflow drawer with limited space (around 18 characters)
@@ -195,6 +186,24 @@
         }
     ]
 
+    PageHeadSections {
+        id: defaultStateSections
+        model: ["Full view", "Queue"]
+        selectedIndex: 0
+    }
+
+    head {
+        sections {
+            model: defaultStateSections.model
+            selectedIndex: defaultStateSections.selectedIndex
+            onSelectedIndexChanged: {
+                if (head.sections.model[head.sections.selectedIndex] != isListView) {
+                    isListView = !isListView
+                }
+            }
+        }
+    }
+
     Item {
         id: fullview
         anchors {

=== modified file 'music-app.qml'
--- music-app.qml	2015-04-03 23:49:13 +0000
+++ music-app.qml	2015-04-23 02:42:22 +0000
@@ -751,7 +751,7 @@
 
         if (!clear) {
             // If same track and on Now playing page then toggle
-            if ((mainPageStack.currentPage.title === i18n.tr("Now playing") || mainPageStack.currentPage.title === i18n.tr("Queue"))
+            if (mainPageStack.currentPage.title === i18n.tr("Now playing")
                     && trackQueue.model.get(player.currentIndex) !== undefined
                     && Qt.resolvedUrl(trackQueue.model.get(player.currentIndex).filename) === file) {
                 player.toggle()
@@ -781,11 +781,6 @@
         else {
             player.playSong(trackQueue.model.get(index).filename, index);
         }
-
-        // Show the Now playing page and make sure the track is visible
-        if (mainPageStack.currentPage.title !== i18n.tr("Queue")) {
-            tabs.pushNowPlaying();
-        }
     }
 
     function playRandomSong(shuffle)
@@ -1132,7 +1127,6 @@
     MusicToolbar {
         id: musicToolbar
         visible: mainPageStack.currentPage.title !== i18n.tr("Now playing") &&
-                 mainPageStack.currentPage.title !== i18n.tr("Queue") &&
                  mainPageStack.currentPage.title !== i18n.tr("Select playlist") &&
                  !firstRun
         objectName: "musicToolbarObject"
@@ -1338,8 +1332,7 @@
             function pushNowPlaying()
             {
                 // only push if on a different page
-                if (mainPageStack.currentPage.title !== i18n.tr("Now playing")
-                        && mainPageStack.currentPage.title !== i18n.tr("Queue")) {
+                if (mainPageStack.currentPage.title !== i18n.tr("Now playing")) {
 
                     var comp = Qt.createComponent("MusicNowPlaying.qml")
                     var nowPlaying = comp.createObject(mainPageStack, {});
@@ -1351,9 +1344,7 @@
                     mainPageStack.push(nowPlaying);
                 }
 
-                if (mainPageStack.currentPage.title === i18n.tr("Queue")) {
-                    mainPageStack.currentPage.isListView = false;  // ensure full view
-                }
+                mainPageStack.currentPage.isListView = false;  // ensure full view
             }
 
             Component.onCompleted: musicToolbar.currentTab = selectedTab
@@ -1379,7 +1370,7 @@
         visible: (noMusic || noPlaylists) && !firstRun
 
         property bool noMusic: allSongsModel.rowCount === 0 && allSongsModelModel.status === SongsModel.Ready && loadedUI
-        property bool noPlaylists: playlistModel.model.count === 0 && playlistModel.workerComplete && mainPageStack.currentPage.title !== i18n.tr("Now playing") && mainPageStack.currentPage.title !== i18n.tr("Queue")
+        property bool noPlaylists: playlistModel.model.count === 0 && playlistModel.workerComplete && mainPageStack.currentPage.title !== i18n.tr("Now playing")
 
         tools: ToolbarItems {
             back: null


Follow ups