- Item {
- id: bluetooth
- property bool connected: false
- property string state
-
- property string artist
- property string title
- property int duration: 0
- property int position: 0
- property int pos_offset: 0
-
- function disableBluetooth() {
- bluetooth.artist = ''
- bluetooth.title = ''
- bluetooth.duration = 0
- bluetooth.position = 0
- bluetooth.pos_offset = 0
- bluetooth.connected = false
- }
- }
-
- Connections {
- target: dbus
-
- onStopPlayback: {
- player.stop()
- playlist.clear()
- playlistmodel.setSource(playlist)
- playlistview.visible = false
- }
-
- onProcessPlaylistUpdate: {
- playlist.clear()
- playlist.addItems(mediaFiles)
-
- playlistmodel.setSource(playlist)
- playlistview.visible = bluetooth.connected == false
- }
-
- onProcessPlaylistHide: {
- playlistview.visible = false
- player.stop()
- }
-
- onProcessPlaylistShow: {
- playlistview.visible = true
- bluetooth.disableBluetooth()
- }
-
- onDisplayBluetoothMetadata: {
- if (avrcp_artist)
- bluetooth.artist = avrcp_artist
- if (avrcp_title)
- bluetooth.title = avrcp_title
- bluetooth.duration = avrcp_duration
- bluetooth.pos_offset = 0
- }
-
- onUpdatePlayerStatus: {
- bluetooth.connected = true
- bluetooth.state = status
- }
-
- onUpdatePosition: {
- slider.value = current_position
- bluetooth.position = current_position
- }
- }
-
- MediaPlayer {