[vlc-commits] qml: set teletext page on es change

Pierre Lamot git at videolan.org
Fri May 29 12:00:43 CEST 2020


vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Fri May 29 11:06:36 2020 +0200| [30ab38cdb77d293a587659225df7e5bc71bdf71f] | committer: Pierre Lamot

qml: set teletext page on es change

  a direct binding can't be used there because or we might end up in a loop

  we only update the value when the user changes manually the value.

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

 modules/gui/qt/player/qml/TeletextWidget.qml | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/modules/gui/qt/player/qml/TeletextWidget.qml b/modules/gui/qt/player/qml/TeletextWidget.qml
index 28c177e73b..6f64447664 100644
--- a/modules/gui/qt/player/qml/TeletextWidget.qml
+++ b/modules/gui/qt/player/qml/TeletextWidget.qml
@@ -81,8 +81,30 @@ FocusScope{
             editable: true
             textColor: widgetfscope.color
             bgColor: widgetfscope.bgColor
-            onValueChanged: player.teletextPage = value
             KeyNavigation.right: indexKeyBtn
+
+            //only update the player teletext page when the user change the value manually
+            property bool inhibitPageUpdate: true
+
+            onValueChanged: {
+                if (inhibitPageUpdate)
+                    return
+                player.teletextPage = value
+            }
+
+            Component.onCompleted: {
+                value = player.teletextPage
+                inhibitPageUpdate = false
+            }
+
+            Connections {
+                target: player
+                onTeletextPageChanged: {
+                    telePageNumber.inhibitPageUpdate = true
+                    telePageNumber.value = player.teletextPage
+                    telePageNumber.inhibitPageUpdate = false
+                }
+            }
         }
 
         Widgets.IconToolButton{



More information about the vlc-commits mailing list