Commit 873e5edb authored by jpd's avatar jpd
Browse files

adjustments to playlist API changes

parent e4b20c82
......@@ -1522,7 +1522,7 @@
PL_LOCK;
playlist_NodeCreate( p_playlist, _("Empty Folder"),
p_playlist->p_local_category, 0, NULL );
p_playlist->p_local_category, PLAYLIST_END, 0, NULL );
PL_UNLOCK;
[self playlistUpdated];
......
......@@ -197,14 +197,14 @@ bool PLModel::dropMimeData( const QMimeData *data, Qt::DropAction action,
if( plMimeData )
{
if( copy )
dropAppendCopy( plMimeData, getItem( parent ) );
dropAppendCopy( plMimeData, getItem( parent ), row );
else
dropMove( plMimeData, getItem( parent ), row );
}
return true;
}
void PLModel::dropAppendCopy( const PlMimeData *plMimeData, PLItem *target )
void PLModel::dropAppendCopy( const PlMimeData *plMimeData, PLItem *target, int pos )
{
PL_LOCK;
......@@ -212,49 +212,20 @@ void PLModel::dropAppendCopy( const PlMimeData *plMimeData, PLItem *target )
playlist_ItemGetByInput( p_playlist, target->p_input );
if( !p_parent ) return;
bool b_flat = p_parent == p_playlist->p_playing &&
!var_InheritBool( p_intf, "playlist-tree" );
if( pos == -1 ) pos = PLAYLIST_END;
QList<input_item_t*> inputItems = plMimeData->inputItems();
foreach( input_item_t* p_input, inputItems )
{
playlist_item_t *p_item = playlist_ItemGetByInput( p_playlist, p_input );
if( !p_item ) continue;
recursiveAppendCopy( p_playlist, p_item, p_parent, b_flat );
pos = playlist_NodeAddCopy( p_playlist, p_item, p_parent, pos );
}
PL_UNLOCK;
}
/* Must be entered WITH playlist lock! */
void PLModel::recursiveAppendCopy( playlist_t *p_playlist, playlist_item_t *source,
playlist_item_t *target, bool b_flat )
{
input_item_t *srcInput = source->p_input;
if( !(source->i_children != -1 && b_flat) )
{
vlc_mutex_lock( &srcInput->lock );
input_item_t *newInput =
input_item_NewWithType( VLC_OBJECT(p_playlist),
srcInput->psz_uri, srcInput->psz_name,
srcInput->i_options, srcInput->ppsz_options,
srcInput->optflagc, srcInput->i_duration,
srcInput->i_type );
vlc_mutex_unlock( &srcInput->lock );
if( source->i_children != -1 )
target = playlist_NodeCreate( p_playlist, newInput->psz_name, target, 0, newInput );
else
playlist_NodeAddInput( p_playlist, newInput, target,
PLAYLIST_APPEND | PLAYLIST_SPREPARSE,
PLAYLIST_END, pl_Locked );
}
for( int i = 0; i < source->i_children; i++ )
recursiveAppendCopy( p_playlist, source->pp_children[i], target, b_flat );
}
void PLModel::dropMove( const PlMimeData * plMimeData, PLItem *target, int row )
{
QList<input_item_t*> inputItems = plMimeData->inputItems();
......@@ -1109,7 +1080,7 @@ void PLModel::popupAddNode()
i_popup_parent );
if( p_item )
{
playlist_NodeCreate( p_playlist, qtu( name ), p_item, 0, NULL );
playlist_NodeCreate( p_playlist, qtu( name ), p_item, PLAYLIST_END, 0, NULL );
}
PL_UNLOCK;
}
......
......@@ -142,8 +142,7 @@ private:
void updateChildren( playlist_item_t *, PLItem * );
/* Deep actions (affect core playlist) */
static void recursiveAppendCopy( playlist_t *, playlist_item_t *, playlist_item_t *, bool );
void dropAppendCopy( const PlMimeData * data, PLItem *target );
void dropAppendCopy( const PlMimeData * data, PLItem *target, int pos );
void dropMove( const PlMimeData * data, PLItem *target, int new_pos );
/* Popup */
......
......@@ -362,9 +362,9 @@ bool PLSelector::dropMimeData ( QTreeWidgetItem * parent, int index,
playlist_item_t *p_item = playlist_ItemGetByInput( THEPL, p_input );
if( !p_item ) continue;
PLModel::recursiveAppendCopy( THEPL, p_item,
to_pl ? THEPL->p_playing : THEPL->p_media_library,
to_pl && !var_InheritBool( p_intf, "playlist-tree" ) );
playlist_NodeAddCopy( THEPL, p_item,
to_pl ? THEPL->p_playing : THEPL->p_media_library,
PLAYLIST_END );
}
playlist_Unlock( THEPL );
......
......@@ -170,7 +170,7 @@ playlist_item_t *UPnPHandler::AddDevice( Device *dev )
*/
char *str = strdup( dev->getFriendlyName( ) );
p_item = playlist_NodeCreate( p_playlist, str, p_sd->p_cat, 0, NULL );
p_item = playlist_NodeCreate( p_playlist, str, p_sd->p_cat, PLAYLIST_END, 0, NULL );
p_item->i_flags &= ~PLAYLIST_SKIP_FLAG;
msg_Dbg( p_sd, "device %s added", str );
free( str );
......@@ -214,7 +214,7 @@ void UPnPHandler::AddContent( playlist_item_t *p_parent, ContentNode *node )
char* p_name = strdup(title); /* See other comment on strdup */
playlist_item_t* p_node = playlist_NodeCreate( p_playlist, p_name,
p_parent, 0, NULL );
p_parent, PLAYLIST_END, 0, NULL );
free(p_name);
unsigned nContentNodes = conNode->getNContentNodes();
......
......@@ -121,7 +121,7 @@ playlist_t * playlist_Create( vlc_object_t *p_parent )
/* Create the root node */
PL_LOCK;
p_playlist->p_root = playlist_NodeCreate( p_playlist, NULL, NULL,
0, NULL );
PLAYLIST_END, 0, NULL );
PL_UNLOCK;
if( !p_playlist->p_root ) return NULL;
......@@ -129,7 +129,7 @@ playlist_t * playlist_Create( vlc_object_t *p_parent )
PL_LOCK;
p_playlist->p_playing = playlist_NodeCreate(
p_playlist, _( "Playlist" ), p_playlist->p_root,
PLAYLIST_RO_FLAG, NULL );
PLAYLIST_END, PLAYLIST_RO_FLAG, NULL );
PL_UNLOCK;
......@@ -142,7 +142,7 @@ playlist_t * playlist_Create( vlc_object_t *p_parent )
PL_LOCK;
p_playlist->p_media_library = playlist_NodeCreate(
p_playlist, _( "Media Library" ), p_playlist->p_root,
PLAYLIST_RO_FLAG, NULL );
PLAYLIST_END, PLAYLIST_RO_FLAG, NULL );
PL_UNLOCK;
if(!p_playlist->p_media_library ) return NULL;
......
......@@ -263,7 +263,7 @@ static void playlist_sd_item_added( const vlc_event_t * p_event, void * user_dat
if( !p_cat )
{
p_cat = playlist_NodeCreate( p_playlist, psz_cat,
p_parent, 0, NULL );
p_parent, PLAYLIST_END, 0, NULL );
p_cat->i_flags &= ~PLAYLIST_SKIP_FLAG;
}
p_parent = p_cat;
......@@ -339,7 +339,7 @@ int playlist_ServicesDiscoveryAdd( playlist_t *p_playlist,
PL_LOCK;
p_node = playlist_NodeCreate( p_playlist, psz_longname,
p_playlist->p_root, 0, NULL );
p_playlist->p_root, PLAYLIST_END, 0, NULL );
PL_UNLOCK;
vlc_event_manager_t *em = services_discovery_EventManager( p_sd );
......
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