← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~vthompson/music-app/now-playing-sections-toggle into lp:music-app

 

Victor Thompson has proposed merging lp:~vthompson/music-app/now-playing-sections-toggle into lp:music-app with lp:~vthompson/music-app/sort-songs-tab-by-date as a prerequisite.

Commit message:
* Add sections toggle for Now playing and Queue.

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

For more details, see:
https://code.launchpad.net/~vthompson/music-app/now-playing-sections-toggle/+merge/260948

* Add sections toggle for Now playing and Queue.
-- 
Your team Music App Developers is requested to review the proposed merge of lp:~vthompson/music-app/now-playing-sections-toggle into lp:music-app.
=== modified file 'app/music-app.qml'
--- app/music-app.qml	2015-06-03 13:14:13 +0000
+++ app/music-app.qml	2015-06-03 13:14:13 +0000
@@ -359,7 +359,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()
@@ -389,11 +389,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)
@@ -691,7 +686,6 @@
         asynchronous: true
         source: "components/MusicToolbar.qml"
         visible: mainPageStack.currentPage.title !== i18n.tr("Now playing") &&
-                 mainPageStack.currentPage.title !== i18n.tr("Queue") &&
                  mainPageStack.currentPage.title !== i18n.tr("Select playlist") &&
                  !firstRun
         z: 200  // put on top of everything else
@@ -961,14 +955,11 @@
             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")) {
                     mainPageStack.push(Qt.resolvedUrl("ui/NowPlaying.qml"), {})
                 }
 
-                if (mainPageStack.currentPage.title === i18n.tr("Queue")) {
-                    mainPageStack.currentPage.isListView = false;  // ensure full view
-                }
+                mainPageStack.currentPage.isListView = false;  // ensure full view
             }
         } // end of tabs
     }

=== modified file 'app/ui/NowPlaying.qml'
--- app/ui/NowPlaying.qml	2015-03-25 00:11:50 +0000
+++ app/ui/NowPlaying.qml	2015-06-03 13:14:13 +0000
@@ -29,13 +29,15 @@
     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 fullViewTitle: i18n.tr("Full view") 
+    // TRANSLATORS: this appears in the header with limited space (around 20 characters)
     property string queueTitle: i18n.tr("Queue") 
 
     onIsListViewChanged: {
@@ -79,13 +81,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)
@@ -132,6 +127,24 @@
         }
     ]
 
+    PageHeadSections {
+        id: defaultStateSections
+        model: [fullViewTitle, queueTitle]
+        selectedIndex: 0
+    }
+
+    head {
+        sections {
+            model: defaultStateSections.model
+            selectedIndex: defaultStateSections.selectedIndex
+            onSelectedIndexChanged: {
+                if (head.sections.model[head.sections.selectedIndex] != isListView) {
+                    isListView = !isListView
+                }
+            }
+        }
+    }
+
     Loader {
         anchors {
             left: parent.left

=== modified file 'po/com.ubuntu.music.pot'
--- po/com.ubuntu.music.pot	2015-05-15 00:16:56 +0000
+++ po/com.ubuntu.music.pot	2015-06-03 13:14:13 +0000
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: music-app\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-05-14 19:15-0500\n"
+"POT-Creation-Date: 2015-06-03 08:11-0500\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@xxxxxx>\n"
@@ -94,7 +94,7 @@
 #. TRANSLATORS: this action appears in the overflow drawer with limited space (around 18 characters)
 #: ../app/components/HeadState/MultiSelectHeadState.qml:39
 #: ../app/components/ListItemActions/AddToPlaylist.qml:26
-#: ../app/ui/NowPlaying.qml:92
+#: ../app/ui/NowPlaying.qml:87
 msgid "Add to playlist"
 msgstr ""
 
@@ -265,29 +265,22 @@
 msgid "Stop Playback"
 msgstr ""
 
-#: ../app/music-app.qml:275 com.ubuntu.music_music.desktop.in.in.h:1
+#: ../app/music-app.qml:278 com.ubuntu.music_music.desktop.in.in.h:1
 msgid "Music"
 msgstr ""
 
-#: ../app/music-app.qml:294
+#: ../app/music-app.qml:297
 msgid "Debug: "
 msgstr ""
 
 #. TRANSLATORS: this appears in the header with limited space (around 20 characters)
-#: ../app/music-app.qml:359 ../app/music-app.qml:690 ../app/music-app.qml:961
+#: ../app/music-app.qml:362 ../app/music-app.qml:688 ../app/music-app.qml:958
 #: ../app/ui/NowPlaying.qml:37
 msgid "Now playing"
 msgstr ""
 
 #. TRANSLATORS: this appears in the header with limited space (around 20 characters)
-#: ../app/music-app.qml:359 ../app/music-app.qml:391 ../app/music-app.qml:691
-#: ../app/music-app.qml:962 ../app/music-app.qml:966
-#: ../app/ui/NowPlaying.qml:39
-msgid "Queue"
-msgstr ""
-
-#. TRANSLATORS: this appears in the header with limited space (around 20 characters)
-#: ../app/music-app.qml:692 ../app/ui/AddToPlaylist.qml:46
+#: ../app/music-app.qml:689 ../app/ui/AddToPlaylist.qml:46
 msgid "Select playlist"
 msgstr ""
 
@@ -362,8 +355,18 @@
 msgid "No music found"
 msgstr ""
 
+#. TRANSLATORS: this appears in the header with limited space (around 20 characters)
+#: ../app/ui/NowPlaying.qml:39
+msgid "Full view"
+msgstr ""
+
+#. TRANSLATORS: this appears in the header with limited space (around 20 characters)
+#: ../app/ui/NowPlaying.qml:41
+msgid "Queue"
+msgstr ""
+
 #. TRANSLATORS: this action appears in the overflow drawer with limited space (around 18 characters)
-#: ../app/ui/NowPlaying.qml:107
+#: ../app/ui/NowPlaying.qml:102
 msgid "Clear queue"
 msgstr ""
 


References