[vlc-devel] commit: Qt: Implement Stream/Save in playlist popup menu ( Jean-Philippe Andre )

git version control git at videolan.org
Fri Aug 22 05:01:36 CEST 2008


vlc | branch: master | Jean-Philippe Andre <jpeg at via.ecp.fr> | Thu Aug 21 22:54:52 2008 -0400| [f025433b9a8d04ddbed9ac7d1bf1e3b9a63958c8] | committer: Jean-Philippe Andre 

Qt: Implement Stream/Save in playlist popup menu

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f025433b9a8d04ddbed9ac7d1bf1e3b9a63958c8
---

 .../gui/qt4/components/playlist/playlist_model.cpp |   40 +++++++++++++++++++-
 .../gui/qt4/components/playlist/playlist_model.hpp |    3 +
 2 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/playlist_model.cpp b/modules/gui/qt4/components/playlist/playlist_model.cpp
index 9eba591..6d4fc63 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.cpp
@@ -26,6 +26,7 @@
 #endif
 
 #include "qt4.hpp"
+#include "dialogs_provider.hpp"
 #include "components/playlist/playlist_model.hpp"
 #include "dialogs/mediainfo.hpp"
 #include <vlc_intf_strings.h>
@@ -396,6 +397,35 @@ int PLModel::rowCount( const QModelIndex &parent ) const
     return parentItem->childCount();
 }
 
+QStringList PLModel::selectedURIs()
+{
+    QStringList lst;
+    for( int i = 0; i < current_selection.size(); i++ )
+    {
+        PL_LOCK;
+        PLItem *item = static_cast<PLItem*>
+                    (current_selection[i].internalPointer());
+        if( !item )
+            continue;
+
+        input_item_t *p_item = input_item_GetById( p_playlist,
+                                                   item->i_input_id );
+        if( !p_item )
+            continue;
+
+        char *psz = input_item_GetURI( p_item );
+        if( !psz )
+            continue;
+        else
+        {
+            lst.append( QString( psz ) );
+            free( psz );
+        }
+        PL_UNLOCK;
+    }
+    return lst;
+}
+
 /************************* General playlist status ***********************/
 
 bool PLModel::hasRandom()
@@ -862,6 +892,7 @@ void PLModel::popupDel()
 {
     doDelete( current_selection );
 }
+
 void PLModel::popupPlay()
 {
     PL_LOCK;
@@ -888,12 +919,17 @@ void PLModel::popupInfo()
 
 void PLModel::popupStream()
 {
-     msg_Err( p_playlist, "Stream not implemented" );
+    QStringList mrls = selectedURIs();
+    if( !mrls.isEmpty() )
+        THEDP->streamingDialog( NULL, mrls[0], false );
+
 }
 
 void PLModel::popupSave()
 {
-     msg_Err( p_playlist, "Save not implemented" );
+    QStringList mrls = selectedURIs();
+    if( !mrls.isEmpty() )
+        THEDP->streamingDialog( NULL, mrls[0], true );
 }
 
 #include <QUrl>
diff --git a/modules/gui/qt4/components/playlist/playlist_model.hpp b/modules/gui/qt4/components/playlist/playlist_model.hpp
index 19fc446..a097fa6 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.hpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.hpp
@@ -96,6 +96,9 @@ public:
     int rowCount( const QModelIndex &parent = QModelIndex() ) const;
     int columnCount( const QModelIndex &parent = QModelIndex() ) const;
 
+    /* Get current selection */
+    QStringList selectedURIs();
+
     void rebuild(); void rebuild( playlist_item_t * );
     bool hasRandom(); bool hasLoop(); bool hasRepeat();
 




More information about the vlc-devel mailing list