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
32 API.BluetoothManager {
40 running: (bluetooth.av_connected && bluetooth.state == "playing")
43 bluetooth.position = bluetooth.position + 250
44 slider.value = bluetooth.position
55 Layout.fillWidth: true
56 Layout.fillHeight: true
57 Layout.preferredHeight: 1080
61 anchors.left: parent.left
62 anchors.right: parent.right
63 anchors.bottom: parent.bottom
64 height: sourceSize.height * width / sourceSize.width
65 fillMode: Image.PreserveAspectCrop
66 source: player.cover_art ? player.cover_art : ''
67 visible: bluetooth.av_connected == false
71 anchors.left: parent.left
72 anchors.right: parent.right
73 anchors.bottom: parent.bottom
83 anchors.margins: root.width * 0.02
85 Layout.fillWidth: true
86 Layout.fillHeight: true
91 visible: bluetooth.connected == false
92 offImage: './images/AGL_MediaPlayer_Shuffle_Inactive.svg'
93 onImage: './images/AGL_MediaPlayer_Shuffle_Active.svg'
97 visible: bluetooth.connected == false
98 checked: player.loop_state
99 offImage: './images/AGL_MediaPlayer_Loop_Inactive.svg'
100 onImage: './images/AGL_MediaPlayer_Loop_Active.svg'
101 onClicked: { player.loop(checked) }
108 Layout.alignment: Layout.Center
109 text: bluetooth.av_connected ? bluetooth.title : (player.title ? player.title : '')
110 horizontalAlignment: Label.AlignHCenter
111 verticalAlignment: Label.AlignVCenter
114 Layout.alignment: Layout.Center
115 text: bluetooth.av_connected ? bluetooth.artist : (player.artist ? player.artist : '')
116 horizontalAlignment: Label.AlignHCenter
117 verticalAlignment: Label.AlignVCenter
118 font.pixelSize: title.font.pixelSize * 0.6
124 Layout.fillWidth: true
125 to: bluetooth.av_connected ? bluetooth.duration : player.duration
126 enabled: bluetooth.av_connected == false
127 value: bluetooth.av_connected ? bluetooth.position : player.position
128 function getPosition() {
129 if (bluetooth.av_connected) {
130 return player.time2str(bluetooth.position)
132 return player.time2str(player.position)
136 anchors.left: parent.left
137 anchors.bottom: parent.top
139 text: slider.getPosition()
143 anchors.right: parent.right
144 anchors.bottom: parent.top
146 text: bluetooth.av_connected ? player.time2str(bluetooth.duration) : player.time2str(player.duration)
148 onPressedChanged: player.seek(value)
151 Layout.fillHeight: true
153 // source: './images/AGL_MediaPlayer_Playlist_Inactive.svg'
156 // source: './images/AGL_MediaPlayer_CD_Inactive.svg'
158 Item { Layout.fillWidth: true }
161 offImage: './images/AGL_MediaPlayer_BackArrow.svg'
163 if (bluetooth.av_connected) {
164 bluetooth.sendMediaCommand("Previous")
165 bluetooth.position = 0
173 offImage: './images/AGL_MediaPlayer_Player_Play.svg'
175 if (bluetooth.av_connected) {
176 bluetooth.sendMediaCommand("Play")
183 when: player.running === true
186 offImage: './images/AGL_MediaPlayer_Player_Pause.svg'
187 onClicked: player.pause()
191 when: bluetooth.av_connected && bluetooth.state == "playing"
194 offImage: './images/AGL_MediaPlayer_Player_Pause.svg'
195 onClicked: bluetooth.sendMediaCommand("Pause")
203 offImage: './images/AGL_MediaPlayer_ForwardArrow.svg'
205 if (bluetooth.av_connected) {
206 bluetooth.sendMediaCommand("Next")
213 Item { Layout.fillWidth: true }
216 visible: bluetooth.connected
217 checked: bluetooth.av_connected
218 offImage: './images/AGL_MediaPlayer_Bluetooth_Inactive.svg'
219 onImage: './images/AGL_MediaPlayer_Bluetooth_Active.svg'
222 if (bluetooth.av_connected) {
223 bluetooth.disconnect_profiles()
225 bluetooth.connect_profiles()
234 Layout.fillWidth: true
235 Layout.fillHeight: true
236 Layout.preferredHeight: 407
241 visible: bluetooth.av_connected == false
251 delegate: MouseArea {
253 width: ListView.view.width
254 height: ListView.view.height / 4
257 anchors.leftMargin: 50
258 anchors.rightMargin: 50
260 Layout.fillWidth: true
262 Layout.fillWidth: true
266 Layout.fillWidth: true
273 // text: player.time2str(model.duration)
275 // font.pixelSize: 32
279 player.pick_track(playlistview.model.get(index).index)
284 highlight: Rectangle {