Commit 3fbe4e68 authored by Ilkka Ollakka's avatar Ilkka Ollakka

qt4: don't look currentItem when creating PLModel

rebuild() does that and sets currentItem itself. Also emit
currentChanged on rebuild, so you stay on currentItem if you add/remove
columns on view.
parent 0ec84ebb
...@@ -111,18 +111,6 @@ PLModel::PLModel( playlist_t *_p_playlist, /* THEPL */ ...@@ -111,18 +111,6 @@ PLModel::PLModel( playlist_t *_p_playlist, /* THEPL */
this, ProcessInputItemUpdate( input_item_t *) ); this, ProcessInputItemUpdate( input_item_t *) );
CONNECT( THEMIM, inputChanged( input_thread_t * ), CONNECT( THEMIM, inputChanged( input_thread_t * ),
this, ProcessInputItemUpdate( input_thread_t* ) ); this, ProcessInputItemUpdate( input_thread_t* ) );
PL_LOCK;
playlist_item_t *p_item;
/* Check if there's allready some item playing when playlist
* model is created, if so, tell model that it's currentone
*/
if( (p_item = playlist_CurrentPlayingItem(p_playlist)) )
{
currentItem = FindByInput( rootItem,
p_item->p_input->i_id );
emit currentChanged( index( currentItem, 0 ) );
}
PL_UNLOCK;
} }
PLModel::~PLModel() PLModel::~PLModel()
...@@ -773,21 +761,13 @@ void PLModel::rebuild( playlist_item_t *p_root ) ...@@ -773,21 +761,13 @@ void PLModel::rebuild( playlist_item_t *p_root )
/* Recreate from root */ /* Recreate from root */
UpdateNodeChildren( rootItem ); UpdateNodeChildren( rootItem );
if( (p_item = playlist_CurrentPlayingItem(p_playlist)) ) if( (p_item = playlist_CurrentPlayingItem(p_playlist)) )
{ currentItem = FindByInput( rootItem, p_item->p_input->i_id );
currentItem = FindByInput( rootItem,
p_item->p_input->i_id );
if( currentItem )
{
UpdateTreeItem( currentItem, true, false );
}
}
else else
{
currentItem = NULL; currentItem = NULL;
}
PL_UNLOCK; PL_UNLOCK;
/* And signal the view */ /* And signal the view */
emit currentChanged( index( currentItem, 0 ) );
emit layoutChanged(); emit layoutChanged();
addCallbacks(); addCallbacks();
} }
......
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