[vlc-commits] [Git][videolan/vlc][master] qml: do not load pip player if there is no support

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Aug 10 10:37:26 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
3b5c92f3 by Fatih Uzunoglu at 2024-08-10T10:24:24+00:00
qml: do not load pip player if there is no support

- - - - -


1 changed file:

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


Changes:

=====================================
modules/gui/qt/maininterface/qml/MainDisplay.qml
=====================================
@@ -83,6 +83,11 @@ FocusScope {
             _showMiniPlayer = true
     }
 
+    Component.onCompleted: {
+        if (MainCtx.canShowVideoPIP)
+            pipPlayerComponent.createObject(this)
+    }
+
     Navigation.cancelAction: function() {
         History.previous(Qt.BacktabFocusReason)
     }
@@ -465,36 +470,40 @@ FocusScope {
         }
     }
 
-    PIPPlayer {
-        id: playerPip
-        anchors {
-            bottom: miniPlayer.top
-            left: parent.left
-            bottomMargin: VLCStyle.margin_normal
-            leftMargin: VLCStyle.margin_normal + VLCStyle.applicationHorizontalMargin
-        }
+    Component {
+        id: pipPlayerComponent
 
-        width: VLCStyle.dp(320, VLCStyle.scale)
-        height: VLCStyle.dp(180, VLCStyle.scale)
-        z: 2
-        visible: g_mainDisplay._showMiniPlayer && MainCtx.hasEmbededVideo
-        enabled: g_mainDisplay._showMiniPlayer && MainCtx.hasEmbededVideo
-
-        dragXMin: 0
-        dragXMax: g_mainDisplay.width - playerPip.width
-        dragYMin: sourcesBanner.y + sourcesBanner.height
-        dragYMax: miniPlayer.y - playerPip.height
-
-        //keep the player visible on resize
-        Connections {
-            target: g_mainDisplay
-            function onWidthChanged() {
-                if (playerPip.x > playerPip.dragXMax)
-                    playerPip.x = playerPip.dragXMax
+        PIPPlayer {
+            id: playerPip
+            anchors {
+                bottom: miniPlayer.top
+                left: parent.left
+                bottomMargin: VLCStyle.margin_normal
+                leftMargin: VLCStyle.margin_normal + VLCStyle.applicationHorizontalMargin
             }
-            function onHeightChanged() {
-                if (playerPip.y > playerPip.dragYMax)
-                    playerPip.y = playerPip.dragYMax
+
+            width: VLCStyle.dp(320, VLCStyle.scale)
+            height: VLCStyle.dp(180, VLCStyle.scale)
+            z: 2
+            visible: g_mainDisplay._showMiniPlayer && MainCtx.hasEmbededVideo
+            enabled: g_mainDisplay._showMiniPlayer && MainCtx.hasEmbededVideo
+
+            dragXMin: 0
+            dragXMax: g_mainDisplay.width - playerPip.width
+            dragYMin: sourcesBanner.y + sourcesBanner.height
+            dragYMax: miniPlayer.y - playerPip.height
+
+            //keep the player visible on resize
+            Connections {
+                target: g_mainDisplay
+                function onWidthChanged() {
+                    if (playerPip.x > playerPip.dragXMax)
+                        playerPip.x = playerPip.dragXMax
+                }
+                function onHeightChanged() {
+                    if (playerPip.y > playerPip.dragYMax)
+                        playerPip.y = playerPip.dragYMax
+                }
             }
         }
     }



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

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/3b5c92f3aa2ac6442f8d4c03f5866cbd3f1152d1
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