[vlc-commits] [Git][videolan/vlc][master] 4 commits: qml: correct connections in ControlLayout

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sat Jan 1 22:04:16 UTC 2022



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
f9fd2bf9 by Fatih Uzunoglu at 2022-01-01T21:43:05+00:00
qml: correct connections in ControlLayout

- - - - -
84f19fbf by Fatih Uzunoglu at 2022-01-01T21:43:05+00:00
qml: make TeletextWidget a control

- - - - -
1ac104f0 by Fatih Uzunoglu at 2022-01-01T21:43:05+00:00
qml: make VolumeWidget a control

- - - - -
182f41d9 by Fatih Uzunoglu at 2022-01-01T21:43:05+00:00
qml: don't recover focus when control layout is hidden

- - - - -


3 changed files:

- modules/gui/qt/player/qml/ControlLayout.qml
- modules/gui/qt/player/qml/controlbarcontrols/TeletextWidget.qml
- modules/gui/qt/player/qml/controlbarcontrols/VolumeWidget.qml


Changes:

=====================================
modules/gui/qt/player/qml/ControlLayout.qml
=====================================
@@ -75,7 +75,6 @@ FocusScope {
     Component.onCompleted: {
         visibleChanged.connect(_handleFocus)
         activeFocusChanged.connect(_handleFocus)
-        model.countChanged.connect(_handleFocus)
     }
 
     RowLayout {
@@ -143,8 +142,8 @@ FocusScope {
 
                 Component.onCompleted: {
                     repeater.countChanged.connect(loader.buildFocusChain)
-                    MainCtx.controlbarProfileModel.selectedProfileChanged.connect(loader.buildFocusChain)
-                    MainCtx.controlbarProfileModel.currentModel.dirtyChanged.connect(loader.buildFocusChain)
+                    repeater.modelChanged.connect(loader.buildFocusChain)
+                    repeater.countChanged.connect(controlLayout._handleFocus)
                 }
 
                 onActiveFocusChanged: {
@@ -205,6 +204,9 @@ FocusScope {
                 }
 
                 function recoverFocus(_index) {
+                    if (!controlLayout.visible)
+                        return
+
                     if (_index === undefined)
                         _index = index
 


=====================================
modules/gui/qt/player/qml/controlbarcontrols/TeletextWidget.qml
=====================================
@@ -17,75 +17,76 @@
  *****************************************************************************/
 
 import QtQuick 2.11
-import QtQuick.Layouts 1.11
-import QtQuick.Controls 2.4
+import QtQuick.Templates 2.4 as T
 
 import org.videolan.vlc 0.1
 
 import "qrc:///widgets/" as Widgets
 import "qrc:///style/"
 
-FocusScope{
-    id: widgetfscope
-    x: teleWidget.x
-    y: teleWidget.y
-    width: teleWidget.width
-    height: teleWidget.height
 
-    property bool autohide: !paintOnly && !Player.isTeletextAvailable
+T.Pane {
+    id: root
+
+    property VLCColors colors: VLCStyle.colors
     property bool paintOnly: false
-    visible: !autohide
 
-    property color color: VLCStyle.colors.text
-    property color bgColor: VLCStyle.colors.bg
+    enabled: Player.isTeletextAvailable
 
-    RowLayout{
-        id: teleWidget
-        width: autohide ? 0 : VLCStyle.widthTeletext
+    implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
+    implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
+
+    contentWidth: teleWidget.implicitWidth
+    contentHeight: teleWidget.implicitHeight
 
-        spacing: 0
+    Keys.priority: Keys.AfterItem
+    Keys.onPressed: Navigation.defaultKeyAction(event)
+
+    Row {
+        id: teleWidget
+        anchors.fill: parent
 
         Widgets.IconToolButton{
             id: teleActivateBtn
-            paintOnly: widgetfscope.paintOnly
+            paintOnly: root.paintOnly
             iconText: VLCIcons.tv
             text: I18n.qtr("Teletext activate")
             size: VLCStyle.icon_normal
             onClicked: Player.teletextEnabled = !Player.teletextEnabled
-            color: widgetfscope.color
+            color: colors.text
             checked: Player.teletextEnabled
             focus: true
+            toolTip.visible: hovered || visualFocus
 
-            Navigation.parentItem: widgetfscope
-            Navigation.rightItem: Player.teletextEnabled ? teleTransparencyBtn : null
+            Navigation.parentItem: root
+            Navigation.rightItem: teleTransparencyBtn
         }
 
         Widgets.IconToolButton{
             id: teleTransparencyBtn
-            paintOnly: widgetfscope.paintOnly
+            paintOnly: root.paintOnly
             iconText: VLCIcons.tvtelx
             text: I18n.qtr("Teletext transparency")
             size: VLCStyle.icon_normal
             opacity: 0.5
-            enabled: Player.teletextEnabled
             onClicked: Player.teletextTransparency = !Player.teletextTransparency
-            color: widgetfscope.color
+            color: colors.text
+            toolTip.visible: hovered || visualFocus
 
-            Navigation.parentItem: widgetfscope
+            Navigation.parentItem: root
             Navigation.leftItem: teleActivateBtn
             Navigation.rightItem: telePageNumber
         }
 
         Widgets.SpinBoxExt{
             id: telePageNumber
-            enabled: Player.teletextEnabled
             from: 100
             to: 899
             editable: true
-            textColor: widgetfscope.color
-            bgColor: widgetfscope.bgColor
+            textColor: colors.text
+            bgColor: colors.bg
 
-            Navigation.parentItem: widgetfscope
+            Navigation.parentItem: root
             Navigation.leftItem: teleTransparencyBtn
             Navigation.rightItem: indexKeyBtn
 
@@ -115,76 +116,76 @@ FocusScope{
 
         Widgets.IconToolButton{
             id: indexKeyBtn
-            paintOnly: widgetfscope.paintOnly
-            enabled: Player.teletextEnabled
+            paintOnly: root.paintOnly
             size: VLCStyle.icon_normal
             iconText: VLCIcons.record
             text: I18n.qtr("Index key")
             onClicked: Player.teletextPage = Player.TELE_INDEX
             color: "grey"
             colorDisabled: "grey"
+            toolTip.visible: hovered || visualFocus
 
-            Navigation.parentItem: widgetfscope
+            Navigation.parentItem: root
             Navigation.leftItem: telePageNumber
             Navigation.rightItem: redKeyBtn
         }
         Widgets.IconToolButton{
             id: redKeyBtn
-            paintOnly: widgetfscope.paintOnly
-            enabled: Player.teletextEnabled
+            paintOnly: root.paintOnly
             size: VLCStyle.icon_normal
             iconText: VLCIcons.record
             text: I18n.qtr("Red key")
             onClicked: Player.teletextPage = Player.TELE_RED
             color: "red"
             colorDisabled: "grey"
+            toolTip.visible: hovered || visualFocus
 
-            Navigation.parentItem: widgetfscope
+            Navigation.parentItem: root
             Navigation.leftItem: indexKeyBtn
             Navigation.rightItem: greenKeyBtn
         }
         Widgets.IconToolButton{
             id: greenKeyBtn
-            paintOnly: widgetfscope.paintOnly
-            enabled: Player.teletextEnabled
+            paintOnly: root.paintOnly
             size: VLCStyle.icon_normal
             iconText: VLCIcons.record
             text: I18n.qtr("Green key")
             onClicked: Player.teletextPage = Player.TELE_GREEN
             color: "green"
             colorDisabled: "grey"
+            toolTip.visible: hovered || visualFocus
 
-            Navigation.parentItem: widgetfscope
+            Navigation.parentItem: root
             Navigation.leftItem: redKeyBtn
             Navigation.rightItem: yellowKeyBtn
         }
         Widgets.IconToolButton{
             id: yellowKeyBtn
-            paintOnly: widgetfscope.paintOnly
-            enabled: Player.teletextEnabled
+            paintOnly: root.paintOnly
             size: VLCStyle.icon_normal
             iconText: VLCIcons.record
             text: I18n.qtr("Yellow key")
             onClicked: Player.teletextPage = Player.TELE_YELLOW
             color: "yellow"
             colorDisabled: "grey"
+            toolTip.visible: hovered || visualFocus
 
-            Navigation.parentItem: widgetfscope
+            Navigation.parentItem: root
             Navigation.leftItem: greenKeyBtn
             Navigation.rightItem: blueKeyBtn
         }
         Widgets.IconToolButton{
             id: blueKeyBtn
-            paintOnly: widgetfscope.paintOnly
-            enabled: Player.teletextEnabled
+            paintOnly: root.paintOnly
             size: VLCStyle.icon_normal
             iconText: VLCIcons.record
             text: I18n.qtr("Blue key")
             onClicked: Player.teletextPage = Player.TELE_BLUE
             color: "blue"
             colorDisabled: "grey"
+            toolTip.visible: hovered || visualFocus
 
-            Navigation.parentItem: widgetfscope
+            Navigation.parentItem: root
             Navigation.leftItem: yellowKeyBtn
         }
     }


=====================================
modules/gui/qt/player/qml/controlbarcontrols/VolumeWidget.qml
=====================================
@@ -17,27 +17,32 @@
  *****************************************************************************/
 import QtQuick 2.11
 import QtQuick.Layouts 1.11
-import QtQuick.Controls 2.4
+import QtQuick.Templates 2.4 as T
 import QtGraphicalEffects 1.0
+
 import org.videolan.vlc 0.1
 
 import "qrc:///widgets/" as Widgets
 import "qrc:///style/"
 
-FocusScope{
-    id: widgetfscope
-
-    implicitWidth: volumeWidget.implicitWidth
-    implicitHeight: volumeWidget.implicitHeight
+T.Pane {
+    id: root
 
+    property VLCColors colors: VLCStyle.colors
+    property color color: colors.buttonText
     property bool paintOnly: false
+    readonly property var _player: paintOnly ? ({ muted: false, volume: .5 }) : Player
 
-    property color color: colors.buttonText
-    property VLCColors colors: VLCStyle.colors
+    implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
+    implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
 
-    readonly property var _player: paintOnly ? ({ muted: false, volume: .5 }) : Player
+    contentWidth: volumeWidget.implicitWidth
+    contentHeight: volumeWidget.implicitHeight
 
-    RowLayout{
+    Keys.priority: Keys.AfterItem
+    Keys.onPressed: Navigation.defaultKeyAction(event)
+
+    RowLayout {
         id: volumeWidget
 
         anchors.fill: parent
@@ -47,7 +52,7 @@ FocusScope{
             id: volumeBtn
 
             focus: true
-            paintOnly: widgetfscope.paintOnly
+            paintOnly: root.paintOnly
             size: VLCStyle.icon_normal
             iconText:
                 if( _player.muted )
@@ -61,19 +66,22 @@ FocusScope{
                 else
                     VLCIcons.volume_high
             text: I18n.qtr("Mute")
-            color: widgetfscope.color
+            color: root.color
             colorHover: colors.buttonTextHover
             colorFocus: colors.bgFocus
             onClicked: Player.muted = !Player.muted
 
-            Navigation.parentItem: widgetfscope
+            Navigation.parentItem: root
             Navigation.rightItem: volControl
         }
 
-        Slider {
+        T.Slider {
             id: volControl
 
             implicitWidth: VLCStyle.dp(100, VLCStyle.scale)
+            implicitHeight: Math.max(background ? background.implicitHeight : 0,
+                                    (handle ? handle.implicitHeight : 0) + topPadding + bottomPadding)
+
             Layout.fillHeight: true
             Layout.margins: VLCStyle.dp(5, VLCStyle.scale)
 
@@ -107,7 +115,7 @@ FocusScope{
             }
 
             Component.onCompleted: {
-                widgetfscope.paintOnlyChanged.connect(_syncVolumeWithPlayer)
+                root.paintOnlyChanged.connect(_syncVolumeWithPlayer)
                 volControl._syncVolumeWithPlayer()
             }
 
@@ -127,7 +135,7 @@ FocusScope{
             }
 
             Navigation.leftItem: volumeBtn
-            Navigation.parentItem: widgetfscope
+            Navigation.parentItem: root
 
             Keys.onUpPressed: {
                 volControl.increase()
@@ -141,7 +149,7 @@ FocusScope{
 
             Keys.priority: Keys.BeforeItem
 
-            readonly property color sliderColor: (volControl.position > fullvolpos) ? colors.volmax : widgetfscope.color
+            readonly property color sliderColor: (volControl.position > fullvolpos) ? colors.volmax : root.color
             readonly property int maxvol: 125
             readonly property real fullvolpos: 100 / maxvol
             readonly property real maxvolpos: maxvol / 100
@@ -169,7 +177,7 @@ FocusScope{
 
                     pos: Qt.point(handle.x + handle.width / 2, handle.y)
 
-                    colors: widgetfscope.colors
+                    colors: root.colors
                 }
             }
 
@@ -189,7 +197,7 @@ FocusScope{
                     width: volControl.visualPosition * sliderBg.width
                     height: parent.height
                     radius: VLCStyle.dp(4, VLCStyle.scale)
-                    color: widgetfscope.color
+                    color: root.color
                     layer.enabled: (paintOnly || volControl.hovered || volControl.activeFocus)
                     layer.effect: LinearGradient {
                         start: Qt.point(0, 0)
@@ -208,7 +216,7 @@ FocusScope{
                     width: VLCStyle.dp(1, VLCStyle.scale)
                     height: parent.height
                     radius: VLCStyle.dp(2, VLCStyle.scale)
-                    color: widgetfscope.color
+                    color: root.color
                 }
             }
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/f15644a5ecf759c6acf6631210d135c182170aba...182f41d9b0fbe8c1a1c6aadd165ed2112d933381

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/f15644a5ecf759c6acf6631210d135c182170aba...182f41d9b0fbe8c1a1c6aadd165ed2112d933381
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list