[vlc-commits] Qt: add popupAddToPlaylist
Jean-Baptiste Kempf
git at videolan.org
Sun May 22 18:46:50 CEST 2011
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sun May 22 18:40:33 2011 +0200| [a40a511642ff9cd0e56c91e0a470f1253db12e0a] | committer: Jean-Baptiste Kempf
Qt: add popupAddToPlaylist
Close #4341
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a40a511642ff9cd0e56c91e0a470f1253db12e0a
---
.../gui/qt4/components/playlist/playlist_model.cpp | 22 +++++++++++++++++--
.../gui/qt4/components/playlist/playlist_model.hpp | 1 +
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/modules/gui/qt4/components/playlist/playlist_model.cpp b/modules/gui/qt4/components/playlist/playlist_model.cpp
index c2b8141..ebec0bb 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.cpp
@@ -944,6 +944,8 @@ bool PLModel::popup( const QModelIndex & index, const QPoint &point, const QMode
}
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" ),
qtr(I_POP_DEL), this, SLOT( popupDel() ) );
menu.addSeparator();
@@ -990,6 +992,22 @@ void PLModel::popupPlay()
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()
{
PL_LOCK;
@@ -1014,7 +1032,6 @@ void PLModel::popupStream()
QStringList mrls = selectedURIs();
if( !mrls.isEmpty() )
THEDP->streamingDialog( NULL, mrls[0], false );
-
}
void PLModel::popupSave()
@@ -1027,8 +1044,7 @@ void PLModel::popupSave()
void PLModel::popupExplore()
{
PL_LOCK;
- playlist_item_t *p_item = playlist_ItemGetById( p_playlist,
- i_popup_item );
+ playlist_item_t *p_item = playlist_ItemGetById( p_playlist, i_popup_item );
if( p_item )
{
input_item_t *p_input = p_item->p_input;
diff --git a/modules/gui/qt4/components/playlist/playlist_model.hpp b/modules/gui/qt4/components/playlist/playlist_model.hpp
index db3a29b..925b129 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.hpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.hpp
@@ -161,6 +161,7 @@ private slots:
void popupSave();
void popupExplore();
void popupAddNode();
+ void popupAddToPlaylist();
void popupSort( int column );
void processInputItemUpdate( input_item_t *);
void processInputItemUpdate( input_thread_t* p_input );
More information about the vlc-commits
mailing list