[vlc-devel] [PATCH 6/7] qml: add render selection menu entries

Pierre Lamot pierre at videolabs.io
Fri Aug 14 18:49:04 CEST 2020


---
 modules/gui/qt/menus/qml/VideoMenu.qml       |  9 ++++
 modules/gui/qt/player/qml/ControlButtons.qml | 51 +++++++++++++++++++-
 2 files changed, 59 insertions(+), 1 deletion(-)

diff --git a/modules/gui/qt/menus/qml/VideoMenu.qml b/modules/gui/qt/menus/qml/VideoMenu.qml
index 1a01824cda..19407f6ca7 100644
--- a/modules/gui/qt/menus/qml/VideoMenu.qml
+++ b/modules/gui/qt/menus/qml/VideoMenu.qml
@@ -17,6 +17,7 @@
  *****************************************************************************/
 import QtQuick 2.11
 import QtQuick.Controls 2.4
+import org.videolan.vlc 0.1
 
 import "qrc:///widgets/" as Widgets
 
@@ -53,6 +54,14 @@ Widgets.MenuExt {
         onTriggered: player.wallpaperMode = !player.wallpaperMode;
     }
 
+    CheckableModelSubMenu {
+        title: i18n.qtr("Video render")
+        enabled: player.isPlaying
+        model: VideoSurfaceTargetModel {
+            ctx: mainctx
+        }
+    }
+
     MenuSeparator { }
 
     CheckableModelSubMenu {
diff --git a/modules/gui/qt/player/qml/ControlButtons.qml b/modules/gui/qt/player/qml/ControlButtons.qml
index 2312548dfb..5d90a83b94 100644
--- a/modules/gui/qt/player/qml/ControlButtons.qml
+++ b/modules/gui/qt/player/qml/ControlButtons.qml
@@ -17,6 +17,7 @@
  *****************************************************************************/
 
 import QtQuick 2.11
+import QtQml 2.11
 import QtQuick.Layouts 1.3
 import QtQuick.Controls 2.4
 
@@ -419,9 +420,57 @@ Item{
             size: VLCStyle.icon_medium
             enabled: !paintOnly && player.hasVideoOutput
             iconText: player.fullscreen ? VLCIcons.defullscreen :VLCIcons.fullscreen
-            onClicked: player.fullscreen = !player.fullscreen
+            onClicked:player.fullscreen = !player.fullscreen
             property bool acceptFocus: true
+
             text: i18n.qtr("fullscreen")
+
+            Widgets.MenuExt {
+                id: fsContextMenu
+                modal: true
+                closePolicy: Popup.CloseOnPressOutside | Popup.CloseOnEscape
+
+                onClosed: {
+                    root._lockAutoHide -= 1
+                    fullScreenBtn.forceActiveFocus()
+                }
+
+                Widgets.MenuItemExt {
+                    text: i18n.qtr("Fullscreen")
+                    enabled: player.isPlaying
+                    checkable: true
+                    checked: player.fullscreen
+                    onTriggered: player.fullscreen = !player.fullscreen
+                }
+
+                Widgets.MenuExt {
+                    title: i18n.qtr("Video render")
+                    enabled: player.isPlaying
+                    Repeater {
+                        id: values
+                        model: VideoSurfaceTargetModel {
+                            ctx: mainctx
+                        }
+                        Widgets.MenuItemExt {
+                            text: model.display
+                            checkable: true
+                            checked: model.checked
+                            onTriggered: model.checked = !model.checked
+                        }
+                    }
+                }
+            }
+
+            MouseArea {
+                anchors.fill: parent
+                acceptedButtons: Qt.RightButton
+                enabled:  true
+                onClicked: {
+                    root._lockAutoHide += 1
+                    fsContextMenu.open()
+                    mouse.accepted = true
+                }
+            }
         }
     }
 
-- 
2.25.1



More information about the vlc-devel mailing list