[vlc-devel] [PATCH 11/14] qml: don't stop the player when leaving the Maxiplayer if the PIP is available

Pierre Lamot pierre at videolabs.io
Thu Oct 22 15:14:23 CEST 2020


---
 modules/gui/qt/maininterface/main_interface.hpp  | 4 ++++
 modules/gui/qt/maininterface/qml/MainDisplay.qml | 1 +
 modules/gui/qt/player/qml/Player.qml             | 2 +-
 modules/gui/qt/player/qml/TopBar.qml             | 4 ++--
 4 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/modules/gui/qt/maininterface/main_interface.hpp b/modules/gui/qt/maininterface/main_interface.hpp
index 4ec9c3a04e..7dc0335db4 100644
--- a/modules/gui/qt/maininterface/main_interface.hpp
+++ b/modules/gui/qt/maininterface/main_interface.hpp
@@ -157,6 +157,7 @@ class MainInterface : public QVLCMW
     Q_PROPERTY(bool hasVLM READ hasVLM CONSTANT)
     Q_PROPERTY(bool clientSideDecoration READ useClientSideDecoration NOTIFY useClientSideDecorationChanged)
     Q_PROPERTY(bool hasToolbarMenu READ hasToolbarMenu NOTIFY hasToolbarMenuChanged)
+    Q_PROPERTY(bool canShowVideoPIP READ canShowVideoPIP CONSTANT)
 
 public:
     /* tors */
@@ -197,6 +198,8 @@ public:
     bool hasVLM() const;
     bool useClientSideDecoration() const;
     inline bool hasToolbarMenu() const { return m_hasToolbarMenu; }
+    inline bool canShowVideoPIP() const { return m_canShowVideoPIP; }
+    inline void setCanShowVideoPIP(bool canShowVideoPIP) { m_canShowVideoPIP = canShowVideoPIP; }
 
     bool hasEmbededVideo() const;
     VideoSurfaceProvider* getVideoSurfaceProvider() const;
@@ -263,6 +266,7 @@ protected:
     ColorSchemeModel*    m_colorScheme;
     bool                 m_clientSideDecoration = false;
     bool                 m_hasToolbarMenu = false;
+    bool                 m_canShowVideoPIP = false;
 
     /* States */
     bool                 playlistVisible;       ///< Is the playlist visible ?
diff --git a/modules/gui/qt/maininterface/qml/MainDisplay.qml b/modules/gui/qt/maininterface/qml/MainDisplay.qml
index d0b81b6878..aecac3bf32 100644
--- a/modules/gui/qt/maininterface/qml/MainDisplay.qml
+++ b/modules/gui/qt/maininterface/qml/MainDisplay.qml
@@ -127,6 +127,7 @@ Widgets.NavigableFocusScope {
         }
     ]
 
+
     property var tabModel: ListModel {
         id: tabModelid
         Component.onCompleted: {
diff --git a/modules/gui/qt/player/qml/Player.qml b/modules/gui/qt/player/qml/Player.qml
index 33d50616d4..ffca84c6e5 100644
--- a/modules/gui/qt/player/qml/Player.qml
+++ b/modules/gui/qt/player/qml/Player.qml
@@ -65,7 +65,7 @@ Widgets.NavigableFocusScope {
         if (rootPlayer.hasEmbededVideo && controlBarView.state === "visible") {
             toolbarAutoHide._setVisibleControlBar(false)
         } else {
-            if (player.hasVideoOutput) {
+            if (mainInterface.hasEmbededVideo && !mainInterface.canShowVideoPIP) {
                mainPlaylistController.stop()
             }
             history.previous()
diff --git a/modules/gui/qt/player/qml/TopBar.qml b/modules/gui/qt/player/qml/TopBar.qml
index 085b18a246..1a59fd93ee 100644
--- a/modules/gui/qt/player/qml/TopBar.qml
+++ b/modules/gui/qt/player/qml/TopBar.qml
@@ -110,8 +110,8 @@ Widgets.NavigableFocusScope{
                             text: i18n.qtr("Back")
                             color: VLCStyle.colors.playerFg
                             onClicked: {
-                                if (player.hasVideoOutput) {
-                                    mainPlaylistController.stop()
+                                if (mainInterface.hasEmbededVideo && !mainInterface.canShowVideoPIP) {
+                                   mainPlaylistController.stop()
                                 }
                                 history.previous()
                             }
-- 
2.25.1



More information about the vlc-devel mailing list