ElisaMainWindow.qml 34.7 KB
Newer Older
1
/*
2
 * Copyright 2016-2018 Matthieu Gallien <matthieu_gallien@yahoo.fr>
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

20
import QtQuick 2.7
21 22 23 24
import QtQuick.Controls 1.3
import QtQuick.Controls.Styles 1.3
import QtQuick.Layouts 1.1
import QtQuick.Window 2.2
25
import org.kde.elisa 1.0
26
import Qt.labs.settings 1.0
27 28

ApplicationWindow {
29 30
    id: mainWindow

31
    visible: true
32

33 34
    minimumWidth: 1000
    minimumHeight: 600
35

Safa AlFulaij's avatar
Safa AlFulaij committed
36 37 38
    LayoutMirroring.enabled: Qt.application.layoutDirection == Qt.RightToLeft
    LayoutMirroring.childrenInherit: true

39 40 41 42 43
    x: persistentSettings.x
    y: persistentSettings.y
    width: persistentSettings.width
    height: persistentSettings.height

Safa AlFulaij's avatar
Safa AlFulaij committed
44
    title: i18n("Elisa")
45

46
    property var goBackAction: elisa.action("go_back")
47

48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
    Action {
        text: goBackAction.text
        shortcut: goBackAction.shortcut
        iconName: elisa.iconName(goBackAction.icon)
        onTriggered: {
            localAlbums.goBack()
            localArtists.goBack()
        }
    }

    Action {
        id: applicationMenuAction
        text: i18nc("open application menu", "Application Menu")
        iconName: "application-menu"
        onTriggered: applicationMenu.popup()
    }

    ApplicationMenu {
        id: applicationMenu
    }

69 70 71 72 73
    SystemPalette {
        id: myPalette
        colorGroup: SystemPalette.Active
    }

74 75 76 77
    Theme {
        id: elisaTheme
    }

78
    Settings {
79 80 81 82
        id: persistentSettings

        property int x
        property int y
83 84
        property int width : 1000
        property int height : 600
85

86
        property var playListState
87 88

        property var playListControlerState
89 90

        property var audioPlayerState
91

92
        property double playControlItemVolume : 100.0
93
        property bool playControlItemMuted : false
94 95
    }

96 97 98 99 100 101 102 103 104
    Connections {
        target: Qt.application
        onAboutToQuit:
        {
            persistentSettings.x = mainWindow.x;
            persistentSettings.y = mainWindow.y;
            persistentSettings.width = mainWindow.width;
            persistentSettings.height = mainWindow.height;

105 106
            persistentSettings.playListState = elisa.mediaPlayList.persistentState;
            persistentSettings.playListControlerState = elisa.mediaPlayList.persistentState;
107
            persistentSettings.audioPlayerState = manageAudioPlayer.persistentState
108

109 110
            persistentSettings.playControlItemVolume = headerBar.playerControl.volume
            persistentSettings.playControlItemMuted = headerBar.playerControl.muted
111 112 113
        }
    }

114 115
    PlatformIntegration {
        id: platformInterface
116

117 118
        playListModel: elisa.mediaPlayList
        playListControler: elisa.mediaPlayList
119 120 121
        audioPlayerManager: manageAudioPlayer
        headerBarManager: myHeaderBarManager
        manageMediaPlayerControl: myPlayControlManager
122
        player: audioPlayer
123 124 125

        onRaisePlayer:
        {
126
            mainWindow.show()
127 128 129
            mainWindow.raise()
            mainWindow.requestActivate()
        }
130 131
    }

132
    AudioWrapper {
133 134
        id: audioPlayer

135
        muted: headerBar.playerControl.muted
136

137
        volume: headerBar.playerControl.volume
138

139
        onVolumeChanged: headerBar.playerControl.volume = volume
140
        onMutedChanged: headerBar.playerControl.muted = muted
141

142 143 144 145 146 147 148 149 150
        source: manageAudioPlayer.playerSource

        onPlaying: {
            myPlayControlManager.playerPlaying()
        }

        onPaused: {
            myPlayControlManager.playerPaused()
        }
151

152 153 154
        onStopped: {
            myPlayControlManager.playerStopped()
        }
155 156
    }

Alexander Stippich's avatar
Alexander Stippich committed
157
    Connections {
158
        target: elisa.mediaPlayList
159

Alexander Stippich's avatar
Alexander Stippich committed
160
        onPlayListLoadFailed: {
161 162
            messageNotification.showNotification(i18nc("message of passive notification when playlist load failed", "Load of playlist failed"), 3000)
        }
163

Alexander Stippich's avatar
Alexander Stippich committed
164
        onEnsurePlay: manageAudioPlayer.ensurePlay()
165

Alexander Stippich's avatar
Alexander Stippich committed
166
        onPlayListFinished: manageAudioPlayer.playListFinished()
167 168
    }

169 170 171
    ManageHeaderBar {
        id: myHeaderBarManager

172 173
        playListModel: elisa.mediaPlayList
        currentTrack: elisa.mediaPlayList.currentTrack
174

175 176 177 178
        artistRole: MediaPlayList.ArtistRole
        titleRole: MediaPlayList.TitleRole
        albumRole: MediaPlayList.AlbumRole
        imageRole: MediaPlayList.ImageRole
179
        isValidRole: MediaPlayList.IsValidRole
180 181 182 183 184
    }

    ManageAudioPlayer {
        id: manageAudioPlayer

185 186
        currentTrack: elisa.mediaPlayList.currentTrack
        playListModel: elisa.mediaPlayList
187
        urlRole: MediaPlayList.ResourceRole
188
        isPlayingRole: MediaPlayList.IsPlayingRole
189 190 191
        titleRole: MediaPlayList.TitleRole
        artistNameRole: MediaPlayList.ArtistRole
        albumNameRole: MediaPlayList.AlbumRole
192

193 194 195
        playerStatus: audioPlayer.status
        playerPlaybackState: audioPlayer.playbackState
        playerError: audioPlayer.error
196
        audioDuration: audioPlayer.duration
197
        playerIsSeekable: audioPlayer.seekable
198
        playerPosition: audioPlayer.position
199

200
        persistentState: persistentSettings.audioPlayerState
201

202 203 204
        onPlayerPlay: audioPlayer.play()
        onPlayerPause: audioPlayer.pause()
        onPlayerStop: audioPlayer.stop()
205
        onSkipNextTrack: elisa.mediaPlayList.skipNextTrack()
206
        onSeek: audioPlayer.seek(position)
207 208
        onSourceInError:
        {
209
            elisa.mediaPlayList.trackInError(source, playerError)
210 211 212 213
            allListeners.playBackError(source, playerError)
        }

        onDisplayTrackError: messageNotification.showNotification(i18n("Error when playing %1", "" + fileName), 3000)
214 215 216 217 218
    }

    ManageMediaPlayerControl {
        id: myPlayControlManager

219 220
        playListModel: elisa.mediaPlayList
        currentTrack: elisa.mediaPlayList.currentTrack
221 222
    }

223 224 225 226
    PassiveNotification {
        id: messageNotification
    }

227
    Rectangle {
228
        color: myPalette.base
229 230
        anchors.fill: parent

231 232 233
        ColumnLayout {
            anchors.fill: parent
            spacing: 0
234

235 236 237 238
            Item {
                Layout.preferredHeight: mainWindow.height * 0.2 + elisaTheme.mediaPlayerControlHeight
                Layout.minimumHeight: mainWindow.height * 0.2 + elisaTheme.mediaPlayerControlHeight
                Layout.maximumHeight: mainWindow.height * 0.2 + elisaTheme.mediaPlayerControlHeight
239
                Layout.fillWidth: true
240

241 242
                HeaderBar {
                    id: headerBar
243

244 245
                    focus: true

246
                    anchors.fill: parent
247

248 249 250 251 252
                    tracksCount: myHeaderBarManager.remainingTracks
                    album: myHeaderBarManager.album
                    title: myHeaderBarManager.title
                    artist: myHeaderBarManager.artist
                    image: myHeaderBarManager.image
253

254
                    ratingVisible: false
255

256 257
                    playerControl.duration: audioPlayer.duration
                    playerControl.seekable: audioPlayer.seekable
258

259 260 261 262 263 264 265
                    playerControl.volume: persistentSettings.playControlItemVolume
                    playerControl.muted: persistentSettings.playControlItemMuted
                    playerControl.position: audioPlayer.position
                    playerControl.skipBackwardEnabled: myPlayControlManager.skipBackwardControlEnabled
                    playerControl.skipForwardEnabled: myPlayControlManager.skipForwardControlEnabled
                    playerControl.playEnabled: myPlayControlManager.playControlEnabled
                    playerControl.isPlaying: myPlayControlManager.musicPlaying
266

267
                    playerControl.onSeek: audioPlayer.seek(position)
268

269 270
                    playerControl.onPlay: manageAudioPlayer.playPause()
                    playerControl.onPause: manageAudioPlayer.playPause()
271

272 273
                    playerControl.onPlayPrevious: elisa.mediaPlayList.skipPreviousTrack()
                    playerControl.onPlayNext: elisa.mediaPlayList.skipNextTrack()
274

275 276
                    ToolButton {
                        id: menuButton
277

278
                        action: applicationMenuAction
279

280
                        z: 2
281

282 283 284 285 286 287 288 289 290 291
                        anchors
                        {
                            right: parent.right
                            top: parent.top
                            rightMargin: elisaTheme.layoutHorizontalMargin * 3
                            topMargin: elisaTheme.layoutHorizontalMargin * 3
                        }
                    }
                    Rectangle {
                        anchors.fill: menuButton
292

293
                        z: 1
294

295
                        radius: width / 2
296

297 298
                        color: myPalette.window
                    }
299

300
                    TrackImportNotification {
301 302 303 304 305 306 307 308 309
                        id: importedTracksCountNotification

                        anchors
                        {
                            right: menuButton.left
                            top: menuButton.top
                            bottom: menuButton.bottom
                            rightMargin: elisaTheme.layoutHorizontalMargin * 3
                        }
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334
                    }

                    Binding {
                        target: importedTracksCountNotification
                        property: 'musicManager'
                        value: elisa.musicManager
                        when: elisa.musicManager !== undefined
                    }

                    Loader {
                        sourceComponent: Binding {
                            target: importedTracksCountNotification
                            property: 'indexingRunning'
                            value: elisa.musicManager.indexingRunning
                        }

                        active: elisa.musicManager !== undefined
                    }

                    Loader {
                        sourceComponent: Binding {
                            target: importedTracksCountNotification
                            property: 'importedTracksCount'
                            value: elisa.musicManager.importedTracksCount
                        }
335

336
                        active: elisa.musicManager !== undefined
337
                    }
338
                }
339
            }
340

341
            RowLayout {
342
                Layout.fillHeight: true
343 344
                Layout.fillWidth: true
                spacing: 0
345

346 347
                ViewSelector {
                    id: listViews
348

349
                    Layout.fillHeight: true
350 351
                    Layout.preferredWidth: mainWindow.width * 0.15
                    Layout.maximumWidth: mainWindow.width * 0.15
352 353
                }

354
                ColumnLayout {
355 356
                    Layout.fillHeight: true
                    Layout.fillWidth: true
357

358
                    spacing: 0
359

360
                    TopNotification {
361
                        id: invalidBalooConfiguration
362

363
                        Layout.fillWidth: true
364

365
                        musicManager: elisa.musicManager
366

367
                        focus: true
368 369 370 371 372 373 374 375 376 377 378 379 380
                    }

                    Item {
                        Layout.fillHeight: true
                        Layout.fillWidth: true

                        RowLayout {
                            anchors.fill: parent

                            spacing: 0

                            id: contentZone

381
                            FocusScope {
382 383
                                id: mainContentView

384
                                focus: true
385 386 387 388 389 390 391

                                Layout.fillHeight: true

                                Layout.minimumWidth: 0
                                Layout.maximumWidth: 0
                                Layout.preferredWidth: 0

Matthieu Gallien's avatar
Matthieu Gallien committed
392

393 394
                                visible: Layout.minimumWidth != 0

395 396 397 398 399 400 401 402
                                Rectangle {
                                    border {
                                        color: (mainContentView.activeFocus ? myPalette.highlight : myPalette.base)
                                        width: 1
                                    }

                                    radius: 3
                                    color: myPalette.base
403

404
                                    anchors.fill: parent
405

406 407
                                    BusyIndicator {
                                        id: busyScanningMusic
408

409
                                        anchors.fill: parent
410

411 412 413 414
                                        anchors.leftMargin: parent.width / 3
                                        anchors.rightMargin: parent.width / 3
                                        anchors.topMargin: parent.height / 3
                                        anchors.bottomMargin: parent.height / 3
415

416
                                        opacity: 0.8
417

418
                                        z: 2
419 420 421 422 423 424 425 426
                                    }

                                    Loader {
                                        sourceComponent: Binding {
                                            target: busyScanningMusic
                                            property: 'running'
                                            value: elisa.musicManager.indexerBusy
                                        }
427

428
                                        active: elisa.musicManager !== undefined
429 430 431 432 433 434 435 436 437 438 439 440 441 442
                                    }

                                    MediaBrowser {
                                        id: localAlbums

                                        focus: true

                                        anchors {
                                            fill: parent

                                            leftMargin: elisaTheme.layoutHorizontalMargin
                                            rightMargin: elisaTheme.layoutHorizontalMargin
                                        }

443 444 445
                                        firstPage: GridBrowserView {
                                            id: allAlbumsView

446
                                            focus: true
447

448
                                            contentModel: elisa.allAlbumsProxyModel
449

450
                                            image: elisaTheme.albumIcon
451 452 453
                                            mainTitle: i18nc("Title of the view of all albums", "Albums")

                                            onOpen: {
454
                                                elisa.singleAlbumProxyModel.sourceModel.loadAlbumData(databaseId)
455 456 457
                                                localAlbums.stackView.push(albumView, {
                                                                               stackView: localAlbums.stackView,
                                                                               albumName: innerMainTitle,
458
                                                                               artistName:  innerSecondaryTitle,
459 460 461 462
                                                                               albumArtUrl: innerImage,
                                                                           })
                                            }
                                            onGoBack: localAlbums.stackView.pop()
463
                                        }
464

465
                                        visible: opacity > 0
466
                                    }
467

468 469
                                    MediaBrowser {
                                        id: localArtists
470

471
                                        focus: true
472

473 474 475 476 477 478
                                        anchors {
                                            fill: parent

                                            leftMargin: elisaTheme.layoutHorizontalMargin
                                            rightMargin: elisaTheme.layoutHorizontalMargin
                                        }
479

480
                                        firstPage: GridBrowserView {
481
                                            id: allArtistsView
482
                                            focus: true
483 484 485 486

                                            showRating: false
                                            delegateDisplaySecondaryText: false

487
                                            contentModel: elisa.allArtistsProxyModel
488

489
                                            image: elisaTheme.artistIcon
490 491 492
                                            mainTitle: i18nc("Title of the view of all artists", "Artists")

                                            onOpen: {
493
                                                elisa.singleArtistProxyModel.setArtistFilterText(innerMainTitle)
494 495 496 497 498 499
                                                localArtists.stackView.push(innerAlbumView, {
                                                                                mainTitle: innerMainTitle,
                                                                                secondaryTitle: innerSecondaryTitle,
                                                                                image: innerImage,
                                                                                stackView: localArtists.stackView
                                                                            })
500

501 502
                                            }
                                            onGoBack: localArtists.stackView.pop()
503 504 505
                                        }

                                        visible: opacity > 0
506
                                    }
507

508 509
                                    MediaBrowser {
                                        id: localTracks
510

511
                                        focus: true
512

513 514 515 516 517 518
                                        anchors {
                                            fill: parent

                                            leftMargin: elisaTheme.layoutHorizontalMargin
                                            rightMargin: elisaTheme.layoutHorizontalMargin
                                        }
519

520
                                        firstPage: MediaAllTracksView {
521
                                            focus: true
522
                                            stackView: localTracks.stackView
523

524
                                            contentModel: elisa.allTracksProxyModel
525 526 527
                                        }

                                        visible: opacity > 0
528 529
                                    }

530 531 532 533 534
                                    Behavior on border.color {
                                        ColorAnimation {
                                            duration: 300
                                        }
                                    }
535
                                }
536
                            }
537

538 539
                            Rectangle {
                                id: firstViewSeparatorItem
540

541 542 543 544
                                border.width: 1
                                border.color: myPalette.mid
                                color: myPalette.mid
                                visible: true
545

546 547
                                Layout.bottomMargin: elisaTheme.layoutVerticalMargin
                                Layout.topMargin: elisaTheme.layoutVerticalMargin
548

549
                                Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
550

551
                                Layout.fillHeight: true
552

553 554 555 556
                                Layout.preferredWidth: 1
                                Layout.minimumWidth: 1
                                Layout.maximumWidth: 1
                            }
557

558 559
                            MediaPlayListView {
                                id: playList
560

561
                                playListModel: elisa.mediaPlayList
562

563 564
                                randomPlayChecked: elisa.mediaPlayList.randomPlay
                                repeatPlayChecked: elisa.mediaPlayList.repeatPlay
565

566
                                Layout.fillHeight: true
567 568
                                Layout.leftMargin: elisaTheme.layoutHorizontalMargin
                                Layout.rightMargin: elisaTheme.layoutHorizontalMargin
569

570 571 572
                                Layout.minimumWidth: contentZone.width
                                Layout.maximumWidth: contentZone.width
                                Layout.preferredWidth: contentZone.width
573

574 575 576
                                onStartPlayback: manageAudioPlayer.ensurePlay()

                                onPausePlayback: manageAudioPlayer.playPause()
577 578

                                onDisplayError: messageNotification.showNotification(errorText)
579
                            }
580

581 582
                            Rectangle {
                                id: viewSeparatorItem
583

584 585 586 587
                                border.width: 1
                                border.color: myPalette.mid
                                color: myPalette.mid
                                visible: Layout.minimumWidth != 0
588

589 590
                                Layout.bottomMargin: elisaTheme.layoutVerticalMargin
                                Layout.topMargin: elisaTheme.layoutVerticalMargin
591

592
                                Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
593

594
                                Layout.fillHeight: true
595

596 597 598 599
                                Layout.preferredWidth: 1
                                Layout.minimumWidth: 1
                                Layout.maximumWidth: 1
                            }
600

601 602
                            ContextView {
                                id: albumContext
603

604
                                Layout.fillHeight: true
605

606 607 608
                                Layout.minimumWidth: contentZone.width
                                Layout.maximumWidth: contentZone.width
                                Layout.preferredWidth: contentZone.width
609

610
                                visible: Layout.minimumWidth != 0
611

612 613 614 615
                                artistName: myHeaderBarManager.artist
                                albumName: myHeaderBarManager.album
                                albumArtUrl: myHeaderBarManager.image
                            }
616 617
                        }
                    }
618 619

                    states: [
620 621
                        State {
                            name: 'full'
622
                            when: listViews.currentIndex === 0
623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666
                            PropertyChanges {
                                target: mainContentView
                                Layout.fillWidth: false
                                Layout.minimumWidth: 0
                                Layout.maximumWidth: 0
                                Layout.preferredWidth: 0
                            }
                            PropertyChanges {
                                target: firstViewSeparatorItem
                                Layout.minimumWidth: 0
                                Layout.maximumWidth: 0
                                Layout.preferredWidth: 0
                            }
                            PropertyChanges {
                                target: playList
                                Layout.minimumWidth: contentZone.width / 2
                                Layout.maximumWidth: contentZone.width / 2
                                Layout.preferredWidth: contentZone.width / 2
                            }
                            PropertyChanges {
                                target: viewSeparatorItem
                                Layout.minimumWidth: 1
                                Layout.maximumWidth: 1
                                Layout.preferredWidth: 1
                            }
                            PropertyChanges {
                                target: albumContext
                                Layout.minimumWidth: contentZone.width / 2
                                Layout.maximumWidth: contentZone.width / 2
                                Layout.preferredWidth: contentZone.width / 2
                            }
                            PropertyChanges {
                                target: localAlbums
                                opacity: 0
                            }
                            PropertyChanges {
                                target: localArtists
                                opacity: 0
                            }
                            PropertyChanges {
                                target: localTracks
                                opacity: 0
                            }
                        },
667
                        State {
668
                            name: 'allAlbums'
669
                            when: listViews.currentIndex === 1
670 671 672 673 674
                            StateChangeScript {
                                script: {
                                    localAlbums.stackView.pop({item: null, immediate: true})
                                }
                            }
675 676
                            PropertyChanges {
                                target: mainContentView
677
                                Layout.fillWidth: true
678 679 680
                                Layout.minimumWidth: contentZone.width * 0.66
                                Layout.maximumWidth: contentZone.width * 0.68
                                Layout.preferredWidth: contentZone.width * 0.68
681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705
                            }
                            PropertyChanges {
                                target: firstViewSeparatorItem
                                Layout.minimumWidth: 1
                                Layout.maximumWidth: 1
                                Layout.preferredWidth: 1
                            }
                            PropertyChanges {
                                target: playList
                                Layout.minimumWidth: contentZone.width * 0.33
                                Layout.maximumWidth: contentZone.width * 0.33
                                Layout.preferredWidth: contentZone.width * 0.33
                            }
                            PropertyChanges {
                                target: viewSeparatorItem
                                Layout.minimumWidth: 0
                                Layout.maximumWidth: 0
                                Layout.preferredWidth: 0
                            }
                            PropertyChanges {
                                target: albumContext
                                Layout.minimumWidth: 0
                                Layout.maximumWidth: 0
                                Layout.preferredWidth: 0
                            }
706 707 708 709 710 711 712 713
                            PropertyChanges {
                                target: localAlbums
                                opacity: 1
                            }
                            PropertyChanges {
                                target: localArtists
                                opacity: 0
                            }
714 715 716 717
                            PropertyChanges {
                                target: localTracks
                                opacity: 0
                            }
718 719 720
                        },
                        State {
                            name: 'allArtists'
721
                            when: listViews.currentIndex === 2
722 723 724 725 726
                            StateChangeScript {
                                script: {
                                    localArtists.stackView.pop({item: null, immediate: true})
                                }
                            }
727 728
                            PropertyChanges {
                                target: mainContentView
729
                                Layout.fillWidth: true
730 731 732
                                Layout.minimumWidth: contentZone.width * 0.66
                                Layout.maximumWidth: contentZone.width * 0.68
                                Layout.preferredWidth: contentZone.width * 0.68
733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765
                            }
                            PropertyChanges {
                                target: firstViewSeparatorItem
                                Layout.minimumWidth: 1
                                Layout.maximumWidth: 1
                                Layout.preferredWidth: 1
                            }
                            PropertyChanges {
                                target: playList
                                Layout.minimumWidth: contentZone.width * 0.33
                                Layout.maximumWidth: contentZone.width * 0.33
                                Layout.preferredWidth: contentZone.width * 0.33
                            }
                            PropertyChanges {
                                target: viewSeparatorItem
                                Layout.minimumWidth: 0
                                Layout.maximumWidth: 0
                                Layout.preferredWidth: 0
                            }
                            PropertyChanges {
                                target: albumContext
                                Layout.minimumWidth: 0
                                Layout.maximumWidth: 0
                                Layout.preferredWidth: 0
                            }
                            PropertyChanges {
                                target: localAlbums
                                opacity: 0
                            }
                            PropertyChanges {
                                target: localArtists
                                opacity: 1
                            }
766 767 768 769
                            PropertyChanges {
                                target: localTracks
                                opacity: 0
                            }
770 771
                        },
                        State {
772
                            name: 'allTracks'
773
                            when: listViews.currentIndex === 3
774 775
                            PropertyChanges {
                                target: mainContentView
776
                                Layout.fillWidth: true
777 778 779
                                Layout.minimumWidth: contentZone.width * 0.66
                                Layout.maximumWidth: contentZone.width * 0.68
                                Layout.preferredWidth: contentZone.width * 0.68
780 781 782
                            }
                            PropertyChanges {
                                target: firstViewSeparatorItem
783 784 785
                                Layout.minimumWidth: 1
                                Layout.maximumWidth: 1
                                Layout.preferredWidth: 1
786 787 788
                            }
                            PropertyChanges {
                                target: playList
789 790 791
                                Layout.minimumWidth: contentZone.width * 0.33
                                Layout.maximumWidth: contentZone.width * 0.33
                                Layout.preferredWidth: contentZone.width * 0.33
792 793 794
                            }
                            PropertyChanges {
                                target: viewSeparatorItem
795 796 797
                                Layout.minimumWidth: 0
                                Layout.maximumWidth: 0
                                Layout.preferredWidth: 0
798 799 800
                            }
                            PropertyChanges {
                                target: albumContext
801 802 803
                                Layout.minimumWidth: 0
                                Layout.maximumWidth: 0
                                Layout.preferredWidth: 0
804
                            }
805 806 807 808 809 810 811 812
                            PropertyChanges {
                                target: localAlbums
                                opacity: 0
                            }
                            PropertyChanges {
                                target: localArtists
                                opacity: 0
                            }
813 814 815 816
                            PropertyChanges {
                                target: localTracks
                                opacity: 1
                            }
817 818 819 820
                        }
                    ]
                    transitions: Transition {
                        NumberAnimation {
821
                            properties: "Layout.minimumWidth, Layout.maximumWidth, Layout.preferredWidth, opacity"
822 823 824
                            easing.type: Easing.InOutQuad
                            duration: 300
                        }
825 826
                    }
                }
827 828 829
            }
        }
    }
830 831 832 833 834 835 836

    Component {
        id: innerAlbumView

        GridBrowserView {
            property var stackView

837
            contentModel: elisa.singleArtistProxyModel
838 839 840

            isSubPage: true

841
            onOpen: {
842
                elisa.singleAlbumProxyModel.sourceModel.loadAlbumData(databaseId)
843 844 845
                localArtists.stackView.push(albumView, {
                                                stackView: localArtists.stackView,
                                                albumName: innerMainTitle,
846
                                                artistName: innerSecondaryTitle,
847
                                                albumArtUrl: innerImage,
848 849 850 851 852 853 854 855 856 857 858
                                            })
            }
            onGoBack: stackView.pop()
        }
    }

    Component {
        id: albumView

        MediaAlbumView {
            property var stackView
859

860
            contentModel: elisa.singleAlbumProxyModel
861

862 863 864 865 866 867 868 869 870 871 872 873 874
            onShowArtist: {
                listViews.currentIndex = 2
                if (localArtists.stackView.depth === 3) {
                    localArtists.stackView.pop()
                }
                if (localArtists.stackView.depth === 2) {
                    var artistPage = localArtists.stackView.get(1)
                    if (artistPage.mainTitle === name) {
                        return
                    } else {
                        localArtists.stackView.pop()
                    }
                }
875
                allArtistsView.open(name, name, elisaTheme.defaultArtistImage, '')
876 877 878 879
            }
            onGoBack: stackView.pop()
        }
    }
880 881 882 883 884 885 886 887 888 889 890 891 892

    Component.onCompleted:
    {
        elisa.initialize()

        var d = new Date();
        var n = d.getMilliseconds();
        elisa.mediaPlayList.seedRandomGenerator(n);

        elisa.mediaPlayList.randomPlay = Qt.binding(function() { return playList.randomPlayChecked })
        elisa.mediaPlayList.repeatPlay = Qt.binding(function() { return playList.repeatPlayChecked })
        myPlayControlManager.randomOrContinuePlay = Qt.binding(function() { return playList.randomPlayChecked || playList.repeatPlayChecked })

893 894 895 896 897
        if (persistentSettings.playListState) {
            elisa.mediaPlayList.persistentState = persistentSettings.playListState
        }

        elisa.mediaPlayList.enqueue(elisa.arguments)
898
    }
899
}