Fix save state when the song was paused

This commit is contained in:
Chocobozzz 2015-06-02 18:11:58 +02:00
parent ff6fd3f04b
commit 10de0d8f74
1 changed files with 20 additions and 17 deletions

View File

@ -422,24 +422,25 @@ MainWindow::MainWindow(Application* app, SystemTrayIcon* tray_icon, OSD* osd,
// Playlist view actions
ui_->action_next_playlist->setShortcuts(
QList<QKeySequence>() << QKeySequence::fromString("Ctrl+Tab")
QList<QKeySequence>()
<< QKeySequence::fromString("Ctrl+Tab")
#ifdef Q_OS_DARWIN
// On OS X "Ctrl+Tab" == Cmd + Tab but this shorcut
// is already used by default for switching between
// applications.
// I would have preferred to use Meta+Tab (which
// means Ctrl+Tab on OS X), like in Firefox or
// Chrome, but this doesn't work (probably at Qt bug)
// and some applications (e.g. Qt creator) uses
// Alt+Tab too so I believe it's a good shorcut anyway
<< QKeySequence::fromString("Alt+Tab")
#endif // Q_OS_DARWIN
<< QKeySequence::fromString("Ctrl+PgDown"));
// On OS X "Ctrl+Tab" == Cmd + Tab but this shorcut
// is already used by default for switching between
// applications.
// I would have preferred to use Meta+Tab (which
// means Ctrl+Tab on OS X), like in Firefox or
// Chrome, but this doesn't work (probably at Qt bug)
// and some applications (e.g. Qt creator) uses
// Alt+Tab too so I believe it's a good shorcut anyway
<< QKeySequence::fromString("Alt+Tab")
#endif // Q_OS_DARWIN
<< QKeySequence::fromString("Ctrl+PgDown"));
ui_->action_previous_playlist->setShortcuts(
QList<QKeySequence>() << QKeySequence::fromString("Ctrl+Shift+Tab")
#ifdef Q_OS_DARWIN
<< QKeySequence::fromString("Alt+Shift+Tab")
#endif // Q_OS_DARWIN
#endif // Q_OS_DARWIN
<< QKeySequence::fromString("Ctrl+PgUp"));
// Actions for switching tabs will be global to the entire window, so adding
// them here
@ -1190,13 +1191,15 @@ void MainWindow::LoadPlaybackStatus() {
void MainWindow::ResumePlayback() {
qLog(Debug) << "Resuming playback";
if (saved_playback_state_ == Engine::Paused) {
NewClosure(app_->player(), SIGNAL(Playing()), app_->player(),
SLOT(PlayPause()));
}
app_->player()->Play();
app_->player()->SeekTo(saved_playback_position_);
if (saved_playback_state_ == Engine::Paused) {
app_->player()->Pause();
}
}
void MainWindow::PlayIndex(const QModelIndex& index) {