[vlc-commits] gui/qt: only add Media\ Library to view if enabled

Filip Roséen git at videolan.org
Sun Jul 24 20:39:16 CEST 2016


vlc | branch: master | Filip Roséen <filip at atch.se> | Sun Jul 24 16:57:57 2016 +0200| [10bf15ba7f324f6a2752dc7e436b637a794d87e7] | committer: Francois Cartegnie

gui/qt: only add Media\ Library to view if enabled

Given that the media-library is conditionally enabled, the
implementation should not add an entity for such if it is not there.

This commit fixes that issue.

Signed-off-by: Francois Cartegnie <fcvlcdev at free.fr>

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

 modules/gui/qt/components/playlist/selector.cpp |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/modules/gui/qt/components/playlist/selector.cpp b/modules/gui/qt/components/playlist/selector.cpp
index 4a0c0e4..2761903 100644
--- a/modules/gui/qt/components/playlist/selector.cpp
+++ b/modules/gui/qt/components/playlist/selector.cpp
@@ -235,10 +235,13 @@ void PLSelector::createItems()
     setCurrentItem( playlistItem->treeItem() );
 
     /* ML */
-    PLSelItem *ml = putPLData( addItem( PL_ITEM_TYPE, N_("Media Library"), true ),
-                              THEPL->p_media_library );
-    ml->treeItem()->setData( 0, SPECIAL_ROLE, QVariant( IS_ML ) );
-    ml->treeItem()->setData( 0, Qt::DecorationRole, QIcon( ":/sidebar/library" ) );
+    if( THEPL->p_media_library )
+    {
+        PLSelItem *ml = putPLData( addItem( PL_ITEM_TYPE, N_("Media Library"), true ),
+          THEPL->p_media_library );
+        ml->treeItem()->setData( 0, SPECIAL_ROLE, QVariant( IS_ML ) );
+        ml->treeItem()->setData( 0, Qt::DecorationRole, QIcon( ":/sidebar/library" ) );
+    }
 
     /* SD nodes */
     QTreeWidgetItem *mycomp = addItem( CATEGORY_TYPE, N_("My Computer"), false, true )->treeItem();



More information about the vlc-commits mailing list