ElisaMainWindow.qml 36.6 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
Alexander Stippich's avatar
Alexander Stippich committed
21 22
import QtQuick.Controls 2.2
import QtQuick.Controls 1.4 as Controls1
23 24
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
    Controls1.Action  {
49 50 51 52 53 54 55
        shortcut: goBackAction.shortcut
        onTriggered: {
            localAlbums.goBack()
            localArtists.goBack()
        }
    }

Alexander Stippich's avatar
Alexander Stippich committed
56
    Controls1.Action {
57 58 59 60 61 62 63 64 65 66
        id: applicationMenuAction
        text: i18nc("open application menu", "Application Menu")
        iconName: "application-menu"
        onTriggered: applicationMenu.popup()
    }

    ApplicationMenu {
        id: applicationMenu
    }

67 68 69 70 71
    SystemPalette {
        id: myPalette
        colorGroup: SystemPalette.Active
    }

72 73 74 75
    Theme {
        id: elisaTheme
    }

76
    Settings {
77 78 79 80
        id: persistentSettings

        property int x
        property int y
81 82
        property int width : 1000
        property int height : 600
83

84
        property var playListState
85 86

        property var playListControlerState
87 88

        property var audioPlayerState
89

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

        property string filterState

   }
96

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

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

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

115 116
    PlatformIntegration {
        id: platformInterface
117

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

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

133
    AudioWrapper {
134 135
        id: audioPlayer

136
        muted: headerBar.playerControl.muted
137

138
        volume: headerBar.playerControl.volume
139

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

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

        onPlaying: {
            myPlayControlManager.playerPlaying()
        }

        onPaused: {
            myPlayControlManager.playerPaused()
        }
152

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

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

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

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

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

170 171 172
    ManageHeaderBar {
        id: myHeaderBarManager

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

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

    ManageAudioPlayer {
        id: manageAudioPlayer

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

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

201
        persistentState: persistentSettings.audioPlayerState
202

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

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

    ManageMediaPlayerControl {
        id: myPlayControlManager

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

224 225 226 227
    PassiveNotification {
        id: messageNotification
    }

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

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

236 237 238 239
            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
240
                Layout.fillWidth: true
241

242 243
                HeaderBar {
                    id: headerBar
244

245 246
                    focus: true

247
                    anchors.fill: parent
248

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

255
                    ratingVisible: false
256

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

260 261 262 263 264 265 266
                    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
267

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

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

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

Alexander Stippich's avatar
Alexander Stippich committed
276
                    Controls1.ToolButton {
277
                        id: menuButton
278

279
                        action: applicationMenuAction
280

281
                        z: 2
282

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

294
                        z: 1
295

296
                        radius: width / 2
297

298 299
                        color: myPalette.window
                    }
300

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

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

                    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
                        }
336

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

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

347 348
                ViewSelector {
                    id: listViews
349

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

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

359
                    spacing: 0
360

361
                    TopNotification {
362
                        id: invalidBalooConfiguration
363

364
                        Layout.fillWidth: true
365

366
                        musicManager: elisa.musicManager
367

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

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

                        RowLayout {
                            anchors.fill: parent

                            spacing: 0

                            id: contentZone

382
                            FocusScope {
383 384
                                id: mainContentView

385
                                focus: true
386 387 388 389 390 391 392

                                Layout.fillHeight: true

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

Matthieu Gallien's avatar
Matthieu Gallien committed
393

394 395
                                visible: Layout.minimumWidth != 0

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

                                    radius: 3
                                    color: myPalette.base
404

405
                                    anchors.fill: parent
406

407 408
                                    BusyIndicator {
                                        id: busyScanningMusic
409
                                        hoverEnabled: false
410
                                        anchors.fill: parent
411

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

417
                                        opacity: 0.8
418

419 420
                                        visible: running

421
                                        z: 2
422 423 424 425 426 427 428 429
                                    }

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

431
                                        active: elisa.musicManager !== undefined
432 433 434 435 436 437 438 439 440 441 442 443 444 445
                                    }

                                    MediaBrowser {
                                        id: localAlbums

                                        focus: true

                                        anchors {
                                            fill: parent

                                            leftMargin: elisaTheme.layoutHorizontalMargin
                                            rightMargin: elisaTheme.layoutHorizontalMargin
                                        }

446 447 448
                                        firstPage: GridBrowserView {
                                            id: allAlbumsView

449
                                            focus: true
450

451
                                            contentModel: elisa.allAlbumsProxyModel
452

453
                                            image: elisaTheme.albumIcon
454 455 456
                                            mainTitle: i18nc("Title of the view of all albums", "Albums")

                                            onOpen: {
457
                                                elisa.singleAlbumProxyModel.loadAlbumData(databaseId)
458 459 460
                                                localAlbums.stackView.push(albumView, {
                                                                               stackView: localAlbums.stackView,
                                                                               albumName: innerMainTitle,
461
                                                                               artistName:  innerSecondaryTitle,
462 463 464 465
                                                                               albumArtUrl: innerImage,
                                                                           })
                                            }
                                            onGoBack: localAlbums.stackView.pop()
466 467 468 469 470 471 472 473

                                            Binding {
                                                target: allAlbumsView
                                                property: 'filterState'
                                                value: persistentSettings.filterState
                                            }

                                            onFilterViewChanged: persistentSettings.filterState = filterState
474
                                        }
475

476
                                        visible: opacity > 0
477
                                    }
478

479 480
                                    MediaBrowser {
                                        id: localArtists
481

482
                                        focus: true
483

484 485 486 487 488 489
                                        anchors {
                                            fill: parent

                                            leftMargin: elisaTheme.layoutHorizontalMargin
                                            rightMargin: elisaTheme.layoutHorizontalMargin
                                        }
490

491
                                        firstPage: GridBrowserView {
492
                                            id: allArtistsView
493
                                            focus: true
494 495 496 497

                                            showRating: false
                                            delegateDisplaySecondaryText: false

498
                                            contentModel: elisa.allArtistsProxyModel
499

500
                                            image: elisaTheme.artistIcon
501 502 503
                                            mainTitle: i18nc("Title of the view of all artists", "Artists")

                                            onOpen: {
504
                                                elisa.singleArtistProxyModel.setArtistFilterText(innerMainTitle)
505 506 507 508 509 510
                                                localArtists.stackView.push(innerAlbumView, {
                                                                                mainTitle: innerMainTitle,
                                                                                secondaryTitle: innerSecondaryTitle,
                                                                                image: innerImage,
                                                                                stackView: localArtists.stackView
                                                                            })
511

512 513
                                            }
                                            onGoBack: localArtists.stackView.pop()
514 515 516 517 518 519 520 521

                                            Binding {
                                                target: allArtistsView
                                                property: 'filterState'
                                                value: persistentSettings.filterState
                                            }

                                            onFilterViewChanged: persistentSettings.filterState = filterState
522 523 524
                                        }

                                        visible: opacity > 0
525
                                    }
526

527 528
                                    MediaBrowser {
                                        id: localTracks
529

530
                                        focus: true
531

532 533 534 535 536 537
                                        anchors {
                                            fill: parent

                                            leftMargin: elisaTheme.layoutHorizontalMargin
                                            rightMargin: elisaTheme.layoutHorizontalMargin
                                        }
538

539
                                        firstPage: MediaAllTracksView {
540
                                            id: allTracksView
541
                                            focus: true
542
                                            stackView: localTracks.stackView
543

544
                                            contentModel: elisa.allTracksProxyModel
545 546 547 548 549 550 551 552

                                            Binding {
                                                target: allTracksView
                                                property: 'filterState'
                                                value: persistentSettings.filterState
                                            }

                                            onFilterViewChanged: persistentSettings.filterState = filterState
553 554 555
                                        }

                                        visible: opacity > 0
556 557
                                    }

558 559 560 561 562
                                    Behavior on border.color {
                                        ColorAnimation {
                                            duration: 300
                                        }
                                    }
563
                                }
564
                            }
565

566 567
                            Rectangle {
                                id: firstViewSeparatorItem
568

569 570 571 572
                                border.width: 1
                                border.color: myPalette.mid
                                color: myPalette.mid
                                visible: true
573

574 575
                                Layout.bottomMargin: elisaTheme.layoutVerticalMargin
                                Layout.topMargin: elisaTheme.layoutVerticalMargin
576

577
                                Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
578

579
                                Layout.fillHeight: true
580

581 582 583 584
                                Layout.preferredWidth: 1
                                Layout.minimumWidth: 1
                                Layout.maximumWidth: 1
                            }
585

586 587
                            MediaPlayListView {
                                id: playList
588

589
                                playListModel: elisa.mediaPlayList
590

591 592
                                randomPlayChecked: elisa.mediaPlayList.randomPlay
                                repeatPlayChecked: elisa.mediaPlayList.repeatPlay
593

594
                                Layout.fillHeight: true
595 596
                                Layout.leftMargin: elisaTheme.layoutHorizontalMargin
                                Layout.rightMargin: elisaTheme.layoutHorizontalMargin
597

598 599 600
                                Layout.minimumWidth: contentZone.width
                                Layout.maximumWidth: contentZone.width
                                Layout.preferredWidth: contentZone.width
601

602 603 604
                                onStartPlayback: manageAudioPlayer.ensurePlay()

                                onPausePlayback: manageAudioPlayer.playPause()
605 606

                                onDisplayError: messageNotification.showNotification(errorText)
607
                            }
608

609 610
                            Rectangle {
                                id: viewSeparatorItem
611

612 613 614 615
                                border.width: 1
                                border.color: myPalette.mid
                                color: myPalette.mid
                                visible: Layout.minimumWidth != 0
616

617 618
                                Layout.bottomMargin: elisaTheme.layoutVerticalMargin
                                Layout.topMargin: elisaTheme.layoutVerticalMargin
619

620
                                Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
621

622
                                Layout.fillHeight: true
623

624 625 626 627
                                Layout.preferredWidth: 1
                                Layout.minimumWidth: 1
                                Layout.maximumWidth: 1
                            }
628

629 630
                            ContextView {
                                id: albumContext
631

632
                                Layout.fillHeight: true
633

634 635 636
                                Layout.minimumWidth: contentZone.width
                                Layout.maximumWidth: contentZone.width
                                Layout.preferredWidth: contentZone.width
637

638
                                visible: Layout.minimumWidth != 0
639

640 641 642 643
                                artistName: myHeaderBarManager.artist
                                albumName: myHeaderBarManager.album
                                albumArtUrl: myHeaderBarManager.image
                            }
644 645
                        }
                    }
646 647

                    states: [
648 649
                        State {
                            name: 'full'
650
                            when: listViews.currentIndex === 0
651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694
                            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
                            }
                        },
695
                        State {
696
                            name: 'allAlbums'
697
                            when: listViews.currentIndex === 1
698 699 700 701 702
                            StateChangeScript {
                                script: {
                                    localAlbums.stackView.pop({item: null, immediate: true})
                                }
                            }
703 704
                            PropertyChanges {
                                target: mainContentView
705
                                Layout.fillWidth: true
706 707 708
                                Layout.minimumWidth: contentZone.width * 0.66
                                Layout.maximumWidth: contentZone.width * 0.68
                                Layout.preferredWidth: contentZone.width * 0.68
709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733
                            }
                            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
                            }
734 735 736 737 738 739 740 741
                            PropertyChanges {
                                target: localAlbums
                                opacity: 1
                            }
                            PropertyChanges {
                                target: localArtists
                                opacity: 0
                            }
742 743 744 745
                            PropertyChanges {
                                target: localTracks
                                opacity: 0
                            }
746 747 748
                        },
                        State {
                            name: 'allArtists'
749
                            when: listViews.currentIndex === 2
750 751 752 753 754
                            StateChangeScript {
                                script: {
                                    localArtists.stackView.pop({item: null, immediate: true})
                                }
                            }
755 756
                            PropertyChanges {
                                target: mainContentView
757
                                Layout.fillWidth: true
758 759 760
                                Layout.minimumWidth: contentZone.width * 0.66
                                Layout.maximumWidth: contentZone.width * 0.68
                                Layout.preferredWidth: contentZone.width * 0.68
761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793
                            }
                            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
                            }
794 795 796 797
                            PropertyChanges {
                                target: localTracks
                                opacity: 0
                            }
798 799
                        },
                        State {
800
                            name: 'allTracks'
801
                            when: listViews.currentIndex === 3
802 803
                            PropertyChanges {
                                target: mainContentView
804
                                Layout.fillWidth: true
805 806 807
                                Layout.minimumWidth: contentZone.width * 0.66
                                Layout.maximumWidth: contentZone.width * 0.68
                                Layout.preferredWidth: contentZone.width * 0.68
808 809 810
                            }
                            PropertyChanges {
                                target: firstViewSeparatorItem
811 812 813
                                Layout.minimumWidth: 1
                                Layout.maximumWidth: 1
                                Layout.preferredWidth: 1
814 815 816
                            }
                            PropertyChanges {
                                target: playList
817 818 819
                                Layout.minimumWidth: contentZone.width * 0.33
                                Layout.maximumWidth: contentZone.width * 0.33
                                Layout.preferredWidth: contentZone.width * 0.33
820 821 822
                            }
                            PropertyChanges {
                                target: viewSeparatorItem
823 824 825
                                Layout.minimumWidth: 0
                                Layout.maximumWidth: 0
                                Layout.preferredWidth: 0
826 827 828
                            }
                            PropertyChanges {
                                target: albumContext
829 830 831
                                Layout.minimumWidth: 0
                                Layout.maximumWidth: 0
                                Layout.preferredWidth: 0
832
                            }
833 834 835 836 837 838 839 840
                            PropertyChanges {
                                target: localAlbums
                                opacity: 0
                            }
                            PropertyChanges {
                                target: localArtists
                                opacity: 0
                            }
841 842 843 844
                            PropertyChanges {
                                target: localTracks
                                opacity: 1
                            }
845 846 847 848
                        }
                    ]
                    transitions: Transition {
                        NumberAnimation {
849
                            properties: "Layout.minimumWidth, Layout.maximumWidth, Layout.preferredWidth, opacity"
850 851 852
                            easing.type: Easing.InOutQuad
                            duration: 300
                        }
853 854
                    }
                }
