main.qml 23.7 KB
Newer Older
1 2
import QtQuick 2.10
import QtQuick.Controls 2.10
Camilo Higuita's avatar
Camilo Higuita committed
3
import QtQuick.Layouts 1.3
Camilo Higuita's avatar
Camilo Higuita committed
4
import QtGraphicalEffects 1.0
5 6 7 8 9 10 11 12 13 14

import org.kde.kirigami 2.7 as Kirigami
import org.kde.mauikit 1.0 as Maui
import org.kde.mauikit 1.1 as MauiLab
import org.maui.vvave 1.0 as Vvave

import Player 1.0
import AlbumsList 1.0
import TracksList 1.0
import PlaylistsList 1.0
15

Camilo Higuita's avatar
Camilo Higuita committed
16
import "utils"
17

Camilo Higuita's avatar
Camilo Higuita committed
18
import "widgets"
19 20
import "widgets/PlaylistsView"
import "widgets/MainPlaylist"
21
import "widgets/SettingsView"
22
import "widgets/SearchView"
23
import "widgets/CloudView"
24

25
import "view_models"
26
import "view_models/BabeTable"
27 28

import "services/local"
29
import "services/web"
Camilo Higuita's avatar
Camilo Higuita committed
30

31 32
import "view_models/BabeGrid"

33 34
import "widgets/InfoView"

35
import "db/Queries.js" as Q
36
import "utils/Help.js" as H
37
import "utils/Player.js" as Player
38

