diff options
author | Arno <arno@disconnect.de> | 2017-02-27 12:34:23 +0100 |
---|---|---|
committer | Arno <arno@disconnect.de> | 2017-02-27 12:34:23 +0100 |
commit | d9e6d8d752000676cf5ea9489f044db78ef12b69 (patch) | |
tree | a0ec134af46d5e0c71fa27fe0388b8e74a03c60d /playerwidget.cpp | |
parent | a49455204fa38c3237bf00a93e0948f4a25355a4 (diff) | |
download | BeetPlayer-d9e6d8d752000676cf5ea9489f044db78ef12b69.tar.gz BeetPlayer-d9e6d8d752000676cf5ea9489f044db78ef12b69.tar.bz2 BeetPlayer-d9e6d8d752000676cf5ea9489f044db78ef12b69.zip |
Advance to next song from playlist
when the current one has finished.
Diffstat (limited to 'playerwidget.cpp')
-rw-r--r-- | playerwidget.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/playerwidget.cpp b/playerwidget.cpp index 33d8e9b..7e70125 100644 --- a/playerwidget.cpp +++ b/playerwidget.cpp @@ -14,7 +14,6 @@ #include <QSqlQuery> #include <QAction> #include <QToolBar> -#include <QMediaPlayer> #include <algorithm> @@ -33,6 +32,7 @@ void PlayerWidget::setupGui(){ mPlayer = new QMediaPlayer(this); connect(mPlayer, SIGNAL(positionChanged(qint64)), this, SLOT(setPosition(qint64))); connect(mPlayer, SIGNAL(durationChanged(qint64)), this, SLOT(setDuration(qint64))); + connect(mPlayer, SIGNAL(stateChanged(QMediaPlayer::State)), this, SLOT(continuePlaying(QMediaPlayer::State))); //THE view mView = new BeetView; @@ -459,13 +459,13 @@ void PlayerWidget::randomPlay(){ } void PlayerWidget::playCurrent(const QModelIndex &index){ + mStopA->trigger(); QString fullPath = index.data(FullPathRole).toString(); play(fullPath); } void PlayerWidget::play(const QString &fullPath){ mPlayer->setMedia(QUrl::fromLocalFile(fullPath)); - mPlayA->trigger(); } @@ -528,3 +528,9 @@ void PlayerWidget::setDuration(qint64 dur){ mSongSlider->setMinimum(0); mSongSlider->setMaximum(durSecs); } + +void PlayerWidget::continuePlaying(QMediaPlayer::State state){ + if(mPlayA->isChecked() && state == QMediaPlayer::StoppedState){ + next(); + } +} |