Commit ed955714 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: fix playlist item menu play&pause actions

Close #16893
parent 66c7e7a7
......@@ -913,7 +913,18 @@ bool PLModel::action( QAction *action, const QModelIndexList &indexes )
case ACTION_PLAY:
if ( !indexes.empty() && indexes.first().isValid() )
{
activateItem( indexes.first() );
if( isCurrent( indexes.first() ) )
playlist_Resume(THEPL);
else
activateItem( indexes.first() );
return true;
}
break;
case ACTION_PAUSE:
if ( !indexes.empty() && indexes.first().isValid() )
{
playlist_Pause(THEPL);
return true;
}
break;
......@@ -994,6 +1005,9 @@ bool PLModel::isSupportedAction( actions action, const QModelIndex &index ) cons
case ACTION_SORT:
return rowCount() && !item->readOnly();
case ACTION_PLAY:
return !isCurrent( index ) || playlist_Status(THEPL) == PLAYLIST_PAUSED;
case ACTION_PAUSE:
return isCurrent( index ) && playlist_Status(THEPL) == PLAYLIST_RUNNING;
case ACTION_STREAM:
case ACTION_SAVE:
case ACTION_INFO:
......
......@@ -189,6 +189,9 @@ bool StandardPLPanel::popup( const QPoint &point )
ADD_MENU_ENTRY( QIcon( ":/menu/play" ), qtr(I_POP_PLAY),
VLCModelSubInterface::ACTION_PLAY )
ADD_MENU_ENTRY( QIcon( ":/menu/pause" ), qtr("Pause"),
VLCModelSubInterface::ACTION_PAUSE )
ADD_MENU_ENTRY( QIcon( ":/menu/stream" ), qtr(I_POP_STREAM),
VLCModelSubInterface::ACTION_STREAM )
......
......@@ -81,6 +81,7 @@ public:
enum actions
{
ACTION_PLAY = 1,
ACTION_PAUSE,
ACTION_STREAM,
ACTION_SAVE,
ACTION_INFO,
......
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