MediaPlayer: Deletion of playlist entries
Several scenarios of misbehaviour found and fixed, examples : * Deleting an item sitting before the currently playing item had the effect of starting the playback of the item before the delete item. (now it just updates the indexes - setting it to fCurrentIndex - 1 - without altering playback). * Deleting the last item of the list had for effect of starting the playback of the entry newingly being the last entry, regardless if the last entry was the active one or not. Should fix #6689.
This commit is contained in:
parent
6446fc3582
commit
b5f22a7f78
@ -325,10 +325,15 @@ Playlist::RemoveItem(int32 index, bool careAboutCurrentIndex)
|
|||||||
_NotifyItemRemoved(index);
|
_NotifyItemRemoved(index);
|
||||||
|
|
||||||
if (careAboutCurrentIndex) {
|
if (careAboutCurrentIndex) {
|
||||||
if (index >= CountItems())
|
// fCurrentIndex isn't in sync yet, so might be one too large (if the
|
||||||
SetCurrentItemIndex(CountItems() - 1);
|
// removed item was above the currently playing item).
|
||||||
else if (index <= fCurrentIndex)
|
if (index < fCurrentIndex)
|
||||||
SetCurrentItemIndex(index - 1);
|
SetCurrentItemIndex(fCurrentIndex - 1, false);
|
||||||
|
else if (index == fCurrentIndex) {
|
||||||
|
if (fCurrentIndex == CountItems())
|
||||||
|
fCurrentIndex--;
|
||||||
|
SetCurrentItemIndex(fCurrentIndex, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
|
Loading…
Reference in New Issue
Block a user