Warning, /maui/vvave/src/widgets/AlbumsView.qml is written in an unsupported language. File is not indexed.
0001 import QtQuick 2.15 0002 import QtQuick.Controls 2.15 0003 0004 import org.mauikit.controls 1.3 as Maui 0005 0006 import "BabeGrid" 0007 import "BabeTable" 0008 0009 import "../db/Queries.js" as Q 0010 import "../utils/Player.js" as Player 0011 0012 StackView 0013 { 0014 id: control 0015 0016 property alias list : albumsViewGrid.list 0017 0018 property string currentQuery: "" 0019 property string currentAlbum: "" 0020 property string currentArtist: "" 0021 0022 property alias holder: albumsViewGrid.holder 0023 property alias prefix: albumsViewGrid.prefix 0024 0025 property Flickable flickable : currentItem.flickable 0026 0027 initialItem: BabeGrid 0028 { 0029 id: albumsViewGrid 0030 holder.emoji: "qrc:/assets/dialog-information.svg" 0031 holder.actions:[ 0032 0033 Action 0034 { 0035 text: i18n("Add sources") 0036 onTriggered: openSettingsDialog() 0037 } 0038 ] 0039 0040 onAlbumCoverClicked:(album, artist) => control.populateTable(album, artist) 0041 onPlayAll: (album, artist) => 0042 { 0043 var query 0044 if(album && artist) 0045 { 0046 query = Q.GET.albumTracks_.arg(album) 0047 query = query.arg(artist) 0048 }else if(artist && !album) 0049 { 0050 query = Q.GET.artistTracks_.arg(artist) 0051 } 0052 0053 Player.playQuery(query) 0054 } 0055 } 0056 0057 Component 0058 { 0059 id: _tracksTableComponent 0060 0061 BabeTable 0062 { 0063 list.query: control.currentQuery 0064 trackNumberVisible: true 0065 coverArtVisible: settings.showArtwork 0066 focus: true 0067 0068 holder.emoji: "qrc:/assets/media-album-track.svg" 0069 holder.title : "Oops!" 0070 holder.body: i18n("This list is empty") 0071 0072 headBar.visible: true 0073 headBar.farLeftContent: ToolButton 0074 { 0075 icon.name: "go-previous" 0076 text: control.prefix === "album" ? i18n("Albums") : i18n("Artists") 0077 onClicked: control.pop() 0078 } 0079 0080 onQueueTrack: (index) => Player.queueTracks([listModel.get(index)], index) 0081 onRowClicked: (index) => Player.quickPlay(listModel.get(index)) 0082 onAppendTrack: (index) => Player.addTrack(listModel.get(index)) 0083 0084 onPlayAll: 0085 { 0086 control.pop() 0087 Player.playAllModel(listModel.list) 0088 } 0089 0090 onAppendAll: 0091 { 0092 control.pop() 0093 Player.appendAllModel(listModel.list) 0094 } 0095 0096 onShuffleAll: 0097 { 0098 control.pop() 0099 Player.shuffleAllModel(listModel.list) 0100 } 0101 } 0102 } 0103 0104 function populateTable(album, artist) 0105 { 0106 control.push(_tracksTableComponent) 0107 0108 currentAlbum = album === undefined ? "" : album 0109 currentArtist = artist 0110 0111 var query 0112 if(currentAlbum && currentArtist) 0113 { 0114 query = Q.GET.albumTracks_.arg(currentAlbum) 0115 query = query.arg(currentArtist) 0116 0117 }else if(currentArtist && !currentAlbum.length) 0118 { 0119 query = Q.GET.artistTracks_.arg(currentArtist) 0120 } 0121 0122 console.log("GET ARTIST OR ALBUM BY", album, artist) 0123 control.currentQuery = query 0124 } 0125 0126 function getFilterField() : Item 0127 { 0128 return control.currentItem.getFilterField() 0129 } 0130 0131 function getGoBackFunc() : Function 0132 { 0133 if (control.depth > 1) 0134 return () => { control.pop() } 0135 else 0136 return null 0137 } 0138 } 0139