X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=app%2FMediaPlayer.qml;h=eab5bb4284d36e4b0525bdfeebfe0280d2169962;hb=345ce20f83f26cd5dfa1eed48ec1227b1233d670;hp=7dfaf06a09b2f57ddbdab08b91b242372dbb982e;hpb=04ae48a26ece6b6e21010f3d187f173837f99c23;p=apps%2Fmediaplayer.git diff --git a/app/MediaPlayer.qml b/app/MediaPlayer.qml index 7dfaf06..eab5bb4 100644 --- a/app/MediaPlayer.qml +++ b/app/MediaPlayer.qml @@ -133,24 +133,10 @@ ApplicationWindow { Connections { target: mediaplayer - onPlaylistChanged: { - playlist_model.clear(); - - for (var i = 0; i < playlist.list.length; i++) { - var item = playlist.list[i] - - playlist_model.append({ "index": item.index, "artist": item.artist ? item.artist : '', "title": item.title ? item.title : '' }) - - if (item.selected) { - playlistview.currentIndex = i - } - } - } - onMetadataChanged: { - player.title = metadata.title - player.album = metadata.album - player.artist = metadata.artist + player.title = metadata.title ? metadata.title : "" + player.album = metadata.album ? metadata.album : "" + player.artist = metadata.artist ? metadata.artist : "" if (metadata.duration) { player.duration = metadata.duration @@ -182,10 +168,6 @@ ApplicationWindow { } } - ListModel { - id: playlist_model - } - ColumnLayout { anchors.fill: parent Item { @@ -392,7 +374,7 @@ ApplicationWindow { text: 'PLAYLIST' opacity: 0.5 } - model: playlist_model + model: MediaplayerModel currentIndex: -1 delegate: MouseArea { @@ -423,7 +405,7 @@ ApplicationWindow { //} } onClicked: { - mediaplayer.picktrack(playlistview.model.get(index).index) + mediaplayer.picktrack(playlistview.model[index].index) } }