[vlc-devel] [PATCH 01/16] qml: factorize the action of showing the MaxiPlayer

Prince Gupta guptaprince8832 at gmail.com
Fri Dec 4 12:18:58 CET 2020


From: Pierre Lamot <pierre at videolabs.io>

this allows to inhibit some automatic behaviors like raising the MiniPlayer.
---
 modules/gui/qt/maininterface/qml/MainDisplay.qml  | 11 +++++++++++
 modules/gui/qt/medialibrary/qml/VideoDisplay.qml  |  2 +-
 modules/gui/qt/medialibrary/qml/VideoGridItem.qml |  4 ++--
 modules/gui/qt/player/qml/ControlButtons.qml      |  2 +-
 4 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/modules/gui/qt/maininterface/qml/MainDisplay.qml b/modules/gui/qt/maininterface/qml/MainDisplay.qml
index 2579db8650..ba221c321b 100644
--- a/modules/gui/qt/maininterface/qml/MainDisplay.qml
+++ b/modules/gui/qt/maininterface/qml/MainDisplay.qml
@@ -35,6 +35,9 @@ Widgets.NavigableFocusScope {
     property string view: ""
     property var viewProperties: ({})
 
+    property alias g_mainDisplay: root
+    property bool _inhibitMiniPlayer: false
+
     onViewChanged: {
         viewProperties = ({})
         loadView()
@@ -139,6 +142,12 @@ Widgets.NavigableFocusScope {
         }
     }
 
+
+    function showPlayer() {
+        root._inhibitMiniPlayer = true
+        history.push(["player"])
+    }
+
     Rectangle {
         color: VLCStyle.colors.bg
         anchors.fill: parent
@@ -318,6 +327,8 @@ Widgets.NavigableFocusScope {
             Player.MiniPlayer {
                 id: miniPlayer
 
+                visible: !root._inhibitMiniPlayer
+
                 anchors.left: parent.left
                 anchors.right: parent.right
                 anchors.bottom: parent.bottom
diff --git a/modules/gui/qt/medialibrary/qml/VideoDisplay.qml b/modules/gui/qt/medialibrary/qml/VideoDisplay.qml
index 1069113075..0722ddd2d8 100644
--- a/modules/gui/qt/medialibrary/qml/VideoDisplay.qml
+++ b/modules/gui/qt/medialibrary/qml/VideoDisplay.qml
@@ -64,8 +64,8 @@ Widgets.NavigableFocusScope {
     }
 
     function _actionAtIndex(index) {
+        g_mainDisplay.showPlayer()
         medialib.addAndPlay( videoModel.getIdsForIndexes( selectionModel.selectedIndexes ) )
-        history.push(["player"])
     }
 
     MLVideoModel {
diff --git a/modules/gui/qt/medialibrary/qml/VideoGridItem.qml b/modules/gui/qt/medialibrary/qml/VideoGridItem.qml
index da7e179570..3a7c599c8e 100644
--- a/modules/gui/qt/medialibrary/qml/VideoGridItem.qml
+++ b/modules/gui/qt/medialibrary/qml/VideoGridItem.qml
@@ -41,14 +41,14 @@ Widgets.GridItem {
     showNewIndicator: true
     onItemDoubleClicked: {
         if ( model.id !== undefined ) {
+            g_mainDisplay.showPlayer()
             medialib.addAndPlay( model.id )
-            history.push(["player"])
         }
     }
     onPlayClicked: {
         if ( model.id !== undefined ) {
+            g_mainDisplay.showPlayer()
             medialib.addAndPlay( model.id )
-            history.push(["player"])
         }
     }
 }
diff --git a/modules/gui/qt/player/qml/ControlButtons.qml b/modules/gui/qt/player/qml/ControlButtons.qml
index 244ee030e9..c170bf6255 100644
--- a/modules/gui/qt/player/qml/ControlButtons.qml
+++ b/modules/gui/qt/player/qml/ControlButtons.qml
@@ -760,7 +760,7 @@ Item{
 
             onClicked: {
                 if (isMiniplayer) {
-                    history.push(["player"])
+                    g_mainDisplay.showPlayer()
                 }
                 else {
                     history.previous()
-- 
2.25.1



More information about the vlc-devel mailing list