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
27 audioRole: MediaPlayer.MusicRole
30 function time2str(value) {
31 return Qt.formatTime(new Date(value), 'mm:ss')
33 onPositionChanged: slider.value = player.position
38 playbackMode: Playlist.Loop
40 // PlaylistItem { source: 'file:///home/root/Videos/Qt_Mashup_DO_NOT_MODIFY.mp4' }
41 // PlaylistItem { source: 'file:///home/root/Videos/Qt_is_everywhere-071116.mp4' }
47 Layout.fillWidth: true
48 Layout.fillHeight: true
49 Layout.preferredHeight: 1080
53 anchors.top: parent.top
54 anchors.left: parent.left
55 anchors.right: parent.right
56 anchors.bottom: controls.top
67 anchors.left: parent.left
68 anchors.right: parent.right
69 anchors.bottom: parent.bottom
79 anchors.margins: root.width * 0.02
81 Layout.fillWidth: true
82 Layout.fillHeight: true
87 offImage: './images/AGL_MediaPlayer_Shuffle_Inactive.svg'
88 onImage: './images/AGL_MediaPlayer_Shuffle_Active.svg'
92 offImage: './images/AGL_MediaPlayer_Loop_Inactive.svg'
93 onImage: './images/AGL_MediaPlayer_Loop_Active.svg'
100 Layout.alignment: Layout.Center
101 text: player.metaData.title ? player.metaData.title : ''
102 horizontalAlignment: Label.AlignHCenter
103 verticalAlignment: Label.AlignVCenter
107 Layout.alignment: Layout.Center
108 text: player.metaData.author ? player.metaData.author : ''
109 horizontalAlignment: Label.AlignHCenter
110 verticalAlignment: Label.AlignVCenter
111 font.pixelSize: title.font.pixelSize * 0.6
117 Layout.fillWidth: true
121 anchors.left: parent.left
122 anchors.bottom: parent.top
124 text: player.time2str(player.position)
128 anchors.right: parent.right
129 anchors.bottom: parent.top
131 text: player.time2str(player.duration)
133 onPressedChanged: player.seek(value)
136 Layout.fillHeight: true
137 Item { Layout.fillWidth: true }
139 offImage: './images/AGL_MediaPlayer_BackArrow.svg'
140 onClicked: playlist.previous()
144 offImage: './images/AGL_MediaPlayer_Player_Play.svg'
145 onClicked: player.play()
148 when: player.playbackState === MediaPlayer.PlayingState
151 offImage: './images/AGL_MediaPlayer_Player_Pause.svg'
152 onClicked: player.pause()
158 offImage: './images/AGL_MediaPlayer_ForwardArrow.svg'
159 onClicked: playlist.next()
162 Item { Layout.fillWidth: true }
168 Layout.fillWidth: true
169 Layout.fillHeight: true
170 Layout.preferredHeight: 407
180 currentIndex: playlist.currentIndex
182 delegate: MouseArea {
184 width: ListView.view.width
185 height: ListView.view.height / 4
188 anchors.leftMargin: 50
189 anchors.rightMargin: 50
191 Layout.fillWidth: true
193 Layout.fillWidth: true
194 text: model.source.toString().split('/').reverse()[0]
198 text: player.time2str(model.duration)
203 property var m: model
205 playlist.currentIndex = model.index
210 highlight: Rectangle {