[vlc-devel] [PATCH 05/11] qt: disable access to Bookmark dialogs when medialibrary is disabled

Pierre Lamot pierre at videolabs.io
Fri Oct 9 12:07:35 CEST 2020


  bookmark are stored in the medialibrary
---
 modules/gui/qt/menus/menus.cpp               | 17 ++++++++++-------
 modules/gui/qt/menus/qml/GlobalShortcuts.qml |  2 +-
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/modules/gui/qt/menus/menus.cpp b/modules/gui/qt/menus/menus.cpp
index f846e2a3a7..25a091a66c 100644
--- a/modules/gui/qt/menus/menus.cpp
+++ b/modules/gui/qt/menus/menus.cpp
@@ -527,13 +527,16 @@ QMenu *VLCMenuBar::NavigMenu( intf_thread_t *p_intf, QMenu *menu )
     menu->addMenu( submenu );
     menu->addMenu( new CheckableListMenu( qtr("&Program") , THEMIM->getPrograms(), CheckableListMenu::GROUPED , menu) );
 
-    submenu = new QMenu( qtr( I_MENU_BOOKMARK ), menu );
-    submenu->setTearOffEnabled( true );
-    addDPStaticEntry( submenu, qtr( "&Manage" ), "",
-                      &DialogsProvider::bookmarksDialog, "Ctrl+B" );
-    submenu->addSeparator();
-    action = menu->addMenu( submenu );
-    action->setData( "bookmark" );
+    if (p_intf->p_sys->p_mi->hasMediaLibrary() )
+    {
+        submenu = new QMenu( qtr( I_MENU_BOOKMARK ), menu );
+        submenu->setTearOffEnabled( true );
+        addDPStaticEntry( submenu, qtr( "&Manage" ), "",
+                          &DialogsProvider::bookmarksDialog, "Ctrl+B" );
+        submenu->addSeparator();
+        action = menu->addMenu( submenu );
+        action->setData( "bookmark" );
+    }
 
     menu->addSeparator();
 
diff --git a/modules/gui/qt/menus/qml/GlobalShortcuts.qml b/modules/gui/qt/menus/qml/GlobalShortcuts.qml
index 489a4cad97..ca98e4024a 100644
--- a/modules/gui/qt/menus/qml/GlobalShortcuts.qml
+++ b/modules/gui/qt/menus/qml/GlobalShortcuts.qml
@@ -35,7 +35,7 @@ Item {
     Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+J"; onActivated: dialogProvider.mediaCodecDialog(); }
     Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+M"; onActivated: dialogProvider.messagesDialog(); }
     Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+P"; onActivated: dialogProvider.prefsDialog(); }
-    Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+B"; onActivated: dialogProvider.bookmarksDialog(); }
+    Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+B"; onActivated: dialogProvider.bookmarksDialog(); enabled: !!medialib}
     Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+T"; onActivated: dialogProvider.gotoTimeDialog(); }
     Shortcut{ context: Qt.ApplicationShortcut; sequence:"F1";     onActivated: dialogProvider.helpDialog(); }
 
-- 
2.25.1



More information about the vlc-devel mailing list