855 856 857
            }
        }
    }
858 859 860 861 862

    Component {
        id: innerAlbumView

        GridBrowserView {
863
            id: innerAlbumGridView
864 865
            property var stackView

866
            contentModel: elisa.singleArtistProxyModel
867 868 869

            isSubPage: true

870
            onOpen: {
871
                elisa.singleAlbumProxyModel.loadAlbumData(databaseId)
872 873 874
                localArtists.stackView.push(albumView, {
                                                stackView: localArtists.stackView,
                                                albumName: innerMainTitle,
875
                                                artistName: innerSecondaryTitle,
876
                                                albumArtUrl: innerImage,
877 878 879
                                            })
            }
            onGoBack: stackView.pop()
880 881 882 883 884 885 886 887

            Binding {
                target: innerAlbumGridView
                property: 'filterState'
                value: persistentSettings.filterState
            }

            onFilterViewChanged: persistentSettings.filterState = filterState
888 889 890 891 892 893 894
        }
    }

    Component {
        id: albumView

        MediaAlbumView {
895
            id: albumGridView
896
            property var stackView
897

898
            contentModel: elisa.singleAlbumProxyModel
899

900 901 902 903 904 905 906 907 908 909 910 911 912
            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()
                    }
                }
913
                allArtistsView.open(name, name, elisaTheme.defaultArtistImage, '')
914 915
            }
            onGoBack: stackView.pop()
916 917 918 919 920 921 922 923

            Binding {
                target: albumGridView
                property: 'filterState'
                value: persistentSettings.filterState
            }

            onFilterViewChanged: persistentSettings.filterState = filterState
924 925
        }
    }
926 927 928 929 930 931 932 933 934

    Component.onCompleted:
    {
        elisa.initialize()

        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 })

935 936 937 938 939
        if (persistentSettings.playListState) {
            elisa.mediaPlayList.persistentState = persistentSettings.playListState
        }

        elisa.mediaPlayList.enqueue(elisa.arguments)
940
    }
941
}