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

Qt: add popupAddToPlaylist

Close #4341
parent 303d976b
...@@ -944,6 +944,8 @@ bool PLModel::popup( const QModelIndex & index, const QPoint &point, const QMode ...@@ -944,6 +944,8 @@ bool PLModel::popup( const QModelIndex & index, const QPoint &point, const QMode
} }
if( i_popup_item > -1 ) if( i_popup_item > -1 )
{ {
if( rootItem->id() != THEPL->p_playing->i_id )
menu.addAction( qtr( "Add to playlist"), this, SLOT( popupAddToPlaylist() ) );
menu.addAction( QIcon( ":/buttons/playlist/playlist_remove" ), menu.addAction( QIcon( ":/buttons/playlist/playlist_remove" ),
qtr(I_POP_DEL), this, SLOT( popupDel() ) ); qtr(I_POP_DEL), this, SLOT( popupDel() ) );
menu.addSeparator(); menu.addSeparator();
...@@ -990,6 +992,22 @@ void PLModel::popupPlay() ...@@ -990,6 +992,22 @@ void PLModel::popupPlay()
PL_UNLOCK; PL_UNLOCK;
} }
void PLModel::popupAddToPlaylist()
{
playlist_Lock( THEPL );
foreach( QModelIndex currentIndex, current_selection )
{
playlist_item_t *p_item = playlist_ItemGetById( THEPL, getId( currentIndex ) );
if( !p_item ) continue;
playlist_NodeAddCopy( THEPL, p_item,
THEPL->p_playing,
PLAYLIST_END );
}
playlist_Unlock( THEPL );
}
void PLModel::popupInfo() void PLModel::popupInfo()
{ {
PL_LOCK; PL_LOCK;
...@@ -1014,7 +1032,6 @@ void PLModel::popupStream() ...@@ -1014,7 +1032,6 @@ void PLModel::popupStream()
QStringList mrls = selectedURIs(); QStringList mrls = selectedURIs();
if( !mrls.isEmpty() ) if( !mrls.isEmpty() )
THEDP->streamingDialog( NULL, mrls[0], false ); THEDP->streamingDialog( NULL, mrls[0], false );
} }
void PLModel::popupSave() void PLModel::popupSave()
...@@ -1027,8 +1044,7 @@ void PLModel::popupSave() ...@@ -1027,8 +1044,7 @@ void PLModel::popupSave()
void PLModel::popupExplore() void PLModel::popupExplore()
{ {
PL_LOCK; PL_LOCK;
playlist_item_t *p_item = playlist_ItemGetById( p_playlist, playlist_item_t *p_item = playlist_ItemGetById( p_playlist, i_popup_item );
i_popup_item );
if( p_item ) if( p_item )
{ {
input_item_t *p_input = p_item->p_input; input_item_t *p_input = p_item->p_input;
......
...@@ -161,6 +161,7 @@ private slots: ...@@ -161,6 +161,7 @@ private slots:
void popupSave(); void popupSave();
void popupExplore(); void popupExplore();
void popupAddNode(); void popupAddNode();
void popupAddToPlaylist();
void popupSort( int column ); void popupSort( int column );
void processInputItemUpdate( input_item_t *); void processInputItemUpdate( input_item_t *);
void processInputItemUpdate( input_thread_t* p_input ); void processInputItemUpdate( input_thread_t* p_input );
......
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