[vlc-devel] [PATCH] qt: add button for BluRay pop-up menu

Petri Hintukainen phintuka at gmail.com
Fri Nov 20 11:36:56 CET 2015


There's no button image included in the patch ...
---
 modules/gui/qt4/components/controller.cpp |  7 +++++++
 modules/gui/qt4/input_manager.cpp         |  8 ++++++++
 modules/gui/qt4/input_manager.hpp         |  1 +
 src/input/var.c                           | 12 ++++++++++++
 4 files changed, 28 insertions(+)

diff --git a/modules/gui/qt4/components/controller.cpp b/modules/gui/qt4/components/controller.cpp
index ba5d951..027c835 100644
--- a/modules/gui/qt4/components/controller.cpp
+++ b/modules/gui/qt4/components/controller.cpp
@@ -566,6 +566,11 @@ QFrame *AbstractController::discFrame()
     menuLayout->addWidget( menuButton );
     BUTTON_SET_BAR2( menuButton, toolbar/dvd_menu, qtr( "Menu" ) );
 
+    QToolButton *popupButton = new QToolButton( menuFrame );
+    setupButton( popupButton );
+    menuLayout->addWidget( popupButton );
+    BUTTON_SET_BAR2( popupButton, toolbar/popup_menu, qtr( "Popup" ) );
+
     discLayout->addWidget( menuFrame );
     menuFrame->hide();
 
@@ -582,6 +587,8 @@ QFrame *AbstractController::discFrame()
             sectionNext() );
     CONNECT( menuButton, clicked(), THEMIM->getIM(),
             sectionMenu() );
+    CONNECT( popupButton, clicked(), THEMIM->getIM(),
+            sectionPopup() );
 
     return discFrame;
 }
diff --git a/modules/gui/qt4/input_manager.cpp b/modules/gui/qt4/input_manager.cpp
index b12cf2d..16b3a6e 100644
--- a/modules/gui/qt4/input_manager.cpp
+++ b/modules/gui/qt4/input_manager.cpp
@@ -836,6 +836,14 @@ void InputManager::sectionNext()
     }
 }
 
+void InputManager::sectionPopup()
+{
+    if( hasInput() )
+    {
+        var_TriggerCallback( p_input, "menu-popup" );
+    }
+}
+
 void InputManager::sectionMenu()
 {
     if( hasInput() )
diff --git a/modules/gui/qt4/input_manager.hpp b/modules/gui/qt4/input_manager.hpp
index f34bd33..f9d9dee 100644
--- a/modules/gui/qt4/input_manager.hpp
+++ b/modules/gui/qt4/input_manager.hpp
@@ -199,6 +199,7 @@ public slots:
     void sectionNext();
     void sectionPrev();
     void sectionMenu();
+    void sectionPopup();
     /* Teletext */
     void telexSetPage( int );          ///< Goto teletext page
     void telexSetTransparency( bool ); ///< Transparency on teletext background
diff --git a/src/input/var.c b/src/input/var.c
index 0ad530c..7218a56 100644
--- a/src/input/var.c
+++ b/src/input/var.c
@@ -112,6 +112,7 @@ static const vlc_input_callback_t p_input_navigation_callbacks[] =
 {
     CALLBACK( "next-title", TitleCallback ),
     CALLBACK( "prev-title", TitleCallback ),
+    CALLBACK( "menu-popup", TitleCallback ),
 
     CALLBACK( NULL, NULL )
 };
@@ -269,6 +270,13 @@ void input_ControlVarNavigation( input_thread_t *p_input )
             var_Change( p_input, "prev-title", VLC_VAR_SETTEXT, &text, NULL );
             var_AddCallback( p_input, "prev-title", TitleCallback, NULL );
         }
+
+        if( var_Type( p_input, "menu-popup" ) == 0 ) {
+            var_Create( p_input, "menu-popup", VLC_VAR_VOID );
+            text.psz_string = _("Menu popup");
+            var_Change( p_input, "menu-popup", VLC_VAR_SETTEXT, &text, NULL );
+            var_AddCallback( p_input, "menu-popup", TitleCallback, NULL );
+        }
     }
 
     /* Create titles and chapters */
@@ -672,6 +680,10 @@ static int TitleCallback( vlc_object_t *p_this, char const *psz_cmd,
         if( val.i_int >= 0 )
             var_Change( p_input, "title", VLC_VAR_SETVALUE, &val, NULL );
     }
+    else if( !strcmp( psz_cmd, "menu-popup" ) )
+    {
+        input_ControlPush( p_input, INPUT_CONTROL_NAV_POPUP, NULL );
+    }
     else
     {
         input_ControlPush( p_input, INPUT_CONTROL_SET_TITLE, &newval );
-- 
2.5.0



More information about the vlc-devel mailing list