[vlc-devel] commit: qt4: don't look currentItem when creating PLModel (Ilkka Ollakka )

git version control git at videolan.org
Tue Aug 18 21:07:02 CEST 2009


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Tue Aug 18 21:48:31 2009 +0300| [3fbe4e68d1565a77f71504e3ddf7f77f2692ec26] | committer: 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.

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

 .../gui/qt4/components/playlist/playlist_model.cpp |   24 +------------------
 1 files changed, 2 insertions(+), 22 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/playlist_model.cpp b/modules/gui/qt4/components/playlist/playlist_model.cpp
index 11e1f88..fcdf44a 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.cpp
@@ -111,18 +111,6 @@ PLModel::PLModel( playlist_t *_p_playlist,  /* THEPL */
             this, ProcessInputItemUpdate( input_item_t *) );
     CONNECT( THEMIM, inputChanged( 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()
@@ -773,21 +761,13 @@ void PLModel::rebuild( playlist_item_t *p_root )
     /* Recreate from root */
     UpdateNodeChildren( rootItem );
     if( (p_item = playlist_CurrentPlayingItem(p_playlist)) )
-    {
-        currentItem = FindByInput( rootItem,
-                                           p_item->p_input->i_id );
-        if( currentItem )
-        {
-            UpdateTreeItem( currentItem, true, false );
-        }
-    }
+        currentItem = FindByInput( rootItem, p_item->p_input->i_id );
     else
-    {
         currentItem = NULL;
-    }
     PL_UNLOCK;
 
     /* And signal the view */
+    emit currentChanged( index( currentItem, 0 ) );
     emit layoutChanged();
     addCallbacks();
 }




More information about the vlc-devel mailing list