Commit 17564286 authored by camilo higuita's avatar camilo higuita

now filtering works and some refactoring on vvavve support it

parent ec0ccafc
This diff is collapsed.
......@@ -201,12 +201,15 @@ function cleanPlaylist()
}
}
function playAll()
function playAll(tracks)
{
sync = false
syncPlaylist = ""
infoMsg = ""
mainPlaylist.list.clear()
appendAll(tracks)
if(_drawer.modal && !_drawer.visible)
_drawer.visible = true
......
......@@ -45,6 +45,7 @@ BabeList
signal appendAll()
focus: true
holder.visible: list.count === 0
listView.spacing: Maui.Style.space.small * (Kirigami.Settings.isMobile ? 1.4 : 1.2)
headBar.leftContent: [
......@@ -77,7 +78,7 @@ BabeList
{
id: sortBtn
icon.name: "view-sort"
visible: listView.count > 2
visible: list.count > 2
MenuItem
{
text: qsTr("Title")
......@@ -179,22 +180,22 @@ BabeList
id: _filterButton
icon.name: "view-filter"
checkable: true
visible: listView.count > 10
visible: list.count > 10
}
]
// listView.headerPositioning: ListView.PullBackHeader
listView.header: Maui.ToolBar
{
Kirigami.Theme.backgroundColor: control.Kirigami.Theme.backgroundColor
visible: _filterButton.checked
visible: _filterButton.checked && _filterButton.visible
width: control.width
position: ToolBar.Header
z: listView.z + 9
middleContent: Maui.TextField
{
Layout.fillWidth: true
onAccepted: listModel.setFilterString(text)
onTextChanged: listModel.setFilterString(text)
}
}
......@@ -319,6 +320,9 @@ BabeList
{
id: _tracksModel
list: _tracksList
recursiveFilteringEnabled: true
sortCaseSensitivity: Qt.CaseInsensitive
filterCaseSensitivity: Qt.CaseInsensitive
}
Tracks
......@@ -417,7 +421,7 @@ BabeList
function saveList()
{
var trackList = []
if(listView.count > 0)
if(list.count > 0)
{
for(var i = 0; i < list.count; ++i)
trackList.push(list.get(i).url)
......@@ -431,9 +435,9 @@ BabeList
{
var trackList = []
if(listView.count > 0)
if(list.count > 0)
{
for(var i = 0; i < listView.count; ++i)
for(var i = 0; i < list.count; ++i)
trackList.push(list.get(i))
Player.queueTracks(trackList)
......
......@@ -22,7 +22,7 @@ Maui.Dialog
BabeList
{
id: playlistsList
id: dialogList
Layout.fillHeight: true
Layout.fillWidth: true
......@@ -31,7 +31,10 @@ Maui.Dialog
holder.title: qsTr("There's not playlists")
holder.body: qsTr("Create a new one and start adding tracks to it")
model: playlistsView.playlistModel
model: Maui.BaseModel
{
list: playlistsList
}
delegate: Maui.ListDelegate
{
......@@ -41,10 +44,10 @@ Maui.Dialog
Connections
{
target: delegate
onClicked: playlistsList.currentIndex = index
onClicked: dialogList.currentIndex = index
onPressAndHold:
{
playlistsList.currentIndex = index
dialogList.currentIndex = index
insert()
}
}
......@@ -61,7 +64,7 @@ Maui.Dialog
onAccepted:
{
addPlaylist()
playlistsView.playlistList.addTrack(playlistsList.listView.currentIndex, tracks)
playlistsList.addTrack(dialogList.listView.currentIndex, tracks)
clear()
}
......@@ -84,7 +87,7 @@ Maui.Dialog
function insert()
{
playlistsView.playlistList.addTrack(playlistsList.listView.currentIndex, tracks)
playlistsList.addTrack(dialogList.listView.currentIndex, tracks)
close()
}
......@@ -93,10 +96,10 @@ Maui.Dialog
if (newPlaylistField.text)
{
var title = newPlaylistField.text.trim()
if( playlistsView.playlistList.insertAt(title, 0))
if(playlistsList.insertAt(title, 0))
{
playlistsList.listView.currentIndex = 0
playlistsList.listView.positionViewAtBeginning()
dialogList.listView.currentIndex = 0
dialogList.listView.positionViewAtBeginning()
}
newPlaylistField.clear()
......
......@@ -131,22 +131,22 @@ BabeGrid
onRowClicked:
{
albumsViewGrid.rowClicked(list.get(index))
albumsViewGrid.rowClicked(listModel.get(index))
}
onQuickPlayTrack:
{
albumsViewGrid.playTrack(list.get(index))
albumsViewGrid.playTrack(listModel.get(index))
}
onQueueTrack:
{
albumsViewGrid.queueTrack(list.get(index))
albumsViewGrid.queueTrack(listModel.get(index))
}
onAppendTrack:
{
albumsViewGrid.appendTrack(list.get(index))
albumsViewGrid.appendTrack(listModel.get(index))
}
onPlayAll:
......
......@@ -25,6 +25,11 @@ Rectangle
forceActiveFocus()
}
Component.onDestruction:
{
_drawer.visible = true
}
Keys.onBackPressed:
{
focusView = false
......
......@@ -8,6 +8,7 @@ Item
{
id: control
property alias list : _filterList
property alias listModel : _filterList.model
property var tracks : []
property string currentFolder : ""
......
......@@ -16,7 +16,6 @@ ColumnLayout
property string playlistQuery
property alias playlistModel : playlistViewModel.model
property alias playlistList : playlistViewModel.list
property alias playlistViewList : playlistViewModel
signal rowClicked(var track)
......@@ -89,10 +88,10 @@ ColumnLayout
clip: true
coverArtVisible: true
headBar.visible: !holder.visible
title: playlistViewModel.list.get(playlistViewModel.currentIndex).playlist
title: playlistsList.get(playlistViewModel.currentIndex).playlist
holder.emoji: "qrc:/assets/dialog-information.svg"
holder.isMask: false
holder.title : playlistViewModel.list.get(playlistViewModel.currentIndex).playlist
holder.title : playlistsList.get(playlistViewModel.currentIndex).playlist
holder.body: "Your playlist is empty,<br>start adding new music to it"
holder.emojiSize: Maui.Style.iconSizes.huge
......@@ -154,8 +153,8 @@ ColumnLayout
Connections
{
target: filterList
onRowClicked: control.rowClicked(filterList.list.get(index))
onQuickPlayTrack: control.quickPlayTrack(filterList.list.get(filterList.currentIndex))
onRowClicked: control.rowClicked(filterList.listModel.get(index))
onQuickPlayTrack: control.quickPlayTrack(filterList.listModel.get(filterList.currentIndex))
onPlayAll: playAll()
onAppendAll: appendAll()
......@@ -168,7 +167,7 @@ ColumnLayout
onRemoveClicked:
{
playlistList.removeTrack(playlistViewList.currentIndex, filterList.list.get(filterList.currentIndex).url)
playlistsList.removeTrack(playlistViewList.currentIndex, filterList.listModel.get(filterList.currentIndex).url)
populate(playlistQuery)
}
}
......@@ -202,12 +201,12 @@ ColumnLayout
function syncAndPlay(index)
{
if(!playlistList.get(index).playlistIcon)
playSync(playlistList.get(index).playlist)
if(!playlistsList.get(index).playlistIcon)
playSync(playlistsList.get(index).playlist)
}
function removePlaylist()
{
playlistList.removePlaylist(playlistViewList.currentIndex)
playlistsList.removePlaylist(playlistViewList.currentIndex)
}
}
......@@ -16,7 +16,6 @@ BabeList
{
id: control
property alias list: _playlistsList
signal playSync(int index)
topPadding: Maui.Style.contentMargins
......@@ -50,12 +49,7 @@ BabeList
Maui.BaseModel
{
id: _playlistsModel
list: _playlistsList
}
Playlists
{
id: _playlistsList
list: playlistsList
}
model: _playlistsModel
......@@ -73,7 +67,7 @@ BabeList
onClicked :
{
currentIndex = index
var playlist = _playlistsList.get(index).playlist
var playlist = playlistsList.get(index).playlist
filterList.group = false
switch(playlist)
......@@ -133,7 +127,7 @@ BabeList
function addPlaylist(text)
{
var title = text.trim()
if(list.insertAt(title, 0))
if(playlistList.insertAt(title, 0))
control.listView.positionViewAtEnd()
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment