- 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 {
- id: player
- audioRole: MediaPlayer.MusicRole
- autoLoad: true
- playlist: playlist
-
- property bool is_bluetooth: false
- function time2str(value) {
- return Qt.formatTime(new Date(value), 'mm:ss')
- }
- onPositionChanged: slider.value = player.position