Merge lp:~kill-animals/music-app/remix-now-playing-main-view-with-controls into lp:~vthompson/music-app/remix-now-playing-main-view

Proposed by Kill Animals
Status: Merged
Approved by: Victor Thompson
Approved revision: 646
Merge reported by: Victor Thompson
Merged at revision: not available
Proposed branch: lp:~kill-animals/music-app/remix-now-playing-main-view-with-controls
Merge into: lp:~vthompson/music-app/remix-now-playing-main-view
Diff against target: 287 lines (+266/-0)
2 files modified
MusicNowPlaying.qml (+265/-0)
music-app.qml (+1/-0)
To merge this branch: bzr merge lp:~kill-animals/music-app/remix-now-playing-main-view-with-controls
Reviewer Review Type Date Requested Status
Victor Thompson Approve
Review via email: mp+237024@code.launchpad.net

Commit message

* Add play controls to the full view of the Now Playing page

Description of the change

This adds the controls to the main view, and looks like this:

http://i.imgur.com/KvwQTBE.png

There it is a sub component of that page, and is anchored to the bottom of the blurred image, with a units.gu(6) margin.

The visibility of the bottom toolbar has been tied to the

isListView bool property

Note: There is a bug pertaining to this, as I will point out in his merge.

To post a comment you must log in.
646. By Akiva Avraham <akiva@akiva-ThinkPad-X230>

Removed Custom Slider, replaced it with the proper one. SIGNIFICANTLY improved how this thing works.

Revision history for this message
Victor Thompson (vthompson) wrote :

This is how the changes look on a Nexus 4: http://i.imgur.com/Olz9OIT.png

In my merge proposal I'm going to make the blurred background used on the Now Playing page smaller. That should help you a bit.

One thing you'll need to fix, or I'll need to work around temporarily, is that if the user switches to the "full view" and hits back, the tool bar is hidden when it shouldn't be.

review: Needs Fixing
Revision history for this message
Victor Thompson (vthompson) wrote :

Actually, perhaps I'll merge this in as requested and tweak as necessary. Thanks!

review: Approve
Revision history for this message
Kill Animals (kill-animals) wrote :

Hey come on irc; I am still working on the patch, eliminating a few more components.

#ubuntu-app-devel akiva-thinkpad

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'MusicNowPlaying.qml'
--- MusicNowPlaying.qml 2014-10-03 05:08:08 +0000
+++ MusicNowPlaying.qml 2014-10-03 12:19:14 +0000
@@ -110,6 +110,271 @@
110 "&album=" + player.currentMetaAlbum)110 "&album=" + player.currentMetaAlbum)
111 : player.currentMetaArt111 : player.currentMetaArt
112 }112 }
113
114 /* Full toolbar */
115 Item {
116 id: musicToolbarFullContainer
117 anchors.top: blurredBackground.bottom
118 anchors.topMargin: units.gu(6)
119 width: blurredBackground.width
120
121 /* Column for labels in wideAspect */
122 Column {
123 id: nowPlayingWideAspectLabels
124 anchors {
125 horizontalCenter: parent.horizontalCenter
126 left: parent.left
127 leftMargin: units.gu(2)
128 right: parent.right
129 rightMargin: units.gu(2)
130 }
131
132 /* Title of track */
133 Label {
134 id: nowPlayingWideAspectTitle
135 anchors {
136 left: parent.left
137 leftMargin: units.gu(1)
138 right: parent.right
139 rightMargin: units.gu(1)
140 }
141 color: styleMusic.playerControls.labelColor
142 elide: Text.ElideRight
143 fontSize: "x-large"
144 objectName: "playercontroltitle"
145 text: trackQueue.model.count === 0 ? "" : player.currentMetaTitle === "" ? player.currentMetaFile : player.currentMetaTitle
146 }
147
148 /* Artist of track */
149 Label {
150 id: nowPlayingWideAspectArtist
151 anchors {
152 left: parent.left
153 leftMargin: units.gu(1)
154 right: parent.right
155 rightMargin: units.gu(1)
156 }
157 color: styleMusic.nowPlaying.labelSecondaryColor
158 elide: Text.ElideRight
159 fontSize: "small"
160 text: trackQueue.model.count === 0 ? "" : player.currentMetaArtist
161 }
162
163 /* Album of track */
164 Label {
165 id: nowPlayingWideAspectAlbum
166 anchors {
167 left: parent.left
168 leftMargin: units.gu(1)
169 right: parent.right
170 rightMargin: units.gu(1)
171 }
172 color: styleMusic.nowPlaying.labelSecondaryColor
173 elide: Text.ElideRight
174 fontSize: "small"
175 text: trackQueue.model.count === 0 ? "" : player.currentMetaAlbum
176 }
177 }
178
179 /* Progress bar component */
180 MouseArea {
181 id: musicToolbarFullProgressContainer
182 anchors.left: parent.left
183 anchors.leftMargin: units.gu(3)
184 anchors.right: parent.right
185 anchors.rightMargin: units.gu(3)
186 anchors.top: nowPlayingWideAspectLabels.bottom
187 anchors.topMargin: units.gu(3)
188 height: units.gu(3)
189 width: parent.width
190 z: 1
191
192 /* Position label */
193 Label {
194 id: musicToolbarFullPositionLabel
195 anchors.top: progressSliderMusic.bottom
196 anchors.left: parent.left
197 color: styleMusic.nowPlaying.labelSecondaryColor
198 fontSize: "small"
199 height: parent.height
200 horizontalAlignment: Text.AlignHCenter
201 text: durationToString(player.position)
202 verticalAlignment: Text.AlignVCenter
203 width: units.gu(3)
204 }
205
206 Slider {
207 id: progressSliderMusic
208 anchors.left: parent.left
209 anchors.right: parent.right
210 function formatValue(v) { return durationToString(v) }
211
212 property bool seeking: false
213
214 onSeekingChanged: {
215 if (seeking === false) {
216 musicToolbarFullPositionLabel.text = durationToString(player.position)
217 }
218 }
219
220 onPressedChanged: {
221 seeking = pressed
222 if (!pressed) {
223 player.seek(value)
224 }
225 }
226
227 Connections {
228 target: player
229 onDurationChanged: {
230 musicToolbarFullDurationLabel.text = durationToString(player.duration)
231 progressSliderMusic.maximumValue = player.duration
232 }
233 onPositionChanged: {
234 if (progressSliderMusic.seeking === false) {
235 progressSliderMusic.value = player.position
236 musicToolbarFullPositionLabel.text = durationToString(player.position)
237 musicToolbarFullDurationLabel.text = durationToString(player.duration)
238 }
239 }
240 onStopped: {
241 musicToolbarFullPositionLabel.text = durationToString(0);
242 musicToolbarFullDurationLabel.text = durationToString(0);
243 }
244 }
245 }
246
247 /* Duration label */
248 Label {
249 id: musicToolbarFullDurationLabel
250 anchors.top: progressSliderMusic.bottom
251 anchors.right: parent.right
252 color: styleMusic.nowPlaying.labelSecondaryColor
253 fontSize: "small"
254 height: parent.height
255 horizontalAlignment: Text.AlignHCenter
256 text: durationToString(player.duration)
257 verticalAlignment: Text.AlignVCenter
258 width: units.gu(3)
259 }
260 }
261
262 /* Repeat button */
263 MouseArea {
264 id: nowPlayingRepeatButton
265 objectName: "repeatShape"
266 anchors.right: nowPlayingPreviousButton.left
267 anchors.rightMargin: units.gu(1)
268 anchors.verticalCenter: nowPlayingPlayButton.verticalCenter
269 height: units.gu(6)
270 opacity: player.repeat && !emptyPage.noMusic ? 1 : .4
271 width: height
272 onClicked: player.repeat = !player.repeat
273
274 Image {
275 id: repeatIcon
276 height: units.gu(3)
277 width: height
278 anchors.verticalCenter: parent.verticalCenter
279 anchors.horizontalCenter: parent.horizontalCenter
280 source: Qt.resolvedUrl("images/media-playlist-repeat.svg")
281 verticalAlignment: Text.AlignVCenter
282 opacity: player.repeat && !emptyPage.noMusic ? 1 : .4
283 }
284 }
285
286 /* Previous button */
287 MouseArea {
288 id: nowPlayingPreviousButton
289 anchors.right: nowPlayingPlayButton.left
290 anchors.rightMargin: units.gu(1)
291 anchors.verticalCenter: nowPlayingPlayButton.verticalCenter
292 height: units.gu(6)
293 objectName: "previousShape"
294 opacity: trackQueue.model.count === 0 ? .4 : 1
295 width: height
296 onClicked: player.previousSong()
297
298 Image {
299 id: nowPlayingPreviousIndicator
300 height: units.gu(3)
301 width: height
302 anchors.horizontalCenter: parent.horizontalCenter
303 anchors.verticalCenter: parent.verticalCenter
304 source: Qt.resolvedUrl("images/media-skip-backward.svg")
305 opacity: 1
306 }
307 }
308
309 /* Play/Pause button */
310 MouseArea {
311 id: nowPlayingPlayButton
312 anchors.horizontalCenter: parent.horizontalCenter
313 anchors.top:musicToolbarFullProgressContainer.bottom
314 anchors.topMargin: units.gu(2)
315 height: units.gu(12)
316 objectName: "playShape"
317 width: height
318 onClicked: player.toggle()
319
320 Image {
321 id: nowPlayingPlayIndicator
322 height: units.gu(6)
323 width: height
324 anchors.horizontalCenter: parent.horizontalCenter
325 anchors.verticalCenter: parent.verticalCenter
326 opacity: emptyPage.noMusic ? .4 : 1
327 source: player.playbackState === MediaPlayer.PlayingState ?
328 Qt.resolvedUrl("images/media-playback-pause.svg") : Qt.resolvedUrl("images/media-playback-start.svg")
329 }
330 }
331
332 /* Next button */
333 MouseArea {
334 id: nowPlayingNextButton
335 anchors.left: nowPlayingPlayButton.right
336 anchors.leftMargin: units.gu(1)
337 anchors.verticalCenter: nowPlayingPlayButton.verticalCenter
338 height: units.gu(6)
339 objectName: "forwardShape"
340 opacity: trackQueue.model.count === 0 ? .4 : 1
341 width: height
342 onClicked: player.nextSong()
343
344 Image {
345 id: nowPlayingNextIndicator
346 height: units.gu(3)
347 width: height
348 anchors.horizontalCenter: parent.horizontalCenter
349 anchors.verticalCenter: parent.verticalCenter
350 source: Qt.resolvedUrl("images/media-skip-forward.svg")
351 opacity: 1
352 }
353 }
354
355 /* Shuffle button */
356 MouseArea {
357 id: nowPlayingShuffleButton
358 objectName: "shuffleShape"
359 anchors.left: nowPlayingNextButton.right
360 anchors.leftMargin: units.gu(1)
361 anchors.verticalCenter: nowPlayingPlayButton.verticalCenter
362 height: units.gu(6)
363 opacity: player.shuffle && !emptyPage.noMusic ? 1 : .4
364 width: height
365 onClicked: player.shuffle = !player.shuffle
366
367 Image {
368 id: shuffleIcon
369 height: units.gu(3)
370 width: height
371 anchors.verticalCenter: parent.verticalCenter
372 anchors.horizontalCenter: parent.horizontalCenter
373 source: Qt.resolvedUrl("images/media-playlist-shuffle.svg")
374 opacity: player.shuffle && !emptyPage.noMusic ? 1 : .4
375 }
376 }
377 }
113 }378 }
114379
115 ListView {380 ListView {
116381
=== modified file 'music-app.qml'
--- music-app.qml 2014-10-01 04:55:18 +0000
+++ music-app.qml 2014-10-03 12:19:14 +0000
@@ -979,6 +979,7 @@
979979
980 MusicToolbar {980 MusicToolbar {
981 id: musicToolbar981 id: musicToolbar
982 visible: nowPlaying.isListView
982 objectName: "musicToolbarObject"983 objectName: "musicToolbarObject"
983 z: 200 // put on top of everything else984 z: 200 // put on top of everything else
984 }985 }

Subscribers

People subscribed via source and target branches

to all changes: