Commit e0a92345 authored by Jakob Leben's avatar Jakob Leben

Qt iconView: browse into node when it spawns subitems

parent 03fef5e5
......@@ -113,6 +113,10 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
}
getSettings()->endGroup();
last_activated_id = -1;
CONNECT( THEMIM, inputChanged( input_thread_t * ),
this, handleInputChange( input_thread_t * ) );
}
StandardPLPanel::~StandardPLPanel()
......@@ -363,13 +367,37 @@ void StandardPLPanel::wheelEvent( QWheelEvent *e )
void StandardPLPanel::activate( const QModelIndex &index )
{
if( model->hasChildren( index ) && currentView == iconView )
last_activated_id = model->itemId( index );
if( model->hasChildren( index ) )
{
iconView->setRootIndex( index );
title->setText( index.data().toString() );
if( currentView == iconView ) {
iconView->setRootIndex( index );
title->setText( index.data().toString() );
}
}
else
{
model->activateItem( index );
}
}
void StandardPLPanel::handleInputChange( input_thread_t *p_input_thread )
{
input_item_t *p_input_item = input_GetItem( p_input_thread );
if( !p_input_item ) return;
playlist_Lock( THEPL );
playlist_item_t *p_item = playlist_ItemGetByInput( THEPL, p_input_item );
if( p_item && p_item->p_parent &&
p_item->p_parent->i_id == last_activated_id )
{
QModelIndex index = model->index( p_item->p_parent->i_id, 0 );
iconView->setRootIndex( index );
title->setText( index.data().toString() );
last_activated_id = p_item->i_id;
}
playlist_Unlock( THEPL );
}
......@@ -76,6 +76,8 @@ private:
int currentRootId;
QSignalMapper *selectColumnsSigMapper;
int last_activated_id;
enum {
TREE_VIEW = 0,
ICON_VIEW,
......@@ -99,6 +101,7 @@ private slots:
void toggleColumnShown( int );
void toggleView();
void activate( const QModelIndex & );
void handleInputChange( input_thread_t * );
};
#endif
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