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
54 Layout.fillWidth: true
55 Layout.fillHeight: true
56 Layout.preferredHeight: 1080
60 anchors.left: parent.left
61 anchors.right: parent.right
62 anchors.bottom: parent.bottom
63 height: sourceSize.height * width / sourceSize.width
64 fillMode: Image.PreserveAspectCrop
65 source: player.cover_art ? player.cover_art : ''
66 visible: bluetooth.av_connected == false
70 anchors.left: parent.left
71 anchors.right: parent.right
72 anchors.bottom: parent.bottom
82 anchors.margins: root.width * 0.02
84 Layout.fillWidth: true
85 Layout.fillHeight: true
90 // visible: bluetooth.connected == false
91 // offImage: './images/AGL_MediaPlayer_Shuffle_Inactive.svg'
92 // onImage: './images/AGL_MediaPlayer_Shuffle_Active.svg'
96 visible: bluetooth.connected == false
97 checked: player.loop_state
98 offImage: './images/AGL_MediaPlayer_Loop_Inactive.svg'
99 onImage: './images/AGL_MediaPlayer_Loop_Active.svg'
100 onClicked: { player.loop(checked) }
107 Layout.alignment: Layout.Center
108 text: bluetooth.av_connected ? bluetooth.title : (player.title ? player.title : '')
109 horizontalAlignment: Label.AlignHCenter
110 verticalAlignment: Label.AlignVCenter
113 Layout.alignment: Layout.Center
114 text: bluetooth.av_connected ? bluetooth.artist : (player.artist ? player.artist : '')
115 horizontalAlignment: Label.AlignHCenter
116 verticalAlignment: Label.AlignVCenter
117 font.pixelSize: title.font.pixelSize * 0.6
123 Layout.fillWidth: true
124 to: bluetooth.av_connected ? bluetooth.duration : player.duration
125 enabled: bluetooth.av_connected == false
126 value: bluetooth.av_connected ? bluetooth.position : player.position
127 function getPosition() {
128 if (bluetooth.av_connected) {
129 return player.time2str(bluetooth.position)
131 return player.time2str(player.position)
135 anchors.left: parent.left
136 anchors.bottom: parent.top
138 text: slider.getPosition()
142 anchors.right: parent.right
143 anchors.bottom: parent.top
145 text: bluetooth.av_connected ? player.time2str(bluetooth.duration) : player.time2str(player.duration)
147 onPressedChanged: player.seek(value)
150 Layout.fillHeight: true
152 // source: './images/AGL_MediaPlayer_Playlist_Inactive.svg'
155 // source: './images/AGL_MediaPlayer_CD_Inactive.svg'
157 Item { Layout.fillWidth: true }
160 offImage: './images/AGL_MediaPlayer_BackArrow.svg'
162 if (bluetooth.av_connected) {
163 bluetooth.sendMediaCommand("Previous")
164 bluetooth.position = 0
172 offImage: './images/AGL_MediaPlayer_Player_Play.svg'
174 if (bluetooth.av_connected) {
175 bluetooth.sendMediaCommand("Play")
182 when: player.running === true
185 offImage: './images/AGL_MediaPlayer_Player_Pause.svg'
186 onClicked: player.pause()
190 when: bluetooth.av_connected && bluetooth.state == "playing"
193 offImage: './images/AGL_MediaPlayer_Player_Pause.svg'
194 onClicked: bluetooth.sendMediaCommand("Pause")
202 offImage: './images/AGL_MediaPlayer_ForwardArrow.svg'
204 if (bluetooth.av_connected) {
205 bluetooth.sendMediaCommand("Next")
212 Item { Layout.fillWidth: true }
215 visible: bluetooth.connected
216 checked: bluetooth.av_connected
217 offImage: './images/AGL_MediaPlayer_Bluetooth_Inactive.svg'
218 onImage: './images/AGL_MediaPlayer_Bluetooth_Active.svg'
221 if (bluetooth.av_connected) {
222 bluetooth.disconnect_profiles()
224 bluetooth.connect_profiles()
233 Layout.fillWidth: true
234 Layout.fillHeight: true
235 Layout.preferredHeight: 407
240 visible: bluetooth.av_connected == false
250 delegate: MouseArea {
252 width: ListView.view.width
253 height: ListView.view.height / 4
256 anchors.leftMargin: 50
257 anchors.rightMargin: 50
259 Layout.fillWidth: true
261 Layout.fillWidth: true
265 Layout.fillWidth: true
272 // text: player.time2str(model.duration)
274 // font.pixelSize: 32
278 player.pick_track(playlistview.model.get(index).index)
283 highlight: Rectangle {