[vlc-devel] [PATCH 05/14] qml: factorize the action of showing the MaxiPlayer
Pierre Lamot
pierre at videolabs.io
Thu Oct 22 15:14:17 CEST 2020
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 +-
modules/gui/qt/player/qml/MiniPlayer.qml | 4 ++--
5 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 ed40c8f714..8eb1cec624 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
@@ -326,6 +335,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 73da8c1e4e..9778e56cac 100644
--- a/modules/gui/qt/medialibrary/qml/VideoDisplay.qml
+++ b/modules/gui/qt/medialibrary/qml/VideoDisplay.qml
@@ -63,8 +63,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 7182e73822..dfbc88a4e9 100644
--- a/modules/gui/qt/player/qml/ControlButtons.qml
+++ b/modules/gui/qt/player/qml/ControlButtons.qml
@@ -820,7 +820,7 @@ Item{
onClicked: {
if (isMiniplayer) {
- history.push(["player"])
+ g_mainDisplay.showPlayer()
}
else {
history.previous()
diff --git a/modules/gui/qt/player/qml/MiniPlayer.qml b/modules/gui/qt/player/qml/MiniPlayer.qml
index 57e8ad1467..acf27ed917 100644
--- a/modules/gui/qt/player/qml/MiniPlayer.qml
+++ b/modules/gui/qt/player/qml/MiniPlayer.qml
@@ -124,7 +124,7 @@ Widgets.NavigableFocusScope {
MouseArea {
anchors.fill: parent
- onClicked: history.push(["player"])
+ onClicked: g_mainDisplay.showPlayer()
}
Keys.onPressed: {
@@ -134,7 +134,7 @@ Widgets.NavigableFocusScope {
}
Keys.onReleased: {
if (!event.accepted && KeyHelper.matchOk(event))
- history.push(["player"])
+ g_mainDisplay.showPlayer()
}
--
2.25.1
More information about the vlc-devel
mailing list