[vlc-devel] [PATCH 10/25] qml: add autoHide management inside Player widget

Prince Gupta guptaprince8832 at gmail.com
Thu Mar 11 09:16:18 UTC 2021


---
 modules/gui/qt/player/qml/Player.qml | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/modules/gui/qt/player/qml/Player.qml b/modules/gui/qt/player/qml/Player.qml
index b538eba9f3..e420e2a6b3 100644
--- a/modules/gui/qt/player/qml/Player.qml
+++ b/modules/gui/qt/player/qml/Player.qml
@@ -33,6 +33,10 @@ Widgets.NavigableFocusScope {
 
     //menu/overlay to dismiss
     property var _menu: undefined
+    property int _lockAutoHide: 0
+    readonly property bool _autoHide: _lockAutoHide == 0
+                                      && rootPlayer.hasEmbededVideo
+                                      && player.hasVideoOutput
 
     property bool hasEmbededVideo: mainInterface.hasEmbededVideo
     readonly property int positionSliderY: controlBarView.y + controlBarView.sliderY
@@ -42,11 +46,6 @@ Widgets.NavigableFocusScope {
     readonly property VLCColors colors: (mainInterface.hasEmbededVideo || (coverLuminance.luminance < 140))
                                         ? VLCStyle.nightColors : VLCStyle.dayColors
 
-    function dismiss() {
-        if (_menu)
-            _menu.dismiss()
-    }
-
     Keys.priority: Keys.AfterItem
     Keys.onPressed: {
         if (event.accepted)
@@ -79,6 +78,21 @@ Widgets.NavigableFocusScope {
         }
     }
 
+    on_AutoHideChanged: {
+        if (_autoHide)
+            toolbarAutoHide.restart()
+    }
+
+    function dismiss() {
+        if (_menu)
+            _menu.dismiss()
+    }
+
+    function lockUnlockAutoHide(lock, source /*unused*/) {
+        _lockAutoHide += lock ? 1 : -1;
+        console.assert(_lockAutoHide >= 0)
+    }
+
     ImageLuminanceExtractor {
         id: coverLuminance
 
@@ -533,6 +547,8 @@ Widgets.NavigableFocusScope {
             }
             else
             {
+                if (!rootPlayer._autoHide)
+                    return;
                 if (!controlBarView.autoHide || !topcontrolView.autoHide)
                     return;
                 controlBarView.state = "hidden"
-- 
2.25.1



More information about the vlc-devel mailing list