Commit f025433b authored by Jean-Philippe Andre's avatar Jean-Philippe Andre

Qt: Implement Stream/Save in playlist popup menu

parent 6bd699cc
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#endif #endif
#include "qt4.hpp" #include "qt4.hpp"
#include "dialogs_provider.hpp"
#include "components/playlist/playlist_model.hpp" #include "components/playlist/playlist_model.hpp"
#include "dialogs/mediainfo.hpp" #include "dialogs/mediainfo.hpp"
#include <vlc_intf_strings.h> #include <vlc_intf_strings.h>
...@@ -396,6 +397,35 @@ int PLModel::rowCount( const QModelIndex &parent ) const ...@@ -396,6 +397,35 @@ int PLModel::rowCount( const QModelIndex &parent ) const
return parentItem->childCount(); 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 ***********************/ /************************* General playlist status ***********************/
bool PLModel::hasRandom() bool PLModel::hasRandom()
...@@ -862,6 +892,7 @@ void PLModel::popupDel() ...@@ -862,6 +892,7 @@ void PLModel::popupDel()
{ {
doDelete( current_selection ); doDelete( current_selection );
} }
void PLModel::popupPlay() void PLModel::popupPlay()
{ {
PL_LOCK; PL_LOCK;
...@@ -888,12 +919,17 @@ void PLModel::popupInfo() ...@@ -888,12 +919,17 @@ void PLModel::popupInfo()
void PLModel::popupStream() 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() void PLModel::popupSave()
{ {
msg_Err( p_playlist, "Save not implemented" ); QStringList mrls = selectedURIs();
if( !mrls.isEmpty() )
THEDP->streamingDialog( NULL, mrls[0], true );
} }
#include <QUrl> #include <QUrl>
......
...@@ -96,6 +96,9 @@ public: ...@@ -96,6 +96,9 @@ public:
int rowCount( const QModelIndex &parent = QModelIndex() ) const; int rowCount( const QModelIndex &parent = QModelIndex() ) const;
int columnCount( const QModelIndex &parent = QModelIndex() ) const; int columnCount( const QModelIndex &parent = QModelIndex() ) const;
/* Get current selection */
QStringList selectedURIs();
void rebuild(); void rebuild( playlist_item_t * ); void rebuild(); void rebuild( playlist_item_t * );
bool hasRandom(); bool hasLoop(); bool hasRepeat(); bool hasRandom(); bool hasLoop(); bool hasRepeat();
......
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