[vlc-commits] [Git][videolan/vlc][master] 3 commits: qml: fix player cursor disapearing after 3s

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Sep 27 08:39:42 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
999e24f6 by Pierre Lamot at 2024-09-27T08:03:43+00:00
qml: fix player cursor disapearing after 3s

fix: #28803

- - - - -
371a7b37 by Pierre Lamot at 2024-09-27T08:03:43+00:00
qml: update playlist button click on video embed policy

when a video becomes embed the playlist is hidden, the playlist visibility
state is kept but the playlist was hidden, clicking the playlist button was
toggling the playlist visiblity. As a result, if the playlist was visible, it
required the user to click twice to show the playlist.

Now when the button is clicked with video embed, it will visually toggle the
playlist and update the playlist "visible" value to the visual state.

- - - - -
22f9ce13 by Pierre Lamot at 2024-09-27T08:03:43+00:00
qml: revert property binding on visible/hidden state in Player

Binding on `state` property was needed to avoid activating the visual transition
when component loads

fix: #28804

- - - - -


2 changed files:

- modules/gui/qt/player/qml/Player.qml
- modules/gui/qt/player/qml/PlayerPlaylistVisibilityFSM.qml


Changes:

=====================================
modules/gui/qt/player/qml/Player.qml
=====================================
@@ -187,14 +187,17 @@ FocusScope {
         onMouseMoved: {
             //short interval for mouse events
             if (Player.isInteractive)
-            {
-                toggleControlBarButtonAutoHide.restart()
-                videoSurface.cursorShape = Qt.ArrowCursor
-            }
-
+                interactiveAutoHideTimer.restart()
             else
                 playerToolbarVisibilityFSM.mouseMove();
         }
+
+        Binding on cursorShape {
+            when: topBar.state === "hidden"
+                  && controlBar.state === "hidden"
+                  && !interactiveAutoHideTimer.running
+            value: Qt.BlankCursor
+        }
     }
 
     // background image
@@ -303,7 +306,11 @@ FocusScope {
             return controlBar
         }
 
-        state: (playerToolbarVisibilityFSM.started && playerToolbarVisibilityFSM.isVisible) ? "visible" : "hidden"
+        //initial state value is "", using a binding avoid animation on startup
+        Binding on state {
+            when: playerToolbarVisibilityFSM.started
+            value: playerToolbarVisibilityFSM.isVisible ? "visible" : "hidden"
+        }
 
         onTogglePlaylistVisibility: playlistVisibility.togglePlaylistVisibility()
 
@@ -337,11 +344,6 @@ FocusScope {
 
             visible: MainCtx.pinVideoControls
         }
