[vlc-devel] commit: Qt: reuse the SD data (Jean-Baptiste Kempf )

git version control git at videolan.org
Mon Sep 7 00:26:39 CEST 2009


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Sep  7 00:22:34 2009 +0200| [ace7419f3678bf32d68c8c273c17866eade302bc] | committer: Jean-Baptiste Kempf 

Qt: reuse the SD data

When reloading, correctly update the view.

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

 modules/gui/qt4/components/playlist/selector.cpp   |   27 +++++++++++--------
 .../gui/qt4/components/playlist/standardpanel.cpp  |    1 -
 2 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/selector.cpp b/modules/gui/qt4/components/playlist/selector.cpp
index d989931..9ba8c35 100644
--- a/modules/gui/qt4/components/playlist/selector.cpp
+++ b/modules/gui/qt4/components/playlist/selector.cpp
@@ -77,25 +77,30 @@ void PLSelector::setSource( QTreeWidgetItem *item )
 
     int i_type = item->data( 0, Qt::UserRole ).toInt();
 
+    assert( ( i_type == PL_TYPE || i_type == ML_TYPE || i_type == SD_TYPE ) );
     if( i_type == SD_TYPE )
     {
-        QString qs = item->data( 0, Qt::UserRole + 1 ).toString();
+        QString qs = item->data( 0, Qt::UserRole + 2 ).toString();
         if( !playlist_IsServicesDiscoveryLoaded( THEPL, qtu( qs ) ) )
         {
             playlist_ServicesDiscoveryAdd( THEPL, qtu( qs ) );
 #warning FIXME
-            emit activated( THEPL->p_root_category->pp_children[THEPL->p_root_category->i_children-1] );
+            playlist_item_t *pl_item =
+                    THEPL->p_root_category->pp_children[THEPL->p_root_category->i_children-1];
+            item->setData( 0, Qt::UserRole + 1, QVariant::fromValue( pl_item ) );
+
+            emit activated( pl_item );
+            return;
         }
     }
-    else if( i_type == PL_TYPE || i_type == ML_TYPE )
-    {
-        playlist_item_t *pl_item =
-                item->data( 0, Qt::UserRole + 1 ).value<playlist_item_t *>();
-        if( pl_item )
+
+    if( i_type == SD_TYPE )
+        msg_Dbg( p_intf, "SD already loaded, reloading" );
+
+    playlist_item_t *pl_item =
+            item->data( 0, Qt::UserRole + 1 ).value<playlist_item_t *>();
+    if( pl_item )
             emit activated( pl_item );
-    }
-    else
-        assert( 0 );
 }
 
 void PLSelector::createItems()
@@ -132,7 +137,7 @@ void PLSelector::createItems()
     {
         sd_item = new QTreeWidgetItem( QStringList( *ppsz_longname ) );
         sd_item->setData( 0, Qt::UserRole, SD_TYPE );
-        sd_item->setData( 0, Qt::UserRole + 1, qfu( *ppsz_name ) );
+        sd_item->setData( 0, Qt::UserRole + 2, qfu( *ppsz_name ) );
         sds->addChild( sd_item );
     }
 }
diff --git a/modules/gui/qt4/components/playlist/standardpanel.cpp b/modules/gui/qt4/components/playlist/standardpanel.cpp
index b1c2292..5445ebd 100644
--- a/modules/gui/qt4/components/playlist/standardpanel.cpp
+++ b/modules/gui/qt4/components/playlist/standardpanel.cpp
@@ -344,4 +344,3 @@ StandardPLPanel::~StandardPLPanel()
     getSettings()->endGroup();
 }
 
-




More information about the vlc-devel mailing list