-1 is a valid index for the current playlist item index
in the Playlist code, but we don't want to get to this index from the GUI. Handle truncation of the index in the ControllerView. This solves invalid button state when using the keyboard to skip to the previous item when the current item was already the first item. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38540 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
45f82fe6d0
commit
11c015d896
@ -135,7 +135,10 @@ void
|
||||
ControllerView::SkipBackward()
|
||||
{
|
||||
BAutolock _(fPlaylist);
|
||||
fPlaylist->SetCurrentItemIndex(fPlaylist->CurrentItemIndex() - 1);
|
||||
int32 index = fPlaylist->CurrentItemIndex() - 1;
|
||||
if (index < 0)
|
||||
index = 0;
|
||||
fPlaylist->SetCurrentItemIndex(index);
|
||||
}
|
||||
|
||||
|
||||
@ -143,7 +146,10 @@ void
|
||||
ControllerView::SkipForward()
|
||||
{
|
||||
BAutolock _(fPlaylist);
|
||||
fPlaylist->SetCurrentItemIndex(fPlaylist->CurrentItemIndex() + 1);
|
||||
int32 index = fPlaylist->CurrentItemIndex() + 1;
|
||||
if (index >= fPlaylist->CountItems())
|
||||
index = fPlaylist->CountItems() - 1;
|
||||
fPlaylist->SetCurrentItemIndex(index);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user