Warning, /maui/vvave/src/widgets/PlaylistsView/PlaylistsView.qml is written in an unsupported language. File is not indexed.
0001 import QtQuick 2.14 0002 import QtQuick.Controls 2.14 0003 0004 import org.mauikit.controls 1.3 as Maui 0005 import org.mauikit.filebrowsing 1.3 as FB 0006 0007 import org.maui.vvave 1.0 as Vvave 0008 0009 import "../BabeTable" 0010 0011 import "../../db/Queries.js" as Q 0012 import "../../utils/Player.js" as Player 0013 0014 StackView 0015 { 0016 id: control 0017 0018 property string playlistQuery 0019 0020 readonly property Flickable flickable : currentItem.flickable 0021 readonly property alias playlistList :_playlistPage.list 0022 0023 Component 0024 { 0025 id: newPlaylistDialogComponent 0026 FB.NewTagDialog {} 0027 } 0028 0029 initialItem: PlaylistsViewModel 0030 { 0031 id: _playlistPage 0032 } 0033 0034 Component 0035 { 0036 id: _filterListComponent 0037 0038 BabeTable 0039 { 0040 id: filterList 0041 0042 property string currentPlaylist //id 0043 0044 property bool isPublic: true 0045 0046 signal removeFromPlaylist(string url) 0047 0048 coverArtVisible: settings.showArtwork 0049 0050 list.query: control.playlistQuery 0051 showTitle: false 0052 title: control.currentPlaylist 0053 0054 holder.emoji: "qrc:/assets/dialog-information.svg" 0055 holder.isMask: true 0056 holder.title : title 0057 holder.body: i18n("Your playlist is empty. Start adding new music to it") 0058 0059 headBar.visible: true 0060 headBar.farLeftContent: ToolButton 0061 { 0062 icon.name: "go-previous" 0063 onClicked: control.pop() 0064 } 0065 0066 contextMenuItems: MenuItem 0067 { 0068 text: i18n("Remove from playlist") 0069 onTriggered: 0070 { 0071 control.playlistList.removeTrack(currentPlaylist, listModel.get(filterList.currentIndex).url) 0072 listModel.list.remove(filterList.currentIndex) 0073 } 0074 } 0075 0076 onQueueTrack: (index) => Player.queueTracks([listModel.get(index)], index) 0077 onRowClicked: (index) => Player.quickPlay(filterList.listModel.get(index)) 0078 onAppendTrack: (index) => Player.addTrack(filterList.listModel.get(index)) 0079 0080 onPlayAll: 0081 { 0082 Player.playAllModel(listModel.list) 0083 control.pop() 0084 0085 if(filterList.isPublic) 0086 { 0087 root.sync = true 0088 root.syncPlaylist = currentPlaylist 0089 } 0090 } 0091 0092 onAppendAll: Player.appendAllModel(listModel.list) 0093 onShuffleAll: Player.shuffleAllModel(listModel.list) 0094 0095 Component.onCompleted: 0096 { 0097 isPublic = false 0098 0099 switch(currentPlaylist) 0100 { 0101 case "mostPlayed": 0102 playlistQuery = Q.GET.mostPlayedTracks 0103 filterList.listModel.sort = "title" 0104 break; 0105 0106 case "randomTracks": 0107 filterList.listModel.sort = "title" 0108 playlistQuery = Q.GET.randomTracks_; 0109 break; 0110 0111 case "recentTracks": 0112 playlistQuery = Q.GET.recentTracks_; 0113 filterList.listModel.sort = "title" 0114 break; 0115 0116 case "neverPlayed": 0117 playlistQuery = Q.GET.neverPlayedTracks_; 0118 filterList.listModel.sort = "title" 0119 break; 0120 0121 case "classicTracks": 0122 playlistQuery = Q.GET.oldTracks; 0123 filterList.listModel.sort = "title" 0124 break; 0125 0126 default: 0127 isPublic = true 0128 playlistQuery = Q.GET.playlistTracks_.arg(currentPlaylist) 0129 break; 0130 } 0131 0132 filterList.isPublic = isPublic 0133 filterList.listModel.clearFilters() 0134 } 0135 } 0136 } 0137 0138 function populate(playlist, isPublic) 0139 { 0140 control.push(_filterListComponent, {'currentPlaylist': playlist, 'isPublic': isPublic}) 0141 } 0142 0143 function getFilterField() : Item 0144 { 0145 return control.currentItem.getFilterField() 0146 } 0147 0148 function getGoBackFunc() : Function 0149 { 0150 if (control.depth > 1) 0151 return () => { control.pop() } 0152 else 0153 return null 0154 } 0155 }