From 1adac8a2f886c8b0bc1e3a73dfaa3ff881696fbb Mon Sep 17 00:00:00 2001 From: Arno Date: Sun, 5 Mar 2017 02:35:21 +0100 Subject: Add Action to View: clear and play --- beetplayer.qrc | 1 + belly_right_and_clear.png | Bin 0 -> 10396 bytes playerwidget.cpp | 11 +++++++++++ playerwidget.h | 1 + 4 files changed, 13 insertions(+) create mode 100644 belly_right_and_clear.png diff --git a/beetplayer.qrc b/beetplayer.qrc index 0954138..7fb02ef 100644 --- a/beetplayer.qrc +++ b/beetplayer.qrc @@ -20,5 +20,6 @@ genre.png stomp.png clean_tampon.png + belly_right_and_clear.png diff --git a/belly_right_and_clear.png b/belly_right_and_clear.png new file mode 100644 index 0000000..7576007 Binary files /dev/null and b/belly_right_and_clear.png differ diff --git a/playerwidget.cpp b/playerwidget.cpp index 65cafb7..91654ae 100644 --- a/playerwidget.cpp +++ b/playerwidget.cpp @@ -200,6 +200,8 @@ void PlayerWidget::createActions(){ connect(nextA, SIGNAL(triggered()), this, SLOT(next())); QAction *addToPlayListA = new QAction(QIcon(":/belly_right.png"), tr("Add to playlist"), this); connect(addToPlayListA, SIGNAL(triggered()), this, SLOT(addToPlayList())); + QAction *addToPlayListAndClearA = new QAction(QIcon(":/belly_right_and_clear.png"), tr("Clear and add"), this); + connect(addToPlayListAndClearA, SIGNAL(triggered()), this, SLOT(addToPlayListAndClear())); QAction *removeFromPlayListA = new QAction(QIcon(":/belly_left.png"), tr("Remove from playlist"), this); connect(removeFromPlayListA, SIGNAL(triggered()), this, SLOT(removeFromPlayList())); QAction *clearPlayListA = new QAction(QIcon(":/delete.png"), tr("Clear Playlist"), this); @@ -215,6 +217,10 @@ void PlayerWidget::createActions(){ connect(muteA, SIGNAL(triggered(bool)), this, SLOT(mute(bool))); QAction *configA = Globals::instance()->action(Globals::ConfigAction); mView->addAction(addToPlayListA); + mView->addAction(addToPlayListAndClearA); + QAction *mViewAS1 = new QAction(this); + mViewAS1->setSeparator(true); + mView->addAction(mViewAS1); mView->addAction(randomPlayA); mPlayListView->addAction(removeFromPlayListA); mPlayListView->addAction(shufflePlayistA); @@ -556,6 +562,11 @@ void PlayerWidget::addToPlayList(){ } } +void PlayerWidget::addToPlayListAndClear(){ + clearPlayList(); + addToPlayList(); +} + void PlayerWidget::removeFromPlayList(){ QModelIndexList sel = mPlayListView->selectionModel()->selectedRows(); QList persistent; diff --git a/playerwidget.h b/playerwidget.h index bc6ad81..e2ac24d 100644 --- a/playerwidget.h +++ b/playerwidget.h @@ -33,6 +33,7 @@ class PlayerWidget : public QWidget { void clearFilter(); void reindex(); void addToPlayList(); + void addToPlayListAndClear(); void removeFromPlayList(); void clearPlayList(); void shufflePlayList(); -- cgit v1.2.3-70-g09d2