Commit 43c8d226 authored by camilo higuita's avatar camilo higuita

using new seleciton bar and floating button for adding new playlists

parent f6be1df4
......@@ -781,25 +781,23 @@ Maui.ApplicationWindow
}
}
Maui.SelectionBar
SelectionBar
{
id: _selectionBar
property alias listView: _selectionBar.selectionList
Layout.maximumWidth: 500
Layout.minimumWidth: 100
Layout.fillWidth: true
Layout.alignment: Qt.AlignCenter
Layout.margins: Maui.Style.space.big
Layout.topMargin: Maui.Style.space.small
Layout.bottomMargin: Maui.Style.space.big
onIconClicked: _contextMenu.popup()
onExitClicked:
{
root.selectionMode = false
clear()
}
SelectionBarMenu
{
id: _contextMenu
}
}
}
}
......
......@@ -54,7 +54,7 @@
<file>assets/vvave.svg</file>
<file>assets/materialdesignicons-webfont.ttf</file>
<file>widgets/CloudView/CloudView.qml</file>
<file>widgets/SelectionBarMenu.qml</file>
<file>widgets/SelectionBar.qml</file>
<file>widgets/FocusView.qml</file>
</qresource>
<qresource prefix="/DB">
......
.import org.kde.kirigami 2.7 as Kirigami
function rootWidth()
{
return root.width;
......@@ -40,10 +42,9 @@ function setStars(stars)
}
}
function notify(title, body)
{
if(isMobile)
if(Kirigami.Settings.isMobile)
root.notify(title+"\n"+body)
else
bae.notify(title, body)
......@@ -71,7 +72,7 @@ function addToSelection(item)
{
if(selectionBar.contains(item.url))
{
selectionBar.removeAtPath(item.url)
selectionBar.removeAtUri(item.url)
return
}
......@@ -81,5 +82,5 @@ function addToSelection(item)
item.mime= "image/png"
item.tooltip= item.url
item.path= item.url
selectionBar.append(item)
selectionBar.append(item.url, item)
}
......@@ -347,6 +347,18 @@ BabeList
onLeftEmblemClicked: H.addToSelection(list.get(index))
isSelected: selectionBar.contains(model.url)
sameAlbum:
{
if(coverArt)
{
if(list.get(index-1))
{
if(list.get(index-1).album === album && list.get(index-1).artist === artist) true
else false
}else false
}else false
}
onClicked:
{
currentIndex = index
......@@ -390,15 +402,15 @@ BabeList
{
target: selectionBar
onPathRemoved:
onUriRemoved:
{
if(path === model.url)
if(uri === model.url)
delegate.isSelected = false
}
onPathAdded:
onUriAdded:
{
if(path === model.url)
if(uri === model.url)
delegate.isSelected = true
}
......
......@@ -25,17 +25,7 @@ Maui.ItemDelegate
readonly property color bgColor : Kirigami.Theme.backgroundColor
readonly property int altHeight : Maui.Style.rowHeight * 1.4
readonly property bool sameAlbum :
{
if(coverArt)
{
if(list.get(index-1))
{
if(list.get(index-1).album === album && list.get(index-1).artist === artist) true
else false
}else false
}else false
}
property bool sameAlbum : false
width: parent.width
height: sameAlbum ? Maui.Style.rowHeight : altHeight
......
......@@ -4,6 +4,7 @@ import QtQuick.Controls 2.10
import org.kde.kirigami 2.7 as Kirigami
import org.kde.mauikit 1.0 as Maui
import TracksList 1.0
import QtGraphicalEffects 1.0
import "../../view_models/BabeTable"
import "../../view_models"
......@@ -29,16 +30,18 @@ Maui.Page
signal syncAndPlay(string playlist)
signal appendAll()
footBar.rightContent: [
ToolButton
{
id : createPlaylistBtn
// text: qsTr("Add")
icon.name : "list-add"
onClicked: newPlaylistDialog.open()
}
]
Maui.FloatingButton
{
id: _overlayButton
z: 999
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.margins: Maui.Style.toolBarHeight
anchors.bottomMargin: Maui.Style.toolBarHeight
icon.name : "list-add"
onClicked: newPlaylistDialog.open()
}
PlaylistsViewModel
{
......
......@@ -110,7 +110,7 @@ BabeList
{
z: control.z + 999
width: control.width
height: 120 + Maui.Style.rowHeight
height: 100 + Maui.Style.rowHeight
Kirigami.Theme.inherit: false
Kirigami.Theme.colorSet: Kirigami.Theme.View
color: Kirigami.Theme.backgroundColor
......
......@@ -7,11 +7,13 @@ import ".."
import "../utils/Help.js" as H
import "../utils/Player.js" as Player
import "../view_models"
import "../view_models/BabeTable"
import org.kde.kirigami 2.7 as Kirigami
import org.kde.mauikit 1.0 as Maui
import org.kde.mauikit 1.1 as MauiLab
Menu
MauiLab.SelectionBar
{
id: control
width: Maui.Style.unit * 200
......@@ -23,35 +25,45 @@ Menu
signal rateClicked(int rate)
listDelegate: TableDelegate
{
Kirigami.Theme.inherit: true
width: parent.width
number: false
coverArt: true
showQuickActions: false
isSelected: true
onLeftEmblemClicked: control.removeAtIndex(index)
background: null
}
MenuItem
Action
{
text: qsTr("Play...")
text: qsTr("Play")
icon.name: "media-playlist-play"
onTriggered:
{
mainPlaylist.list.clear()
var tracks = _selectionBar.selectedItems
for(var i in tracks)
Player.appendTrack(tracks[i])
Player.playAll()
Player.playAll(control.items)
}
}
MenuItem
Action
{
text: qsTr("Append...")
onTriggered: Player.appendAll(_selectionBar.selectedItems)
text: qsTr("Append")
icon.name: "media-playlist-append"
onTriggered: Player.appendAll(control.items)
}
MenuItem
Action
{
text: qsTr("Queue")
icon.name: "view-media-recent"
onTriggered:
{
Player.queueTracks(_selectionBar.selectedItems)
close()
Player.queueTracks(control.items)
}
}
......@@ -70,45 +82,42 @@ Menu
// }
MenuItem
Action
{
text: qsTr("Add to...")
text: qsTr("Add to")
icon.name: "document-save"
onTriggered:
{
playlistDialog.tracks = _selectionBar.selectedPaths
playlistDialog.tracks = control.uris
playlistDialog.open()
close()
}
}
MenuSeparator {}
MenuItem
Action
{
text: qsTr("Share...")
text: qsTr("Share")
icon.name: "document-share"
onTriggered:
{
if(isAndroid)
{
Maui.Android.shareDialog(_selectionBar.selectedPaths)
Maui.Android.shareDialog(control.uris)
return
}
_dialogLoader.sourceComponent = _shareDialogComponent
root.dialog.show(_selectionBar.selectedPaths)
close()
root.dialog.show(control.uris)
}
}
MenuSeparator {}
MenuItem
Action
{
text: qsTr("Remove")
icon.name: "edit-delete"
Kirigami.Theme.textColor: Kirigami.Theme.negativeTextColor
onTriggered:
{
close()
}
}
......
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