From e390f3a399828c9ea9b8f4edc23e16466039d2b6 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Tue, 29 Sep 2020 17:38:00 +0200 Subject: [PATCH] Clear now playing in MainWindow::MediaPlaying() instead Fixes #548 --- src/core/mainwindow.cpp | 2 ++ src/playlist/playlist.cpp | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/core/mainwindow.cpp b/src/core/mainwindow.cpp index cce0464ff..bb6250885 100644 --- a/src/core/mainwindow.cpp +++ b/src/core/mainwindow.cpp @@ -1261,6 +1261,8 @@ void MainWindow::MediaPlaying() { track_position_timer_->start(); track_slider_timer_->start(); UpdateTrackPosition(); + + if (app_->playlist_manager()->active()) app_->playlist_manager()->active()->set_nowplaying(false); SendNowPlaying(); } diff --git a/src/playlist/playlist.cpp b/src/playlist/playlist.cpp index 9857e5112..89efeaf24 100644 --- a/src/playlist/playlist.cpp +++ b/src/playlist/playlist.cpp @@ -595,9 +595,9 @@ int Playlist::previous_row(const bool ignore_repeat_track) const { void Playlist::set_current_row(const int i, const AutoScroll autoscroll, const bool is_stopping) { QModelIndex old_current_item_index = current_item_index_; + QModelIndex new_current_item_index = QPersistentModelIndex(index(i, 0, QModelIndex())); - ClearStreamMetadata(); - nowplaying_ = false; + if (new_current_item_index != current_item_index_) ClearStreamMetadata(); if (next_row() != -1 && next_row() != i) { PlaylistItemPtr next_item = item_at(next_row()); @@ -607,7 +607,7 @@ void Playlist::set_current_row(const int i, const AutoScroll autoscroll, const b } } - current_item_index_ = QPersistentModelIndex(index(i, 0, QModelIndex())); + current_item_index_ = new_current_item_index; // if the given item is the first in the queue, remove it from the queue if (current_item_index_.row() == queue_->PeekNext()) {