main.qml 25.8 KB
Newer Older
Camilo Higuita's avatar
Camilo Higuita committed
1 2 3
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
4
import QtGraphicalEffects 1.0
Camilo Higuita's avatar
Camilo Higuita committed
5
import QtQuick.Controls.Material 2.1
6

7 8
import org.kde.kirigami 2.2 as Kirigami

9
import "utils"
10

Camilo Higuita's avatar
Camilo Higuita committed
11
import "widgets"
12
import "widgets/MyBeatView"
13 14
import "widgets/PlaylistsView"
import "widgets/MainPlaylist"
15
import "widgets/SettingsView"
16

17
import "view_models"
18
import "view_models/BabeDialog"
Camilo Higuita's avatar
Camilo Higuita committed
19

20 21 22
import "db/Queries.js" as Q
import "utils/Player.js" as Player

23
Kirigami.ApplicationWindow
Camilo Higuita's avatar
Camilo Higuita committed
24
{
25
    id: root
Camilo Higuita's avatar
Camilo Higuita committed
26
    visible: true
27
    width: !isMobile ? wideSize : 400
28
    minimumWidth: !isMobile ? columnWidth : 0
29
    minimumHeight:  !isMobile ? columnWidth+64 : 0
Camilo Higuita's avatar
Camilo Higuita committed
30 31
    height: 500
    title: qsTr("Babe")
32
    //    wideScreen: root.width > coverSize
Camilo Higuita's avatar
Camilo Higuita committed
33

34 35 36 37 38 39
    /*ALIASES*/
    property alias playIcon: playIcon
    property alias babeBtnIcon: babeBtnIcon
    property alias progressBar : progressBar
    property alias animFooter : animFooter
    property alias mainPlaylist : mainPlaylist
40

41 42
    /*PLAYBACK*/
    property bool shuffle : false
43
    property var currentTrack : ({babe: "0", stars: "0"})
44 45 46
    property int currentTrackIndex : 0
    property int prevTrackIndex : 0
    property string currentArtwork
47
    property bool currentBabe : currentTrack.babe == "0" ? false : true
48 49
    property string durationTimeLabel : "00:00"
    property string progressTimeLabel : "00:00"
50
    property bool isPlaying : false
51

52
    /*THEMING*/
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
    property string babeColor : bae.babeColor()
    property string babeAltColor : bae.babeAltColor()
    property string backgroundColor : bae.backgroundColor()
    property string foregroundColor : bae.foregroundColor()
    property string textColor : bae.textColor()
    property string babeHighlightColor : bae.highlightColor()
    property string highlightTextColor : bae.highlightTextColor()
    property string midColor : bae.midColor()
    property string midLightColor : bae.midLightColor()
    property string darkColor : bae.darkColor()
    property string baseColor : bae.baseColor()
    property string altColor : bae.altColor()
    property string shadowColor : bae.shadowColor()

    readonly property string lightBackgroundColor : "#eff0f1"
    readonly property string lightForegroundColor : "#31363b"
    readonly property string lightTextColor : "#31363b"
    readonly property string lightBabeHighlightColor : "#3daee9"
    readonly property string lightHighlightTextColor : "#eff0f1"
    readonly property string lightMidColor : "#cacaca"
    readonly property string lightMidLightColor : "#dfdfdf"
    readonly property string lightDarkColor : "#7f8c8d"
    readonly property string lightBaseColor : "#fcfcfc"
    readonly property string lightAltColor : "#eeeeee"
    readonly property string lightShadowColor : "#868686"
78

79 80 81 82 83 84 85 86 87 88 89 90
    readonly property string darkBackgroundColor : "#333"
    readonly property string darkForegroundColor : "#FAFAFA"
    readonly property string darkTextColor : darkForegroundColor
    readonly property string darkBabeHighlightColor : "#29B6F6"
    readonly property string darkHighlightTextColor : darkForegroundColor
    readonly property string darkMidColor : "#424242"
    readonly property string darkMidLightColor : "#616161"
    readonly property string darkDarkColor : "#212121"
    readonly property string darkBaseColor : "#212121"
    readonly property string darkAltColor : "#424242"
    readonly property string darkShadowColor : "#424242"

91
    Material.theme: Material.Light
92 93 94 95 96 97
    Material.accent: babeColor
    Material.background: backgroundColor
    Material.primary: backgroundColor
    Material.foreground: foregroundColor

    /*READONLY PROPS*/
98
    readonly property var iconSizes : ({ "small" : 16, "medium" : isMobile ? 24 : 22, "big" : 32, "large" : 48 })
99
    readonly property var fontSizes : ({"tiny": isMobile ? 7.5 : 7, "small" : isMobile ? 9.5 : 8.5, "medium" : isMobile ? 11 :  10, "big" : isMobile ? 11.5 : 10.5, "large" : isMobile ? 12 : 11.5})
100
    readonly property real opacityLevel : 0.8
101
    readonly property bool isMobile: bae.isMobile()
102
    readonly property int wideSize : bae.screenGeometry("width")*0.5
103
    readonly property int rowHeight: isMobile ? 60 : 52
104
    readonly property int rowHeightAlt: isMobile ? 48 : 32
105
    readonly property int headerHeight: rowHeight
106
    readonly property int contentMargins : isMobile ? 8 : 10
107 108 109 110 111 112 113 114
    readonly property var viewsIndex : ({
                                            "babeit": 0,
                                            "tracks" : 1,
                                            "albums" : 2,
                                            "artists" : 3,
                                            "playlists" : 4,
                                            "search" : 5
                                        })
115
    property bool mainlistEmpty : !mainPlaylist.table.count > 0
116

117
    /*PROPS*/
118
    property int toolBarIconSize: bae.loadSetting("ICON_SIZE", "BABE", iconSizes.medium)
119 120
    property int toolBarHeight : isMobile ? 48 : toolBarIconSize *2

121
    property int columnWidth: Kirigami.Units.gridUnit * 18
122
    property int coverSize: isMobile ? Math.sqrt(root.width*root.height)*0.4 : columnWidth * 0.65
123
    property int currentView : viewsIndex.tracks
124

125 126 127
    /*USEFUL PROPS*/
    property string syncPlaylist : ""
    property bool sync : false
128
    property string infoMsg : ""
129
    property bool infoLabels : bae.loadSetting("PLAYBACKINFO", "BABE", false) == "true" ? true : false
130

131 132 133 134
    /*SIGNALS*/
    signal missingAlert(var track)

    /*CONF*/
135 136
    pageStack.defaultColumnWidth: columnWidth
    pageStack.initialPage: [mainPlaylist, views]
137 138
    pageStack.interactive: isMobile
    pageStack.separatorVisible: pageStack.wideMode
139

140 141
    overlay.modal: Rectangle
    {
142 143 144 145
        color: isMobile ? darkColor : "transparent"
        opacity: 0.5
        height: root.height - playbackControls.height - toolbar.height
        y: toolbar.height
146 147 148 149 150 151
    }

    overlay.modeless: Rectangle
    {
        color: "transparent"
    }
152

153 154
    /*HANDLE EVENTS*/
    onWidthChanged: if(isMobile)
155
                    {
156
                        if(width > height)
157 158 159
                            mainPlaylist.cover.visible = false
                        else  mainPlaylist.cover.visible = true
                    }
160

161
    onClosing: Player.savePlaylist()
162

163 164 165 166
    pageStack.onCurrentIndexChanged:
    {
        if(pageStack.currentIndex === 0 && isMobile && !pageStack.wideMode)
        {
167 168
            bae.androidStatusBarColor(babeColor)
            Material.background = babeColor
169 170
        }else
        {
171 172
            bae.androidStatusBarColor(babeAltColor)
            Material.background = babeAltColor
173 174 175
        }
    }

176 177 178 179 180 181 182
    onMissingAlert:
    {
        missingDialog.message = track.title +" by "+track.artist+" is missing"
        missingDialog.messageBody = "Do you want to remove it from your collection?"
        missingDialog.open()
    }

183 184 185
    Component.onCompleted:
    {
        if(isMobile) settingsDrawer.switchColorScheme(bae.loadSetting("THEME", "BABE", "Dark"))
186
        settingsDrawer.visible = false
187
    }
188

189 190

    /*COMPONENTS*/
191
    BabeNotify { id: babeNotify }
192

193
    BabeMessage
194 195
    {
        id: missingDialog
196
        width: isMobile ? parent.width *0.9 : parent.width*0.4
197 198 199
        title: "Missing file"
        onAccepted:
        {
200
            bae.removeTrack(currentTrack.url)
201
            mainPlaylist.table.model.remove(mainPlaylist.table.currentIndex)
202 203 204 205

        }
    }

206
    /*CONNECTIONS*/
207 208
    Connections
    {
Camilo Higuita's avatar
Camilo Higuita committed
209
        target: player
210
        onPos: progressBar.value = pos
211 212
        onTiming: progressTimeLabel = time
        onDurationChanged: durationTimeLabel = time
Camilo Higuita's avatar
Camilo Higuita committed
213
        onFinished: Player.nextTrack()
214
        onIsPlaying:  isPlaying = playing
215 216
    }

217 218
    Connections
    {
219
        target: bae
220 221
        onRefreshTables:
        {
222
            console.log("Clearing tables")
223
            tracksView.list.clearTable()
224 225
            albumsView.clearGrid()
            artistsView.clearGrid()
226 227 228 229 230

            tracksView.populate()
            albumsView.populate()
            artistsView.populate()
        }
231 232 233

        onTrackLyricsReady:
        {
234 235 236
                        console.log("TRACKS READY SIGNAL2")
            //            if(url === currentTrack.url)
                            Player.setLyrics(lyrics)
237
        }
238 239 240

        onSkipTrack: Player.nextTrack()
        onBabeIt: Player.babeTrack()
241 242
    }

243 244

    /* UI */
Camilo Higuita's avatar
Camilo Higuita committed
245 246
    header: BabeBar
    {
247
        id: toolbar
248
        height: toolBarHeight
Camilo Higuita's avatar
Camilo Higuita committed
249
        visible: true
250
        currentIndex: currentView
251 252
        bgColor: isMobile && pageStack.currentIndex === 0 && !pageStack.wideMode ? babeColor : babeAltColor
        textColor: isMobile && pageStack.currentIndex === 0 && !pageStack.wideMode ? "#FFF" : bae.foregroundColor()
Camilo Higuita's avatar
Camilo Higuita committed
253

254
        onSettingsViewClicked: settingsDrawer.visible ? settingsDrawer.close() : settingsDrawer.open()
255

256 257 258
        onTracksViewClicked:
        {
            pageStack.currentIndex = 1
259
            currentView = viewsIndex.tracks
260
        }
261

262 263 264
        onAlbumsViewClicked:
        {
            pageStack.currentIndex = 1
265
            currentView = viewsIndex.albums
266
        }
267

268 269 270
        onArtistsViewClicked:
        {
            pageStack.currentIndex = 1
271
            currentView = viewsIndex.artists
272
        }
273

274 275 276
        onPlaylistsViewClicked:
        {
            pageStack.currentIndex = 1
277
            currentView = viewsIndex.playlists
278
        }
279

280 281 282
        onBabeViewClicked:
        {
            pageStack.currentIndex = 1
283
            currentView = viewsIndex.babeit
284
        }
285 286 287 288

        onSearchViewClicked:
        {
            pageStack.currentIndex = 1
289
            currentView = viewsIndex.search
290
        }
Camilo Higuita's avatar
Camilo Higuita committed
291 292
    }

293
    footer: Item
294
    {
295 296
        id: playbackControls
        anchors.horizontalCenter: parent.horizontalCenter
297
        height: visible ? headerHeight : 0
298
        width: root.width
299
        visible: true
300 301 302

        FastBlur
        {
303
            anchors.fill: parent
304 305 306 307 308 309
            source: mainPlaylist.artwork
            radius: 100
            transparentBorder: false
            cached: true
            z: -999
        }
310

311
        Rectangle
312
        {
313
            id: footerBg
314
            anchors.fill: parent
315
            color: darkDarkColor
316 317
            opacity: opacityLevel
            z: -999
318

319 320 321 322 323 324 325 326
            SequentialAnimation
            {
                id: animFooter
                PropertyAnimation
                {
                    target: footerBg
                    property: "color"
                    easing.type: Easing.InOutQuad
327 328
                    from: darkMidColor
                    to: darkDarkColor
329 330 331
                    duration: 500
                }
            }
332 333 334 335 336
        }

        Slider
        {
            id: progressBar
337

338
            height: 10
339
            width: parent.width
340
            z: 999
341 342 343
            anchors.left: parent.left
            anchors.right: parent.right
            anchors.top: parent.top
344
            padding: 0
345 346 347 348 349 350 351 352
            from: 0
            to: 1000
            value: 0
            spacing: 0

            onMoved: player.seek(player.duration() / 1000 * value);

            background: Rectangle
353
            {
354
                x: progressBar.leftPadding
355
                y: progressBar.y
356
                implicitWidth: 200
357
                implicitHeight: 10
358 359
                width: progressBar.availableWidth
                height: implicitHeight
360
                color: "transparent"
361

362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378
                Kirigami.Separator
                {

                    Rectangle
                    {
                        anchors.fill: parent
                        color: Kirigami.Theme.viewFocusColor
                    }

                    anchors
                    {
                        left: parent.left
                        right: parent.right
                        top: parent.top
                    }
                }

379 380 381
                Rectangle
                {
                    width: progressBar.visualPosition * parent.width
382
                    height: 4
383 384
                    color: babeColor
                }
385 386
            }

387
            handle: Rectangle
388
            {
389
                x: progressBar.leftPadding + progressBar.visualPosition * (progressBar.availableWidth - width)
390
                y: progressBar.y-(height/2)
391 392 393
                implicitWidth: progressBar.pressed ? 16 : 0
                implicitHeight: progressBar.pressed ? 16 : 0
                radius:  progressBar.pressed ? 16 : 0
394
                color: babeColor
395
            }
396

397
        }
398

399 400

        GridLayout
401 402 403
        {
            anchors.fill: parent
            height: parent.height
404
            width: parent.width
405

406 407 408
            rowSpacing: 0
            columnSpacing: 0
            rows: 2
409
            columns: 2
410 411


412 413
            Item
            {
414
                Layout.alignment: Qt.AlignLeft
415 416 417 418 419 420 421 422
                Layout.fillHeight: true
                Layout.maximumWidth: miniArtwork.visible ? headerHeight : 0
                Layout.minimumWidth: miniArtwork.visible ? headerHeight : 0
                Layout.minimumHeight: miniArtwork.visible ? headerHeight : 0
                Layout.maximumHeight: miniArtwork.visible ? headerHeight : 0
                Layout.row: 1
                Layout.rowSpan: 2
                Layout.column: 1
423

424 425
                //                height: headerHeight
                //                width:  miniArtwork.visible ? headerHeight : 0
426

427 428
                Image
                {
429
                    id: miniArtwork
430
                    visible: ((!pageStack.wideMode && pageStack.currentIndex !== 0) || !mainPlaylist.cover.visible) && !mainlistEmpty
431 432 433

                    height: headerHeight
                    width: headerHeight
434
                    anchors.left: parent.left
435
                    anchors.verticalCenter: parent.verticalCenter
436 437 438 439 440 441 442 443 444
                    source:
                    {
                        if(currentArtwork)
                            (currentArtwork.length > 0 && currentArtwork !== "NONE")? "file://"+encodeURIComponent(currentArtwork) : "qrc:/assets/cover.png"
                        else "qrc:/assets/cover.png"
                    }
                    fillMode:  Image.PreserveAspectFit
                    cache: false
                    antialiasing: true
445 446 447 448 449 450 451 452 453 454 455

                    MouseArea
                    {
                        anchors.fill: parent
                        onClicked:
                        {
                            if(!isMobile && pageStack.wideMode)
                                root.width = columnWidth
                            pageStack.currentIndex = 0
                        }
                    }
456 457
                }
            }
458

459
            Item
460
            {
461
                Layout.alignment: Qt.AlignCenter
462
                Layout.fillWidth: true
463 464 465 466
                Layout.fillHeight: true
                Layout.row: 2
                Layout.column: 2
                Layout.maximumHeight: playbackInfo.visible ? playbackInfo.font.pointSize*2 : 0
467

468
                Label
469
                {
470
                    id: playbackInfo
471

472
                    visible: !mainlistEmpty && infoLabels
473 474 475 476
                    //                anchors.top: playIcon.bottom
                    //                anchors.horizontalCenter: playIcon.horizontalCenter
                    width: parent.width
                    height: parent.height
477 478
                    horizontalAlignment: Qt.AlignHCenter
                    verticalAlignment: Qt.AlignVCenter
479
                    text: progressTimeLabel  + "  /  " + (currentTrack ? (currentTrack.title ? currentTrack.title + " - " + currentTrack.artist : "--- - "+currentTrack.artist) : "") + "  /  " + durationTimeLabel
480
                    color: darkForegroundColor
481
                    font.pointSize: fontSizes.tiny
482 483
                    elide: Text.ElideRight
                }
484
            }
485

486 487 488 489 490 491 492
            RowLayout
            {
                Layout.fillWidth: true
                Layout.fillHeight: true
                Layout.alignment: Qt.AlignCenter
                Layout.row: 1
                Layout.column: 2
493

494 495 496 497
                BabeButton
                {
                    id: babeBtnIcon
                    iconName: "love"
498
                    iconColor: currentBabe ? babeColor : darkForegroundColor
499
                    onClicked:
500
                    {
501 502 503
                        var value = mainPlaylist.contextMenu.babeIt(currentTrackIndex)
                        currentTrack.babe = value ? "1" : "0"
                        currentBabe = value
504 505

                        //                        bae.runPy();
506
                    }
507
                }
508

509 510 511
                BabeButton
                {
                    id: previousBtn
512
                    iconColor: darkForegroundColor
513 514 515 516
                    iconName: "media-skip-backward"
                    onClicked: Player.previousTrack()
                    onPressAndHold: Player.playAt(prevTrackIndex)
                }
517

518 519 520
                BabeButton
                {
                    id: playIcon
521
                    iconColor: darkForegroundColor
522

523
                    iconName:  isPlaying ? "media-playback-pause" :  "media-playback-start"
524
                    onClicked:
525
                    {
526 527
                        if(player.isPaused()) Player.resumeTrack()
                        else Player.pauseTrack()
528
                    }
529
                }
530

531 532 533
                BabeButton
                {
                    id: nextBtn
534
                    iconColor: darkForegroundColor
535

536 537 538
                    iconName: "media-skip-forward"
                    onClicked: Player.nextTrack()
                    onPressAndHold: Player.playAt(Player.shuffle())
539
                }
540

541 542 543
                BabeButton
                {
                    id: shuffleBtn
544 545
                    iconColor: darkForegroundColor

546 547 548 549
                    iconName: shuffle ? "media-playlist-shuffle" : "media-playlist-repeat"
                    onClicked: shuffle = !shuffle
                }

550 551
            }

552

553

554
        }
555 556
    }

557
    background: Rectangle
558 559
    {
        anchors.fill: parent
560
        color: altColor
561 562 563
        z: -999
    }

564
    globalDrawer: SettingsView
Camilo Higuita's avatar
Camilo Higuita committed
565 566
    {
        id: settingsDrawer
567
        //        contentItem.implicitWidth: columnWidth
568
        onIconSizeChanged: toolBarIconSize = size
Camilo Higuita's avatar
Camilo Higuita committed
569
    }
570

571 572 573 574 575 576 577 578 579 580 581 582
    Item
    {
        id: message
        visible: infoMsg.length > 0
        anchors.bottom: parent.bottom
        width: pageStack.wideMode ? columnWidth : parent.width
        height: toolBarIconSize
        z:999

        Rectangle
        {
            id: infoBg
583

584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618
            anchors.fill: parent
            z: -999
            color: altColor
            opacity: opacityLevel

            SequentialAnimation
            {
                id: animBg
                PropertyAnimation
                {
                    target: infoBg
                    property: "color"
                    easing.type: Easing.InOutQuad
                    to: babeColor
                    duration: 250
                }

                PropertyAnimation
                {
                    target: infoBg
                    property: "color"
                    easing.type: Easing.InOutQuad
                    to: altColor
                    duration: 500
                }
            }
        }

        Label
        {
            id: infoTxt
            anchors.centerIn: parent
            anchors.fill: parent
            height: parent.height
            width: parent.width
619
            font.pointSize: fontSizes.medium
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 645 646 647
            text: infoMsg
            horizontalAlignment: Qt.AlignHCenter
            verticalAlignment: Qt.AlignVCenter
            color: foregroundColor

            SequentialAnimation
            {
                id: animTxt
                PropertyAnimation
                {
                    target: infoTxt
                    property: "color"
                    easing.type: Easing.InOutQuad
                    to: "white"
                    duration: 250
                }

                PropertyAnimation
                {
                    target: infoTxt
                    property: "color"
                    easing.type: Easing.InOutQuad
                    to: foregroundColor
                    duration: 500
                }
            }
        }
    }
648 649 650 651

    MainPlaylist
    {
        id: mainPlaylist
652 653
        anchors.fill: parent
        clip: true
654 655 656



657 658 659 660 661 662 663 664
        Connections
        {
            target: mainPlaylist
            onCoverPressed: Player.appendAll(tracks)
            onCoverDoubleClicked: Player.playAll(tracks)
        }
    }

Camilo Higuita's avatar
Camilo Higuita committed
665
    Page
Camilo Higuita's avatar
Camilo Higuita committed
666
    {
667
        id: views
Camilo Higuita's avatar
Camilo Higuita committed
668
        anchors.fill: parent
669
        clip: true
670 671
        //        focusPolicy: Qt.WheelFocus
        //        visualFocus: true
Camilo Higuita's avatar
Camilo Higuita committed
672

673
        Column
Camilo Higuita's avatar
Camilo Higuita committed
674
        {
675
            anchors.fill: parent
Camilo Higuita's avatar
Camilo Higuita committed
676

677
            SwipeView
Camilo Higuita's avatar
Camilo Higuita committed
678
            {
679 680
                id: swipeView
                width: parent.width
681 682
                height: parent.height

683
                Component.onCompleted: contentItem.interactive = root.isMobile
684

685
                currentIndex: currentView
686

687 688
                onCurrentItemChanged: currentItem.forceActiveFocus()

689 690 691
                onCurrentIndexChanged:
                {
                    currentView = currentIndex
692 693 694
                    if(pageStack.currentIndex === 0) mainPlaylist.list.forceActiveFocus()
                    else if(currentView === viewsIndex.tracks) tracksView.forceActiveFocus()
                    else if(currentView === viewsIndex.search) searchView.forceActiveFocus()
695

696 697
                    if(!babeitView.isConnected && currentIndex === viewsIndex.babeit)
                        babeitView.logginDialog.open()
698
                }
699

700
                BabeitView
701
                {
702
                    id: babeitView
703 704
                }

705 706
                TracksView
                {
707
                    id: tracksView
708 709 710 711 712
                    Connections
                    {
                        target: tracksView
                        onRowClicked: Player.addTrack(tracksView.model.get(index))
                        onQuickPlayTrack: Player.quickPlay(tracksView.model.get(index))
Camilo Higuita's avatar
Camilo Higuita committed
713 714
                        onPlayAll: Player.playAll(bae.get(Q.GET.allTracks))
                        onAppendAll: Player.appendAll(bae.get(Q.GET.allTracks))
715

716
                    }
717
                }
Camilo Higuita's avatar
Camilo Higuita committed
718

Camilo Higuita's avatar
Camilo Higuita committed
719
                AlbumsView
720
                {
721
                    id: albumsView
722 723 724 725
                    Connections
                    {
                        target: albumsView
                        onRowClicked: Player.addTrack(track)
726 727
                        onPlayAlbum: Player.playAll(tracks)
                        onAppendAlbum: Player.appendAll(tracks)
728 729
                        onPlayTrack: Player.quickPlay(track)
                    }
Camilo Higuita's avatar
Camilo Higuita committed
730
                }
731

Camilo Higuita's avatar
Camilo Higuita committed
732 733
                ArtistsView
                {
734
                    id: artistsView
735 736 737 738 739

                    Connections
                    {
                        target: artistsView
                        onRowClicked: Player.addTrack(track)
740 741
                        onPlayAlbum: Player.playAll(tracks)
                        onAppendAlbum: Player.appendAll(tracks)
742 743
                        onPlayTrack: Player.quickPlay(track)
                    }
Camilo Higuita's avatar
Camilo Higuita committed
744
                }
745

746 747 748 749 750 751 752 753
                PlaylistsView
                {
                    id: playlistsView
                    Connections
                    {
                        target: playlistsView
                        onRowClicked: Player.addTrack(track)
                        onQuickPlayTrack: Player.quickPlay(track)
Camilo Higuita's avatar
Camilo Higuita committed
754 755
                        onPlayAll: Player.playAll(tracks)
                        onAppendAll: Player.appendAll(tracks)
756 757 758 759 760 761
                        onPlaySync:
                        {
                            var tracks = bae.get(Q.GET.playlistTracks_.arg(playlist))
                            Player.playAll(tracks)
                            root.sync = true
                            root.syncPlaylist = playlist
762
                            root.infoMsg = "Syncing to "+ playlist
763 764
                            console.log("ALLOW PLAYLIOST SYNC FOR: " ,root.syncPlaylist = playlist)
                        }
765 766
                    }
                }
Camilo Higuita's avatar
Camilo Higuita committed
767

768 769 770
                SearchTable
                {
                    id: searchView
771 772
                    Connections
                    {
773 774 775
                        target: searchView.searchTable
                        onRowClicked: Player.addTrack(searchView.searchTable.model.get(index))
                        onQuickPlayTrack: Player.quickPlay(searchView.searchTable.model.get(index))
776 777
                        onPlayAll: Player.playAll(searchView.searchRes)
                        onAppendAll: Player.appendAll(searchView.searchRes)
778 779
                        onArtworkDoubleClicked:
                        {
780 781
                            var query = Q.GET.albumTracks_.arg(searchView.searchTable.model.get(index).album)
                            query = query.arg(searchView.searchTable.model.get(index).artist)
782 783 784 785

                            Player.playAll(bae.get(query))

                        }
786
                    }
787 788
                }

789 790 791
            }
        }
    }
Camilo Higuita's avatar
Camilo Higuita committed
792
    /*animations*/
793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836

    pageStack.layers.popEnter: Transition {
        PauseAnimation {
            duration: Kirigami.Units.longDuration
        }
    }
    pageStack.layers.popExit: Transition {
        YAnimator {
            from: 0
            to: pageStack.layers.height
            duration: Kirigami.Units.longDuration
            easing.type: Easing.OutCubic
        }
    }

    pageStack.layers.pushEnter: Transition {
        YAnimator {
            from: pageStack.layers.height
            to: 0
            duration: Kirigami.Units.longDuration
            easing.type: Easing.OutCubic
        }
    }

    pageStack.layers.pushExit: Transition {
        PauseAnimation {
            duration: Kirigami.Units.longDuration
        }
    }

    pageStack.layers.replaceEnter: Transition {
        YAnimator {
            from: pageStack.layers.width
            to: 0
            duration: Kirigami.Units.longDuration
            easing.type: Easing.OutCubic
        }
    }

    pageStack.layers.replaceExit: Transition {
        PauseAnimation {
            duration: Kirigami.Units.longDuration
        }
    }
837 838 839 840 841 842 843 844

    /*FUNCTIONS*/
    function infoMsgAnim()
    {
        animBg.running = true
        animTxt.running = true
    }

Camilo Higuita's avatar
Camilo Higuita committed
845
}