[vlc-devel] commit: Qt PL Model: don't emit currentChanged twice (Jakob Leben )

git version control git at videolan.org
Tue Jan 26 05:52:32 CET 2010


vlc | branch: master | Jakob Leben <jleben at videolan.org> | Tue Jan 26 05:50:52 2010 +0100| [b2b38e5e78d42ec301ef0c750aae9051275b4b81] | committer: Jakob Leben 

Qt PL Model: don't emit currentChanged twice

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b2b38e5e78d42ec301ef0c750aae9051275b4b81
---

 .../gui/qt4/components/playlist/playlist_model.cpp |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/playlist_model.cpp b/modules/gui/qt4/components/playlist/playlist_model.cpp
index ae67d69..0e2bb01 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.cpp
@@ -655,16 +655,10 @@ void PLModel::rebuild( playlist_item_t *p_root, bool b_first )
     assert( rootItem );
     /* Recreate from root */
     updateChildren( rootItem );
-    if( (p_item = playlist_CurrentPlayingItem(p_playlist)) )
-        currentItem = findByInput( rootItem, p_item->p_input->i_id );
-    else
-        currentItem = NULL;
     PL_UNLOCK;
 
     /* And signal the view */
     reset();
-
-    emit currentChanged( index( currentItem, 0 ) );
 }
 
 void PLModel::takeItem( PLItem *item )
@@ -724,7 +718,10 @@ void PLModel::removeItem( PLItem *item )
 void PLModel::updateChildren( PLItem *root )
 {
     playlist_item_t *p_node = playlist_ItemGetById( p_playlist, root->i_id );
+    PLItem *oldCurrent = currentItem;
     updateChildren( p_node, root );
+    if( currentItem != oldCurrent );
+    emit currentChanged( index( currentItem, 0 ) );
 }
 
 /* This function must be entered WITH the playlist lock */
@@ -739,7 +736,6 @@ void PLModel::updateChildren( playlist_item_t *p_node, PLItem *root )
         if( p_item && newItem->p_input == p_item->p_input )
         {
             currentItem = newItem;
-            emit currentChanged( index( currentItem, 0 ) );
         }
         if( p_node->pp_children[i]->i_children != -1 )
             updateChildren( p_node->pp_children[i], newItem );




More information about the vlc-devel mailing list