Commit b9bcec29 authored by Camilo Higuita's avatar Camilo Higuita

add actions to tabledelegate artwork on mainplaylist and searchresults

parent 610a3225
......@@ -31,10 +31,8 @@ Babe::Babe(QObject *parent) : QObject(parent)
#if (defined (Q_OS_LINUX) && !defined (Q_OS_ANDROID))
this->nof = new Notify(this);
connect(this->nof,&Notify::babeSong,[this](const BAE::DB &track)
connect(this->nof,&Notify::babeSong,[this]()
{
qDebug()<<"BABETRACKKKK";
Q_UNUSED(track);
emit this->babeIt();
});
......@@ -221,9 +219,7 @@ void Babe::brainz(const bool &on)
QVariant Babe::loadSetting(const QString &key, const QString &group, const QVariant &defaultValue)
{
auto res = BAE::loadSettings(key, group, defaultValue);
qDebug()<<res<<"LOADSET RES";
return res;
return BAE::loadSettings(key, group, defaultValue);
}
void Babe::saveSetting(const QString &key, const QVariant &value, const QString &group)
......@@ -546,7 +542,6 @@ QVariantList Babe::searchFor(const QStringList &queries)
}
searchQuery = searchQuery.trimmed();
qDebug()<<"Searching for: "<<searchQuery;
if(!searchQuery.isEmpty())
{
......@@ -554,7 +549,7 @@ QVariantList Babe::searchFor(const QStringList &queries)
mapList += this->con->getSearchedTracks(key, searchQuery);
else
{
auto queryTxt = QString("SELECT * FROM tracks WHERE title LIKE \"%"+searchQuery+"%\" OR artist LIKE \"%"+searchQuery+"%\" OR album LIKE \"%"+searchQuery+"%\"OR genre LIKE \"%"+searchQuery+"%\"OR url LIKE \"%"+searchQuery+"%\" LIMIT 1000");
auto queryTxt = QString("SELECT t.*, al.artwork FROM tracks t INNER JOIN albums al ON t.album = al.album AND t.artist = al.artist WHERE t.title LIKE \"%"+searchQuery+"%\" OR t.artist LIKE \"%"+searchQuery+"%\" OR t.album LIKE \"%"+searchQuery+"%\"OR t.genre LIKE \"%"+searchQuery+"%\"OR t.url LIKE \"%"+searchQuery+"%\" LIMIT 1000");
mapList += this->con->getDBDataQML(queryTxt);
}
}
......
......@@ -64,7 +64,7 @@ void Notify::actions(uint id)
{
switch(id)
{
case 1: emit this->babeSong(this->track); break;
case 1: emit this->babeSong(); break;
case 2: emit this->skipSong(); break;
default: break;
}
......
......@@ -28,7 +28,7 @@ private:
BAE::DB track;
signals:
void babeSong(const BAE::DB &track);
void babeSong();
void skipSong();
public slots:
......
......@@ -34,15 +34,15 @@ ApplicationWindow
// pageStack.defaultColumnWidth: columnWidth
// pageStack.initialPage: [playlistPage, views]
// overlay.modal: Rectangle
// {
// color: "transparent"
// }
// overlay.modal: Rectangle
// {
// color: "transparent"
// }
// overlay.modeless: Rectangle
// {
// color: "transparent"
// }
// overlay.modeless: Rectangle
// {
// color: "transparent"
// }
onWidthChanged: if(bae.isMobile())
{
......@@ -58,12 +58,15 @@ ApplicationWindow
{
if(searchInput.text)
{
var query = searchInput.text
searchView.headerTitle = query
var queries = query.split(",")
searchView.searchRes = bae.searchFor(queries)
if(searchInput !== searchView.headerTitle)
{
var query = searchInput.text
searchView.headerTitle = query
var queries = query.split(",")
searchView.searchRes = bae.searchFor(queries)
searchView.populate(searchView.searchRes)
searchView.populate(searchView.searchRes)
}
// albumsView.filter(res)
currentView = 5
}
......@@ -168,7 +171,7 @@ ApplicationWindow
ToolButton
{
anchors.right: parent.right
anchors.right: parent.right
BabeIcon
{
visible: searchInput.text
......@@ -261,6 +264,7 @@ ApplicationWindow
onQuickPlayTrack: Player.quickPlay(tracksView.model.get(index))
onPlayAll: Player.playAll(bae.get(Q.Query.allTracks))
onAppendAll: Player.appendAll(bae.get(Q.Query.allTracks))
}
}
......@@ -306,6 +310,14 @@ ApplicationWindow
onPlayAll: Player.playAll(searchView.searchRes)
onAppendAll: Player.appendAll(searchView.searchRes)
onHeaderClosed: clearSearch()
onArtworkDoubleClicked:
{
var query = Q.Query.albumTracks_.arg(searchView.model.get(index).album)
query = query.arg(searchView.model.get(index).artist)
Player.playAll(bae.get(query))
}
}
}
......
......@@ -6,10 +6,7 @@ Player::Player(QObject *parent) : QObject(parent)
{
this->player = new QMediaPlayer(this);
connect(player, &QMediaPlayer::durationChanged, this, [&](qint64 dur) {
qDebug()<<"DUARTION READY<<"<<dur;
auto duration = BAE::transformTime(dur/1000);
qDebug()<<duration;
emit this->durationChanged(duration);
emit this->durationChanged(BAE::transformTime(dur/1000));
});
......
......@@ -8,7 +8,7 @@ function playTrack(track)
player.play()
root.title = root.mainPlaylist.currentTrack.title + " - " +root.mainPlaylist.currentTrack.artist
var artwork = root.mainPlaylist.currentTrack.artwork
// root.mainPlaylist.list.currentItem.playingIndicator = true
// root.mainPlaylist.list.currentItem.playingIndicator = true
root.mainPlaylist.currentArtwork = artwork ? artwork : bae.loadCover(root.mainPlaylist.currentTrack.url)
if(!root.active)
......@@ -100,11 +100,22 @@ function quickPlay(track)
}
function appendTracksAt(tracks, at)
{
if(tracks)
for(var i in tracks)
{
if(tracks[i].url !== root.mainPlaylist.list.model.get(at).url)
root.mainPlaylist.list.model.insert(parseInt(at)+parseInt(i), tracks[i])
}
}
function appendTrack(track)
{
if(track)
{
var empty = root.mainPlaylist.list.count
if((empty > 0 && track.url !== root.mainPlaylist.list.model.get(root.mainPlaylist.list.count-1).url) || empty === 0)
{
......
......@@ -30,6 +30,7 @@ ListView
signal quickPlayTrack(int index)
signal queueTrack(int index)
signal headerClosed()
signal artworkDoubleClicked(int index)
signal playAll()
signal appendAll()
......@@ -210,6 +211,8 @@ ListView
}
onPlay: list.quickPlayTrack(index)
onArtworkCoverDoubleClicked: list.artworkDoubleClicked(index)
}
}
......
......@@ -13,6 +13,8 @@ ItemDelegate
signal play()
signal rightClicked()
signal artworkCoverDoubleClicked()
signal artworkCoverClicked()
property string textColor: bae.foregroundColor()
property bool number : false
......@@ -96,6 +98,9 @@ ItemDelegate
antialiasing: true
}
onDoubleClicked: artworkCoverDoubleClicked()
onClicked: artworkCoverClicked()
}
}
......
......@@ -339,7 +339,7 @@ Item
Layout.fillWidth:true
Layout.alignment: Qt.AlignCenter
horizontalAlignment: Qt.AlignHCenter
text: currentTrack.title ? currentTrack.title + " - " + currentTrack.artist : "--- - "+currentTrack.artist
text: currentTrack ? (currentTrack.title ? currentTrack.title + " - " + currentTrack.artist : "--- - "+currentTrack.artist) : ""
color: bae.foregroundColor()
font.pointSize: 8
}
......@@ -474,6 +474,15 @@ Item
}
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)
}
holder.message: "Empty playlist..."
Component.onCompleted:
{
......
......@@ -10,7 +10,7 @@ BabeTable
headerBar: true
headerClose: true
holder.message: "No search results!"
coverArtVisible: true
function populate(tracks)
{
searchTable.clearTable()
......
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