]> git.sesse.net Git - vlc/commitdiff
Extensions/Qt: buildsystem + menu entries
authorJean-Philippe André <jpeg@videolan.org>
Tue, 10 Nov 2009 17:37:05 +0000 (18:37 +0100)
committerJean-Philippe André <jpeg@videolan.org>
Sun, 24 Jan 2010 15:05:16 +0000 (16:05 +0100)
You can now play with extensions, from the menu View > Extensions

modules/gui/qt4/Modules.am
modules/gui/qt4/main_interface.cpp
modules/gui/qt4/menus.cpp
modules/gui/qt4/menus.hpp

index 15f842cf1cb1138c425f815c5f7bc8cda2f786cf..d86c20a386f8c05c6a6fc3a242ec3363bfcefb74 100644 (file)
@@ -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 \
index f0083fb2cb127d61648004ecbdccd9fba2b585d5..8b6530c5ddecba9d8669369944ca28352114829d 100644 (file)
@@ -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;
 
index 5aa45a2836feddf4d844d4634e58dd977f0cc5be..99c3f81c50ca0d89d35b24d46ab172377676823b 100644 (file)
@@ -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;
 }
 
@@ -487,6 +495,44 @@ QMenu *QVLCMenu::InterfacesMenu( intf_thread_t *p_intf, QMenu *current )
     return Populate( p_intf, current, varnames, objects );
 }
 
+/**
+ * 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
  **/
index 257f3f7558cce6cc6c678d838ed28ceb748087ce..b31e85e195f1e1c49fc54908f165a77af12027f5 100644 (file)
@@ -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: