Commit 73d4a8dd authored by Camilo higuita's avatar Camilo higuita

clean up and remeber last played playlist now working again

parent 43541014
......@@ -384,12 +384,12 @@ void Babe::saveSetting(const QString &key, const QVariant &value, const QString
void Babe::savePlaylist(const QStringList &list)
{
BAE::saveSettings("PLAYLIST", list, "MAINWINDOW");
FM::saveSettings("LASTPLAYLIST", list, "PLAYLIST");
}
QStringList Babe::lastPlaylist()
{
return BAE::loadSettings("PLAYLIST","MAINWINDOW",{}).toStringList();
return FM::loadSettings("LASTPLAYLIST","PLAYLIST", QStringList()).toStringList();
}
void Babe::savePlaylistPos(const int &pos)
......
......@@ -44,14 +44,13 @@ Maui.ApplicationWindow
/***************************************************/
/******************** ALIASES ********************/
/*************************************************/
property alias animFooter: mainPlaylist.animFooter
property alias mainPlaylist: mainPlaylist
property alias selectionBar: selectionBar
property alias progressBar: progressBar
about.appIcon: "qrc:/assets/vvave.svg"
about.appDescription: qsTr("VVAVE will handle your whole music collection by retreaving semantic information from the web. Just relax, enjoy and discover your new music ")
showAccounts: false
/***************************************************/
/******************** PLAYBACK ********************/
/*************************************************/
......@@ -65,25 +64,17 @@ Maui.ApplicationWindow
property int prevTrackIndex: 0
property string currentArtwork: !mainlistEmpty ? mainPlaylist.list.get(0).artwork : ""
property bool currentBabe: currentTrack.babe == "0" ? false : true
property bool currentBabe: currentTrack.fav == "0" ? false : true
property string durationTimeLabel: player.duration
property alias durationTimeLabel: player.duration
property string progressTimeLabel: player.transformTime(player.position/1000)
property bool isPlaying: player.playing
property bool autoplay: bae.loadSetting("AUTOPLAY", "BABE",
false) === "true" ? true : false
property alias isPlaying: player.playing
property int onQueue: 0
property bool mainlistEmpty: !mainPlaylist.table.count > 0
/***************************************************/
/******************** UI PROPS ********************/
/*************************************************/
property int columnWidth: Kirigami.Units.gridUnit * 17
/***************************************************/
/***************************************************/
/******************** HANDLERS ********************/
/*************************************************/
......@@ -96,23 +87,24 @@ Maui.ApplicationWindow
playlists: 3,
search: 4,
folders: 5,
cloud: 6,
vvave: 7,
linking: 8,
youtube: 9,
spotify: 10
// cloud: 6,
// vvave: 7,
// linking: 8,
youtube: 6,
// spotify: 10
})
property string syncPlaylist: ""
property bool sync: false
property string infoMsg: ""
property bool infoLabels: bae.loadSetting("LABELS", "PLAYBACK", false) == "true" ? true : false
property bool isLinked: false
property bool isServing: false
// property bool isLinked: false
// property bool isServing: false
property bool focusMode : false
// property bool focusMode : false
property bool selectionMode : false
/***************************************************/
......@@ -123,12 +115,6 @@ Maui.ApplicationWindow
/*SIGNALS*/
signal missingAlert(var track)
/*CONF*/
// pageStack.defaultColumnWidth: columnWidth
// pageStack.initialPage: [mainPlaylist, views]
// pageStack.interactive: isMobile
// pageStack.separatorVisible: pageStack.wideMode
/*HANDLE EVENTS*/
onClosing: Player.savePlaylist()
......@@ -169,7 +155,7 @@ Maui.ApplicationWindow
/* UI */
property bool accent : pageStack.wideMode || (!pageStack.wideMode && pageStack.currentIndex === 1)
altToolBars: false
accentColor: bae.babeColor()
accentColor: babeColor
headBarFGColor: altColorText
headBarBGColor: currentView === viewsIndex.vvave ? "#7e57c2" : "#212121"
colorSchemeName: "vvave"
......@@ -413,21 +399,21 @@ Maui.ApplicationWindow
mainMenu: [
Maui.MenuItem
{
text: "Vvave Stream"
icon.name: "headphones"
onTriggered:
{
pageStack.currentIndex = 1
currentView = viewsIndex.vvave
}
},
// Maui.MenuItem
// {
// text: "Vvave Stream"
// icon.name: "headphones"
// onTriggered:
// {
// pageStack.currentIndex = 1
// currentView = viewsIndex.vvave
// }
// },
Maui.MenuItem
{
text: qsTr("Folders")
icon.name: "folder-open"
icon.name: "folder"
onTriggered:
{
pageStack.currentIndex = 1
......@@ -435,17 +421,17 @@ Maui.ApplicationWindow
}
},
Maui.MenuItem
{
text: qsTr("Linking")
icon.name: "view-links"
onTriggered:
{
pageStack.currentIndex = 1
currentView = viewsIndex.linking
if(!isLinked) linkingView.linkingConf.open()
}
},
// Maui.MenuItem
// {
// text: qsTr("Linking")
// icon.name: "view-links"
// onTriggered:
// {
// pageStack.currentIndex = 1
// currentView = viewsIndex.linking
// if(!isLinked) linkingView.linkingConf.open()
// }
// },
Maui.MenuItem
{
......@@ -458,16 +444,16 @@ Maui.ApplicationWindow
}
},
Maui.MenuItem
{
text: qsTr("Cloud")
icon.name: "folder-cloud"
onTriggered:
{
pageStack.currentIndex = 1
currentView = viewsIndex.cloud
}
},
// Maui.MenuItem
// {
// text: qsTr("Cloud")
// icon.name: "folder-cloud"
// onTriggered:
// {
// pageStack.currentIndex = 1
// currentView = viewsIndex.cloud
// }
// },
// Maui.MenuItem
......@@ -570,7 +556,7 @@ Maui.ApplicationWindow
id: message
visible: infoMsg.length && sync
anchors.bottom: parent.bottom
width: pageStack.wideMode ? columnWidth : parent.width
width: parent.width
height: iconSize
z: 999
......@@ -665,9 +651,7 @@ Maui.ApplicationWindow
onCoverPressed: Player.appendAll(tracks)
onCoverDoubleClicked: Player.playAll(tracks)
}
}
}
ColumnLayout
......@@ -680,27 +664,6 @@ Maui.ApplicationWindow
Layout.fillHeight: true
Layout.fillWidth: true
interactive: isMobile
// contentItem: ListView
// {
// model: swipeView.contentModel
// interactive: swipeView.interactive
// currentIndex: swipeView.currentIndex
// spacing: swipeView.spacing
// orientation: swipeView.orientation
// snapMode: ListView.SnapOneItem
// boundsBehavior: Flickable.StopAtBounds
// highlightRangeMode: ListView.StrictlyEnforceRange
// preferredHighlightBegin: 0
// preferredHighlightEnd: 0
// highlightMoveDuration: 250
// // min:10
// maximumFlickVelocity: 10 * (swipeView.orientation ===
// Qt.Horizontal ? width : height)
// }
currentIndex: currentView
onCurrentItemChanged: currentItem.forceActiveFocus()
......@@ -942,32 +905,31 @@ Maui.ApplicationWindow
}
}
CloudView
{
id: cloudView
// CloudView
// {
// id: cloudView
// onQuickPlayTrack: Player.quickPlay(cloudView.list.get(index))
// }
onQuickPlayTrack: Player.quickPlay(cloudView.list.get(index))
}
BabeitView
{
id: babeitView
}
// BabeitView
// {
// id: babeitView
// }
LinkingView
{
id: linkingView
}
// LinkingView
// {
// id: linkingView
// }
YouTube
{
id: youtubeView
}
Spotify
{
id: spotifyView
}
// Spotify
// {
// id: spotifyView
// }
}
Maui.SelectionBar
......
......@@ -150,7 +150,6 @@ function appendTrack(track)
if(track)
{
mainPlaylist.list.append(track)
animFooter.running = true
if(sync === true)
{
infoMsgAnim()
......@@ -194,13 +193,16 @@ function appendAll(tracks)
function savePlaylist()
{
var list = []
var n = mainPlaylist.list.count
var n = mainPlaylist.listView.count
n = n > 15 ? 15 : n
for(var i=0 ; i < n; i++)
{
var url = mainPlaylist.list.get(i).url
list.push(url)
}
console.log("SAVING LIST", list)
bae.savePlaylist(list)
bae.savePlaylistPos(mainPlaylist.listView.currentIndex)
}
......
......@@ -14,7 +14,8 @@ StackView
initialItem: Maui.Page
{
headBarTitle: qsTr("Source folders")
// headBarTitle: qsTr("Source folders")
headBar.visible: false
headBarExit: false
margins: space.large
......
......@@ -22,7 +22,6 @@ Maui.Page
property alias listModel: table.listModel
property alias listView : table.listView
property alias table: table
property alias animFooter : animFooter
property alias menu : playlistMenu
property alias contextMenu: table.contextMenu
......@@ -48,32 +47,13 @@ Maui.Page
footBar.implicitHeight: toolBarHeight * 1.3
footBarItem: AlbumsRoll
{
{
anchors.fill : parent
anchors.leftMargin: space.small
anchors.rightMargin: space.small
id: albumsRoll
id: albumsRoll
}
// footBar.rightContent: Maui.ToolButton
// {
// id: infoBtn
// iconName: "documentinfo"
// onClicked:
// {
// if( stackView.currentItem !== table)
// {
// stackView.pop(table)
// albumsRoll.positionAlbum(currentTrackIndex)
// }else
// {
// stackView.push(infoView)
// }
// }
// }
footBar.background: Rectangle
{
id: footerBg
......@@ -99,21 +79,6 @@ Maui.Page
source: "file://"+encodeURIComponent(currentArtwork)
}
SequentialAnimation
{
id: animFooter
PropertyAnimation
{
target: footerBg
property: "color"
easing.type: Easing.InOutQuad
from: "black"
to: darkViewBackgroundColor
duration: 500
}
}
FastBlur
{
id: fastBlur
......@@ -173,31 +138,23 @@ Maui.Page
if(n>0)
{
console.log("GETTINGS LAST PLAYED TRACKS", list)
for(var i = 0; i < n; i++)
{
var where = "url = \""+list[i]+"\""
var query = Q.GET.tracksWhere_.arg(where)
var track = bae.get(query)
Player.appendTrack(track[0])
table.list.appendQuery(query);
}
}else
{
where = "babe = 1"
where = "fav = 1"
query = Q.GET.tracksWhere_.arg(where)
var tracks = bae.get(query)
for(var pos=0; pos< tracks.length; pos++)
Player.appendTrack(tracks[pos])
list.appendQuery(query);
}
if(autoplay)
Player.playAt(0)
// var pos = bae.lastPlaylistPos()
// console.log("POSSS:", pos)
// list.currentIndex = pos
// play(list.model.get(pos))
}
}
......
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