[vlc-devel] [PATCH 03/16] qml: Add paint-only feature to player controller buttons

Rohan Rajpal rohan17089 at iiitd.ac.in
Wed Jul 31 14:30:43 CEST 2019


Add paint only feature to buttons and
widgets to make them usable for the editor
---
 modules/gui/qt/qml/player/ControlButtons.qml | 13 ++++++++-----
 modules/gui/qt/qml/player/TeletextWidget.qml | 18 +++++++++++++-----
 modules/gui/qt/qml/player/VolumeWidget.qml   |  6 +++++-
 3 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/modules/gui/qt/qml/player/ControlButtons.qml b/modules/gui/qt/qml/player/ControlButtons.qml
index 317bd364a3..7a96647ae6 100644
--- a/modules/gui/qt/qml/player/ControlButtons.qml
+++ b/modules/gui/qt/qml/player/ControlButtons.qml
@@ -235,7 +235,7 @@ Item{
             id: recordBtn
             size: VLCStyle.icon_medium
             text: VLCIcons.record
-            enabled: player.isPlaying
+            enabled: !paintOnly && player.isPlaying
             checked: player.isRecording
             onClicked: player.toggleRecord()
             property bool acceptFocus: true
@@ -270,7 +270,7 @@ Item{
         Utils.IconToolButton{
             id: snapshotBtn
             size: VLCStyle.icon_medium
-            enabled: player.isPlaying
+            enabled: !paintOnly && player.isPlaying
             text: VLCIcons.snapshot
             onClicked: player.snapshot()
             property bool acceptFocus: true
@@ -283,7 +283,7 @@ Item{
         Utils.IconToolButton{
             id: stopBtn
             size: VLCStyle.icon_medium
-            enabled: player.isPlaying
+            enabled: !paintOnly && player.isPlaying
             text: VLCIcons.stop
             onClicked: mainPlaylistController.stop()
             property bool acceptFocus: true
@@ -295,7 +295,7 @@ Item{
         Utils.IconToolButton{
             id: infoBtn
             size: VLCStyle.icon_medium
-            enabled: player.isPlaying
+            enabled: !paintOnly && player.isPlaying
             text: VLCIcons.info
             onClicked: dialogProvider.mediaInfoDialog()
             property bool acceptFocus: true
@@ -308,7 +308,7 @@ Item{
         Utils.IconToolButton{
             id: frameBtn
             size: VLCStyle.icon_medium
-            enabled: player.isPlaying
+            enabled: !paintOnly && player.isPlaying
             text: VLCIcons.frame_by_frame
             onClicked: player.frameNext()
             property bool acceptFocus: true
@@ -397,6 +397,9 @@ Item{
     Component{
         id: aspectRatioDelegate
         Utils.ComboBoxExt {
+            property bool paintOnly: false
+            enabled: !paintOnly
+            objectName: PlayerControlBarModel.ASPECT_RATIO_COMBOBOX
             Layout.alignment: Qt.AlignVCenter
             width: VLCStyle.combobox_width_normal
             height: VLCStyle.combobox_height_normal
diff --git a/modules/gui/qt/qml/player/TeletextWidget.qml b/modules/gui/qt/qml/player/TeletextWidget.qml
index e63ec52f1b..b7e5b62d28 100644
--- a/modules/gui/qt/qml/player/TeletextWidget.qml
+++ b/modules/gui/qt/qml/player/TeletextWidget.qml
@@ -32,8 +32,9 @@ FocusScope{
     width: teleWidget.width
     height: teleWidget.height
 
-    property bool autohide: !player.isTeletextAvailable
+    property bool autohide: !paintOnly && !player.isTeletextAvailable
     property bool acceptFocus: autohide
+    property bool paintOnly: false
     visible: !autohide
 
     RowLayout{
@@ -44,6 +45,7 @@ FocusScope{
 
         Utils.IconToolButton{
             id: teleActivateBtn
+            paintOnly: widgetfscope.paintOnly
             text: VLCIcons.tv
             size: VLCStyle.icon_normal
             onClicked: player.teletextEnabled = !player.teletextEnabled
@@ -55,6 +57,7 @@ FocusScope{
 
         Utils.IconToolButton{
             id: teleTransparencyBtn
+            paintOnly: widgetfscope.paintOnly
             text: VLCIcons.tvtelx
             size: VLCStyle.icon_normal
             opacity: 0.5
@@ -75,6 +78,7 @@ FocusScope{
 
         Utils.IconToolButton{
             id: indexKeyBtn
+            paintOnly: widgetfscope.paintOnly
             enabled: player.teletextEnabled
             size: VLCStyle.icon_normal
             text: VLCIcons.record
@@ -84,38 +88,42 @@ FocusScope{
         }
         Utils.IconToolButton{
             id: redKeyBtn
+            paintOnly: widgetfscope.paintOnly
             enabled: player.teletextEnabled
             size: VLCStyle.icon_normal
             text: VLCIcons.record
             onClicked: player.teletextPage = PlayerController.TELE_RED
-            color: enabled ? "red" : "grey"
+            color: enabled || paintOnly? "red" : "grey"
             KeyNavigation.right: greenKeyBtn
         }
         Utils.IconToolButton{
             id: greenKeyBtn
+            paintOnly: widgetfscope.paintOnly
             enabled: player.teletextEnabled
             size: VLCStyle.icon_normal
             text: VLCIcons.record
             onClicked: player.teletextPage = PlayerController.TELE_GREEN
-            color: enabled ? "green" : "grey"
+            color: enabled || paintOnly? "green" : "grey"
             KeyNavigation.right: yellowKeyBtn
         }
         Utils.IconToolButton{
             id: yellowKeyBtn
+            paintOnly: widgetfscope.paintOnly
             enabled: player.teletextEnabled
             size: VLCStyle.icon_normal
             text: VLCIcons.record
             onClicked: player.teletextPage = PlayerController.TELE_YELLOW
-            color: enabled ? "yellow" : "grey"
+            color: enabled || paintOnly ? "yellow" : "grey"
             KeyNavigation.right: blueKeyBtn
         }
         Utils.IconToolButton{
             id: blueKeyBtn
+            paintOnly: widgetfscope.paintOnly
             enabled: player.teletextEnabled
             size: VLCStyle.icon_normal
             text: VLCIcons.record
             onClicked: player.teletextPage = PlayerController.TELE_BLUE
-            color: enabled ? "blue" : "grey"
+            color: enabled || paintOnly? "blue" : "grey"
         }
     }
 }
diff --git a/modules/gui/qt/qml/player/VolumeWidget.qml b/modules/gui/qt/qml/player/VolumeWidget.qml
index d823eb23d8..adbf8bfde5 100644
--- a/modules/gui/qt/qml/player/VolumeWidget.qml
+++ b/modules/gui/qt/qml/player/VolumeWidget.qml
@@ -29,13 +29,17 @@ FocusScope{
     y: volumeWidget.y
     width: volumeWidget.width
     height: volumeWidget.height
+    property bool paintOnly: true
+    enabled: !paintOnly
 
     property bool acceptFocus: true
+    Component.onCompleted: paintOnly = false
 
     RowLayout{
         id: volumeWidget
         Utils.IconToolButton{
             id: volumeBtn
+            paintOnly: widgetfscope.paintOnly
             size: VLCStyle.icon_normal
             text:
                 if( player.muted )
@@ -76,7 +80,7 @@ FocusScope{
             property double maxvolpos: maxvol / 100
 
             onValueChanged: {
-                if (player.muted) player.muted = false
+                if (!paintOnly && player.muted) player.muted = false
                 player.volume = volControl.value
             }
 
-- 
2.17.1



More information about the vlc-devel mailing list