ElisaMainWindow.qml 33.3 KB
Newer Older
1
/*
2
 * Copyright 2016-2017 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;

Alexander Stippich's avatar
Alexander Stippich committed
105 106
            persistentSettings.playListState = mediaPlayList.persistentState;
            persistentSettings.playListControlerState = 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

Alexander Stippich's avatar
Alexander Stippich committed
117 118
        playListModel: mediaPlayList
        playListControler: 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 158 159
    Connections {
        target: mediaPlayList
        onPlayListLoadFailed: {
160 161
            messageNotification.showNotification(i18nc("message of passive notification when playlist load failed", "Load of playlist failed"), 3000)
        }
Alexander Stippich's avatar
Alexander Stippich committed
162 163
        onEnsurePlay: manageAudioPlayer.ensurePlay()
        onPlayListFinished: manageAudioPlayer.playListFinished()
164 165
    }

Alexander Stippich's avatar
Alexander Stippich committed
166 167 168
    Component.onCompleted: {
        mediaPlayList.persistentState = persistentSettings.playListState
        mediaPlayList.enqueueAndPlay(elisa.arguments)
169 170 171 172 173
    }

    ManageHeaderBar {
        id: myHeaderBarManager

Alexander Stippich's avatar
Alexander Stippich committed
174 175
        playListModel: mediaPlayList
        currentTrack: mediaPlayList.currentTrack
176

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

    ManageAudioPlayer {
        id: manageAudioPlayer

Alexander Stippich's avatar
Alexander Stippich committed
187 188
        currentTrack: mediaPlayList.currentTrack
        playListModel: mediaPlayList
189
        urlRole: MediaPlayList.ResourceRole
190
        isPlayingRole: MediaPlayList.IsPlayingRole
191 192 193
        titleRole: MediaPlayList.TitleRole
        artistNameRole: MediaPlayList.ArtistRole
        albumNameRole: MediaPlayList.AlbumRole
194

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

202
        persistentState: persistentSettings.audioPlayerState
203

204 205 206
        onPlayerPlay: audioPlayer.play()
        onPlayerPause: audioPlayer.pause()
        onPlayerStop: audioPlayer.stop()
Alexander Stippich's avatar
Alexander Stippich committed
207
        onSkipNextTrack: mediaPlayList.skipNextTrack()
208
        onSeek: audioPlayer.seek(position)
209 210
        onSourceInError:
        {
Alexander Stippich's avatar
Alexander Stippich committed
211
            mediaPlayList.trackInError(source, playerError)
212 213 214 215
            allListeners.playBackError(source, playerError)
        }

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

    ManageMediaPlayerControl {
        id: myPlayControlManager

Alexander Stippich's avatar
Alexander Stippich committed
221 222
        playListModel: mediaPlayList
        currentTrack: mediaPlayList.currentTrack
223 224
    }

225 226 227 228
    PassiveNotification {
        id: messageNotification
    }

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

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

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

243 244
                HeaderBar {
                    id: headerBar
245

246 247
                    focus: true

248
                    anchors.fill: parent
249

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

256
                    ratingVisible: false
257

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

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

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

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

Alexander Stippich's avatar
Alexander Stippich committed
274 275
                    playerControl.onPlayPrevious: mediaPlayList.skipPreviousTrack()
                    playerControl.onPlayNext: mediaPlayList.skipNextTrack()
276

277 278
                    ToolButton {
                        id: menuButton
279

280
                        action: applicationMenuAction
281

282
                        z: 2
283

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

295
                        z: 1
296

297
                        radius: width / 2
298

299 300
                        color: myPalette.window
                    }
301

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

                        anchors
                        {
                            right: menuButton.left
                            top: menuButton.top
                            bottom: menuButton.bottom
                            rightMargin: elisaTheme.layoutHorizontalMargin * 3
                        }

313 314
                        indexingRunning: allListeners.indexingRunning
                        importedTracksCount: allListeners.importedTracksCount
315
                        musicManager: allListeners
316
                    }
317
                }
318
            }
319

320
            RowLayout {
321
                Layout.fillHeight: true
322 323
                Layout.fillWidth: true
                spacing: 0
324

325 326
                ViewSelector {
                    id: listViews
327

328
                    Layout.fillHeight: true
329 330
                    Layout.preferredWidth: mainWindow.width * 0.15
                    Layout.maximumWidth: mainWindow.width * 0.15
331 332
                }

333
                ColumnLayout {
334 335
                    Layout.fillHeight: true
                    Layout.fillWidth: true
336

337
                    spacing: 0
338

339
                    TopNotification {
340
                        id: invalidBalooConfiguration
341

342
                        Layout.fillWidth: true
343

344 345
                        musicManager: allListeners

346
                        focus: true
347 348 349 350 351 352 353 354 355 356 357 358 359
                    }

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

                        RowLayout {
                            anchors.fill: parent

                            spacing: 0

                            id: contentZone

360
                            FocusScope {
361 362
                                id: mainContentView

363
                                focus: true
364 365 366 367 368 369 370

                                Layout.fillHeight: true

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

Matthieu Gallien's avatar
Matthieu Gallien committed
371

372 373
                                visible: Layout.minimumWidth != 0

374 375 376 377 378 379 380 381
                                Rectangle {
                                    border {
                                        color: (mainContentView.activeFocus ? myPalette.highlight : myPalette.base)
                                        width: 1
                                    }

                                    radius: 3
                                    color: myPalette.base
382

383
                                    anchors.fill: parent
384

385 386
                                    BusyIndicator {
                                        id: busyScanningMusic
387

388
                                        anchors.fill: parent
389

390 391 392 393
                                        anchors.leftMargin: parent.width / 3
                                        anchors.rightMargin: parent.width / 3
                                        anchors.topMargin: parent.height / 3
                                        anchors.bottomMargin: parent.height / 3
394

395
                                        opacity: 0.8
396

397
                                        z: 2
398

399
                                        running: allListeners.indexerBusy
400 401 402 403 404 405 406 407 408 409 410 411 412 413
                                    }

                                    MediaBrowser {
                                        id: localAlbums

                                        focus: true

                                        anchors {
                                            fill: parent

                                            leftMargin: elisaTheme.layoutHorizontalMargin
                                            rightMargin: elisaTheme.layoutHorizontalMargin
                                        }

414 415 416
                                        firstPage: GridBrowserView {
                                            id: allAlbumsView

417
                                            focus: true
418

Alexander Stippich's avatar
Alexander Stippich committed
419
                                            contentModel: allAlbumsProxyModel
420

421
                                            image: elisaTheme.albumIcon
422 423 424
                                            mainTitle: i18nc("Title of the view of all albums", "Albums")

                                            onOpen: {
425
                                                singleAlbumProxyModel.sourceModel.loadAlbumData(databaseId)
426 427 428
                                                localAlbums.stackView.push(albumView, {
                                                                               stackView: localAlbums.stackView,
                                                                               albumName: innerMainTitle,
429
                                                                               artistName:  innerSecondaryTitle,
430 431 432 433
                                                                               albumArtUrl: innerImage,
                                                                           })
                                            }
                                            onGoBack: localAlbums.stackView.pop()
434
                                        }
435

436
                                        visible: opacity > 0
437
                                    }
438

439 440
                                    MediaBrowser {
                                        id: localArtists
441

442
                                        focus: true
443

444 445 446 447 448 449
                                        anchors {
                                            fill: parent

                                            leftMargin: elisaTheme.layoutHorizontalMargin
                                            rightMargin: elisaTheme.layoutHorizontalMargin
                                        }
450

451
                                        firstPage: GridBrowserView {
452
                                            id: allArtistsView
453
                                            focus: true
454 455 456 457

                                            showRating: false
                                            delegateDisplaySecondaryText: false

Alexander Stippich's avatar
Alexander Stippich committed
458
                                            contentModel: allArtistsProxyModel
459

460
                                            image: elisaTheme.artistIcon
461 462 463
                                            mainTitle: i18nc("Title of the view of all artists", "Artists")

                                            onOpen: {
464
                                                singleArtistProxyModel.setArtistFilterText(innerMainTitle)
465 466 467 468 469 470
                                                localArtists.stackView.push(innerAlbumView, {
                                                                                mainTitle: innerMainTitle,
                                                                                secondaryTitle: innerSecondaryTitle,
                                                                                image: innerImage,
                                                                                stackView: localArtists.stackView
                                                                            })
471

472 473
                                            }
                                            onGoBack: localArtists.stackView.pop()
474 475 476
                                        }

                                        visible: opacity > 0
477
                                    }
478

479 480
                                    MediaBrowser {
                                        id: localTracks
481

482
                                        focus: true
483

484 485 486 487 488 489
                                        anchors {
                                            fill: parent

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

491
                                        firstPage: MediaAllTracksView {
492
                                            focus: true
493
                                            stackView: localTracks.stackView
494

Alexander Stippich's avatar
Alexander Stippich committed
495
                                            contentModel: allTracksProxyModel
496 497 498
                                        }

                                        visible: opacity > 0
499 500
                                    }

501 502 503 504 505
                                    Behavior on border.color {
                                        ColorAnimation {
                                            duration: 300
                                        }
                                    }
506
                                }
507
                            }
508

509 510
                            Rectangle {
                                id: firstViewSeparatorItem
511

512 513 514 515
                                border.width: 1
                                border.color: myPalette.mid
                                color: myPalette.mid
                                visible: true
516

517 518
                                Layout.bottomMargin: elisaTheme.layoutVerticalMargin
                                Layout.topMargin: elisaTheme.layoutVerticalMargin
519

520
                                Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
521

522
                                Layout.fillHeight: true
523

524 525 526 527
                                Layout.preferredWidth: 1
                                Layout.minimumWidth: 1
                                Layout.maximumWidth: 1
                            }
528

529 530
                            MediaPlayListView {
                                id: playList
531

Alexander Stippich's avatar
Alexander Stippich committed
532
                                playListModel: mediaPlayList
533

Alexander Stippich's avatar
Alexander Stippich committed
534 535
                                randomPlayChecked: mediaPlayList.randomPlay
                                repeatPlayChecked: mediaPlayList.repeatPlay
536

537
                                Layout.fillHeight: true
538 539
                                Layout.leftMargin: elisaTheme.layoutHorizontalMargin
                                Layout.rightMargin: elisaTheme.layoutHorizontalMargin
540

541 542 543
                                Layout.minimumWidth: contentZone.width
                                Layout.maximumWidth: contentZone.width
                                Layout.preferredWidth: contentZone.width
544

545 546
                                Component.onCompleted:
                                {
Alexander Stippich's avatar
Alexander Stippich committed
547 548
                                    mediaPlayList.randomPlay = Qt.binding(function() { return playList.randomPlayChecked })
                                    mediaPlayList.repeatPlay = Qt.binding(function() { return playList.repeatPlayChecked })
549 550
                                    myPlayControlManager.randomOrContinuePlay = Qt.binding(function() { return playList.randomPlayChecked || playList.repeatPlayChecked })
                                }
551 552 553 554

                                onStartPlayback: manageAudioPlayer.ensurePlay()

                                onPausePlayback: manageAudioPlayer.playPause()
555 556

                                onDisplayError: messageNotification.showNotification(errorText)
557
                            }
558

559 560
                            Rectangle {
                                id: viewSeparatorItem
561

562 563 564 565
                                border.width: 1
                                border.color: myPalette.mid
                                color: myPalette.mid
                                visible: Layout.minimumWidth != 0
566

567 568
                                Layout.bottomMargin: elisaTheme.layoutVerticalMargin
                                Layout.topMargin: elisaTheme.layoutVerticalMargin
569

570
                                Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
571

572
                                Layout.fillHeight: true
573

574 575 576 577
                                Layout.preferredWidth: 1
                                Layout.minimumWidth: 1
                                Layout.maximumWidth: 1
                            }
578

579 580
                            ContextView {
                                id: albumContext
581

582
                                Layout.fillHeight: true
583

584 585 586
                                Layout.minimumWidth: contentZone.width
                                Layout.maximumWidth: contentZone.width
                                Layout.preferredWidth: contentZone.width
587

588
                                visible: Layout.minimumWidth != 0
589

590 591 592 593
                                artistName: myHeaderBarManager.artist
                                albumName: myHeaderBarManager.album
                                albumArtUrl: myHeaderBarManager.image
                            }
594 595
                        }
                    }
596 597

                    states: [
598 599
                        State {
                            name: 'full'
600
                            when: listViews.currentIndex === 0
601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644
                            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
                            }
                        },
645
                        State {
646
                            name: 'allAlbums'
647
                            when: listViews.currentIndex === 1
648 649 650 651 652
                            StateChangeScript {
                                script: {
                                    localAlbums.stackView.pop({item: null, immediate: true})
                                }
                            }
653 654
                            PropertyChanges {
                                target: mainContentView
655
                                Layout.fillWidth: true
656 657 658
                                Layout.minimumWidth: contentZone.width * 0.66
                                Layout.maximumWidth: contentZone.width * 0.68
                                Layout.preferredWidth: contentZone.width * 0.68
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
                            }
                            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
                            }
684 685 686 687 688 689 690 691
                            PropertyChanges {
                                target: localAlbums
                                opacity: 1
                            }
                            PropertyChanges {
                                target: localArtists
                                opacity: 0
                            }
692 693 694 695
                            PropertyChanges {
                                target: localTracks
                                opacity: 0
                            }
696 697 698
                        },
                        State {
                            name: 'allArtists'
699
                            when: listViews.currentIndex === 2
700 701 702 703 704
                            StateChangeScript {
                                script: {
                                    localArtists.stackView.pop({item: null, immediate: true})
                                }
                            }
705 706
                            PropertyChanges {
                                target: mainContentView
707
                                Layout.fillWidth: true
708 709 710
                                Layout.minimumWidth: contentZone.width * 0.66
                                Layout.maximumWidth: contentZone.width * 0.68
                                Layout.preferredWidth: contentZone.width * 0.68
711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743
                            }
                            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
                            }
744 745 746 747
                            PropertyChanges {
                                target: localTracks
                                opacity: 0
                            }
748 749
                        },
                        State {
750
                            name: 'allTracks'
751
                            when: listViews.currentIndex === 3
752 753
                            PropertyChanges {
                                target: mainContentView
754
                                Layout.fillWidth: true
755 756 757
                                Layout.minimumWidth: contentZone.width * 0.66
                                Layout.maximumWidth: contentZone.width * 0.68
                                Layout.preferredWidth: contentZone.width * 0.68
758 759 760
                            }
                            PropertyChanges {
                                target: firstViewSeparatorItem
761 762 763
                                Layout.minimumWidth: 1
                                Layout.maximumWidth: 1
                                Layout.preferredWidth: 1
764 765 766
                            }
                            PropertyChanges {
                                target: playList
767 768 769
                                Layout.minimumWidth: contentZone.width * 0.33
                                Layout.maximumWidth: contentZone.width * 0.33
                                Layout.preferredWidth: contentZone.width * 0.33
770 771 772
                            }
                            PropertyChanges {
                                target: viewSeparatorItem
773 774 775
                                Layout.minimumWidth: 0
                                Layout.maximumWidth: 0
                                Layout.preferredWidth: 0
776 777 778
                            }
                            PropertyChanges {
                                target: albumContext
779 780 781
                                Layout.minimumWidth: 0
                                Layout.maximumWidth: 0
                                Layout.preferredWidth: 0
782
                            }
783 784 785 786 787 788 789 790
                            PropertyChanges {
                                target: localAlbums
                                opacity: 0
                            }
                            PropertyChanges {
                                target: localArtists
                                opacity: 0
                            }
791 792 793 794
                            PropertyChanges {
                                target: localTracks
                                opacity: 1
                            }
795 796 797 798
                        }
                    ]
                    transitions: Transition {
                        NumberAnimation {
799
                            properties: "Layout.minimumWidth, Layout.maximumWidth, Layout.preferredWidth, opacity"
800 801 802
                            easing.type: Easing.InOutQuad
                            duration: 300
                        }
803 804
                    }
                }
805 806 807
            }
        }
    }
808 809 810 811 812 813 814

    Component {
        id: innerAlbumView

        GridBrowserView {
            property var stackView

Alexander Stippich's avatar
Alexander Stippich committed
815
            contentModel: singleArtistProxyModel
816 817 818

            isSubPage: true

819
            onOpen: {
820
                singleAlbumProxyModel.sourceModel.loadAlbumData(databaseId)
821 822 823
                localArtists.stackView.push(albumView, {
                                                stackView: localArtists.stackView,
                                                albumName: innerMainTitle,
824
                                                artistName: innerSecondaryTitle,
825
                                                albumArtUrl: innerImage,
826 827 828 829 830 831 832 833 834 835 836
                                            })
            }
            onGoBack: stackView.pop()
        }
    }

    Component {
        id: albumView

        MediaAlbumView {
            property var stackView
837

Alexander Stippich's avatar
Alexander Stippich committed
838
            contentModel: singleAlbumProxyModel
839

840 841 842 843 844 845 846 847 848 849 850 851 852
            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()
                    }
                }
853
                allArtistsView.open(name, name, elisaTheme.defaultArtistImage, '')
854 855 856 857
            }
            onGoBack: stackView.pop()
        }
    }
858
}