Commit ad0ae63d authored by Camilo Higuita's avatar Camilo Higuita

organize code and start working on playlists view

parent dc9f0277
......@@ -633,7 +633,7 @@ QVariantList CollectionDB::getSearchedTracks(const KEY &where, const QString &se
search);
else if(where == KEY::WIKI)
queryTxt = QString("SELECT DISTINCT t.* FROM %1 t INNER JOIN %2 al ON t.%3 = al.%3 INNER JOIN %4 ar ON t.%5 = ar.%5 WHERE al.%6 LIKE \"%%7%\" OR ar.%6 LIKE \"%%7%\" COLLATE NOCASE").arg(TABLEMAP[TABLE::TRACKS],
queryTxt = QString("SELECT DISTINCT t.*, al.artwork FROM %1 t INNER JOIN %2 al ON t.%3 = al.%3 INNER JOIN %4 ar ON t.%5 = ar.%5 WHERE al.%6 LIKE \"%%7%\" OR ar.%6 LIKE \"%%7%\" COLLATE NOCASE").arg(TABLEMAP[TABLE::TRACKS],
TABLEMAP[TABLE::ALBUMS],KEYMAP[KEY::ALBUM],
TABLEMAP[TABLE::ARTISTS],KEYMAP[KEY::ARTIST],
KEYMAP[where],
......
......@@ -8,7 +8,6 @@ import "db/Queries.js" as Q
import "utils/Icons.js" as MdiFont
import "utils/Player.js" as Player
import "utils"
import "view_models"
import "widgets"
//Kirigami.ApplicationWindow
......
......@@ -2,9 +2,6 @@
<qresource prefix="/">
<file>main.qml</file>
<file>qtquickcontrols2.conf</file>
<file>view_models/BabeAlbum.qml</file>
<file>view_models/BabeGrid.qml</file>
<file>view_models/BabeTable.qml</file>
<file>widgets/BabeBar.qml</file>
<file>utils/Icons.js</file>
<file>utils/materialdesignicons-webfont.ttf</file>
......@@ -13,7 +10,6 @@
<file>widgets/InfoView.qml</file>
<file>widgets/ArtistsView.qml</file>
<file>widgets/AlbumsView.qml</file>
<file>view_models/TableDelegate.qml</file>
<file>assets/cover.png</file>
<file>data_models/db_model.qml</file>
<file>widgets/MainPlaylist.qml</file>
......@@ -27,16 +23,20 @@
<file>widgets/PlaylistMenu.qml</file>
<file>widgets/LyricsView.qml</file>
<file>db/Queries.js</file>
<file>view_models/TableMenu.qml</file>
<file>widgets/SearchTable.qml</file>
<file>utils/Help.js</file>
<file>assets/Babe.notifyrc</file>
<file>widgets/FolderPicker.qml</file>
<file>view_models/FolderPickerList.qml</file>
<file>view_models/FolderPickerDelegate.qml</file>
<file>utils/BabeIcon.qml</file>
<file>view_models/TableMenuItem.qml</file>
<file>view_models/BabeScrollBar.qml</file>
<file>assets/bars.gif</file>
<file>view_models/FolderPicker/FolderPickerList.qml</file>
<file>view_models/FolderPicker/FolderPickerDelegate.qml</file>
<file>view_models/BabeGrid/BabeAlbum.qml</file>
<file>view_models/BabeGrid/BabeGrid.qml</file>
<file>view_models/BabeTable/TableDelegate.qml</file>
<file>view_models/BabeTable/BabeTable.qml</file>
<file>view_models/BabeTable/TableMenu.qml</file>
<file>view_models/BabeTable/TableMenuItem.qml</file>
</qresource>
</RCC>
import QtQuick.Controls 2.2
import QtQuick 2.9
import ".."
Pane
{
......
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import "../utils/Icons.js" as MdiFont
import "../utils"
import "../../utils/Icons.js" as MdiFont
import "../../utils"
import ".."
ListView
{
......@@ -39,6 +40,8 @@ ListView
clip: true
highlight: Rectangle
{
width: list.width
......@@ -212,7 +215,9 @@ ListView
}
}
ScrollBar.vertical:BabeScrollBar {}
ScrollBar.vertical:BabeScrollBar { }
function openItemMenu(index)
{
......
import QtQuick 2.9
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.2
import "../utils/Icons.js" as MdiFont
import "../utils"
import "../../utils/Icons.js" as MdiFont
import "../../utils"
ItemDelegate
{
id: delegateRoot
width: parent.width
height: sameAlbum && coverArt ? 48 : 64
height: sameAlbum ? 48 : 64
clip: true
signal play()
signal rightClicked()
......@@ -20,10 +20,13 @@ ItemDelegate
readonly property bool sameAlbum :
{
if(listModel.get(index-1))
if(coverArt)
{
if(listModel.get(index-1).album === album) true
else false
if(listModel.get(index-1))
{
if(listModel.get(index-1).album === album) true
else false
}else false
}else false
}
......@@ -38,6 +41,11 @@ ItemDelegate
property string trackMood : art
property alias trackRating : trackRating
NumberAnimation on x
{
running: ListView.isCurrentItem
from: 0; to: 100
}
Rectangle
{
......@@ -74,7 +82,7 @@ ItemDelegate
visible: coverArt
Layout.fillHeight: true
width: sameAlbum && coverArt ? 64 : parent.height
width: sameAlbum ? 64 : parent.height
ToolButton
{
......@@ -109,7 +117,7 @@ ItemDelegate
{
visible: quickPlay
Layout.fillHeight: true
width: parent.height
width: sameAlbum ? 64 : parent.height
ToolButton
{
......
......@@ -2,9 +2,9 @@ import QtQuick 2.0
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import "../utils/Icons.js" as MdiFont
import "../utils/Help.js" as H
import "../utils"
import "../../utils/Icons.js" as MdiFont
import "../../utils/Help.js" as H
import "../../utils"
Menu
{
......
......@@ -2,9 +2,8 @@ import QtQuick 2.0
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import "../utils/Icons.js" as MdiFont
import "../utils/Help.js" as H
import "../utils"
import "../../utils/Icons.js" as MdiFont
import "../../utils"
MenuItem
{
......
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import ".."
ListView
{
......
......@@ -2,7 +2,9 @@ import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import "../view_models"
import "../view_models/BabeGrid"
import "../view_models/BabeTable"
import "../utils/Icons.js" as MdiFont
import "../utils"
import "../db/Queries.js" as Q
......
......@@ -2,7 +2,9 @@ import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import "../view_models"
import "../view_models/BabeGrid"
import "../view_models/BabeTable"
import "../utils/Icons.js" as MdiFont
import "../utils"
import "../db/Queries.js" as Q
......
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import "../utils/Icons.js" as MdiFont
import "../utils"
......
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import "../view_models"
import "../view_models/FolderPicker"
import "../utils/Icons.js" as MdiFont
import "../utils"
Popup
......
......@@ -7,7 +7,7 @@ import "../utils/Icons.js" as MdiFont
import "../utils/Player.js" as Player
import "../db/Queries.js" as Q
import "../utils"
import "../view_models"
import "../view_models/BabeTable"
import "../widgets"
Item
......@@ -471,65 +471,77 @@ Item
height: parent.height
quickPlayVisible: false
coverArtVisible: true
// onMovementStarted:
// {
// if(contentY > list.height)
// {
// cover.visible = false
// }
// else
// {
// cover.visible = true
// }
// }
Rectangle
{
anchors.fill: parent
color: bae.altColor()
z: -999
}
Rectangle
{
anchors.fill: parent
color: bae.altColor()
z: -999
}
onRowClicked: Player.playTrack(model.get(index))
onArtworkDoubleClicked:
{
var query = Q.Query.albumTracks_.arg(model.get(index).album)
query = query.arg(model.get(index).artist)
Player.playAll(bae.get(query))
// Player.appendTracksAt(bae.get(query),index)
onRowClicked: Player.playTrack(model.get(index))
onArtworkDoubleClicked:
{
var query = Q.Query.albumTracks_.arg(model.get(index).album)
query = query.arg(model.get(index).artist)
}
holder.message: "Empty playlist..."
Component.onCompleted:
{
var list = bae.lastPlaylist()
var n = list.length
Player.playAll(bae.get(query))
// Player.appendTracksAt(bae.get(query),index)
if(n>0)
}
holder.message: "Empty playlist..."
Component.onCompleted:
{
for(var i = 0; i < n; i++)
var list = bae.lastPlaylist()
var n = list.length
if(n>0)
{
var where = "url = \""+list[i]+"\""
for(var i = 0; i < n; i++)
{
var where = "url = \""+list[i]+"\""
var query = Q.Query.tracksWhere_.arg(where)
var track = bae.get(query)
Player.appendTrack(track[0])
}
}else
{
var where = "babe = 1"
var query = Q.Query.tracksWhere_.arg(where)
var track = bae.get(query)
Player.appendTrack(track[0])
}
}else
{
var where = "babe = 1"
var query = Q.Query.tracksWhere_.arg(where)
var tracks = bae.get(query)
var tracks = bae.get(query)
for(var pos=0; pos< tracks.length; pos++)
for(var pos=0; pos< tracks.length; pos++)
Player.appendTrack(tracks[pos])
}
// var pos = bae.lastPlaylistPos()
// console.log("POSSS:", pos)
// list.currentIndex = pos
// play(list.model.get(pos))
}
}
// var pos = bae.lastPlaylistPos()
// console.log("POSSS:", pos)
// list.currentIndex = pos
// play(list.model.get(pos))
InfoView
{
id: infoView
width: parent.width
height: parent.height
}
}
InfoView
{
id: infoView
width: parent.width
height: parent.height
}
}
}
}
}
import QtQuick 2.9
import "../view_models"
BabeTable
ListView
{
id: playlistsView
headerBar: true
id: playlistListRoot
clip: true
focus: true
interactive: true
highlightFollowsCurrentItem: false
keyNavigationWraps: !isMobile
keyNavigationEnabled : !isMobile
Keys.onUpPressed: decrementCurrentIndex()
Keys.onDownPressed: incrementCurrentIndex()
Keys.onReturnPressed: rowClicked(currentIndex)
boundsBehavior: isMobile? Flickable.StopAtBounds : Flickable.DragAndOvershootBounds
flickableDirection: Flickable.AutoFlickDirection
snapMode: ListView.SnapToItem
addDisplaced: Transition
{
NumberAnimation { properties: "x,y"; duration: 1000 }
}
BabeHolder
{
id: holder
visible: playlistListRoot.count === 0
}
}
import QtQuick 2.9
import "../view_models"
import "../view_models/BabeTable"
import "../db/Queries.js" as Q
BabeTable
......
import QtQuick 2.9
import "../view_models"
import "../view_models/BabeTable"
import "../db/Queries.js" as Q
BabeTable
......
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