diff options
author | Matt Ranostay <matt.ranostay@konsulko.com> | 2017-03-30 15:05:03 -0700 |
---|---|---|
committer | Matt Ranostay <matt.ranostay@konsulko.com> | 2017-04-14 10:56:21 -0700 |
commit | 4eee2655560fbb2f7724095bb7fa488f3f39ba55 (patch) | |
tree | f8903724e9890fd8163880d04a1f5545577ce3ed /app/MediaPlayer.qml | |
parent | 86affe07b3ec456c8c43651a7d009508dd64491a (diff) |
dbus: add signal support for removable media
Detect media insertation and removal from lightmediascanner
and update the playlist accordingly. This makes some assumptions
that only one media device will available at a time.
Bug-AGL: SPEC-484
Change-Id: I8300abce3ac09c9cd0327c9d90892e3c5171d8d2
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'app/MediaPlayer.qml')
-rw-r--r-- | app/MediaPlayer.qml | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/app/MediaPlayer.qml b/app/MediaPlayer.qml index 37c2ab1..dae74a0 100644 --- a/app/MediaPlayer.qml +++ b/app/MediaPlayer.qml @@ -24,6 +24,32 @@ import MediaPlayer 1.0 ApplicationWindow { id: root + function clearMetadata() { + title.text = '' + artist.text = '' + duration.text = player.time2str(0) + albumart.visible = false + } + + Connections { + target: dbus + onProcessPlaylistUpdate: { + playlist.clear() + playlist.addItems(mediaFiles) + + playlistmodel.setSource(playlist) + playlistview.visible = true + albumart.visible = true + } + + onProcessPlaylistHide: { + player.stop() + playlistview.visible = false + clearMetadata() + } + + } + MediaPlayer { id: player audioRole: MediaPlayer.MusicRole @@ -53,6 +79,7 @@ ApplicationWindow { Layout.preferredHeight: 1080 clip: true Image { + id: albumart anchors.left: parent.left anchors.right: parent.right anchors.bottom: parent.bottom @@ -178,17 +205,22 @@ ApplicationWindow { Layout.fillWidth: true Layout.fillHeight: true Layout.preferredHeight: 407 + + PlaylistWithMetadata { + id: playlistmodel + source: playlist + } + ListView { anchors.fill: parent + id: playlistview clip: true header: Label { x: 50 text: 'PLAYLIST' opacity: 0.5 } - model: PlaylistWithMetadata { - source: playlist - } + model: playlistmodel currentIndex: playlist.currentIndex delegate: MouseArea { |