← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~vthompson/music-app/music-uc1.3-now-playing-fix-1447428 into lp:music-app

 

Victor Thompson has proposed merging lp:~vthompson/music-app/music-uc1.3-now-playing-fix-1447428 into lp:music-app with lp:~vthompson/music-app/music-uc1.3 as a prerequisite.

Commit message:
* Add initial page sections to Now Playing view

Requested reviews:
  Music App Developers (music-app-dev)
Related bugs:
  Bug #1447428 in Ubuntu Music App: "[music] Use new page head sections from new sdk"
  https://bugs.launchpad.net/music-app/+bug/1447428

For more details, see:
https://code.launchpad.net/~vthompson/music-app/music-uc1.3-now-playing-fix-1447428/+merge/275635

* Add initial page sections to Now Playing view

This adds a Now Playing toggle to the Now Playing view, using the newer Page Head Sections API. This has been approved by Design.
-- 
Your team Music App Developers is requested to review the proposed merge of lp:~vthompson/music-app/music-uc1.3-now-playing-fix-1447428 into lp:music-app.
=== modified file 'app/music-app.qml'
--- app/music-app.qml	2015-10-24 19:12:49 +0000
+++ app/music-app.qml	2015-10-24 19:12:49 +0000
@@ -369,7 +369,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()
@@ -399,11 +399,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)
@@ -984,14 +979,9 @@
             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
-                }
             }
         } // end of tabs
     }

=== modified file 'app/ui/NowPlaying.qml'
--- app/ui/NowPlaying.qml	2015-10-24 19:12:49 +0000
+++ app/ui/NowPlaying.qml	2015-10-24 19:12:49 +0000
@@ -30,13 +30,15 @@
     flickable: isListView ? queueListLoader.item : null  // Ensures that the header is shown in fullview
     objectName: "nowPlayingPage"
     showToolbar: false
-    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: {
@@ -54,6 +56,12 @@
         }
     }
 