-
-        onStateChanged: {
-            videoSurface.cursorShape = state === "visible"
-                                       ? Qt.ArrowCursor : Qt.BlankCursor
-        }
     }
 
     MouseArea {
@@ -583,7 +585,11 @@ FocusScope {
         focus: false
         edge: Widgets.DrawerExt.Edges.Right
 
-        state: (playlistVisibility.started && playlistVisibility.isPlaylistVisible) ? "visible" : "hidden"
+        //initial state value is "", using a binding avoid animation on startup
+        Binding on state {
+            when: playlistVisibility.started
+            value: playlistVisibility.isPlaylistVisible ? "visible" : "hidden"
+        }
 
         component: PlaylistListView {
             id: playlistView
@@ -685,23 +691,17 @@ FocusScope {
     }
 
     Timer {
-        // toggleControlBarButton's visibility depends on this timer
-        id: toggleControlBarButtonAutoHide
-        running: true
+        // NavigationBox's visibility depends on this timer
+        id: interactiveAutoHideTimer
+        running: false
         repeat: false
         interval: 3000
-
-        onTriggered: {
-            // Cursor hides when toggleControlBarButton is not visible
-            videoSurface.forceActiveFocus()
-            videoSurface.cursorShape = Qt.BlankCursor
-        }
     }
 
     NavigationBox {
         id: navBox
         visible: Player.isInteractive && navBox.show
-                    && (toggleControlBarButtonAutoHide.running
+                    && (interactiveAutoHideTimer.running
                     || navBox.hovered || !rootPlayer.hasEmbededVideo)
 
         x: rootPlayer.x + VLCStyle.margin_normal + VLCStyle.applicationHorizontalMargin
@@ -718,10 +718,9 @@ FocusScope {
         }
     }
 
-    // NavigationBox's visibility depends on this timer
     Connections {
         target: MainCtx
-        function onNavBoxToggled() { toggleControlBarButtonAutoHide.restart() }
+        function onNavBoxToggled() { interactiveAutoHideTimer.restart() }
     }
 
     Connections {
@@ -741,7 +740,7 @@ FocusScope {
         visible: Player.isInteractive
                  && rootPlayer.hasEmbededVideo
                  && !(MainCtx.pinVideoControls && !Player.fullscreen)
-                 && (toggleControlBarButtonAutoHide.running === true
+                 && (interactiveAutoHideTimer.running === true
                      || controlBar.state !== "hidden" || toggleControlBarButton.hovered)
         focus: true
         anchors {
@@ -801,6 +800,7 @@ FocusScope {
             return topBar
         }
 
+        //initial state value is "", using a binding avoid animation on startup
         Binding on state {
             when: playerToolbarVisibilityFSM.started
             value: playerToolbarVisibilityFSM.isVisible ? "visible" : "hidden"
@@ -853,11 +853,7 @@ FocusScope {
 
         Keys.onPressed: (event) => {
             if (Player.isInteractive)
-            {
-                toggleControlBarButtonAutoHide.restart()
-                videoSurface.cursorShape = Qt.ArrowCursor
-            }
-
+                interactiveAutoHideTimer.restart()
             else
                 playerToolbarVisibilityFSM.keyboardMove()
         }


=====================================
modules/gui/qt/player/qml/PlayerPlaylistVisibilityFSM.qml
=====================================
@@ -43,15 +43,14 @@ FSM {
     id: fsm
  
     //incoming signals
+
+    //user clicked on the playlist button
     signal togglePlaylistVisibility()
+    //playlist visibility update externally
     signal updatePlaylistVisible()
     signal updatePlaylistDocked()
     signal updateVideoEmbed()
- 
-    //internal signals
-    signal _updateVideoEmbed()
-    onUpdateVideoEmbed: _updateVideoEmbed()
- 
+
     //exposed internal states
     property alias isPlaylistVisible: fsmVisible.active
  
@@ -62,7 +61,6 @@ FSM {
         updatePlaylistVisible: fsm.updatePlaylistVisible,
         updatePlaylistDocked: fsm.updatePlaylistDocked,
         updateVideoEmbed: fsm.updateVideoEmbed,
-        updateVideoEmbed: fsm._updateVideoEmbed,
     })
  
     FSMState {
@@ -90,15 +88,14 @@ FSM {
                 guard: () => !MainCtx.playlistDocked,
                 target: fsmFloating
             },
-            togglePlaylistVisibility: {
-                action: () => {
-                    MainCtx.playlistVisible = !MainCtx.playlistVisible
-                }
-            },
         })
  
         FSMState {
             id: fsmVisible
+
+            function enter() {
+                MainCtx.playlistVisible = true
+            }
  
             transitions: ({
                 updateVideoEmbed: {
@@ -107,7 +104,10 @@ FSM {
                 },
                 updatePlaylistVisible: {
                     guard: () => !MainCtx.playlistVisible,
-                    target: fsmHidden
+                    target: fsmFollowVisible
+                },
+                togglePlaylistVisibility: {
+                    target: fsmFollowVisible
                 },
             })
         }
@@ -121,9 +121,7 @@ FSM {
                 id: fsmFollowVisible
 
                 function enter() {
-                    //automatic transitions
-                    if (MainCtx.playlistVisible)
-                        fsm.updatePlaylistVisible()
+                    MainCtx.playlistVisible = false
                 }
 
                 transitions: ({
@@ -135,6 +133,9 @@ FSM {
                         guard: () => MainCtx.playlistVisible,
                         target: fsmVisible
                     },
+                    togglePlaylistVisibility: {
+                        target: fsmVisible
+                    },
                 })
             }
 
@@ -142,9 +143,15 @@ FSM {
                 id: fsmEmbed
 
                 transitions: ({
-                    updateVideoEmbed: { //guards tested in order{
-                        guard: () => !MainCtx.hasEmbededVideo,
+                    updateVideoEmbed: [{ //guards tested in order{
+                        guard: () => !MainCtx.hasEmbededVideo && !MainCtx.playlistVisible,
                         target: fsmFollowVisible
+                    }, {
+                        guard: () => !MainCtx.hasEmbededVideo && MainCtx.playlistVisible,
+                        target: fsmVisible
+                    }],
+                    togglePlaylistVisibility: {
+                        target: fsmVisible
                     },
                     updatePlaylistVisible: {
                         guard: () => MainCtx.playlistVisible,



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/bf29dae9b367e8b3c31fc9b582694d9c22afec91...22f9ce13fe93f65a0256e7588f9daeecbfd20903

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/bf29dae9b367e8b3c31fc9b582694d9c22afec91...22f9ce13fe93f65a0256e7588f9daeecbfd20903
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list