summaryrefslogtreecommitdiffstats
path: root/playerwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'playerwidget.cpp')
-rw-r--r--playerwidget.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/playerwidget.cpp b/playerwidget.cpp
index b9152d1..62ab6e1 100644
--- a/playerwidget.cpp
+++ b/playerwidget.cpp
@@ -75,6 +75,11 @@ void PlayerWidget::setupGui(){
viewByFolderA->setCheckable(true);
viewAG->addAction(viewByFolderA);
connect(viewByFolderA, SIGNAL(triggered()), this, SLOT(doPopulateByFolder()));
+ viewAG->addAction(Helper::createSeparator(this));
+ mSearchA = new QAction(QIcon(":/gaping_ass.png"), tr("View search"), this);
+ mSearchA->setCheckable(true);
+ viewAG->addAction(mSearchA);
+ connect(mSearchA, SIGNAL(triggered()), this, SLOT(doFilter()));
viewTB->addActions(viewAG->actions());
//filter
@@ -653,15 +658,19 @@ void PlayerWidget::doPopulateBySong(){
void PlayerWidget::doFilter(){
QString filter = mSearch->text();
- if(filter.isEmpty()){
- mView->setModel(mViewModel);
- return;
- }
- qApp->setOverrideCursor(Qt::BusyCursor);
mSearchModel->clear();
mSearchModel->setHorizontalHeaderLabels(QStringList() << tr("Name"));
mView->setModel(mSearchModel);
mCurrentModel = mSearchModel;
+ emit viewModeChanged(tr("Search"));
+ mSearchA->setChecked(true);
+ if(filter.isEmpty()){
+ emit message(QString(tr("No search term set! Cowardly refusing to do anything!")));
+ return;
+ }
+ QString msg = QString(tr("Searching for \"%1\"")).arg(filter);
+ emit message(msg);
+ qApp->setOverrideCursor(Qt::BusyCursor);
QStandardItem *root = mSearchModel->invisibleRootItem();
populateByArtist(root, filter);
populateByAlbum(root, filter, FilterType);