Commit 736cc6b8 authored by Jakob Leben's avatar Jakob Leben

playlist, Qt: playlist browsing support

A new playlist item flag stops playlist after the item gets subitems.
The flag is set only upon user request to play an item from Qt views and only
if he does so in playlist "tree mode" not "one level".
Behavior on items played when playlist advances is unaffected.
This allows for comfortable "browsing" of playlist in tree mode, in particular
when using the Qt interface's icon view.
parent b5998426
......@@ -161,6 +161,7 @@ struct playlist_item_t
#define PLAYLIST_RO_FLAG 0x0008 /**< Write-enabled ? */
#define PLAYLIST_REMOVE_FLAG 0x0010 /**< Remove this item at the end */
#define PLAYLIST_EXPANDED_FLAG 0x0020 /**< Expanded node */
#define PLAYLIST_SUBITEM_STOP_FLAG 0x0040 /**< Must playlist stop if the item gets subitems ?*/
/** Playlist status */
typedef enum
......
......@@ -410,7 +410,6 @@ void StandardPLPanel::wheelEvent( QWheelEvent *e )
void StandardPLPanel::activate( const QModelIndex &index )
{
last_activated_id = model->getItem( index )->inputItem()->i_id;
if( model->hasChildren( index ) )
{
if( currentView == iconView ) {
......@@ -421,6 +420,11 @@ void StandardPLPanel::activate( const QModelIndex &index )
}
else
{
playlist_Lock( THEPL );
playlist_item_t *p_item = playlist_ItemGetById( THEPL, model->itemId( index ) );
p_item->i_flags |= PLAYLIST_SUBITEM_STOP_FLAG;
last_activated_id = p_item->p_input->i_id;//model->getItem( index )->inputItem()->i_id;
playlist_Unlock( THEPL );
model->activateItem( index );
}
}
......@@ -435,12 +439,15 @@ void StandardPLPanel::browseInto( input_item_t *p_input )
playlist_item_t *p_item = playlist_ItemGetByInput( THEPL, p_input );
assert( p_item != NULL );
QModelIndex index = model->index( p_item->i_id, 0 );
if( currentView == iconView ) {
QModelIndex index = model->index( p_item->i_id, 0 );
iconView->setRootIndex( index );
locationBar->setIndex( index );
}
last_activated_id = p_item->pp_children[0]->p_input->i_id;
else
treeView->setExpanded( index, true );
last_activated_id = -1;
playlist_Unlock( THEPL );
}
......
......@@ -82,8 +82,11 @@ static void input_item_subitem_added( const vlc_event_t * p_event,
return;
}
bool b_stop = p_item_in_category->i_flags & PLAYLIST_SUBITEM_STOP_FLAG;
b_play = b_play &&
p_item_in_category == get_current_status_item( p_playlist );
p_item_in_category == get_current_status_item( p_playlist ) &&
p_item_in_category->i_children == -1;
/* If this item is already a node don't transform it */
if( p_item_in_category->i_children == -1 )
......@@ -100,6 +103,13 @@ static void input_item_subitem_added( const vlc_event_t * p_event,
if( i_ret == VLC_SUCCESS && b_play )
{
if( b_stop )
{
p_item_in_category->i_flags &= ~PLAYLIST_SUBITEM_STOP_FLAG;
PL_UNLOCK;
playlist_Stop( p_playlist );
return;
}
playlist_Control( p_playlist, PLAYLIST_VIEWPLAY,
pl_Locked, p_item_in_category, NULL );
}
......
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