2 * Copyright (C) 2016 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.
18 import QtQuick.Layouts 1.1
19 import QtQuick.Controls 2.0
20 import QtMultimedia 5.6
21 import AGL.Demo.Controls 1.0
22 import MediaPlayer 1.0
33 API.BluetoothManager {
41 running: (bluetooth.av_connected && bluetooth.state == "playing")
44 bluetooth.position = bluetooth.position + 250
45 slider.value = bluetooth.position
56 Layout.fillWidth: true
57 Layout.fillHeight: true
58 Layout.preferredHeight: 1080
62 anchors.left: parent.left
63 anchors.right: parent.right
64 anchors.bottom: parent.bottom
65 height: sourceSize.height * width / sourceSize.width
66 fillMode: Image.PreserveAspectCrop
67 source: player.cover_art ? player.cover_art : ''
68 visible: bluetooth.av_connected == false
72 anchors.left: parent.left
73 anchors.right: parent.right
74 anchors.bottom: parent.bottom
84 anchors.margins: root.width * 0.02
86 Layout.fillWidth: true
87 Layout.fillHeight: true
92 visible: bluetooth.connected == false
93 offImage: './images/AGL_MediaPlayer_Shuffle_Inactive.svg'
94 onImage: './images/AGL_MediaPlayer_Shuffle_Active.svg'
98 visible: bluetooth.connected == false
99 checked: player.loop_state
100 offImage: './images/AGL_MediaPlayer_Loop_Inactive.svg'
101 onImage: './images/AGL_MediaPlayer_Loop_Active.svg'
102 onClicked: { player.loop(checked) }
109 Layout.alignment: Layout.Center
110 text: bluetooth.av_connected ? bluetooth.title : (player.title ? player.title : '')
111 horizontalAlignment: Label.AlignHCenter
112 verticalAlignment: Label.AlignVCenter
115 Layout.alignment: Layout.Center
116 text: bluetooth.av_connected ? bluetooth.artist : (player.artist ? player.artist : '')
117 horizontalAlignment: Label.AlignHCenter
118 verticalAlignment: Label.AlignVCenter
119 font.pixelSize: title.font.pixelSize * 0.6
125 Layout.fillWidth: true
126 to: bluetooth.av_connected ? bluetooth.duration : player.duration
127 enabled: bluetooth.av_connected == false
128 value: bluetooth.av_connected ? bluetooth.position : player.position
129 function getPosition() {
130 if (bluetooth.av_connected) {
131 return player.time2str(bluetooth.position)
133 return player.time2str(player.position)
137 anchors.left: parent.left
138 anchors.bottom: parent.top
140 text: slider.getPosition()
144 anchors.right: parent.right
145 anchors.bottom: parent.top
147 text: bluetooth.av_connected ? player.time2str(bluetooth.duration) : player.time2str(player.duration)
149 onPressedChanged: player.seek(value)
152 Layout.fillHeight: true
154 // source: './images/AGL_MediaPlayer_Playlist_Inactive.svg'
157 // source: './images/AGL_MediaPlayer_CD_Inactive.svg'
159 Item { Layout.fillWidth: true }
162 offImage: './images/AGL_MediaPlayer_BackArrow.svg'
164 if (bluetooth.av_connected) {
165 bluetooth.sendMediaCommand("Previous")
166 bluetooth.position = 0
174 offImage: './images/AGL_MediaPlayer_Player_Play.svg'
176 if (bluetooth.av_connected) {
177 bluetooth.sendMediaCommand("Play")
184 when: player.running === true
187 offImage: './images/AGL_MediaPlayer_Player_Pause.svg'
188 onClicked: player.pause()
192 when: bluetooth.av_connected && bluetooth.state == "playing"
195 offImage: './images/AGL_MediaPlayer_Player_Pause.svg'
196 onClicked: bluetooth.sendMediaCommand("Pause")
204 offImage: './images/AGL_MediaPlayer_ForwardArrow.svg'
206 if (bluetooth.av_connected) {
207 bluetooth.sendMediaCommand("Next")
214 Item { Layout.fillWidth: true }
217 visible: bluetooth.connected
218 checked: bluetooth.av_connected
219 offImage: './images/AGL_MediaPlayer_Bluetooth_Inactive.svg'
220 onImage: './images/AGL_MediaPlayer_Bluetooth_Active.svg'
223 if (bluetooth.av_connected) {
224 bluetooth.disconnect_profiles()
226 bluetooth.connect_profiles()
235 Layout.fillWidth: true
236 Layout.fillHeight: true
237 Layout.preferredHeight: 407
242 visible: bluetooth.av_connected == false
252 delegate: MouseArea {
254 width: ListView.view.width
255 height: ListView.view.height / 4
258 anchors.leftMargin: 50
259 anchors.rightMargin: 50
261 Layout.fillWidth: true
263 Layout.fillWidth: true
267 Layout.fillWidth: true
274 // text: player.time2str(model.duration)
276 // font.pixelSize: 32
280 player.pick_track(playlistview.model.get(index).index)
285 highlight: Rectangle {