[vlc-devel] commit: qt4: selector take2 to fix service discoveries (Ilkka Ollakka )

git version control git at videolan.org
Sun Oct 25 16:47:31 CET 2009


vlc | branch: master | Ilkka Ollakka <ileoo at iki.fi> | Sun Oct 25 16:57:12 2009 +0200| [906e7c0bdefc214da036e3ec6be8a7a0de2f4e13] | committer: Ilkka Ollakka 

qt4: selector take2 to fix service discoveries

should fix #3112 again ;) . Playlist still has issue to crash if current item is
destroyed, but thats different issue

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

 modules/gui/qt4/components/playlist/selector.cpp |   21 ++++++++++++---------
 modules/gui/qt4/components/playlist/selector.hpp |    1 +
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/selector.cpp b/modules/gui/qt4/components/playlist/selector.cpp
index 42076f9..82db5d6 100644
--- a/modules/gui/qt4/components/playlist/selector.cpp
+++ b/modules/gui/qt4/components/playlist/selector.cpp
@@ -82,23 +82,25 @@ void PLSelector::setSource( QTreeWidgetItem *item )
         if( !playlist_IsServicesDiscoveryLoaded( THEPL, qtu( qs ) ) )
         {
             playlist_ServicesDiscoveryAdd( THEPL, qtu( qs ) );
-#warning FIXME
-            playlist_item_t *pl_item =
-                    THEPL->p_root_category->pp_children[THEPL->p_root_category->i_children-1];
-            item->setData( 0, PPL_ITEM_ROLE, QVariant::fromValue( pl_item ) );
 
-            emit activated( pl_item );
-            return;
         }
     }
 
     if( i_type == SD_TYPE )
         msg_Dbg( p_intf, "SD already loaded, reloading" );
 
-    playlist_item_t *pl_item =
-            item->data( 0, PPL_ITEM_ROLE ).value<playlist_item_t *>();
+    playlist_Lock( THEPL );
+    playlist_item_t *pl_item = NULL;
+    if( i_type == SD_TYPE )
+       pl_item = playlist_ChildSearchName( THEPL->p_root_category, qtu( item->data(0, LONGNAME_ROLE ).toString() ) );
+    else if ( i_type == PL_TYPE )
+       pl_item = THEPL->p_local_category;
+    else if ( i_type == ML_TYPE )
+       pl_item = THEPL->p_ml_category;
+    playlist_Unlock( THEPL );
+
     if( pl_item )
-            emit activated( pl_item );
+       emit activated( pl_item );
 }
 
 void PLSelector::createItems()
@@ -135,6 +137,7 @@ void PLSelector::createItems()
         sd_item = new QTreeWidgetItem( QStringList( qfu(*ppsz_longname) ) );
         sd_item->setData( 0, TYPE_ROLE, SD_TYPE );
         sd_item->setData( 0, NAME_ROLE, qfu( *ppsz_name ) );
+        sd_item->setData( 0, LONGNAME_ROLE, qfu( *ppsz_longname ) );
         sd_item->setFlags( sd_item->flags() & ~Qt::ItemIsDropEnabled );
         sds->addChild( sd_item );
         free( *ppsz_name );
diff --git a/modules/gui/qt4/components/playlist/selector.hpp b/modules/gui/qt4/components/playlist/selector.hpp
index f0471a3..758b35e 100644
--- a/modules/gui/qt4/components/playlist/selector.hpp
+++ b/modules/gui/qt4/components/playlist/selector.hpp
@@ -48,6 +48,7 @@ enum {
     TYPE_ROLE = Qt::UserRole,
     PPL_ITEM_ROLE,
     NAME_ROLE,
+    LONGNAME_ROLE,
 };
 
 Q_DECLARE_METATYPE( playlist_item_t *);




More information about the vlc-devel mailing list