@@ -0,0 +1,175 @@
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
61+ model: previewData.tracks
63+ signal stopPlayback()
66+ objectName: "trackItem" + index
73+ property int column1Width: units.gu(3)
74+ property int column2Width: width - (2 * spacing) - column1Width - column3Width
75+ property int column3Width: units.gu(4)
76+ anchors.verticalCenter: parent.verticalCenter
80+ width: trackRow.column1Width
85+ anchors.centerIn: playButtonShape
86+ name: audioPlayer.playbackState == Audio.PlayingState ? "media-playback-pause" : "media-playback-start"
93+ if (audioPlayer.playbackState == Audio.PlayingState) {
95+ } else if (audioPlayer.playbackState == Audio.PausedState){
98+ trackRepeater.stopPlayback();
106+ objectName: "trackTitleLabel"
110+ horizontalAlignment: Text.AlignLeft
111+ anchors.verticalCenter: parent.verticalCenter
112+ width: parent.column2Width
116+ elide: Text.ElideRight
118+ // FIXME: get color values from design
125+ topMargin: units.dp(3)
128+ visible: audioPlayer.playbackState != Audio.StoppedState
132+ anchors.fill: parent
133+ anchors.rightMargin: parent.width - (parent.width * audioPlayer.percent / 100)
139+ objectName: "timeLabel"
143+ anchors.verticalCenter: parent.verticalCenter
144+ horizontalAlignment: Text.AlignRight
145+ width: parent.column3Width
155+ bottom: parent.bottom
163+ property real percent: audioPlayer.position * 100 / audioPlayer.duration
164+ onPositionChanged: print("got percent", percent, position, duration)
168+ target: trackRepeater
169+ onStopPlayback: audioPlayer.stop();