diff options
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(); + } +} |