Commit b2b38e5e authored by Jakob Leben's avatar Jakob Leben

Qt PL Model: don't emit currentChanged twice

parent 382b629a
...@@ -655,16 +655,10 @@ void PLModel::rebuild( playlist_item_t *p_root, bool b_first ) ...@@ -655,16 +655,10 @@ void PLModel::rebuild( playlist_item_t *p_root, bool b_first )
assert( rootItem ); assert( rootItem );
/* Recreate from root */ /* Recreate from root */
updateChildren( rootItem ); updateChildren( rootItem );
if( (p_item = playlist_CurrentPlayingItem(p_playlist)) )
currentItem = findByInput( rootItem, p_item->p_input->i_id );
else
currentItem = NULL;
PL_UNLOCK; PL_UNLOCK;
/* And signal the view */ /* And signal the view */
reset(); reset();
emit currentChanged( index( currentItem, 0 ) );
} }
void PLModel::takeItem( PLItem *item ) void PLModel::takeItem( PLItem *item )
...@@ -724,7 +718,10 @@ void PLModel::removeItem( PLItem *item ) ...@@ -724,7 +718,10 @@ void PLModel::removeItem( PLItem *item )
void PLModel::updateChildren( PLItem *root ) void PLModel::updateChildren( PLItem *root )
{ {
playlist_item_t *p_node = playlist_ItemGetById( p_playlist, root->i_id ); playlist_item_t *p_node = playlist_ItemGetById( p_playlist, root->i_id );
PLItem *oldCurrent = currentItem;
updateChildren( p_node, root ); updateChildren( p_node, root );
if( currentItem != oldCurrent );
emit currentChanged( index( currentItem, 0 ) );
} }
/* This function must be entered WITH the playlist lock */ /* This function must be entered WITH the playlist lock */
...@@ -739,7 +736,6 @@ void PLModel::updateChildren( playlist_item_t *p_node, PLItem *root ) ...@@ -739,7 +736,6 @@ void PLModel::updateChildren( playlist_item_t *p_node, PLItem *root )
if( p_item && newItem->p_input == p_item->p_input ) if( p_item && newItem->p_input == p_item->p_input )
{ {
currentItem = newItem; currentItem = newItem;
emit currentChanged( index( currentItem, 0 ) );
} }
if( p_node->pp_children[i]->i_children != -1 ) if( p_node->pp_children[i]->i_children != -1 )
updateChildren( p_node->pp_children[i], newItem ); updateChildren( p_node->pp_children[i], newItem );
......
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