summaryrefslogtreecommitdiffstats
path: root/playerwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'playerwidget.cpp')
-rw-r--r--playerwidget.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/playerwidget.cpp b/playerwidget.cpp
index b238f62..36910cc 100644
--- a/playerwidget.cpp
+++ b/playerwidget.cpp
@@ -129,9 +129,9 @@ void PlayerWidget::populateByArtist(){
QSqlQuery artistsQ(db);
artistsQ.prepare("SELECT iartists_id, tartists_name FROM artists ORDER BY tartists_name ASC");
QSqlQuery albumQ(db);
- albumQ.prepare("SELECT ialbums_id, talbum_name, siyear FROM albums WHERE iartists_id = :aid ORDER BY talbum_name ASC");
+ albumQ.prepare("SELECT DISTINCT(songs.ialbums_id), talbum_name, siyear FROM songs, albums WHERE songs.iartists_id = :artistid AND songs.ialbums_id = albums.ialbums_id");
QSqlQuery songQ(db);
- songQ.prepare("SELECT sipos, ttitle, tfullpath FROM songs WHERE ialbums_id = :alid ORDER BY sipos ASC");
+ songQ.prepare("SELECT sipos, ttitle, tfullpath FROM songs WHERE ialbums_id = :alid AND iartists_id = :arid ORDER BY sipos ASC");
//reset view+model
mView->setSortingEnabled(false);
@@ -148,7 +148,7 @@ void PlayerWidget::populateByArtist(){
curArtist->setData(Artist, TypeRole);
curArtist->setData(artistsQ.value(0).toInt(), IdRole);
root->appendRow(curArtist);
- albumQ.bindValue(":aid", artistsQ.value(0));
+ albumQ.bindValue(":artistid", artistsQ.value(0));
albumQ.exec();
while(albumQ.next()){
QStandardItem *curAlbum = new QStandardItem;
@@ -158,6 +158,7 @@ void PlayerWidget::populateByArtist(){
curAlbum->setData(albumQ.value(0), IdRole);
curArtist->appendRow(curAlbum);
songQ.bindValue(":alid", albumQ.value(0));
+ songQ.bindValue(":arid", artistsQ.value(0));
songQ.exec();
while(songQ.next()){
QStandardItem *curSong = new QStandardItem;