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 ...@@ -161,6 +161,7 @@ struct playlist_item_t
#define PLAYLIST_RO_FLAG 0x0008 /**< Write-enabled ? */ #define PLAYLIST_RO_FLAG 0x0008 /**< Write-enabled ? */
#define PLAYLIST_REMOVE_FLAG 0x0010 /**< Remove this item at the end */ #define PLAYLIST_REMOVE_FLAG 0x0010 /**< Remove this item at the end */
#define PLAYLIST_EXPANDED_FLAG 0x0020 /**< Expanded node */ #define PLAYLIST_EXPANDED_FLAG 0x0020 /**< Expanded node */
#define PLAYLIST_SUBITEM_STOP_FLAG 0x0040 /**< Must playlist stop if the item gets subitems ?*/
/** Playlist status */ /** Playlist status */
typedef enum typedef enum
......
...@@ -410,7 +410,6 @@ void StandardPLPanel::wheelEvent( QWheelEvent *e ) ...@@ -410,7 +410,6 @@ void StandardPLPanel::wheelEvent( QWheelEvent *e )
void StandardPLPanel::activate( const QModelIndex &index ) void StandardPLPanel::activate( const QModelIndex &index )
{ {
last_activated_id = model->getItem( index )->inputItem()->i_id;
if( model->hasChildren( index ) ) if( model->hasChildren( index ) )
{ {
if( currentView == iconView ) { if( currentView == iconView ) {
...@@ -421,6 +420,11 @@ void StandardPLPanel::activate( const QModelIndex &index ) ...@@ -421,6 +420,11 @@ void StandardPLPanel::activate( const QModelIndex &index )
} }
else 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 ); model->activateItem( index );
} }
} }
...@@ -435,12 +439,15 @@ void StandardPLPanel::browseInto( input_item_t *p_input ) ...@@ -435,12 +439,15 @@ void StandardPLPanel::browseInto( input_item_t *p_input )
playlist_item_t *p_item = playlist_ItemGetByInput( THEPL, p_input ); playlist_item_t *p_item = playlist_ItemGetByInput( THEPL, p_input );
assert( p_item != NULL ); assert( p_item != NULL );
if( currentView == iconView ) {
QModelIndex index = model->index( p_item->i_id, 0 ); QModelIndex index = model->index( p_item->i_id, 0 );
if( currentView == iconView ) {
iconView->setRootIndex( index ); iconView->setRootIndex( index );
locationBar->setIndex( 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 ); playlist_Unlock( THEPL );
} }
......
...@@ -82,8 +82,11 @@ static void input_item_subitem_added( const vlc_event_t * p_event, ...@@ -82,8 +82,11 @@ static void input_item_subitem_added( const vlc_event_t * p_event,
return; return;
} }
bool b_stop = p_item_in_category->i_flags & PLAYLIST_SUBITEM_STOP_FLAG;
b_play = b_play && 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 this item is already a node don't transform it */
if( p_item_in_category->i_children == -1 ) if( p_item_in_category->i_children == -1 )
...@@ -100,6 +103,13 @@ static void input_item_subitem_added( const vlc_event_t * p_event, ...@@ -100,6 +103,13 @@ static void input_item_subitem_added( const vlc_event_t * p_event,
if( i_ret == VLC_SUCCESS && b_play ) 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, playlist_Control( p_playlist, PLAYLIST_VIEWPLAY,
pl_Locked, p_item_in_category, NULL ); 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