[vlc-commits] [Git][videolan/vlc][master] qml: make miniplayer invisible when out of view

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Mon Dec 6 18:08:38 UTC 2021



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
bf8e6301 by Fatih Uzunoglu at 2021-12-06T17:46:11+00:00
qml: make miniplayer invisible when out of view

- - - - -


2 changed files:

- modules/gui/qt/maininterface/qml/MainDisplay.qml
- modules/gui/qt/player/qml/MiniPlayer.qml


Changes:

=====================================
modules/gui/qt/maininterface/qml/MainDisplay.qml
=====================================
@@ -62,7 +62,7 @@ FocusScope {
         stackView.currentItem.Navigation.upItem = sourcesBanner
         stackView.currentItem.Navigation.rightItem = playlistColumn
         stackView.currentItem.Navigation.downItem = Qt.binding(function() {
-            return miniPlayer.expanded ? miniPlayer : medialibId
+            return miniPlayer.visible ? miniPlayer : medialibId
         })
 
         sourcesBanner.localMenuDelegate = Qt.binding(function () { return !!stackView.currentItem.localMenuDelegate ? stackView.currentItem.localMenuDelegate : null })
@@ -331,7 +331,7 @@ FocusScope {
 
                             Navigation.parentItem: medialibId
                             Navigation.upItem: sourcesBanner
-                            Navigation.downItem: miniPlayer.expanded ? miniPlayer : null
+                            Navigation.downItem: miniPlayer.visible ? miniPlayer : null
 
                             Navigation.leftAction: function() {
                                 stackView.currentItem.setCurrentItemFocus(Qt.TabFocusReason);
@@ -435,7 +435,10 @@ FocusScope {
             Player.MiniPlayer {
                 id: miniPlayer
 
-                visible: !root._inhibitMiniPlayer
+                Binding on state {
+                    when: root._inhibitMiniPlayer && !miniPlayer.visible
+                    value: ""
+                }
 
                 anchors.left: parent.left
                 anchors.right: parent.right
@@ -445,12 +448,12 @@ FocusScope {
                 Navigation.parentItem: medialibId
                 Navigation.upItem: stackView
                 Navigation.cancelItem:sourcesBanner
-                onExpandedChanged: {
-                    if (!expanded && miniPlayer.activeFocus)
+                onVisibleChanged: {
+                    if (!visible && miniPlayer.activeFocus)
                         stackView.forceActiveFocus()
                 }
 
-                mainContent: mainColumn
+                effectSource: mainColumn
             }
 
             Connections {


=====================================
modules/gui/qt/player/qml/MiniPlayer.qml
=====================================
@@ -14,17 +14,21 @@ FocusScope {
     implicitHeight: controlBar.implicitHeight
     height: 0
 
-    readonly property bool expanded: (height !== 0)
+    visible: false
 
-    property var mainContent: undefined
+    property alias effectSource: effect.source
 
     state: (player.playingState === PlayerController.PLAYING_STATE_STOPPED) ? ""
                                                                             : "expanded"
 
     states: State {
-        id: stateExpanded
         name: "expanded"
 
+        PropertyChanges {
+            target: root
+            visible: true
+        }
+
         PropertyChanges {
             target: root
             height: implicitHeight
@@ -34,7 +38,12 @@ FocusScope {
     transitions: Transition {
         from: ""; to: "expanded"
         reversible: true
-        NumberAnimation { property: "height"; easing.type: Easing.InOutSine; duration: VLCStyle.duration_normal; }
+
+        SequentialAnimation {
+            // visible should change first, in order for inner layouts to calculate implicitHeight correctly
+            PropertyAction { property: "visible" }
+            NumberAnimation { property: "height"; easing.type: Easing.InOutSine; duration: VLCStyle.duration_normal; }
+        }
     }
 
     // this MouseArea prevents mouse events to be sent below miniplayer
@@ -45,6 +54,7 @@ FocusScope {
     }
 
     Widgets.FrostedGlassEffect {
+        id: effect
         anchors.fill: controlBar
 
         source: mainContent



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/bf8e63018d6727b7edd58d63519e2fe29ca29fd8

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/bf8e63018d6727b7edd58d63519e2fe29ca29fd8
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list