From cba00af5348162259eb7909078083edf510853f5 Mon Sep 17 00:00:00 2001 From: Arno Date: Mon, 27 Feb 2017 01:16:45 +0100 Subject: Fix filtering The SQL query for genres was wrong. Copy and Paste error. Also mark songs as songs when filtering. --- playerwidget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'playerwidget.cpp') diff --git a/playerwidget.cpp b/playerwidget.cpp index f0bb6cf..976da48 100644 --- a/playerwidget.cpp +++ b/playerwidget.cpp @@ -219,6 +219,7 @@ void PlayerWidget::populateBySong(QStandardItem *parent, const QString &filter){ curSong->setFont(QFont("courier")); QString songText = QString(tr("%1 %2 (%3)")).arg(QChar(0x266C)).arg(songQ.value(1).toString()).arg(songQ.value(4).toString()); curSong->setText(songText); + curSong->setData(Song, TypeRole); curSong->setData(songQ.value(0), IdRole); curSong->setData(songQ.value(2), FullPathRole); curSong->setData(songQ.value(3), GenreRole); @@ -246,8 +247,7 @@ void PlayerWidget::populateByGenre(QStandardItem *parent, const QString &filter) curGenre->setData(genreQ.value(0), IdRole); root->appendRow(curGenre); QSqlQuery songQ = QSqlQuery(db); - //songQ.prepare("SELECT sipos, ttitle, tfullpath, igenres_id, artists.tartists_name FROM songs, artists WHERE igenres_id = :id AND songs.iartists_id = artists.iartists_id ORDER BY ttitle ASC"); - songQ.prepare("SELECT sipos, ttitle, tfullpath, igenres_id, artists.tartists_name, albums.talbum_name FROM songs, artists, albums WHERE ttitle ~ :f AND songs.iartists_id = artists.iartists_id and songs.ialbums_id = albums.ialbums_id ORDER BY ttitle ASC"); + songQ.prepare("SELECT sipos, ttitle, tfullpath, igenres_id, artists.tartists_name, albums.talbum_name FROM songs, artists, albums WHERE igenres_id = :id AND songs.iartists_id = artists.iartists_id AND songs.ialbums_id = albums.ialbums_id ORDER BY ttitle ASC"); songQ.bindValue(":id", genreQ.value(0)); songQ.exec(); while(songQ.next()){ -- cgit v1.2.3-70-g09d2