Merge pull request #6475 from rohtie/bugfix-position-not-resumed
Fix resuming playback position on startup
This commit is contained in:
commit
9eeb6d3758
|
@ -1342,8 +1342,20 @@ void MainWindow::ResumePlayback() {
|
|||
|
||||
app_->player()->Play();
|
||||
|
||||
connect(track_position_timer_, SIGNAL(timeout()),
|
||||
SLOT(ResumePlaybackPosition()));
|
||||
}
|
||||
|
||||
void MainWindow::ResumePlaybackPosition() {
|
||||
// We must wait until the song has a length because
|
||||
// seeking a song without length does not work
|
||||
if (app_->player()->engine()->length_nanosec() > 0) {
|
||||
disconnect(track_position_timer_, SIGNAL(timeout()), this,
|
||||
SLOT(ResumePlaybackPosition()));
|
||||
|
||||
app_->player()->SeekTo(saved_playback_position_);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::PlayIndex(const QModelIndex& index) {
|
||||
if (!index.isValid()) return;
|
||||
|
|
|
@ -271,6 +271,7 @@ signals:
|
|||
void SavePlaybackStatus(QSettings* settings);
|
||||
void LoadPlaybackStatus();
|
||||
void ResumePlayback();
|
||||
void ResumePlaybackPosition();
|
||||
|
||||
void AddSongInfoGenerator(smart_playlists::GeneratorPtr gen);
|
||||
|
||||
|
|
Loading…
Reference in New Issue