From 12cb6d69cbd45de4e2b06ceff9d6c438248efebb Mon Sep 17 00:00:00 2001 From: "nikwen.developer@gmail.com" Date: Sun, 17 Aug 2014 11:13:50 +0000 Subject: [PATCH] Toggle fetch covers bug --- ubuntu/backend/mpdbackend.cpp | 8 +++++++- ubuntu/backend/mpdbackend.h | 1 + ubuntu/qml/cantata/backend/SettingsBackend.qml | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ubuntu/backend/mpdbackend.cpp b/ubuntu/backend/mpdbackend.cpp index 8f20e8c5e..190d14846 100644 --- a/ubuntu/backend/mpdbackend.cpp +++ b/ubuntu/backend/mpdbackend.cpp @@ -154,7 +154,13 @@ void MPDBackend::setAlbumViewSort(int s) { void MPDBackend::setCoverFetch(bool s) { Covers::self()->setFetchCovers(s); } - + +void MPDBackend::resetAllModels() { //TODO: Better idea? + MusicLibraryModel::self()->resetModel(); + AlbumsModel::self()->resetModel(); + PlaylistsModel::self()->resetModel(); +} + void MPDBackend::playPause() { switch (MPDStatus::self()->state()) { case MPDState_Playing: diff --git a/ubuntu/backend/mpdbackend.h b/ubuntu/backend/mpdbackend.h index 0f9391726..eb82ccae6 100644 --- a/ubuntu/backend/mpdbackend.h +++ b/ubuntu/backend/mpdbackend.h @@ -111,6 +111,7 @@ public: Q_INVOKABLE int getCrossfade() { return MPDStatus::self()->crossFade(); } Q_INVOKABLE QStringList getOutputs () { return outputSettings; } Q_INVOKABLE QString getReplayGain () { return replayGainSetting; } + Q_INVOKABLE void resetAllModels(); PlayQueueProxyModel * getPlayQueueProxyModel() { return &playQueueProxyModel; } MusicLibraryProxyModel * getArtistsProxyModel() { return &artistsProxyModel; } diff --git a/ubuntu/qml/cantata/backend/SettingsBackend.qml b/ubuntu/qml/cantata/backend/SettingsBackend.qml index 6615afc71..1938a759e 100644 --- a/ubuntu/qml/cantata/backend/SettingsBackend.qml +++ b/ubuntu/qml/cantata/backend/SettingsBackend.qml @@ -53,7 +53,8 @@ Item { onContentsChanged: { if (contents != undefined) { console.log("Update cover fetch") - backend.setCoverFetch(contents["coverFetch"]) //TODO: Untick fetch checkbox => Delete saved images => Tick fetch checkbox => First few album covers are not loaded + backend.setCoverFetch(contents["coverFetch"]) //TODO: Untick fetch checkbox => Delete saved images => Reopen app => Tick fetch checkbox => First few album covers are not loaded + backend.resetAllModels() } } }