+    onVisibleChanged: {
+        if (!visible) {
+            head.sections.selectedIndex = 0
+        }
+    }
+
     // Ensure that the listview has loaded before attempting to positionAt
     function ensureListViewLoaded() {
         if (queueListLoader.item.count === trackQueue.model.count) {
@@ -72,6 +80,20 @@
         queueListLoader.item.positionViewAtIndex(index, ListView.Center);
     }
 
+    PageHeadSections {
+        id: defaultStateSections
+        model: [fullViewTitle, queueTitle]
+        selectedIndex: isListView
+    }
+
+    head {
+        sections {
+            model: defaultStateSections.model
+            selectedIndex: defaultStateSections.selectedIndex
+            onSelectedIndexChanged: isListView = !isListView
+        }
+    }
+
     state: isListView && queueListLoader.item.state === "multiselectable" ? "selection" : "default"
     states: [
         PageHeadState {
@@ -80,13 +102,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)
@@ -141,7 +156,7 @@
             topMargin: headerHeight
         }
 
-        property real headerHeight: units.gu(6)
+        property real headerHeight: units.gu(10)
 
         height: parent.height - headerHeight - units.gu(9.5)
         source: "../components/NowPlayingFullView.qml"

=== modified file 'debian/changelog'
--- debian/changelog	2015-10-24 19:12:49 +0000
+++ debian/changelog	2015-10-24 19:12:49 +0000
@@ -6,6 +6,7 @@
   [ Victor Thompson ]
   * Remove some deprecated code for the UbuntuShape image property.
   * Update app to use the Ubuntu Components version 1.3 (LP: #1508363)
+  * Add initial page sections to Now Playing view (LP: #1447428)
 
  -- Bartosz Kosiorek <gang65@xxxxxxxxxxxxxx>  Tue, 08 Sep 2015 10:08:49 +0200
 

=== modified file 'po/com.ubuntu.music.pot'
--- po/com.ubuntu.music.pot	2015-08-21 19:41:03 +0000
+++ po/com.ubuntu.music.pot	2015-10-24 19:12:49 +0000
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: music-app\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-08-21 20:40+0100\n"
+"POT-Creation-Date: 2015-10-24 14:06-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"
@@ -37,7 +37,7 @@
 msgid "Cancel"
 msgstr ""
 
-#: ../app/components/Dialog/ContentHubWaitDialog.qml:34
+#: ../app/components/Dialog/ContentHubWaitDialog.qml:33
 msgid "Waiting for file(s)..."
 msgstr ""
 
@@ -83,7 +83,7 @@
 msgstr ""
 
 #: ../app/components/Dialog/RemovePlaylistDialog.qml:37
-#: ../app/components/ListItemActions/Remove.qml:28
+#: ../app/components/ListItemActions/Remove.qml:27
 msgid "Remove"
 msgstr ""
 
@@ -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:93
+#: ../app/ui/NowPlaying.qml:108
 msgid "Add to playlist"
 msgstr ""
 
@@ -180,11 +180,11 @@
 msgid "Shuffle"
 msgstr ""
 
-#: ../app/components/Walkthrough/Slide1.qml:58
+#: ../app/components/Walkthrough/Slide1.qml:59
 msgid "Welcome to Music"
 msgstr ""
 
-#: ../app/components/Walkthrough/Slide1.qml:72
+#: ../app/components/Walkthrough/Slide1.qml:73
 msgid ""
 "Enjoy your favorite music with Ubuntu's Music App. Take a short tour on how "
 "to get started or press skip to start listening now."
@@ -195,7 +195,7 @@
 msgstr ""
 
 #: ../app/components/Walkthrough/Slide2.qml:67
-#: ../app/ui/LibraryEmptyState.qml:117
+#: ../app/ui/LibraryEmptyState.qml:123
 msgid ""
 "Connect your device to any computer and simply drag files to the Music "
 "folder or insert removable media with music."
@@ -213,84 +213,78 @@
 msgid "Start"
 msgstr ""
 
-#: ../app/components/Walkthrough/Walkthrough.qml:84
+#: ../app/components/Walkthrough/Walkthrough.qml:120
 msgid "Skip"
 msgstr ""
 
-#: ../app/music-app.qml:155
+#: ../app/music-app.qml:156
 msgid "Next"
 msgstr ""
 
-#: ../app/music-app.qml:156
+#: ../app/music-app.qml:157
 msgid "Next Track"
 msgstr ""
 
-#: ../app/music-app.qml:162
+#: ../app/music-app.qml:163
 msgid "Pause"
 msgstr ""
 
-#: ../app/music-app.qml:162
+#: ../app/music-app.qml:163
 msgid "Play"
 msgstr ""
 
-#: ../app/music-app.qml:164
+#: ../app/music-app.qml:165
 msgid "Pause Playback"
 msgstr ""
 
-#: ../app/music-app.qml:164
+#: ../app/music-app.qml:165
 msgid "Continue or start playback"
 msgstr ""
 
-#: ../app/music-app.qml:169
+#: ../app/music-app.qml:170
 msgid "Back"
 msgstr ""
 
-#: ../app/music-app.qml:170
+#: ../app/music-app.qml:171
 msgid "Go back to last page"
 msgstr ""
 
-#: ../app/music-app.qml:178
+#: ../app/music-app.qml:179
 msgid "Previous"
 msgstr ""
 
-#: ../app/music-app.qml:179
+#: ../app/music-app.qml:180
 msgid "Previous Track"
 msgstr ""
 
-#: ../app/music-app.qml:184
+#: ../app/music-app.qml:185
 msgid "Stop"
 msgstr ""
 
-#: ../app/music-app.qml:185
+#: ../app/music-app.qml:186
 msgid "Stop Playback"
 msgstr ""
 
-#: ../app/music-app.qml:276 com.ubuntu.music_music.desktop.in.in.h:1
+#: ../app/music-app.qml:277 com.ubuntu.music_music.desktop.in.in.h:1
 msgid "Music"
 msgstr ""
 
-#: ../app/music-app.qml:306
+#: ../app/music-app.qml:307
 msgid "Debug: "
 msgstr ""
 
 #. TRANSLATORS: this appears in the header with limited space (around 20 characters)
-#: ../app/music-app.qml:371 ../app/music-app.qml:986
+#: ../app/music-app.qml:372 ../app/music-app.qml:982
 #: ../app/ui/NowPlaying.qml:38
 msgid "Now playing"
 msgstr ""
 
 #. TRANSLATORS: this appears in the header with limited space (around 20 characters)
-#: ../app/music-app.qml:371 ../app/music-app.qml:403 ../app/music-app.qml:987
-#: ../app/music-app.qml:991 ../app/ui/NowPlaying.qml:40
-msgid "Queue"
-msgstr ""
-
-#. TRANSLATORS: this appears in the header with limited space (around 20 characters)
-#: ../app/ui/AddToPlaylist.qml:46
+#: ../app/ui/AddToPlaylist.qml:45
 msgid "Select playlist"
 msgstr ""
 
-#: ../app/ui/AddToPlaylist.qml:94 ../app/ui/Playlists.qml:87
+#: ../app/ui/AddToPlaylist.qml:93 ../app/ui/Playlists.qml:86
 #: ../app/ui/SongsView.qml:292 ../app/ui/SongsView.qml:293
 #, qt-format
 msgid "%1 song"
@@ -300,12 +294,12 @@
 
 #. TRANSLATORS: this is the name of the playlists page shown in the tab header.
 #. Remember to keep the translation short to fit the screen width
-#: ../app/ui/AddToPlaylist.qml:99 ../app/ui/Playlists.qml:38
+#: ../app/ui/AddToPlaylist.qml:98 ../app/ui/Playlists.qml:37
 #: ../app/ui/SongsView.qml:103
 msgid "Playlists"
 msgstr ""
 
-#: ../app/ui/AddToPlaylist.qml:109 ../app/ui/Recent.qml:37
+#: ../app/ui/AddToPlaylist.qml:108 ../app/ui/Recent.qml:36
 #: ../app/ui/SongsView.qml:91
 msgid "Recent"
 msgstr ""
@@ -314,35 +308,35 @@
 msgid "Albums"
 msgstr ""
 
-#: ../app/ui/Albums.qml:72 ../app/ui/ArtistView.qml:129
-#: ../app/ui/ArtistView.qml:142 ../app/ui/Recent.qml:82
+#: ../app/ui/Albums.qml:72 ../app/ui/ArtistView.qml:128
+#: ../app/ui/ArtistView.qml:141 ../app/ui/Recent.qml:81
 #: ../app/ui/SongsView.qml:249
 msgid "Unknown Album"
 msgstr ""
 
-#: ../app/ui/Albums.qml:73 ../app/ui/ArtistView.qml:85
-#: ../app/ui/ArtistView.qml:141 ../app/ui/Artists.qml:80
-#: ../app/ui/Recent.qml:83 ../app/ui/SongsView.qml:270
+#: ../app/ui/Albums.qml:73 ../app/ui/ArtistView.qml:84
+#: ../app/ui/ArtistView.qml:140 ../app/ui/Artists.qml:79
+#: ../app/ui/Recent.qml:82 ../app/ui/SongsView.qml:270
 msgid "Unknown Artist"
 msgstr ""
 
-#: ../app/ui/Albums.qml:83 ../app/ui/ArtistView.qml:140
-#: ../app/ui/Recent.qml:98
+#: ../app/ui/Albums.qml:83 ../app/ui/ArtistView.qml:139
+#: ../app/ui/Recent.qml:97
 msgid "Album"
 msgstr ""
 
-#: ../app/ui/ArtistView.qml:104
+#: ../app/ui/ArtistView.qml:103
 #, qt-format
 msgid "%1 album"
 msgid_plural "%1 albums"
 msgstr[0] ""
 msgstr[1] ""
 
-#: ../app/ui/Artists.qml:38
+#: ../app/ui/Artists.qml:37
 msgid "Artists"
 msgstr ""
 
-#: ../app/ui/Artists.qml:108
+#: ../app/ui/Artists.qml:107
 msgid "Artist"
 msgstr ""
 
@@ -361,17 +355,27 @@
 msgid "Genre"
 msgstr ""
 
-#: ../app/ui/LibraryEmptyState.qml:106
+#: ../app/ui/LibraryEmptyState.qml:112
 msgid "No music found"
 msgstr ""
 
+#. TRANSLATORS: this appears in the header with limited space (around 20 characters)
+#: ../app/ui/NowPlaying.qml:40
+msgid "Full view"
+msgstr ""
+
+#. TRANSLATORS: this appears in the header with limited space (around 20 characters)
+#: ../app/ui/NowPlaying.qml:42
+msgid "Queue"
+msgstr ""
+
 #. TRANSLATORS: this action appears in the overflow drawer with limited space (around 18 characters)
-#: ../app/ui/NowPlaying.qml:108
+#: ../app/ui/NowPlaying.qml:123
 msgid "Clear queue"
 msgstr ""
 
-#: ../app/ui/Playlists.qml:99 ../app/ui/Playlists.qml:100
-#: ../app/ui/Recent.qml:83 ../app/ui/Recent.qml:98 ../app/ui/SongsView.qml:67
+#: ../app/ui/Playlists.qml:98 ../app/ui/Playlists.qml:99
+#: ../app/ui/Recent.qml:82 ../app/ui/Recent.qml:97 ../app/ui/SongsView.qml:67
 #: ../app/ui/SongsView.qml:82 ../app/ui/SongsView.qml:114
 #: ../app/ui/SongsView.qml:154 ../app/ui/SongsView.qml:188
 #: ../app/ui/SongsView.qml:203 ../app/ui/SongsView.qml:222


Follow ups