diff options
author | Jan-Simon Moeller <jsmoeller@linuxfoundation.org> | 2019-09-16 12:11:23 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@automotivelinux.org> | 2019-09-16 12:11:23 +0000 |
commit | b8c33e115378478b1481f56f068ffba410dfea1c (patch) | |
tree | c8cf0d11fa400f99bcd47f753255d08240f35148 | |
parent | 8bcc689eb4d31ecbbcf050cb5af32e8e72624732 (diff) | |
parent | 5d2e0d0e22b9c66a20518c21481f55f0ba0f63c8 (diff) |
Merge "mediaplayer: clear metadata in consumer UI on media removal"
-rw-r--r-- | mediaplayer/mediaplayer.cpp | 16 |
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)); } |