39
Maui.ApplicationWindow
Camilo Higuita's avatar
Camilo Higuita committed
40 41
{

Camilo Higuita's avatar
Camilo Higuita committed
42
    id: root
43
    title: currentTrack ? currentTrack.title + " - " +  currentTrack.artist + " | " + currentTrack.album : ""
44 45 46
    /***************************************************/
    /******************** ALIASES ********************/
    /*************************************************/
camilo higuita's avatar
camilo higuita committed
47
    property alias mainPlaylist: mainPlaylist
48
    property alias selectionBar: _selectionBar
Camilo higuita's avatar
Camilo higuita committed
49
    property alias progressBar: progressBar
50
    property alias dialog : _dialogLoader.item
51

camilo higuita's avatar
camilo higuita committed
52 53
    Maui.App.iconName: "qrc:/assets/vvave.svg"
    Maui.App.description: qsTr("VVAVE will handle your whole music collection by retreaving semantic information from the web. Just relax, enjoy and discover your new music ")
54 55 56
    /***************************************************/
    /******************** PLAYBACK ********************/
    /*************************************************/
Camilo higuita's avatar
Camilo higuita committed
57
    property bool isShuffle: Maui.FM.loadSettings("SHUFFLE","PLAYBACK", false)
58
    property var currentTrack: mainPlaylist.listView.itemAtIndex(currentTrackIndex)
camilo higuita's avatar
camilo higuita committed
59

60
    property int currentTrackIndex: -1
camilo higuita's avatar
camilo higuita committed
61
    property int prevTrackIndex: 0
62

63
    readonly property string currentArtwork: currentTrack ?  currentTrack.artwork : ""
64

65
    property alias durationTimeLabel: player.duration
66
    property string progressTimeLabel: player.transformTime((player.duration/1000) *(player.pos/ 1000))
67

68
    property alias isPlaying: player.playing
camilo higuita's avatar
camilo higuita committed
69
    property int onQueue: 0
70

71
    property bool mainlistEmpty: !mainPlaylist.table.count > 0
camilo higuita's avatar
camilo higuita committed
72

73
    /***************************************************/
74 75
    /******************** HANDLERS ********************/
    /*************************************************/
camilo higuita's avatar
camilo higuita committed
76
    readonly property var viewsIndex: ({ tracks: 0,
camilo higuita's avatar
camilo higuita committed
77 78 79
                                           albums: 1,
                                           artists: 2,
                                           playlists: 3,
80 81
                                           cloud: 4,
                                           folders: 5,
82
                                           youtube: 6})
camilo higuita's avatar
camilo higuita committed
83 84 85

    property string syncPlaylist: ""
    property bool sync: false
86

87
    property bool focusView : false
Camilo higuita's avatar
Camilo higuita committed
88
    property bool selectionMode : false
89 90 91 92

    /***************************************************/
    /******************** UI COLORS *******************/
    /*************************************************/
93
    readonly property color babeColor: "#f84172"
94

95 96 97
    /*SIGNALS*/
    signal missingAlert(var track)

camilo higuita's avatar
camilo higuita committed
98
    //    flickable: swipeView.currentItem.flickable ||  swipeView.currentItem.item.flickable
Camilo Higuita's avatar
Camilo Higuita committed
99

camilo higuita's avatar
camilo higuita committed
100
    footerPositioning: ListView.InlineFooter
101
    /*HANDLE EVENTS*/
Camilo Higuita's avatar
Camilo Higuita committed
102
    onClosing: Player.savePlaylist()
Camilo Higuita's avatar
Camilo Higuita committed
103 104
    onMissingAlert:
    {
105
        var message = qsTr("Missing file")
106 107
        var messageBody = track.title + " by " + track.artist + " is missing.\nDo you want to remove it from your collection?"
        notify("dialog-question", message, messageBody, function ()
108
        {
109
            mainPlaylist.list.remove(mainPlaylist.table.currentIndex)
110
        })
111 112 113
    }

    /*COMPONENTS*/
114 115 116 117
    Player
    {
        id: player
        volume: 100
118
        onFinishedChanged: if (!mainlistEmpty)
Camilo higuita's avatar
Camilo higuita committed
119
                           {
120
                               if (currentTrack && currentTrack.url)
Camilo higuita's avatar
Camilo higuita committed
121
                                   mainPlaylist.list.countUp(currentTrackIndex)
122

Camilo higuita's avatar
Camilo higuita committed
123 124
                               Player.nextTrack()
                           }
125 126
    }

camilo higuita's avatar
camilo higuita committed
127
    headBar.visible: !focusView
128 129 130 131 132 133 134
    headBar.rightContent: ToolButton
    {
        icon.name: "item-select"
        onClicked: selectionMode = !selectionMode
        checkable: false
        checked: selectionMode
    }
135

136 137 138 139 140
    Loader
    {
        id: _dialogLoader
    }

141 142 143 144 145 146 147
    InfoView
    {
        id: infoView
        maxWidth: parent.width * 0.8
        maxHeight: parent.height * 0.9
    }

148 149 150
    Loader
    {
        id: _focusViewLoader
151
        anchors.fill: parent
152 153
        active: focusView
        source: "widgets/FocusView.qml"
154 155
    }

156
    Component
157
    {
158
        id: _shareDialogComponent
159
        MauiLab.ShareDialog {}
160 161
    }

162
    Component
163
    {
164
        id: _fmDialogComponent
165 166 167 168 169 170 171
        Maui.FileDialog {}
    }

    Component
    {
        id: _settingsDialogComponent
        SettingsDialog {}
172 173
    }

174 175 176 177 178
    SourcesDialog
    {
        id: sourcesDialog
    }

179 180 181 182 183
    FloatingDisk
    {
        id: _floatingDisk
    }

Camilo higuita's avatar
Camilo higuita committed
184
    mainMenu: [
185

186 187 188 189
        MenuSeparator{},

        MenuItem
        {
camilo higuita's avatar
camilo higuita committed
190 191 192 193 194 195 196
            text: qsTr("Settings")
            icon.name: "settings-configure"
            onTriggered:
            {
                _dialogLoader.sourceComponent = _settingsDialogComponent
                dialog.open()
            }
197 198
        },

199
        MenuItem
200
        {
201
            text: qsTr("Sources")
202 203
            icon.name: "folder-add"
            onTriggered: sourcesDialog.open()
Camilo higuita's avatar
Camilo higuita committed
204 205
        },

206 207
        MenuSeparator{},

208
        MenuItem
Camilo higuita's avatar
Camilo higuita committed
209
        {
210
            text: qsTr("Open")
Camilo higuita's avatar
Camilo higuita committed
211 212 213
            icon.name: "folder-add"
            onTriggered:
            {
214 215 216 217
                _dialogLoader.sourceComponent = _fmDialogComponent
                root.dialog.settings.onlyDirs = false
                root.dialog.settings.filterType = Maui.FMList.AUDIO
                root.dialog.show(function(paths)
Camilo higuita's avatar
Camilo higuita committed
218
                {
219
                    Vvave.Vvave.openUrls(paths)
220
                    root.dialog.close()
Camilo higuita's avatar
Camilo higuita committed
221 222
                })
            }
223
        }
224
    ]
225

226 227 228 229 230
    Playlists
    {
        id: playlistsList
    }

231 232 233 234 235
    PlaylistDialog
    {
        id: playlistDialog
    }

236
    sideBar: Maui.AbstractSideBar
Camilo Higuita's avatar
Camilo Higuita committed
237
    {
Camilo higuita's avatar
Camilo higuita committed
238
        id: _drawer
239
        width: visible ? Math.min(Kirigami.Units.gridUnit * 16, root.width) : 0
camilo higuita's avatar
camilo higuita committed
240 241
        collapsed: !isWide
        collapsible: true
camilo higuita's avatar
camilo higuita committed
242
        dragMargin: Maui.Style.space.big
camilo higuita's avatar
camilo higuita committed
243 244 245 246
        overlay.visible: collapsed && position > 0 && visible
        Connections
        {
            target: _drawer.overlay
247
            onClicked: _drawer.visible = false
camilo higuita's avatar
camilo higuita committed
248
        }
249

250
        MainPlaylist
Camilo Higuita's avatar
Camilo Higuita committed
251
        {
Camilo higuita's avatar
Camilo higuita committed
252
            id: mainPlaylist
253
            anchors.fill: parent
Camilo higuita's avatar
Camilo higuita committed
254 255 256 257 258
            Connections
            {
                target: mainPlaylist
                onCoverPressed: Player.appendAll(tracks)
                onCoverDoubleClicked: Player.playAll(tracks)
camilo higuita's avatar
camilo higuita committed
259
            }
260 261 262
        }
    }

263
    footer: ColumnLayout
Camilo Higuita's avatar
Camilo Higuita committed
264
    {
265
        visible: !focusView
camilo higuita's avatar
camilo higuita committed
266
        width: parent.width
267
        spacing: 0
268
        height: visible ? implicitHeight : 0
269

270
        Maui.ToolBar
camilo higuita's avatar
camilo higuita committed
271
        {
272
            Layout.fillWidth: true
camilo higuita's avatar
camilo higuita committed
273
            preferredHeight: Maui.Style.toolBarHeightAlt * 0.8
274 275
            position: ToolBar.Footer
            visible: isPlaying
276

277
            leftContent: Label
Camilo Higuita's avatar
Camilo Higuita committed
278
            {
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303
                id: _label1
                visible: text.length
                verticalAlignment: Qt.AlignVCenter
                horizontalAlignment: Qt.AlignHCenter
                text: progressTimeLabel
                elide: Text.ElideMiddle
                wrapMode: Text.NoWrap
                color: Kirigami.Theme.textColor
                font.weight: Font.Normal
                font.pointSize: Maui.Style.fontSizes.default
            }

            middleContent:  ColumnLayout
            {
                Layout.fillHeight: true
                Layout.fillWidth: true
                spacing: 0

                Label
                {
                    Layout.fillHeight: true
                    Layout.fillWidth: true
                    visible: text.length
                    verticalAlignment: Qt.AlignVCenter
                    horizontalAlignment: Qt.AlignHCenter
304
                    text: root.title
305 306 307 308 309 310 311 312 313
                    elide: Text.ElideMiddle
                    wrapMode: Text.NoWrap
                    color: Kirigami.Theme.textColor
                    font.weight: Font.Normal
                    font.pointSize: Maui.Style.fontSizes.default
                }
            }

            rightContent: Label
Camilo Higuita's avatar
Camilo Higuita committed
314
            {
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331
                id: _label2
                visible: text.length
                verticalAlignment: Qt.AlignVCenter
                horizontalAlignment: Qt.AlignHCenter
                text: player.transformTime(player.duration/1000)
                elide: Text.ElideMiddle
                wrapMode: Text.NoWrap
                color: Kirigami.Theme.textColor
                font.weight: Font.Normal
                font.pointSize: Maui.Style.fontSizes.default
                opacity: 0.7
            }

            background: Slider
            {
                id: progressBar
                padding: 0
camilo higuita's avatar
camilo higuita committed
332
                from: 0
333 334 335 336 337
                to: 1000
                value: player.pos
                spacing: 0
                focus: true
                onMoved: player.pos = value
338
                enabled: player.playing
339
                Kirigami.Separator
340
                {
341 342 343 344
                    anchors.top: parent.top
                    anchors.left: parent.left
                    anchors.right: parent.right
                }
camilo higuita's avatar
camilo higuita committed
345

346
                background: Rectangle
347
                {
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370
                    implicitWidth: progressBar.width
                    implicitHeight: progressBar.height
                    width: progressBar.availableWidth
                    height: implicitHeight
                    color: "transparent"
                    opacity: 0.4

                    Rectangle
                    {
                        width: progressBar.visualPosition * parent.width
                        height: progressBar.height
                        color: Kirigami.Theme.highlightColor
                    }
                }

                handle: Rectangle
                {
                    x: progressBar.leftPadding + progressBar.visualPosition
                       * (progressBar.availableWidth - width)
                    y: 0
                    implicitWidth: Maui.Style.iconSizes.medium
                    implicitHeight: progressBar.height
                    color: progressBar.pressed ? Qt.lighter(Kirigami.Theme.highlightColor, 1.2) : "transparent"
371
                }
372
            }
373 374
        }

375
        Maui.ToolBar
camilo higuita's avatar
camilo higuita committed
376
        {
377 378 379
            Layout.fillWidth: true
            Layout.preferredHeight: Maui.Style.toolBarHeight
            position: ToolBar.Footer
Camilo higuita's avatar
Camilo higuita committed
380

381 382 383 384 385 386 387
            background: Item
            {
                Image
                {
                    id: artworkBg
                    height: parent.height
                    width: parent.width
camilo higuita's avatar
camilo higuita committed
388

389 390
                    sourceSize.width: 500
                    sourceSize.height: height
camilo higuita's avatar
camilo higuita committed
391

392 393 394 395 396
                    fillMode: Image.PreserveAspectCrop
                    antialiasing: true
                    smooth: true
                    asynchronous: true
                    cache: true
camilo higuita's avatar
camilo higuita committed
397

398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426
                    source: currentArtwork
                }

                FastBlur
                {
                    id: fastBlur
                    anchors.fill: parent
                    source: artworkBg
                    radius: 100
                    transparentBorder: false
                    cached: true

                    Rectangle
                    {
                        anchors.fill: parent
                        color: Kirigami.Theme.backgroundColor
                        opacity: 0.8
                    }
                }

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

            rightContent: ToolButton
427
            {
428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464
                icon.name: _volumeSlider.value === 0 ? "player-volume-muted" : "player-volume"
                onPressAndHold :
                {
                    player.volume = player.volume === 0 ? 100 : 0
                }

                onClicked:
                {
                    _sliderPopup.visible ? _sliderPopup.close() : _sliderPopup.open()
                }

                Popup
                {
                    id: _sliderPopup
                    height: 150
                    width: parent.width
                    y: -150
                    x: 0
                    //                            closePolicy: Popup.CloseOnEscape | Popup.CloseOnPress
                    Slider
                    {
                        id: _volumeSlider
                        visible: true
                        height: parent.height
                        width: 20
                        anchors.horizontalCenter: parent.horizontalCenter
                        from: 0
                        to: 100
                        value: player.volume
                        orientation: Qt.Vertical

                        onMoved:
                        {
                            player.volume = value
                        }
                    }
                }
465
            }
466 467 468 469 470 471 472

            middleContent: [
                ToolButton
                {
                    id: babeBtnIcon
                    icon.name: "love"
                    enabled: currentTrackIndex >= 0
473
                    checked: currentTrack ? Maui.FM.isFav(currentTrack.url) : false
474
                    icon.color: checked ? babeColor :  Kirigami.Theme.textColor
475 476
                    onClicked: if (!mainlistEmpty)
                               {
477
                                   mainPlaylist.list.fav(currentTrackIndex, !Maui.FM.isFav(currentTrack.url))
478 479 480
                               }
                },

481
                Maui.ToolActions
482
                {
483 484 485
                    expanded: true
                    autoExclusive: false
                    checkable: false
486

487 488 489 490 491 492 493 494 495 496 497 498 499 500 501
                    Action
                    {
                        icon.name: "media-skip-backward"
                        onTriggered: Player.previousTrack()
                        //                    onPressAndHold: Player.playAt(prevTrackIndex)
                    }
                    //ambulatorios1@clinicaantioquia.com.co, copago martha hilda restrepo, cc 22146440 eps salud total, consulta expecialista urologo, hora 3:40 pm
                    Action
                    {
                        id: playIcon
                        text: qsTr("Play and pause")
                        enabled: currentTrackIndex >= 0
                        icon.name: isPlaying ? "media-playback-pause" : "media-playback-start"
                        onTriggered: player.playing = !player.playing
                    }
502

503 504 505 506 507 508 509
                    Action
                    {
                        text: qsTr("Next")
                        icon.name: "media-skip-forward"
                        onTriggered: Player.nextTrack()
                        //                    onPressAndHold: Player.playAt(Player.shuffle())
                    }
510 511 512 513 514 515 516 517 518 519 520 521 522 523
                },

                ToolButton
                {
                    id: shuffleBtn
                    icon.color: babeColor
                    icon.name: isShuffle ? "media-playlist-shuffle" : "media-playlist-normal"
                    onClicked:
                    {
                        isShuffle = !isShuffle
                        Maui.FM.saveSettings("SHUFFLE", isShuffle, "PLAYBACK")
                    }
                }
            ]
camilo higuita's avatar
camilo higuita committed
524
        }
525
    }
camilo higuita's avatar
camilo higuita committed
526

527
    ColumnLayout
camilo higuita's avatar
camilo higuita committed
528 529
    {
        anchors.fill: parent
530
        visible: !focusView
531

532
        MauiLab.AppViews
533
        {
534 535 536
            id: swipeView
            Layout.fillHeight: true
            Layout.fillWidth: true
Camilo higuita's avatar
Camilo higuita committed
537

538
            MauiLab.AppViewLoader
539
            {
540 541
                MauiLab.AppView.title: qsTr("Tracks")
                MauiLab.AppView.iconName: "view-media-track"
542

543
                TracksView
544
                {
545 546 547 548 549 550 551 552
                    id: tracksView
                    onRowClicked: Player.quickPlay(tracksView.listModel.get(index))
                    onQuickPlayTrack: Player.quickPlay(tracksView.listModel.get(index))
                    onAppendTrack: Player.addTrack(tracksView.listModel.get(index))
                    onPlayAll: Player.playAll( tracksView.listModel.getAll())
                    onAppendAll: Player.appendAll( tracksView.listModel.getAll())
                    onQueueTrack: Player.queueTracks([tracksView.listModel.get(index)], index)
                    Connections
Camilo higuita's avatar
Camilo higuita committed
553
                    {
554 555
                        target: Vvave.Vvave
                        onRefreshTables: tracksView.list.refresh()
556
                    }
Camilo Higuita's avatar
Camilo Higuita committed
557
                }
558
            }
559

560
            MauiLab.AppViewLoader
561
            {
camilo higuita's avatar
camilo higuita committed
562 563
                MauiLab.AppView.title: qsTr("Albums")
                MauiLab.AppView.iconName: "view-media-album-cover"
564

565 566 567
                AlbumsView
                {
                    id: albumsView
568

569 570 571 572 573 574 575
                    holder.emoji: "qrc:/assets/dialog-information.svg"
                    holder.isMask: false
                    holder.title : qsTr("No Albums!")
                    holder.body: qsTr("Add new music sources")
                    holder.emojiSize: Maui.Style.iconSizes.huge
                    list.query: Albums.ALBUMS
                    list.sortBy: Albums.ALBUM
576

577 578 579
                    onRowClicked: Player.quickPlay(track)
                    onAppendTrack: Player.addTrack(track)
                    onPlayTrack: Player.quickPlay(track)
580

581
                    onAlbumCoverClicked: albumsView.populateTable(album, artist)
582

583 584 585 586
                    onAlbumCoverPressedAndHold:
                    {
                        var query = Q.GET.albumTracks_.arg(album)
                        query = query.arg(artist)
587

588 589 590 591 592
                        mainPlaylist.list.clear()
                        mainPlaylist.list.sortBy = Tracks.NONE
                        mainPlaylist.list.query = query
                        Player.playAt(0)
                    }
593

594 595
                    onPlayAll: Player.playAll(albumsView.listModel.getAll())
                    onAppendAll: Player.appendAll(albumsView.listModel.getAll())
596

597 598 599 600
                    Connections
                    {
                        target: Vvave.Vvave
                        onRefreshTables: albumsView.list.refresh()
camilo higuita's avatar
camilo higuita committed
601
                    }
602
                }
603
            }
camilo higuita's avatar
camilo higuita committed
604

605
            MauiLab.AppViewLoader
606
            {
607 608
                MauiLab.AppView.title: qsTr("Artists")
                MauiLab.AppView.iconName: "view-media-artist"
609

610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628
                AlbumsView
                {
                    id: artistsView

                    holder.emoji: "qrc:/assets/dialog-information.svg"
                    holder.isMask: false
                    holder.title : qsTr("No Artists!")
                    holder.body: qsTr("Add new music sources")
                    holder.emojiSize: Maui.Style.iconSizes.huge
                    list.query: Albums.ARTISTS
                    list.sortBy: Albums.ARTIST
                    table.list.sortBy:  Tracks.NONE

                    onRowClicked: Player.quickPlay(track)
                    onAppendTrack: Player.addTrack(track)
                    onPlayTrack: Player.quickPlay(track)
                    onAlbumCoverClicked: artistsView.populateTable(undefined, artist)

                    onAlbumCoverPressedAndHold:
camilo higuita's avatar
camilo higuita committed
629
                    {
630 631 632 633 634 635
                        var query = Q.GET.artistTracks_.arg(artist)
                        mainPlaylist.list.clear()
                        mainPlaylist.list.sortBy = Tracks.NONE
                        mainPlaylist.list.query = query
                        Player.playAt(0)
                    }
636

637 638
                    onPlayAll: Player.playAll(artistsView.listModel.getAll())
                    onAppendAll: Player.appendAll(artistsView.listModel.getAll())
639

640 641 642 643
                    Connections
                    {
                        target: Vvave.Vvave
                        onRefreshTables: artistsView.list.refresh()
camilo higuita's avatar
camilo higuita committed
644 645
                    }
                }
646
            }
camilo higuita's avatar
camilo higuita committed
647

648
            MauiLab.AppViewLoader
649
            {
camilo higuita's avatar
camilo higuita committed
650
                MauiLab.AppView.title: qsTr("Playlists")
651
                MauiLab.AppView.iconName: "view-media-playlist"
652 653

                PlaylistsView
camilo higuita's avatar
camilo higuita committed
654
                {
655
                    id: playlistsView
656

657 658 659 660 661
                    onRowClicked: Player.quickPlay(track)
                    onAppendTrack: Player.addTrack(track)
                    onPlayTrack: Player.quickPlay(track)
                    onAppendAll: Player.appendAll(playlistsView.listModel.getAll())
                    onSyncAndPlay:
camilo higuita's avatar
camilo higuita committed
662
                    {
663
                        Player.playAll(playlistsView.listModel.getAll())
664

665 666
                        root.sync = true
                        root.syncPlaylist = playlist
camilo higuita's avatar
camilo higuita committed
667
                    }
668 669

                    onPlayAll: Player.playAll(playlistsView.listModel.getAll())
camilo higuita's avatar
camilo higuita committed
670
                }
671
            }
camilo higuita's avatar
camilo higuita committed
672

673
            MauiLab.AppViewLoader
674
            {
675
                MauiLab.AppView.title: qsTr("Cloud")
camilo higuita's avatar
camilo higuita committed
676
                MauiLab.AppView.iconName: "folder-cloud"
677
                CloudView
678
                {
679
                    id: cloudView
680
                }
681
            }
682

683
            MauiLab.AppViewLoader
684
            {
685 686
                MauiLab.AppView.title: qsTr("Folders")
                MauiLab.AppView.iconName: "folder"
687 688

                FoldersView
camilo higuita's avatar
camilo higuita committed
689
                {
690
                    id: foldersView
691

692
                    Connections
camilo higuita's avatar
camilo higuita committed
693
                    {
694 695 696
                        target: Vvave.Vvave
                        onRefreshTables: foldersView.populate()
                    }
camilo higuita's avatar
camilo higuita committed
697

698 699 700
                    Connections
                    {
                        target: foldersView.list
701

702 703
                        onRowClicked: Player.quickPlay(foldersView.list.model.get(index))
                        onQuickPlayTrack: Player.quickPlay(foldersView.list.model.get(index))
704

705 706
                        onAppendTrack: Player.addTrack(foldersView.listModel.get(index))
                        onPlayAll: Player.playAll(foldersView.listModel.getAll())
707

708 709
                        onAppendAll: Player.appendAll(foldersView.listModel.getAll())
                        onQueueTrack: Player.queueTracks([foldersView.list.model.get(index)], index)
710
                    }
camilo higuita's avatar
camilo higuita committed
711
                }
712
            }
camilo higuita's avatar
camilo higuita committed
713

714
            MauiLab.AppViewLoader
715
            {
716 717
                MauiLab.AppView.title: qsTr("YouTube")
                MauiLab.AppView.iconName: "internet-services"
718

719 720 721
                YouTube
                {
                    id: youtubeView
722
                }
camilo higuita's avatar
camilo higuita committed
723
            }
724
        }
Camilo higuita's avatar
Camilo higuita committed
725

726 727 728 729 730 731 732 733 734
        SelectionBar
        {
            id: _selectionBar
            property alias listView: _selectionBar.selectionList
            Layout.alignment: Qt.AlignHCenter
            Layout.preferredWidth: Math.min(parent.width-(Maui.Style.space.medium*2), implicitWidth)
            Layout.margins: Maui.Style.space.medium
            maxListHeight: swipeView.height - Maui.Style.space.medium
            onExitClicked:
camilo higuita's avatar
camilo higuita committed
735
            {
736 737
                root.selectionMode = false
                clear()
738
            }
Camilo Higuita's avatar
Camilo Higuita committed
739
        }
Camilo higuita's avatar
Camilo higuita committed
740
    }
741

camilo higuita's avatar
camilo higuita committed
742
    /*CONNECTIONS*/
Camilo Higuita's avatar
Camilo Higuita committed
743 744
    Connections
    {
745
        target: Vvave.Vvave
746

747 748 749 750 751
        onRefreshTables:
        {
            if(size>0) root.notify("emblem-info", "Collection updated", size+" new tracks added...")
        }

Camilo higuita's avatar
Camilo higuita committed
752 753 754 755 756
        onOpenFiles:
        {
            Player.appendTracksAt(tracks, 0)
            Player.playAt(0)
        }
757
    }
camilo higuita's avatar
camilo higuita committed
758 759 760 761 762 763 764 765 766

    Component.onCompleted:
    {
        if(isAndroid)
        {
            Maui.Android.statusbarColor(Kirigami.Theme.backgroundColor, true)
            Maui.Android.navBarColor(Kirigami.Theme.backgroundColor, true)
        }
    }
Camilo Higuita's avatar
Camilo Higuita committed
767
}