Commit c5f7d8ef authored by Filip Roséen's avatar Filip Roséen Committed by François Cartegnie

gui/qt: fix PLModel::isSupportedAction( ACTION_PLAY, ... )

Prior to this commit, ACTION_PLAY was supported if:

    - the index was not associated with the currently playing
      item, or;
    - the playlist was paused.

In other words, the option would not be enabled if the playlist was in
a stopped state.

This commit changes the associated logic to the following, meaning
that the action is supported:

    - when the user has right-clicked on an entity, and;
    - the playlist is either stopped or paused, and;
    - the associated index is not currently playing.

Usage of PL_LOCK/PL_UNLOCK has also been replaced by vlc_playlist_lock
to aid code-reasoning and maintenance.
Signed-off-by: François Cartegnie's avatarFrancois Cartegnie <fcvlcdev@free.fr>
parent fcd81218
......@@ -1014,10 +1014,17 @@ bool PLModel::isSupportedAction( actions action, const QModelIndex &index ) cons
return rowCount();
case ACTION_PLAY:
{
PL_LOCK;
bool b_ret = !isCurrent( index ) || playlist_Status(THEPL) == PLAYLIST_PAUSED;
PL_UNLOCK;
return b_ret;
if( !item )
return false;
{
vlc_playlist_locker pl_lock ( THEPL );
if( playlist_Status( THEPL ) != PLAYLIST_RUNNING )
return true;
}
return !isCurrent( index );
}
case ACTION_PAUSE:
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment