summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArno <arno@disconnect.de>2018-02-18 15:42:41 +0100
committerArno <arno@disconnect.de>2018-02-18 15:42:41 +0100
commita3577a6b0a7735eb4040431eccc2807a63b7f24e (patch)
tree2167ff6d09b6118d0b646ef70f4a3ee87223d944
parent6f3ae187f8e818263dda4676508b109a3b5e291b (diff)
downloadBeetPlayer-a3577a6b0a7735eb4040431eccc2807a63b7f24e.tar.gz
BeetPlayer-a3577a6b0a7735eb4040431eccc2807a63b7f24e.tar.bz2
BeetPlayer-a3577a6b0a7735eb4040431eccc2807a63b7f24e.zip
Activate WebRadio playlist when selecting WebRadio Collection
-rw-r--r--playerwidget.cpp23
-rw-r--r--playerwidget.h2
2 files changed, 18 insertions, 7 deletions
diff --git a/playerwidget.cpp b/playerwidget.cpp
index f90788b..df3c285 100644
--- a/playerwidget.cpp
+++ b/playerwidget.cpp
@@ -93,7 +93,7 @@ void PlayerWidget::setupGui(QSplashScreen *splash){
int cIdx = mCollectionStack->addWidget(artistsView);
QAction *viewByArtistsA = new QAction(QIcon(":/artist.png"), tr("View by artist"), this);
viewByArtistsA->setCheckable(true);
- connect(viewByArtistsA, &QAction::triggered, [this, cIdx] { mCollectionStack->setCurrentIndex(cIdx); });
+ connect(viewByArtistsA, &QAction::triggered, [this, cIdx] { setCollectionIndex(cIdx, false); });
bottomTBG->addAction(viewByArtistsA);
//albums view
CollectionAlbumsView *albumsView = new CollectionAlbumsView;
@@ -105,7 +105,7 @@ void PlayerWidget::setupGui(QSplashScreen *splash){
cIdx = mCollectionStack->addWidget(albumsView);
mViewByAlbumsA = new QAction(QIcon(":/album.png"), tr("View by album"), this);
mViewByAlbumsA->setCheckable(true);
- connect(mViewByAlbumsA, &QAction::triggered, [this, cIdx] { mCollectionStack->setCurrentIndex(cIdx); });
+ connect(mViewByAlbumsA, &QAction::triggered, [this, cIdx] { setCollectionIndex(cIdx, false); });
bottomTBG->addAction(mViewByAlbumsA);
//dates view
CollectionDatesView *datesView = new CollectionDatesView;;
@@ -117,7 +117,7 @@ void PlayerWidget::setupGui(QSplashScreen *splash){
cIdx = mCollectionStack->addWidget(datesView);
QAction *viewByDatesA = new QAction(QIcon(":/sissyd.png"), tr("View by date"), this);
viewByDatesA->setCheckable(true);
- connect(viewByDatesA, &QAction::triggered, [this, cIdx] { mCollectionStack->setCurrentIndex(cIdx); });
+ connect(viewByDatesA, &QAction::triggered, [this, cIdx] { setCollectionIndex(cIdx, false); });
bottomTBG->addAction(viewByDatesA);
//favorites view
CollectionFavoritesView *favoritesView = new CollectionFavoritesView;
@@ -129,7 +129,7 @@ void PlayerWidget::setupGui(QSplashScreen *splash){
cIdx = mCollectionStack->addWidget(favoritesView);
QAction *viewByFavoritesA = new QAction(QIcon(":/male_chastity_belt.png"), tr("View by favorites"), this);
viewByFavoritesA->setCheckable(true);
- connect(viewByFavoritesA, &QAction::triggered, [this, cIdx] { mCollectionStack->setCurrentIndex(cIdx); });
+ connect(viewByFavoritesA, &QAction::triggered, [this, cIdx] { setCollectionIndex(cIdx, false); });
bottomTBG->addAction(viewByFavoritesA);
//webradio view
CollectionWebradioView *webradioView = new CollectionWebradioView;
@@ -141,7 +141,7 @@ void PlayerWidget::setupGui(QSplashScreen *splash){
cIdx = mCollectionStack->addWidget(webradioView);
QAction *viewByWebradioA = new QAction(QIcon(":/dog_hood.png"), tr("Webradio"), this);
viewByWebradioA->setCheckable(true);
- connect(viewByWebradioA, &QAction::triggered, [this, cIdx] { mCollectionStack->setCurrentIndex(cIdx); });
+ connect(viewByWebradioA, &QAction::triggered, [this, cIdx] { setCollectionIndex(cIdx, true); });
bottomTBG->addAction(viewByWebradioA);
//folders view
CollectionFoldersView *foldersView = new CollectionFoldersView;
@@ -153,7 +153,7 @@ void PlayerWidget::setupGui(QSplashScreen *splash){
cIdx = mCollectionStack->addWidget(foldersView);
QAction *viewByFoldersA = new QAction(QIcon(":/folder.png"), tr("View by folder"), this);
viewByFoldersA->setCheckable(true);
- connect(viewByFoldersA, &QAction::triggered, [this, cIdx] { mCollectionStack->setCurrentIndex(cIdx); });
+ connect(viewByFoldersA, &QAction::triggered, [this, cIdx] { setCollectionIndex(cIdx, false); });
bottomTBG->addAction(viewByFoldersA);
for(QAction *a : bottomTBG->actions()){
bottomTB->addAction(a);
@@ -1026,3 +1026,14 @@ void PlayerWidget::gotoAlbum(){
}
}
}
+
+void PlayerWidget::setCollectionIndex(int collectionIndex, bool isWebradio){
+ mCollectionStack->setCurrentIndex(collectionIndex);
+ int plIdx = 0;
+ if(isWebradio){
+ plIdx = mPlaylistTab->indexOf(mWebRadioView);
+ }else{
+ plIdx = mPlaylistTab->indexOf(mSongView);
+ }
+ mPlaylistTab->setCurrentIndex(plIdx);
+}
diff --git a/playerwidget.h b/playerwidget.h
index 07d8c26..22098d8 100644
--- a/playerwidget.h
+++ b/playerwidget.h
@@ -68,6 +68,7 @@ class PlayerWidget : public QWidget {
void writeSettings();
void aboutDlg();
void gotoAlbum();
+ void setCollectionIndex(int collectionIndex, bool isWebradio);
signals:
void viewModeChanged(const QString &viewMode);
@@ -86,7 +87,6 @@ class PlayerWidget : public QWidget {
void recurse(const QModelIndex &parent);
void addSong(const QModelIndex &idx);
void play(const QString &fullPath);
- //void playUrl(const QString &url);
void playUrl(const QModelIndex &idx);
void advance(int numSongs);
void adjustVolume(int by);