From d4ead877793b747dabfe01c66f58094ea4c1adda Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 6 May 2017 07:53:05 +0200 Subject: Adjust searching turns out searching the database is much cheaper than filtering views. For the latter we have to traverse the whole tree up and down to see if the current node is valid. If we have a valid parent, the current node is valid, and so is it when we have a current child... --- playerwidget.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'playerwidget.cpp') diff --git a/playerwidget.cpp b/playerwidget.cpp index ec6fe0b..17384a3 100644 --- a/playerwidget.cpp +++ b/playerwidget.cpp @@ -91,7 +91,7 @@ void PlayerWidget::setupGui(){ viewByGenreA->setCheckable(true); viewAG->addAction(viewByGenreA); connect(viewByGenreA, &QAction::triggered, this, &PlayerWidget::doPopulateByGenre); - QAction *viewByDateA = new QAction(QIcon(":/bizarre_amputee.png"), tr("View by date"), this); + QAction *viewByDateA = new QAction(QIcon(":/sissyd.png"), tr("View by date"), this); viewByDateA->setCheckable(true); viewAG->addAction(viewByDateA); connect(viewByDateA, &QAction::triggered, this, &PlayerWidget::doPopulateByDate); @@ -1060,10 +1060,22 @@ void PlayerWidget::doFilter(){ emit message(msg); qApp->setOverrideCursor(Qt::BusyCursor); QStandardItem *root = mSearchModel->invisibleRootItem(); - populateByArtist(root, filter); - populateByAlbum(root, filter, FilterType); - populateByGenre(root, filter); - populateBySong(root, filter, FilterType); + QStandardItem *artistI = new QStandardItem(QIcon(":/quadd.png"), tr("Artists")); + artistI->setFont(QFont("courier", -1, QFont::Bold)); + root->appendRow(artistI); + populateByArtist(artistI, filter); + QStandardItem *albumI = new QStandardItem(QIcon(":/quadd.png"), tr("Albums")); + albumI->setFont(QFont("courier", -1, QFont::Bold)); + root->appendRow(albumI); + populateByAlbum(albumI, filter, FilterType); + QStandardItem *genreI = new QStandardItem(QIcon(":/quadd.png"), tr("Genres")); + genreI->setFont(QFont("courier", -1, QFont::Bold)); + root->appendRow(genreI); + populateByGenre(genreI, filter); + QStandardItem *songI = new QStandardItem(QIcon(":/quadd.png"), tr("Songs")); + songI->setFont(QFont("courier", -1, QFont::Bold)); + root->appendRow(songI); + populateBySong(songI, filter, FilterType); qApp->restoreOverrideCursor(); emit viewModeChanged(tr("Search")); emit modelChanged(); -- cgit v1.2.3-70-g09d2