@@ -1,203 +0,0 @@
2− * Copyright (C) 2013 Canonical, Ltd.
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
18−import QtMultimedia 5.0
19−import Ubuntu.Components 0.1
20−import Ubuntu.Components.ListItems 0.1
23−import "../../Components"
29− previewImages: previewImageComponent
30− header: headerComponent
31− description: descriptionComponent
34− id: previewImageComponent
38− source: previewData ? previewData.image : ""
39− initialHeight: height
47− title: previewData.title
48− subtitle: previewData.subtitle
53− id: descriptionComponent
56− height: childrenRect.height
59− objectName: "audioPlayer"
60− property real progress: audioPlayer.position / audioPlayer.duration
62− property Item playingItem
64− Component.onDestruction: {
68− onErrorStringChanged: console.warn("Audio player error:", errorString)
74− onIsCurrentChanged: {
75− if (!root.isCurrent) {
82− anchors { left: parent.left; right: parent.right }
83− visible: trackRepeater.count > 0
86− objectName: "topDivider"
87− anchors { left: parent.left; right: parent.right }
92− objectName: "trackRepeater"
94− model: previewData.tracks
98− objectName: "trackItem" + index
99− anchors { left: parent.left; right: parent.right }
101− property bool isPlayingItem: audioPlayer.playingItem == trackItem
105− // Make sure we change the source, even if two items point to the same uri location
106− audioPlayer.source = "";
107− audioPlayer.source = model.uri;
108− audioPlayer.playingItem = trackItem;
115− spacing: units.gu(1)
116− property int column1Width: units.gu(3)
117− property int column2Width: width - (2 * spacing) - column1Width - column3Width
118− property int column3Width: units.gu(4)
119− anchors.verticalCenter: parent.verticalCenter
122− objectName: "playButton"
123− width: trackRow.column1Width
125− iconSource: audioPlayer.playbackState == Audio.PlayingState && trackItem.isPlayingItem ? "image://theme/media-playback-pause" : "image://theme/media-playback-start"
127− // Can't be "transparent" or "#00xxxxxx" as the button optimizes away the surrounding shape
128− // FIXME when this is resolved: https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1251685
132− if (trackItem.isPlayingItem) {
133− if (audioPlayer.playbackState == Audio.PlayingState) {
134− audioPlayer.pause();
135− } else if (audioPlayer.playbackState == Audio.PausedState){
145− objectName: "trackTitleLabel"
149− horizontalAlignment: Text.AlignLeft
150− anchors.verticalCenter: parent.verticalCenter
151− width: parent.column2Width
155− elide: Text.ElideRight
159− objectName: "progressBarFill"
160− color: UbuntuColors.orange
161− anchors.left: progressBarImage.left
162− anchors.right: progressBarImage.right
163− anchors.verticalCenter: progressBarImage.verticalCenter
165− anchors.margins: units.dp(2)
166− anchors.rightMargin: maxWidth - (maxWidth * audioPlayer.progress) + units.dp(2)
167− visible: progressBarImage.visible
168− property int maxWidth: progressBarImage.width - units.dp(4)
172− id: progressBarImage
173− anchors { left: parent.left; top: parent.bottom; right: parent.right }
175− visible: audioPlayer.playbackState != Audio.StoppedState && trackItem.isPlayingItem && model.length.length > 0
176− source: "graphics/music_progress_bg.png"
182− objectName: "timeLabel"
186− anchors.verticalCenter: parent.verticalCenter
187− horizontalAlignment: Text.AlignRight
188− width: parent.column3Width
196− anchors { left: parent.left; bottom: parent.bottom; right: parent.right }