summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Botö <erik.boto@pelagicore.com>2017-01-04 07:03:01 +0100
committerErik Botö <erik.boto@pelagicore.com>2017-01-04 08:21:52 +0000
commit6ea40f00f82f22d17a7d745df533aff631b5dc82 (patch)
treed8499cef866d18fbbb19b26ef59075b39134fc2b
parentc906c39ad014b69337e94e5ea511a2c2adb0eeab (diff)
downloadneptune-ui-6ea40f00f82f22d17a7d745df533aff631b5dc82.tar.gz
Music app: Fix inconsitency between initial song metadata and song
It is not enough to reevaluate metadata when count changes, since different queries can have the same number of results. This is why the initial song if you just launch the app and press play is not the song you see title and art for. This commit fixes that by acting on query changes instead. Change-Id: Ifea5eb4090c8825a4270e98f89b16ad9e3740ec3 Reviewed-by: Nedim Hadzic <nedim.hadzic@pelagicore.com>
-rw-r--r--apps/com.pelagicore.music/MusicProvider.qml11
1 files changed, 7 insertions, 4 deletions
diff --git a/apps/com.pelagicore.music/MusicProvider.qml b/apps/com.pelagicore.music/MusicProvider.qml
index 4089ee4..0fa5539 100644
--- a/apps/com.pelagicore.music/MusicProvider.qml
+++ b/apps/com.pelagicore.music/MusicProvider.qml
@@ -46,18 +46,21 @@ QtObject {
property SqlQueryDataSource nowPlaying: SqlQueryDataSource {
database: "media"
query: 'select * from music'
+ onQueryChanged: root.reevaluate()
}
property int currentIndex: 0
property int count: nowPlaying.count
- onCountChanged: {
- currentIndex = -1
- currentIndex = 0
- }
+
property var currentEntry: nowPlaying.get(currentIndex);
property url currentSource: nowPlaying.storageLocation + '/media/music/' + currentEntry.source
property url currentCover: nowPlaying.storageLocation + '/media/music/' + currentEntry.cover
+ function reevaluate() {
+ currentIndex = -1
+ currentIndex = 0
+ }
+
function queryAllAlbums() {
musicLibrary.query = 'select * from music group by album'
}