@@ -55,6 +55,13 @@ GenericPreview {
5555 Column {
5656 height: childrenRect.height
5757
58+ ThinDivider {
59+ anchors {
60+ left: parent.left
61+ right: parent.right
62+ }
63+ }
64+
5865 Repeater {
5966 id: trackRepeater
6067
@@ -115,23 +122,29 @@ GenericPreview {
115122 styleColor: "black"
116123 elide: Text.ElideRight
117124
118− // FIXME: get color values from design
119125 UbuntuShape {
120− color: "#66000000"
126+ id: progressBarFill
127+ color: UbuntuColors.orange
128+ anchors.left: progressBarImage.left
129+ anchors.right: progressBarImage.right
130+ anchors.verticalCenter: progressBarImage.verticalCenter
131+ height: units.dp(2)
132+ anchors.margins: units.dp(2)
133+ anchors.rightMargin: maxWidth - (maxWidth * audioPlayer.percent / 100) + units.dp(2)
134+ visible: progressBarImage.visible
135+ property int maxWidth: progressBarImage.width - units.dp(4)
136+ }
137+ Image {
138+ id: progressBarImage
121139 anchors {
122140 left: parent.left
123141 top: parent.bottom
124142 right: parent.right
125− topMargin: units.dp(3)
126143 }
127− height: units.dp(2)
144+ height: units.dp(6)
128145 visible: audioPlayer.playbackState != Audio.StoppedState
146+ source: "graphics/music_progress_bg.png"
129147
130− UbuntuShape {
131− color: "#dd4814"
132− anchors.fill: parent
133− anchors.rightMargin: parent.width - (parent.width * audioPlayer.percent / 100)
134− }
135148 }
136149 }
137150 Label {
@@ -161,8 +174,21 @@ GenericPreview {
161174 id: audioPlayer
162175 source: uri
163176 property real percent: audioPlayer.position * 100 / audioPlayer.duration
164− onPositionChanged: print("got percent", percent, position, duration)
165177
178+ Component.onDestruction: {
179+ audioPlayer.stop();
180+ }
181+
182+ onErrorStringChanged: print("Audio player error:", errorString)
183+
184+ }
185+ Connections {
186+ target: root
187+ onIsCurrentChanged: {
188+ if (!root.isCurrent) {
189+ audioPlayer.stop();
190+ }
191+ }
166192 }
167193 Connections {
168194 target: trackRepeater