[vlc-commits] Qt, selector: activate the SQL ML

Jean-Baptiste Kempf git at videolan.org
Mon May 9 11:06:00 CEST 2011


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon May  2 22:40:16 2011 +0200| [c1fd72005df18877637144885a8da01c832a2e5e] | committer: Jean-Baptiste Kempf

Qt, selector: activate the SQL ML

So at least, someone can test/fix it...

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/gui/qt4/components/playlist/playlist.cpp   |    6 +++---
 modules/gui/qt4/components/playlist/selector.cpp   |   12 +++++++++++-
 modules/gui/qt4/components/playlist/selector.hpp   |    5 +++--
 .../gui/qt4/components/playlist/standardpanel.cpp  |    7 +++++--
 .../gui/qt4/components/playlist/standardpanel.hpp  |    2 +-
 5 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/playlist.cpp b/modules/gui/qt4/components/playlist/playlist.cpp
index c2d6334..54396ec 100644
--- a/modules/gui/qt4/components/playlist/playlist.cpp
+++ b/modules/gui/qt4/components/playlist/playlist.cpp
@@ -144,9 +144,9 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
     layout->setColumnStretch( 3, 3 );
 
     /* Connect the activation of the selector to a redefining of the PL */
-    DCONNECT( selector, activated( playlist_item_t * ),
-              mainView, setRoot( playlist_item_t * ) );
-    mainView->setRoot( p_root );
+    DCONNECT( selector, activated( playlist_item_t *, bool ),
+              mainView, setRoot( playlist_item_t *, bool ) );
+    mainView->setRoot( p_root, false );
 
     /* */
     split = new PlaylistSplitter( this );
diff --git a/modules/gui/qt4/components/playlist/selector.cpp b/modules/gui/qt4/components/playlist/selector.cpp
index e2ed853..4f9a9da 100644
--- a/modules/gui/qt4/components/playlist/selector.cpp
+++ b/modules/gui/qt4/components/playlist/selector.cpp
@@ -192,6 +192,9 @@ void PLSelector::createItems()
                               THEPL->p_media_library );
     ml->treeItem()->setData( 0, SPECIAL_ROLE, QVariant( IS_ML ) );
 
+    /* SQL ML */
+    QTreeWidgetItem *sql_ml =  addItem( SQL_ML, "SQL Media Library" )->treeItem();
+
     /* SD nodes */
     QTreeWidgetItem *mycomp = addItem( CATEGORY_TYPE, N_("My Computer") )->treeItem();
     QTreeWidgetItem *devices = addItem( CATEGORY_TYPE, N_("Devices") )->treeItem();
@@ -271,11 +274,18 @@ void PLSelector::setSource( QTreeWidgetItem *item )
         if( !sd_loaded )
             playlist_ServicesDiscoveryAdd( THEPL, qtu( qs ) );
     }
+    else if( i_type == SQL_ML )
+    {
+        emit activated( NULL, true );
+        return;
+    }
 
     /* */
     playlist_Lock( THEPL );
     playlist_item_t *pl_item = NULL;
 
+    /* Special case for podcast */
+    // FIXME: simplify
     if( i_type == SD_TYPE )
     {
         /* Find the right item for the SD */
@@ -301,7 +311,7 @@ void PLSelector::setSource( QTreeWidgetItem *item )
 
     /* */
     if( pl_item )
-        emit activated( pl_item );
+        emit activated( pl_item, false );
 }
 
 PLSelItem * PLSelector::addItem (
diff --git a/modules/gui/qt4/components/playlist/selector.hpp b/modules/gui/qt4/components/playlist/selector.hpp
index d97335e..ddac879 100644
--- a/modules/gui/qt4/components/playlist/selector.hpp
+++ b/modules/gui/qt4/components/playlist/selector.hpp
@@ -43,7 +43,8 @@ class QLabel;
 enum SelectorItemType {
     CATEGORY_TYPE,
     SD_TYPE,
-    PL_ITEM_TYPE
+    PL_ITEM_TYPE,
+    SQL_ML
 };
 
 enum SpecialData {
@@ -144,7 +145,7 @@ private slots:
     void podcastRemove( PLSelItem* );
 
 signals:
-    void activated( playlist_item_t * );
+    void activated( playlist_item_t *, bool );
 };
 
 #endif
diff --git a/modules/gui/qt4/components/playlist/standardpanel.cpp b/modules/gui/qt4/components/playlist/standardpanel.cpp
index ae19f71..54189c3 100644
--- a/modules/gui/qt4/components/playlist/standardpanel.cpp
+++ b/modules/gui/qt4/components/playlist/standardpanel.cpp
@@ -86,7 +86,7 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
              this, handleExpansion( const QModelIndex& ) );
     CONNECT( model, rootChanged(), this, handleRootChange() );
 
-    setRoot( p_root );
+    setRoot( p_root, false );
 }
 
 StandardPLPanel::~StandardPLPanel()
@@ -189,8 +189,11 @@ void StandardPLPanel::searchDelayed( const QString& searchText )
 
 /* Set the root of the new Playlist */
 /* This activated by the selector selection */
-void StandardPLPanel::setRoot( playlist_item_t *p_item )
+void StandardPLPanel::setRoot( playlist_item_t *p_item, bool b )
 {
+    if( b ) //SQLML
+        return;
+
     model->rebuild( p_item );
 }
 
diff --git a/modules/gui/qt4/components/playlist/standardpanel.hpp b/modules/gui/qt4/components/playlist/standardpanel.hpp
index 3853918..4520ff8 100644
--- a/modules/gui/qt4/components/playlist/standardpanel.hpp
+++ b/modules/gui/qt4/components/playlist/standardpanel.hpp
@@ -99,7 +99,7 @@ private:
     bool eventFilter ( QObject * watched, QEvent * event );
 
 public slots:
-    void setRoot( playlist_item_t * );
+    void setRoot( playlist_item_t *, bool );
     void browseInto( const QModelIndex& );
 
 private slots:



More information about the vlc-commits mailing list