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... --- beetplayer.qrc | 2 ++ playerwidget.cpp | 22 +++++++++++++++++----- quadd.png | Bin 0 -> 4544 bytes sissyd.png | Bin 0 -> 5203 bytes 4 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 quadd.png create mode 100644 sissyd.png diff --git a/beetplayer.qrc b/beetplayer.qrc index 7237932..4c41d40 100644 --- a/beetplayer.qrc +++ b/beetplayer.qrc @@ -27,5 +27,7 @@ fill-color.png bizarre_amputee.png home.png + sissyd.png + quadd.png 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(); diff --git a/quadd.png b/quadd.png new file mode 100644 index 0000000..bd5f799 Binary files /dev/null and b/quadd.png differ diff --git a/sissyd.png b/sissyd.png new file mode 100644 index 0000000..79f29c3 Binary files /dev/null and b/sissyd.png differ -- cgit v1.2.3-70-g09d2