← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~vthompson/music-app/sort-songs-tab-by-date into lp:music-app

 

Victor Thompson has proposed merging lp:~vthompson/music-app/sort-songs-tab-by-date into lp:music-app.

Commit message:
Sort songs tab by date modified/added.

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

For more details, see:
https://code.launchpad.net/~vthompson/music-app/sort-songs-tab-by-date/+merge/260906

Sort songs tab by date modified/added.

This is a WIP at the moment. The other views, unfortunately, do not use models that seem to have a way of being sorted by date added.
-- 
Your team Music App Developers is requested to review the proposed merge of lp:~vthompson/music-app/sort-songs-tab-by-date into lp:music-app.
=== added file 'app/components/Themes/Ambiance/PageHeadStyle.qml'
--- app/components/Themes/Ambiance/PageHeadStyle.qml	1970-01-01 00:00:00 +0000
+++ app/components/Themes/Ambiance/PageHeadStyle.qml	2015-06-03 02:22:58 +0000
@@ -0,0 +1,7 @@
+import QtQuick 2.3
+import Ubuntu.Components 1.1
+import Ubuntu.Components.Themes.Ambiance 1.1 as Theme
+
+Theme.PageHeadStyle {
+    selectedSectionColor: UbuntuColors.green
+}

=== modified file 'app/music-app.qml'
--- app/music-app.qml	2015-05-10 00:34:24 +0000
+++ app/music-app.qml	2015-06-03 02:22:58 +0000
@@ -269,6 +269,9 @@
         // TODO: Workaround for pad.lv/1356779, force the theme's backgroundText color
         // to work with the app's backgroundColor
         Theme.palette.normal.backgroundText = "#81888888"
+
+        // Replace default header style
+        mainView.header.style = Qt.createComponent(Qt.resolvedUrl("components/Themes/Ambiance/PageHeadStyle.qml"))
     }
 
     // VARIABLES

=== modified file 'app/ui/Songs.qml'
--- app/ui/Songs.qml	2015-02-16 20:27:40 +0000
+++ app/ui/Songs.qml	2015-06-03 02:22:58 +0000
@@ -53,6 +53,23 @@
         }
     ]
 
+    PageHeadSections {
+        id: defaultStateSections
+        model: ["Title", "Date added"]
+        selectedIndex: 0
+    }
+
+    head {
+        sections {
+            model: defaultStateSections.model
+            selectedIndex: defaultStateSections.selectedIndex
+            onSelectedIndexChanged: {
+                songsModelFilter.sort.property = head.sections.selectedIndex == 0 ? "title" : "eTag"
+                songsModelFilter.sort.order = head.sections.selectedIndex == 0 ? Qt.AscendingOrder : Qt.DescendingOrder
+            }
+        }
+    }
+
     // Hack for autopilot otherwise Albums appears as MusicPage
     // due to bug 1341671 it is required that there is a property so that
     // qml doesn't optimise using the parent type


Follow ups