[vlc-commits] qml: factorize the action of showing the MaxiPlayer

Pierre Lamot git at videolan.org
Mon Dec 7 12:31:50 UTC 2020


vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Fri Oct 16 10:05:57 2020 +0200| [c4ff46d18a399c69528173c0587c4af8aa713b0d] | committer: Pierre Lamot

qml: factorize the action of showing the MaxiPlayer

  this allows to inhibit some automatic behaviors like raising the MiniPlayer.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c4ff46d18a399c69528173c0587c4af8aa713b0d
---

 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      |  6 +++---
 4 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/modules/gui/qt/maininterface/qml/MainDisplay.qml b/modules/gui/qt/maininterface/qml/MainDisplay.qml
index 5fef02b37a..a0b8e5f130 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
@@ -320,6 +329,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 57411351db..8a5023dbb5 100644
--- a/modules/gui/qt/player/qml/ControlButtons.qml
+++ b/modules/gui/qt/player/qml/ControlButtons.qml
@@ -758,7 +758,7 @@ Item{
 
             onClicked: {
                 if (isMiniplayer) {
-                    history.push(["player"])
+                    g_mainDisplay.showPlayer()
                 }
                 else {
                     history.previous()
@@ -793,14 +793,14 @@ Item{
             }
             Keys.onReleased: {
                 if (!event.accepted && KeyHelper.matchOk(event))
-                    history.push(["player"])
+		    g_mainDisplay.showPlayer()
             }
 
             MouseArea {
                 id: artworkInfoMouseArea
                 anchors.fill: parent
                 visible: !paintOnly
-                onClicked: history.push(["player"])
+                onClicked: g_mainDisplay.showPlayer()
                 hoverEnabled: true
             }
 



More information about the vlc-commits mailing list