summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--playerwidget.cpp28
1 files changed, 16 insertions, 12 deletions
diff --git a/playerwidget.cpp b/playerwidget.cpp
index f6ad0d6..f944e64 100644
--- a/playerwidget.cpp
+++ b/playerwidget.cpp
@@ -478,25 +478,25 @@ void PlayerWidget::rightCurrentChanged(const QModelIndex &cur, const QModelIndex
}
void PlayerWidget::doPlay(){
- if(mPlayer->state() == QMediaPlayer::PausedState || mPlayer->state() == QMediaPlayer::StoppedState){
- mPlayer->play();
- mPlayA->setChecked(true);
- emit playModeChanged(tr("Playing"));
- emit setWinTitle(mCurWinTitle);
- mTrayIcon->setIcon(QIcon(":/play.png"));
- mTrayIcon->setToolTip(mCurToolTip);
- return;
- }
int playListCount = mSongModel->rowCount();
if(playListCount == 0){
emit message(tr("Playlist is empty! Dazed and confused, but trying to continue..."));
doStop();
return;
}
+
+ if(mPlayer->state() == QMediaPlayer::PausedState){
+ mPlayer->play();
+ mPlayA->setChecked(true);
+ emit playModeChanged(tr("Playing"));
+ return;
+ }
QModelIndexList sel = mSongView->selectionModel()->selectedRows();
- if(sel.isEmpty()){
- mSongView->selectionModel()->select(mSongModel->index(0, 0), QItemSelectionModel::SelectCurrent);
- sel = mSongView->selectionModel()->selectedRows();
+ if(mPlayer->state() == QMediaPlayer::StoppedState){
+ if(sel.isEmpty()){
+ mSongView->selectionModel()->setCurrentIndex(mSongModel->index(0, 0), QItemSelectionModel::SelectCurrent);
+ sel = mSongView->selectionModel()->selectedRows();
+ }
}
playCurrent(sel.first());
}
@@ -739,6 +739,10 @@ void PlayerWidget::playCurrent(const QModelIndex &index){
mPlayer->stop();
QString fullPath = index.data(CollectionWidget::FullPathRole).toString();
play(fullPath);
+ mPlayer->play();
+ mPlayA->setChecked(true);
+ emit playModeChanged(tr("Playing"));
+ emit setWinTitle(mCurWinTitle);
mTrayIcon->setIcon(QIcon(":/play.png"));
mTrayIcon->setToolTip(mCurToolTip);
}