Commit a8bb68e1 authored by Camilo Higuita's avatar Camilo Higuita

shuffle playback now working

parent 8b6a7160
......@@ -34,6 +34,7 @@ ApplicationWindow
property var currentTrack
property string currentArtwork
property bool shuffle : false
// minimumWidth: columnWidth
......@@ -282,7 +283,9 @@ ApplicationWindow
ToolButton
{
id: shuffleBtn
Icon{text: MdiFont.Icon.shuffle}
Icon{text: shuffle ? MdiFont.Icon.shuffle : MdiFont.Icon.shuffleDisabled}
onClicked: shuffle = shuffle ? false : true
}
}
}
......
......@@ -20,7 +20,13 @@ function resumeTrack()
function nextTrack()
{
var next = mainPlaylistTable.currentIndex+1 >= mainPlaylistTable.count? 0 : mainPlaylistTable.currentIndex+1
var next
if(shuffle)
next = shuffle()
else
next = mainPlaylistTable.currentIndex+1 >= mainPlaylistTable.count? 0 : mainPlaylistTable.currentIndex+1
mainPlaylistTable.currentIndex = next
playTrack(mainPlaylistTable.model.get(next))
}
......@@ -32,6 +38,13 @@ function previousTrack()
playTrack(mainPlaylistTable.model.get(previous))
}
function shuffle()
{
var pos = Math.floor(Math.random() * mainPlaylistTable.count)
return pos
}
function savePlaylist()
{
var list = []
......
......@@ -11,7 +11,7 @@ ToolBar
property string accentColor : "#E91E63"
property string textColor : "#ffffff"
property string backgroundColor : "#31363b"
property int size
property int size //icon size
property int currentIndex : 0
......@@ -88,7 +88,6 @@ ToolBar
text: MdiFont.Icon.album
color: currentIndex === 2? accentColor : textColor
iconSize: size
}
onClicked: albumsViewClicked()
......
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