Commit 5fde3603 authored by Camilo Higuita's avatar Camilo Higuita

longpress on playback buttons: previous= play previusly played track next= shuffle next track

parent ada6b380
......@@ -16,7 +16,7 @@ Kirigami.ApplicationWindow
{
id: root
visible: true
width: 400
width: isMobile ? 800 : 400
height: 500
title: qsTr("Babe")
wideScreen: root.width > coverSize
......@@ -127,10 +127,10 @@ Kirigami.ApplicationWindow
onPlaylistViewClicked:
{
if(pageStack.wideMode)
if(pageStack.wideMode && !isMobile)
root.width = columnWidth
else
pageStack.currentIndex = 0
pageStack.currentIndex = 0
}
onTracksViewClicked:
......@@ -278,13 +278,11 @@ Kirigami.ApplicationWindow
{
currentItem.forceActiveFocus();
}
onCurrentIndexChanged:
{
currentView = currentIndex
if(currentView === 0) mainPlaylist.list.forceActiveFocus()
else if(currentView === 1) tracksView.forceActiveFocus()
}
TracksView
......
......@@ -64,20 +64,19 @@ function nextTrack()
else
next = root.mainPlaylist.list.currentIndex+1 >= root.mainPlaylist.list.count? 0 : root.mainPlaylist.list.currentIndex+1
root.mainPlaylist.list.currentIndex = next
playTrack(root.mainPlaylist.list.model.get(next))
root.mainPlaylist.prevTrackIndex = root.mainPlaylist.list.currentIndex
playAt(next)
}
function previousTrack()
{
var previous = root.mainPlaylist.list.currentIndex-1 >= 0 ? root.mainPlaylist.list.currentIndex-1 : root.mainPlaylist.list.count-1
root.mainPlaylist.list.currentIndex = previous
playTrack(root.mainPlaylist.list.model.get(previous))
var previous = previous = root.mainPlaylist.list.currentIndex-1 >= 0 ? root.mainPlaylist.list.currentIndex-1 : root.mainPlaylist.list.count-1
root.mainPlaylist.prevTrackIndex = root.mainPlaylist.list.currentIndex
playAt(previous)
}
function shuffle()
{
{
var pos = Math.floor(Math.random() * root.mainPlaylist.list.count)
return pos
}
......@@ -123,10 +122,7 @@ function appendTrack(track)
root.mainPlaylist.list.model.append(track)
if(empty === 0 && root.mainPlaylist.list.count>0)
{
root.mainPlaylist.list.currentIndex = 0
playTrack(root.mainPlaylist.list.model.get(0))
}
playAt(0)
}
}
}
......
......@@ -16,7 +16,7 @@ ListView
property bool quickPlayVisible : true
property bool coverArtVisible : false
property bool menuItemVisible : isMobile
property int prevIndex
property bool trackDuration
property bool trackRating
......@@ -181,7 +181,7 @@ ListView
{
target: delegate
// onPressAndHold: if(root.isMobile) openItemMenu(index)
// onPressAndHold: if(root.isMobile) openItemMenu(index)
onRightClicked: openItemMenu(index)
onClicked:
......
......@@ -18,6 +18,8 @@ Item
id: mainPlaylistRoot
property var currentTrack
property int currentTrackIndex : 0
property int prevTrackIndex : 0
property string currentArtwork
property bool shuffle : false
property int playbackIconSize: isMobile ? 24 : 22
......@@ -144,7 +146,7 @@ Item
anchors.fill: parent
color: bae.midLightColor()
opacity: 0.8
z: -999
z: -999
}
// onYChanged:
// {
......@@ -253,6 +255,8 @@ Item
iconSize: playbackIconSize
onClicked: Player.previousTrack()
onPressAndHold: Player.playAt(prevTrackIndex)
}
BabeButton
......@@ -275,7 +279,7 @@ Item
iconSize: playbackIconSize
onClicked: Player.nextTrack()
onPressAndHold: Player.playAt(Player.shuffle())
}
BabeButton
......@@ -504,7 +508,13 @@ Item
}
onRowClicked: Player.playTrack(model.get(index))
onRowClicked:
{
prevTrackIndex = currentTrackIndex
currentTrackIndex = currentIndex
Player.playAt(index)
}
onArtworkDoubleClicked:
{
var query = Q.GET.albumTracks_.arg(model.get(index).album)
......
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