summaryrefslogtreecommitdiffstats
path: root/mediaplayer
diff options
context:
space:
mode:
authorJan-Simon Moeller <jsmoeller@linuxfoundation.org>2019-09-16 12:11:23 +0000
committerGerrit Code Review <gerrit@automotivelinux.org>2019-09-16 12:11:23 +0000
commitb8c33e115378478b1481f56f068ffba410dfea1c (patch)
treec8cf0d11fa400f99bcd47f753255d08240f35148 /mediaplayer
parent8bcc689eb4d31ecbbcf050cb5af32e8e72624732 (diff)
parent5d2e0d0e22b9c66a20518c21481f55f0ba0f63c8 (diff)
Merge "mediaplayer: clear metadata in consumer UI on media removal"
Diffstat (limited to 'mediaplayer')
-rw-r--r--mediaplayer/mediaplayer.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/mediaplayer/mediaplayer.cpp b/mediaplayer/mediaplayer.cpp
index 0ef7d34..96799dc 100644
--- a/mediaplayer/mediaplayer.cpp
+++ b/mediaplayer/mediaplayer.cpp
@@ -62,6 +62,22 @@ void Mediaplayer::updatePlaylist(QVariantMap playlist)
m_playlist.append(new Playlist(item));
}
+ if (m_playlist.count() == 0) {
+ QVariantMap tmp, track;
+
+ track.insert("title", "");
+ track.insert("artist", "");
+ track.insert("album", "");
+ track.insert("duration", 0);
+
+ tmp.insert("position", 0);
+ tmp.insert("track", track);
+
+ // clear metadata in UI
+ m_context->setContextProperty("AlbumArt", "");
+ emit metadataChanged(tmp);
+ }
+
// Refresh model
m_context->setContextProperty("MediaplayerModel", QVariant::fromValue(m_playlist));
}