on xenial help sign in
fix issues from reviews, finetune progress bar design
3ef6e98Michael Zanetti
Dash/DashPreview.qml+2
@@ -25,6 +25,7 @@ Item {
25 property alias showProcessingAction: waitingForActionMouseArea.enabled
25 property alias showProcessingAction: waitingForActionMouseArea.enabled
26
26
27 property real previewWidthRatio: 0.5
27 property real previewWidthRatio: 0.5
28+ property bool isCurrent: false
28
29
29 property Component previewImages
30 property Component previewImages
30 property Component header
31 property Component header
@@ -36,6 +37,7 @@ Item {
36 readonly property int columnWidth: narrowMode ? contentRow.width : (contentRow.width / 3) - contentRow.spacing
37 readonly property int columnWidth: narrowMode ? contentRow.width : (contentRow.width / 3) - contentRow.spacing
37 readonly property int contentSpacing: units.gu(3)
38 readonly property int contentSpacing: units.gu(3)
38
39
40+
39 clip: true
41 clip: true
40
42
41 function ensureVisible(item) {
43 function ensureVisible(item) {
Dash/GenericScopeView.qml+6
@@ -484,6 +484,12 @@ ScopeView {
484 }
484 }
485 }
485 }
486
486
487+ Binding {
488+ target: item
489+ property: "isCurrent"
490+ value: previewListView.currentIndex == index
491+ }
492+
487 function closePreviewSpinner() {
493 function closePreviewSpinner() {
488 if(item) {
494 if(item) {
489 item.showProcessingAction = false;
495 item.showProcessingAction = false;
Dash/Music/MusicPreview.qml+36−10
@@ -55,6 +55,13 @@ GenericPreview {
55 Column {
55 Column {
56 height: childrenRect.height
56 height: childrenRect.height
57
57
58+ ThinDivider {
59+ anchors {
60+ left: parent.left
61+ right: parent.right
62+ }
63+ }
64+
58 Repeater {
65 Repeater {
59 id: trackRepeater
66 id: trackRepeater
60
67
@@ -115,23 +122,29 @@ GenericPreview {
115 styleColor: "black"
122 styleColor: "black"
116 elide: Text.ElideRight
123 elide: Text.ElideRight
117
124
118− // FIXME: get color values from design
119 UbuntuShape {
125 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
121 anchors {
139 anchors {
122 left: parent.left
140 left: parent.left
123 top: parent.bottom
141 top: parent.bottom
124 right: parent.right
142 right: parent.right
125− topMargin: units.dp(3)
126 }
143 }
127− height: units.dp(2)
144+ height: units.dp(6)
128 visible: audioPlayer.playbackState != Audio.StoppedState
145 visible: audioPlayer.playbackState != Audio.StoppedState
146+ source: "graphics/music_progress_bg.png"
129
147
130− UbuntuShape {
131− color: "#dd4814"
132− anchors.fill: parent
133− anchors.rightMargin: parent.width - (parent.width * audioPlayer.percent / 100)
134− }
135 }
148 }
136 }
149 }
137 Label {
150 Label {
@@ -161,8 +174,21 @@ GenericPreview {
161 id: audioPlayer
174 id: audioPlayer
162 source: uri
175 source: uri
163 property real percent: audioPlayer.position * 100 / audioPlayer.duration
176 property real percent: audioPlayer.position * 100 / audioPlayer.duration
164− onPositionChanged: print("got percent", percent, position, duration)
165
177
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+ }
166 }
192 }
167 Connections {
193 Connections {
168 target: trackRepeater
194 target: trackRepeater
plugins/Unity/musicpreview.cpp+1−1
@@ -39,7 +39,7 @@ void MusicPreview::setUnityPreview(unity::dash::Preview::Ptr unityPreview)
39 Q_EMIT tracksChanged();
39 Q_EMIT tracksChanged();
40}
40}
41
41
42−MusicPreviewTrackModel *MusicPreview::tracks() const
42+MusicPreviewTrackModel* MusicPreview::tracks() const
43{
43{
44 if (m_unityMusicPreview == nullptr) {
44 if (m_unityMusicPreview == nullptr) {
45 qWarning() << "Preview not set";
45 qWarning() << "Preview not set";