[vlc-devel] [PATCH 7/8] Extensions/Qt: buildsystem + menu entries

Jean-Philippe André jpeg at videolan.org
Tue Dec 22 23:44:14 CET 2009


You can now play with extensions, from the menu View > Extensions
---
 modules/gui/qt4/Modules.am           |    6 ++++
 modules/gui/qt4/dialogs_provider.cpp |    5 +++
 modules/gui/qt4/main_interface.cpp   |    4 +++
 modules/gui/qt4/menus.cpp            |   46 ++++++++++++++++++++++++++++++++++
 modules/gui/qt4/menus.hpp            |    2 +
 5 files changed, 63 insertions(+), 0 deletions(-)

diff --git a/modules/gui/qt4/Modules.am b/modules/gui/qt4/Modules.am
index 9ce1baf..cd95f76 100644
--- a/modules/gui/qt4/Modules.am
+++ b/modules/gui/qt4/Modules.am
@@ -20,6 +20,7 @@ nodist_SOURCES_qt4 = \
 		dialogs_provider.moc.cpp \
 		input_manager.moc.cpp \
 		actions_manager.moc.cpp \
+		extensions_manager.moc.cpp \
 		recents.moc.cpp \
 		variables.moc.cpp \
 		dialogs/playlist.moc.cpp \
@@ -41,6 +42,7 @@ nodist_SOURCES_qt4 = \
 		dialogs/podcast_configuration.moc.cpp \
 		dialogs/vlm.moc.cpp \
 		dialogs/firstrun.moc.cpp \
+		dialogs/extensions.moc.cpp \
 		components/extended_panels.moc.cpp \
 		components/info_panels.moc.cpp \
 		components/preferences_widgets.moc.cpp \
@@ -210,6 +212,7 @@ SOURCES_qt4 = 	qt4.cpp \
 		dialogs_provider.cpp \
 		input_manager.cpp \
 		actions_manager.cpp \
+		extensions_manager.cpp \
 		recents.cpp \
 		variables.cpp \
 		dialogs/playlist.cpp \
@@ -231,6 +234,7 @@ SOURCES_qt4 = 	qt4.cpp \
 		dialogs/vlm.cpp \
 		dialogs/firstrun.cpp \
 		dialogs/podcast_configuration.cpp \
+		dialogs/extensions.cpp \
 		components/extended_panels.cpp \
 		components/info_panels.cpp \
 		components/preferences_widgets.cpp \
@@ -258,6 +262,7 @@ noinst_HEADERS = \
 	dialogs_provider.hpp \
 	input_manager.hpp \
 	actions_manager.hpp \
+	extensions_manager.hpp \
 	recents.hpp \
 	variables.hpp \
 	dialogs/playlist.hpp \
@@ -279,6 +284,7 @@ noinst_HEADERS = \
 	dialogs/vlm.hpp \
 	dialogs/firstrun.hpp \
 	dialogs/podcast_configuration.hpp \
+	dialogs/extensions.hpp \
 	components/extended_panels.hpp \
 	components/info_panels.hpp \
 	components/preferences_widgets.hpp \
diff --git a/modules/gui/qt4/dialogs_provider.cpp b/modules/gui/qt4/dialogs_provider.cpp
index b710eed..0b8d3b9 100644
--- a/modules/gui/qt4/dialogs_provider.cpp
+++ b/modules/gui/qt4/dialogs_provider.cpp
@@ -53,6 +53,7 @@
 #include "dialogs/toolbar.hpp"
 #include "dialogs/plugins.hpp"
 #include "dialogs/external.hpp"
+#include "dialogs/extensions.hpp"
 
 #include <QEvent>
 #include <QApplication>
@@ -79,6 +80,9 @@ DialogsProvider::DialogsProvider( intf_thread_t *_p_intf ) :
     CONNECT( SDMapper, mapped (QString), this, SDMenuAction( QString ) );
 
     new DialogHandler (p_intf, this );
+
+    /* Extension dialogs */
+    ExtensionsDialogProvider::getInstance( p_intf );
 }
 
 DialogsProvider::~DialogsProvider()
@@ -92,6 +96,7 @@ DialogsProvider::~DialogsProvider()
 #ifdef UPDATE_CHECK
     UpdateDialog::killInstance();
 #endif
+    ExtensionsDialogProvider::killInstance();
 
     delete menusMapper;
     delete menusUpdateMapper;
diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp
index 86bffe7..56fbf83 100644
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -32,6 +32,7 @@
 #include "main_interface.hpp"
 #include "input_manager.hpp"
 #include "actions_manager.hpp"
+#include "extensions_manager.hpp" // killInstance
 
 #include "util/customwidgets.hpp"
 #include "util/qt_dirs.hpp"
@@ -318,6 +319,9 @@ MainInterface::~MainInterface()
     /* Be sure to kill the actionsManager... FIXME */
     ActionsManager::killInstance();
 
+    /* Idem, FIXME */
+    ExtensionsManager::killInstance();
+
     /* Delete the FSC controller */
     delete fullscreenControls;
 
diff --git a/modules/gui/qt4/menus.cpp b/modules/gui/qt4/menus.cpp
index cc43536..b9cefe4 100644
--- a/modules/gui/qt4/menus.cpp
+++ b/modules/gui/qt4/menus.cpp
@@ -43,6 +43,7 @@
 #include "input_manager.hpp"     /* Input Management */
 #include "recents.hpp"           /* Recent Items */
 #include "actions_manager.hpp"
+#include "extensions_manager.hpp"
 
 #include <QMenu>
 #include <QMenuBar>
@@ -471,6 +472,13 @@ QMenu *QVLCMenu::ViewMenu( intf_thread_t *p_intf,
         ":/menu/preferences", SLOT( toolbarDialog() ) );
     menu->addSeparator();
 
+    /* Extensions */
+    menu->addSeparator();
+    QMenu *extmenu = ExtensionsMenu( p_intf, menu );
+    MenuFunc *f = new MenuFunc( menu, 5 );
+    CONNECT( menu, aboutToShow(), THEDP->menusUpdateMapper, map() );
+    THEDP->menusUpdateMapper->setMapping( menu, f );
+
     return menu;
 }
 
@@ -488,6 +496,44 @@ QMenu *QVLCMenu::InterfacesMenu( intf_thread_t *p_intf, QMenu *current )
 }
 
 /**
+ * Extensions Sub-Menu
+ * EXPERIMENTAL
+ **/
+QMenu *QVLCMenu::ExtensionsMenu( intf_thread_t *p_intf, QMenu *current )
+{
+    QMenu *extMenu = NULL;
+
+    QAction *extAction = NULL;
+    foreach( QAction *action, current->actions() )
+    {
+        if( action->text() == qtr( "&Extensions" ) )
+        {
+            extAction = action;
+            break;
+        }
+    }
+
+    ExtensionsManager *extMgr = ExtensionsManager::getInstance( p_intf );
+
+    extMenu = new QMenu( qtr( "&Extensions" ) );
+    if( extMgr->isLoaded() )
+    {
+        /* Let the ExtensionsManager build itself the menu */
+        extMgr->menu( extMenu );
+    }
+    else
+    {
+        extMenu->addAction( qtr( "&Load extensions" ),
+                            extMgr, SLOT( loadExtensions() ) );
+    }
+
+    if( extAction )
+        extAction->setMenu( extMenu );
+    else
+        current->addMenu( extMenu );
+}
+
+/**
  * Main Audio Menu
  **/
 QMenu *QVLCMenu::AudioMenu( intf_thread_t *p_intf, QMenu * current )
diff --git a/modules/gui/qt4/menus.hpp b/modules/gui/qt4/menus.hpp
index 257f3f7..b31e85e 100644
--- a/modules/gui/qt4/menus.hpp
+++ b/modules/gui/qt4/menus.hpp
@@ -109,6 +109,7 @@ private:
     static QMenu *ViewMenu( intf_thread_t *, MainInterface *,
                             bool with = true );
     static QMenu *InterfacesMenu( intf_thread_t *p_intf, QMenu * );
+    static QMenu *ExtensionsMenu( intf_thread_t *p_intf, QMenu * );
 
     static QMenu *NavigMenu( intf_thread_t *, QMenu * );
     static QMenu *NavigMenu( intf_thread_t *, QWidget * );
@@ -163,6 +164,7 @@ public:
             case 2: QVLCMenu::VideoMenu( p_intf, menu ); break;
             case 3: QVLCMenu::RebuildNavigMenu( p_intf, menu ); break;
             case 4: QVLCMenu::InterfacesMenu( p_intf, menu ); break;
+            case 5: QVLCMenu::ExtensionsMenu( p_intf, menu ); break;
         }
     }
 private:
-- 
1.6.5.3






More information about the vlc-devel mailing list