2 * Copyright (C) 2018 The Qt Company Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 import QtQuick.Layouts 1.1
18 import QtQuick.Controls 2.0
19 import QtMultimedia 5.6
20 import AGL.Demo.Controls 1.0
30 property var titles: Object
32 playlist.addItem(media.path)
33 titles[media.path] = media.title
36 playlist.removeItem(index)
42 audioRole: MediaPlayer.MusicRole
45 function time2str(value) {
46 return Qt.formatTime(new Date(value), 'mm:ss')
48 onPositionChanged: slider.value = player.position
53 playbackMode: Playlist.Loop
55 // PlaylistItem { source: 'file:///home/root/Videos/Qt_Mashup_DO_NOT_MODIFY.mp4' }
56 // PlaylistItem { source: 'file:///home/root/Videos/Qt_is_everywhere-071116.mp4' }
62 Layout.fillWidth: true
63 Layout.fillHeight: true
64 Layout.preferredHeight: 1080
68 anchors.top: parent.top
69 anchors.left: parent.left
70 anchors.right: parent.right
71 anchors.bottom: controls.top
82 anchors.left: parent.left
83 anchors.right: parent.right
84 anchors.bottom: parent.bottom
94 anchors.margins: root.width * 0.02
96 Layout.fillWidth: true
97 Layout.fillHeight: true
102 offImage: './images/AGL_MediaPlayer_Shuffle_Inactive.svg'
103 onImage: './images/AGL_MediaPlayer_Shuffle_Active.svg'
107 offImage: './images/AGL_MediaPlayer_Loop_Inactive.svg'
108 onImage: './images/AGL_MediaPlayer_Loop_Active.svg'
115 Layout.alignment: Layout.Center
116 text: player.metaData.title ? player.metaData.title : ''
117 horizontalAlignment: Label.AlignHCenter
118 verticalAlignment: Label.AlignVCenter
122 Layout.alignment: Layout.Center
123 text: player.metaData.author ? player.metaData.author : ''
124 horizontalAlignment: Label.AlignHCenter
125 verticalAlignment: Label.AlignVCenter
126 font.pixelSize: title.font.pixelSize * 0.6
132 Layout.fillWidth: true
136 anchors.left: parent.left
137 anchors.bottom: parent.top
139 text: player.time2str(player.position)
143 anchors.right: parent.right
144 anchors.bottom: parent.top
146 text: player.time2str(player.duration)
148 onPressedChanged: player.seek(value)
151 Layout.fillHeight: true
152 Item { Layout.fillWidth: true }
154 offImage: './images/AGL_MediaPlayer_BackArrow.svg'
155 onClicked: playlist.previous()
159 offImage: './images/AGL_MediaPlayer_Player_Play.svg'
160 onClicked: player.play()
163 when: player.playbackState === MediaPlayer.PlayingState
166 offImage: './images/AGL_MediaPlayer_Player_Pause.svg'
167 onClicked: player.pause()
173 offImage: './images/AGL_MediaPlayer_ForwardArrow.svg'
174 onClicked: playlist.next()
177 Item { Layout.fillWidth: true }
183 Layout.fillWidth: true
184 Layout.fillHeight: true
185 Layout.preferredHeight: 407
195 currentIndex: playlist.currentIndex
197 delegate: MouseArea {
199 width: ListView.view.width
200 height: ListView.view.height / 4
203 anchors.leftMargin: 50
204 anchors.rightMargin: 50
206 Layout.fillWidth: true
208 Layout.fillWidth: true
209 text: scanner.titles[model.source] ? scanner.titles[model.source] : model.source.toString().split('/').reverse()[0]
213 text: player.time2str(model.duration)
218 property var m: model
220 playlist.currentIndex = model.index
225 highlight: Rectangle {