Make sure the last played track gets restored properly when we re-open clementine
This commit is contained in:
parent
c70fb01c44
commit
4dbd1f2a2f
|
@ -824,14 +824,15 @@ void Playlist::Restore() {
|
||||||
items_ = backend_->GetPlaylistItems(id_);
|
items_ = backend_->GetPlaylistItems(id_);
|
||||||
|
|
||||||
PlaylistBackend::Playlist p = backend_->GetPlaylist(id_);
|
PlaylistBackend::Playlist p = backend_->GetPlaylist(id_);
|
||||||
last_played_item_index_ =
|
|
||||||
p.last_played == -1 ? QModelIndex() : index(p.last_played);
|
|
||||||
|
|
||||||
for (int i=0 ; i<items_.count() ; ++i) {
|
for (int i=0 ; i<items_.count() ; ++i) {
|
||||||
virtual_items_ << i;
|
virtual_items_ << i;
|
||||||
};
|
};
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
|
|
||||||
|
last_played_item_index_ =
|
||||||
|
p.last_played == -1 ? QModelIndex() : index(p.last_played);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Playlist::removeRows(int row, int count, const QModelIndex& parent) {
|
bool Playlist::removeRows(int row, int count, const QModelIndex& parent) {
|
||||||
|
|
|
@ -157,7 +157,7 @@ void PlaylistManager::SetActivePlaylist(int id) {
|
||||||
|
|
||||||
// Kinda a hack: unset the current item from the old active playlist before
|
// Kinda a hack: unset the current item from the old active playlist before
|
||||||
// setting the new one
|
// setting the new one
|
||||||
if (active_ != -1)
|
if (active_ != -1 && active_ != id)
|
||||||
active()->set_current_index(-1);
|
active()->set_current_index(-1);
|
||||||
|
|
||||||
active_ = id;
|
active_ = id;
|
||||||
|
|
Loading…
Reference in New Issue