From 5d2e0d0e22b9c66a20518c21481f55f0ba0f63c8 Mon Sep 17 00:00:00 2001 From: Matt Ranostay Date: Thu, 12 Sep 2019 21:49:16 -0700 Subject: mediaplayer: clear metadata in consumer UI on media removal On storage removal the metadata displayed for the media playing should be cleared in consumer UI Bug-AGL: SPEC-1430 Change-Id: I9824c94cf81fc0beb0cc278ac980813e906efbe8 Signed-off-by: Matt Ranostay --- mediaplayer/mediaplayer.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'mediaplayer') 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)); } -- cgit 1.2.3-korg