[vlc-devel] commit: Extensions/Qt: buildsystem + menu entries ( Jean-Philippe André )

git version control git at videolan.org
Sun Jan 24 16:09:53 CET 2010


vlc | branch: master | Jean-Philippe André <jpeg at videolan.org> | Tue Nov 10 18:37:05 2009 +0100| [d7cb06d6f67a9a100f311f405306abcbf7d5a908] | committer: Jean-Philippe André 

Extensions/Qt: buildsystem + menu entries

You can now play with extensions, from the menu View > Extensions

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

 modules/gui/qt4/Modules.am         |    6 ++++
 modules/gui/qt4/main_interface.cpp |    4 +++
 modules/gui/qt4/menus.cpp          |   46 ++++++++++++++++++++++++++++++++++++
 modules/gui/qt4/menus.hpp          |    2 +
 4 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/modules/gui/qt4/Modules.am b/modules/gui/qt4/Modules.am
index 15f842c..d86c20a 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/main_interface.cpp b/modules/gui/qt4/main_interface.cpp
index f0083fb..8b6530c 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 5aa45a2..99c3f81 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:




More information about the vlc-devel mailing list