diff options
author | Arno <arno@disconnect.de> | 2017-05-06 07:53:05 +0200 |
---|---|---|
committer | Arno <arno@disconnect.de> | 2017-05-06 07:53:05 +0200 |
commit | d4ead877793b747dabfe01c66f58094ea4c1adda (patch) | |
tree | 39f4f7a66df5d4163f9a862b7070dd7b57d6d0ec | |
parent | 3380fd84e8a8f73fc5523111821c743bde988009 (diff) | |
download | BeetPlayer-d4ead877793b747dabfe01c66f58094ea4c1adda.tar.gz BeetPlayer-d4ead877793b747dabfe01c66f58094ea4c1adda.tar.bz2 BeetPlayer-d4ead877793b747dabfe01c66f58094ea4c1adda.zip |
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...
-rw-r--r-- | beetplayer.qrc | 2 | ||||
-rw-r--r-- | playerwidget.cpp | 22 | ||||
-rw-r--r-- | quadd.png | bin | 0 -> 4544 bytes | |||
-rw-r--r-- | sissyd.png | bin | 0 -> 5203 bytes |
4 files changed, 19 insertions, 5 deletions
diff --git a/beetplayer.qrc b/beetplayer.qrc index 7237932..4c41d40 100644 --- a/beetplayer.qrc +++ b/beetplayer.qrc @@ -27,5 +27,7 @@ <file>fill-color.png</file> <file>bizarre_amputee.png</file> <file>home.png</file> + <file>sissyd.png</file> + <file>quadd.png</file> </qresource> </RCC> 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 Binary files differnew file mode 100644 index 0000000..bd5f799 --- /dev/null +++ b/quadd.png diff --git a/sissyd.png b/sissyd.png Binary files differnew file mode 100644 index 0000000..79f29c3 --- /dev/null +++ b/sissyd.png |