[vlc-devel] commit: Qt: playlist: fix updating of currently playing item (Jakob Leben )

git version control git at videolan.org
Sat Jan 30 10:24:00 CET 2010


vlc | branch: master | Jakob Leben <jleben at videolan.org> | Sat Jan 30 01:17:05 2010 +0100| [6a4273c261850edf99dc127bcb937c7adc0558e2] | committer: Jakob Leben 

Qt: playlist: fix updating of currently playing item

- When input changes, update visible item after currentItem has been set.
- Check if item is current when adding it.

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

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

diff --git a/modules/gui/qt4/components/playlist/playlist_model.cpp b/modules/gui/qt4/components/playlist/playlist_model.cpp
index f9c8762..ba7c3e7 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.cpp
@@ -577,7 +577,6 @@ bool PLModel::canEdit() const
 void PLModel::processInputItemUpdate( input_thread_t *p_input )
 {
     if( !p_input ) return;
-    processInputItemUpdate( input_GetItem( p_input ) );
     if( p_input && !( p_input->b_dead || !vlc_object_alive( p_input ) ) )
     {
         PLItem *item = findByInput( rootItem, input_GetItem( p_input )->i_id );
@@ -588,7 +587,9 @@ void PLModel::processInputItemUpdate( input_thread_t *p_input )
     {
         currentItem = NULL;
     }
+    processInputItemUpdate( input_GetItem( p_input ) );
 }
+
 void PLModel::processInputItemUpdate( input_item_t *p_item )
 {
     if( !p_item ||  p_item->i_id <= 0 ) return;
@@ -607,6 +608,7 @@ void PLModel::processItemAppend( int i_item, int i_parent )
 {
     playlist_item_t *p_item = NULL;
     PLItem *newItem = NULL;
+    input_thread_t *currentInputThread;
 
     PLItem *nodeItem = findById( rootItem, i_parent );
     if( !nodeItem ) return;
@@ -621,10 +623,18 @@ void PLModel::processItemAppend( int i_item, int i_parent )
     newItem = new PLItem( p_item, nodeItem );
     PL_UNLOCK;
 
+    currentInputThread = THEMIM->getInput();
+    if( currentInputThread &&
+        newItem->p_input == input_GetItem( currentInputThread ) )
+            currentItem = newItem;
+
     beginInsertRows( index( nodeItem, 0 ), nodeItem->childCount(), nodeItem->childCount() );
     nodeItem->appendChild( newItem );
     endInsertRows();
-    updateTreeItem( newItem );
+
+    if( currentItem == newItem )
+      emit currentChanged( index( newItem, 0 ) );
+
     return;
 end:
     PL_UNLOCK;




More information about the vlc-devel mailing list