bool PLModel::isCurrent( const QModelIndex &index ) const
{
- input_thread_t *p_input_thread = THEMIM->getInput();
- if( !p_input_thread ) return false;
- return getItem( index )->p_input == input_GetItem( p_input_thread );
+ return getItem( index )->p_input == THEMIM->currentInputItem();
}
int PLModel::itemId( const QModelIndex &index ) const
PL_LOCK;
p_item = playlist_ItemGetById( p_playlist, i_item );
- if( !p_item || p_item->i_flags & PLAYLIST_DBL_FLAG ) goto end;
+ if( !p_item || p_item->i_flags & PLAYLIST_DBL_FLAG )
+ {
+ PL_UNLOCK; return;
+ }
for( pos = 0; pos < p_item->p_parent->i_children; pos++ )
if( p_item->p_parent->pp_children[pos] == p_item ) break;
nodeItem->insertChild( newItem, pos );
endInsertRows();
- return;
-end:
- PL_UNLOCK;
- return;
+ if( newItem->p_input == THEMIM->currentInputItem() )
+ emit currentChanged( index( newItem, 0 ) );
}
input_thread_t *getInput() { return p_input; }
InputManager *getIM() { return im; }
+ inline input_item_t *currentInputItem()
+ {
+ return ( p_input ? input_GetItem( p_input ) : NULL );
+ }
vout_thread_t* getVout();
aout_instance_t *getAout();