[vlc-commits] qml: revise menu handling in Player

Prince Gupta git at videolan.org
Tue Apr 6 13:12:07 UTC 2021


vlc | branch: master | Prince Gupta <guptaprince8832 at gmail.com> | Tue Mar 16 00:17:25 2021 +0530| [a950eeb20d699ef1b59b0eb6b919a61b3c723bb3] | committer: Pierre Lamot

qml: revise menu handling in Player

1. make _menu member public, it's already being used outside the class
2. support Popup like objects as a menu

Signed-off-by: Pierre Lamot <pierre at videolabs.io>

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

 modules/gui/qt/player/qml/ControlButtons.qml |  4 ++--
 modules/gui/qt/player/qml/Player.qml         | 10 +++++++---
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/modules/gui/qt/player/qml/ControlButtons.qml b/modules/gui/qt/player/qml/ControlButtons.qml
index c3f3dac142..10aa86b3c5 100644
--- a/modules/gui/qt/player/qml/ControlButtons.qml
+++ b/modules/gui/qt/player/qml/ControlButtons.qml
@@ -448,13 +448,13 @@ Item{
 
                 onOpened: {
                     controlButtons.requestLockUnlockAutoHide(true, controlButtons)
-                    rootPlayer._menu = langMenu
+                    rootPlayer.menu = langMenu
                 }
 
                 onMenuClosed: {
                     controlButtons.requestLockUnlockAutoHide(false, controlButtons)
                     langBtn.forceActiveFocus()
-                    rootPlayer._menu = undefined
+                    rootPlayer.menu = undefined
                 }
             }
         }
diff --git a/modules/gui/qt/player/qml/Player.qml b/modules/gui/qt/player/qml/Player.qml
index 6086394665..bcfc331911 100644
--- a/modules/gui/qt/player/qml/Player.qml
+++ b/modules/gui/qt/player/qml/Player.qml
@@ -32,7 +32,7 @@ Widgets.NavigableFocusScope {
     id: rootPlayer
 
     //menu/overlay to dismiss
-    property var _menu: undefined
+    property var menu: undefined
     property int _lockAutoHide: 0
     readonly property bool _autoHide: _lockAutoHide == 0
                                       && rootPlayer.hasEmbededVideo
@@ -92,8 +92,12 @@ Widgets.NavigableFocusScope {
     }
 
     function dismiss() {
-        if (_menu)
-            _menu.dismiss()
+        if ((typeof menu === undefined) || !menu)
+            return
+        if (menu.hasOwnProperty("dismiss"))
+            menu.dismiss()
+        else if (menu.hasOwnProperty("close"))
+            menu.close()
     }
 
     function lockUnlockAutoHide(lock, source /*unused*/) {



More information about the vlc-commits mailing list