~ahayzen/music-app/remix-confinement-back-002

« back to all changes in this revision

Viewing changes to MusicNowPlaying.qml

* Remove legacy toolbar code
* Make full (non listview) now playing default
* Fix header disappearing in full now playing.

Approved by Victor Thompson, Ubuntu Phone Apps Jenkins Bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
 
29
29
MusicPage {
30
30
    id: nowPlaying
 
31
    flickable: isListView ? queuelist : null  // Ensures that the header is shown in fullview
31
32
    objectName: "nowPlayingPage"
32
33
    title: i18n.tr("Now Playing")
33
34
    visible: false
34
35
    onVisibleChanged: {
35
36
        if (!visible) {
36
37
            // Reset the isListView property
37
 
            // TODO: In the future this will default to false
38
 
            isListView = true
 
38
            isListView = false
39
39
        }
40
40
    }
41
41
 
42
42
    property int ensureVisibleIndex: 0  // ensure first index is visible at startup
43
 
    property bool isListView: true
 
43
    property bool isListView: false
 
44
 
 
45
    head.backAction: Action {
 
46
        iconName: "back";
 
47
        objectName: "backButton"
 
48
        onTriggered: {
 
49
            mainPageStack.pop();
 
50
 
 
51
            while (mainPageStack.depth > 1) {  // jump back to the tab layer if via SongsPage
 
52
                mainPageStack.pop();
 
53
            }
 
54
        }
 
55
    }
44
56
 
45
57
    head {
46
58
        actions: [
88
100
 
89
101
    Rectangle {
90
102
        id: fullview
91
 
        visible: !isListView
92
103
        anchors.fill: parent
93
104
        color: "transparent"
94
 
        clip: true
 
105
        visible: !isListView
95
106
 
96
107
        BlurredBackground {
97
108
            id: blurredBackground
195
206
                    id: progressSliderMusic
196
207
                    anchors.left: parent.left
197
208
                    anchors.right: parent.right
 
209
                    objectName: "progressSliderShape"
198
210
                    function formatValue(v) { return durationToString(v) }
199
211
 
200
212
                    property bool seeking: false
255
267
            /* Repeat button */
256
268
            MouseArea {
257
269
                id: nowPlayingRepeatButton
258
 
                objectName: "repeatShape"
259
270
                anchors.right: nowPlayingPreviousButton.left
260
271
                anchors.rightMargin: units.gu(1)
261
272
                anchors.verticalCenter: nowPlayingPlayButton.verticalCenter
272
283
                    anchors.horizontalCenter: parent.horizontalCenter
273
284
                    color: "white"
274
285
                    name: "media-playlist-repeat"
 
286
                    objectName: "repeatShape"
275
287
                    opacity: player.repeat && !emptyPage.noMusic ? 1 : .4
276
288
                }
277
289
            }
283
295
                anchors.rightMargin: units.gu(1)
284
296
                anchors.verticalCenter: nowPlayingPlayButton.verticalCenter
285
297
                height: units.gu(6)
286
 
                objectName: "previousShape"
287
298
                opacity: trackQueue.model.count === 0  ? .4 : 1
288
299
                width: height
289
300
                onClicked: player.previousSong()
296
307
                    anchors.horizontalCenter: parent.horizontalCenter
297
308
                    color: "white"
298
309
                    name: "media-skip-backward"
 
310
                    objectName: "previousShape"
299
311
                    opacity: 1
300
312
                }
301
313
            }
307
319
                anchors.top: musicToolbarFullProgressContainer.bottom
308
320
                anchors.topMargin: units.gu(2)
309
321
                height: units.gu(12)
310
 
                objectName: "playShape"
311
322
                width: height
312
323
                onClicked: player.toggle()
313
324
 
320
331
                    opacity: emptyPage.noMusic ? .4 : 1
321
332
                    color: "white"
322
333
                    name: player.playbackState === MediaPlayer.PlayingState ? "media-playback-pause" : "media-playback-start"
 
334
                    objectName: "playShape"
323
335
                }
324
336
            }
325
337
 
330
342
                anchors.leftMargin: units.gu(1)
331
343
                anchors.verticalCenter: nowPlayingPlayButton.verticalCenter
332
344
                height: units.gu(6)
333
 
                objectName: "forwardShape"
334
345
                opacity: trackQueue.model.count === 0 ? .4 : 1
335
346
                width: height
336
347
                onClicked: player.nextSong()
343
354
                    anchors.horizontalCenter: parent.horizontalCenter
344
355
                    color: "white"
345
356
                    name: "media-skip-forward"
 
357
                    objectName: "forwardShape"
346
358
                    opacity: 1
347
359
                }
348
360
            }
350
362
            /* Shuffle button */
351
363
            MouseArea {
352
364
                id: nowPlayingShuffleButton
353
 
                objectName: "shuffleShape"
354
365
                anchors.left: nowPlayingNextButton.right
355
366
                anchors.leftMargin: units.gu(1)
356
367
                anchors.verticalCenter: nowPlayingPlayButton.verticalCenter
367
378
                    anchors.horizontalCenter: parent.horizontalCenter
368
379
                    color: "white"
369
380
                    name: "media-playlist-shuffle"
 
381
                    objectName: "shuffleShape"
370
382
                    opacity: player.shuffle && !emptyPage.noMusic ? 1 : .4
371
383
                }
372
384
            }
375
387
 
376
388
    ListView {
377
389
        id: queuelist
378
 
        visible: isListView
379
 
        objectName: "nowPlayingQueueList"
380
390
        anchors {
381
391
            fill: parent
382
392
        }
383
393
        delegate: queueDelegate
 
394
        footer: Item {
 
395
            height: mainView.height - (styleMusic.common.expandHeight + queuelist.currentHeight) + units.gu(8)
 
396
        }
 
397
        highlightFollowsCurrentItem: false
384
398
        model: trackQueue.model
385
 
        highlightFollowsCurrentItem: false
 
399
        objectName: "nowPlayingQueueList"
386
400
        state: "normal"
387
401
        states: [
388
402
            State {
400
414
                }
401
415
            }
402
416
        ]
403
 
        footer: Item {
404
 
            height: mainView.height - (styleMusic.common.expandHeight + queuelist.currentHeight) + units.gu(8)
405
 
        }
 
417
        visible: isListView
406
418
 
407
419
        property int normalHeight: units.gu(12)
408
420
        property int currentHeight: units.gu(40)