[vlc-devel] [PATCH 5/5] qml: Add Teletext widget

Rohan Rajpal rohan17089 at iiitd.ac.in
Sat Jul 6 07:34:59 CEST 2019


Add the teletxt widget to the player
controller
---
 modules/gui/qt/Makefile.am                    |   1 +
 .../gui/qt/components/player_controller.hpp   |   9 ++
 modules/gui/qt/qml/player/ControlButtons.qml  |  10 +-
 modules/gui/qt/qml/player/TeletextWidget.qml  | 121 ++++++++++++++++++
 modules/gui/qt/vlc.qrc                        |   1 +
 5 files changed, 140 insertions(+), 2 deletions(-)
 create mode 100644 modules/gui/qt/qml/player/TeletextWidget.qml

diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index 966dd37924..2624f3bea1 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -539,6 +539,7 @@ libqt_plugin_la_QML = \
 	gui/qt/qml/player/VolumeWidget.qml \
 	gui/qt/qml/player/ModalControlBar.qml \
 	gui/qt/qml/player/SliderBar.qml \
+	gui/qt/qml/player/TeletextWidget.qml \
 	gui/qt/qml/dialogs/Dialogs.qml \
 	gui/qt/qml/dialogs/ModalDialog.qml \
 	gui/qt/qml/utils/DNDLabel.qml \
diff --git a/modules/gui/qt/components/player_controller.hpp b/modules/gui/qt/components/player_controller.hpp
index 885eba2cd4..bd199aece7 100644
--- a/modules/gui/qt/components/player_controller.hpp
+++ b/modules/gui/qt/components/player_controller.hpp
@@ -97,6 +97,15 @@ public:
     };
     Q_ENUM(MediaStopAction)
 
+    enum Telekeys{
+        TELE_RED = VLC_PLAYER_TELETEXT_KEY_RED,
+        TELE_GREEN = VLC_PLAYER_TELETEXT_KEY_GREEN,
+        TELE_YELLOW = VLC_PLAYER_TELETEXT_KEY_YELLOW,
+        TELE_BLUE = VLC_PLAYER_TELETEXT_KEY_BLUE,
+        TELE_INDEX = VLC_PLAYER_TELETEXT_KEY_INDEX
+    };
+    Q_ENUM(Telekeys)
+
     //playback
     Q_PROPERTY(PlayingState playingState READ getPlayingState NOTIFY playingStateChanged)
     Q_PROPERTY(bool isPlaying READ hasInput NOTIFY inputChanged)
diff --git a/modules/gui/qt/qml/player/ControlButtons.qml b/modules/gui/qt/qml/player/ControlButtons.qml
index b7874775a8..8fe7424f40 100644
--- a/modules/gui/qt/qml/player/ControlButtons.qml
+++ b/modules/gui/qt/qml/player/ControlButtons.qml
@@ -57,6 +57,7 @@ Item{
         case PlayerControlBarModel.QUIT_BUTTON: return quitBtnDelegate
         case PlayerControlBarModel.VOLUME: return volumeBtnDelegate
         case PlayerControlBarModel.ASPECT_RATIO_COMBOBOX: return aspectRatioDelegate
+        case PlayerControlBarModel.TELETEXT_BUTTONS: return teletextdelegate
         }
         console.log("button delegate id " + inpID +  " doesn't exists")
         return spacerDelegate
@@ -397,14 +398,19 @@ Item{
             id: combo
             property bool acceptFocus: true
             Layout.alignment: Qt.AlignVCenter
-            height: VLCStyle.heightInput
-            width: VLCStyle.widthSortBox
+            height: 28 * scale
+            width: 100 * scale
             textRole: "display"
             model: player.aspectRatio
             onCurrentIndexChanged: model.toggleIndex(currentIndex)
         }
     }
 
+    Component{
+        id: teletextdelegate
+        TeletextWidget{}
+    }
+
     Component{
         id: volumeBtnDelegate
         VolumeWidget{}
diff --git a/modules/gui/qt/qml/player/TeletextWidget.qml b/modules/gui/qt/qml/player/TeletextWidget.qml
new file mode 100644
index 0000000000..1842873eb9
--- /dev/null
+++ b/modules/gui/qt/qml/player/TeletextWidget.qml
@@ -0,0 +1,121 @@
+/*****************************************************************************
+ * Copyright (C) 2019 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * ( at your option ) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+import QtQuick 2.11
+import QtQuick.Layouts 1.3
+import QtQuick.Controls 2.4
+
+import org.videolan.vlc 0.1
+
+import "qrc:///utils/" as Utils
+import "qrc:///style/"
+
+FocusScope{
+    id: widgetfscope
+    x: teleWidget.x
+    y: teleWidget.y
+    width: teleWidget.width
+    height: teleWidget.height
+
+    property bool autohide: !player.isTeletextAvailable
+    property bool acceptFocus: autohide
+    visible: !autohide
+
+    RowLayout{
+        id: teleWidget
+        width: autohide ? 0 : 280 * scale
+
+        spacing: 0
+
+        Utils.IconToolButton{
+            id: teleActivateBtn
+            text: VLCIcons.tv
+            size: VLCStyle.icon_normal
+            onClicked: player.teletextEnabled = !player.teletextEnabled
+            checked: player.teletextEnabled
+            focus: true
+            KeyNavigation.right: player.teletextEnabled ?
+                                     teleTransparencyBtn : blueKeyBtn.KeyNavigation.right
+        }
+
+        Utils.IconToolButton{
+            id: teleTransparencyBtn
+            text: VLCIcons.tvtelx
+            size: VLCStyle.icon_normal
+            opacity: 0.5
+            enabled: player.teletextEnabled
+            onClicked: player.teletextTransparency = !player.teletextTransparency
+            KeyNavigation.right: telePageNumber
+        }
+
+        Utils.SpinBoxExt{
+            id: telePageNumber
+            enabled: player.teletextEnabled
+            from: 100
+            to: 899
+            editable: true
+            onValueChanged: player.teletextPage = value
+            KeyNavigation.right: indexKeyBtn
+        }
+
+        Utils.IconToolButton{
+            id: indexKeyBtn
+            enabled: player.teletextEnabled
+            size: VLCStyle.icon_normal
+            text: VLCIcons.record
+            onClicked: player.teletextPage = PlayerController.TELE_INDEX
+            color: "grey"
+            KeyNavigation.right: redKeyBtn
+        }
+        Utils.IconToolButton{
+            id: redKeyBtn
+            enabled: player.teletextEnabled
+            size: VLCStyle.icon_normal
+            text: VLCIcons.record
+            onClicked: player.teletextPage = PlayerController.TELE_RED
+            color: enabled ? "red" : "grey"
+            KeyNavigation.right: greenKeyBtn
+        }
+        Utils.IconToolButton{
+            id: greenKeyBtn
+            enabled: player.teletextEnabled
+            size: VLCStyle.icon_normal
+            text: VLCIcons.record
+            onClicked: player.teletextPage = PlayerController.TELE_GREEN
+            color: enabled ? "green" : "grey"
+            KeyNavigation.right: yellowKeyBtn
+        }
+        Utils.IconToolButton{
+            id: yellowKeyBtn
+            enabled: player.teletextEnabled
+            size: VLCStyle.icon_normal
+            text: VLCIcons.record
+            onClicked: player.teletextPage = PlayerController.TELE_YELLOW
+            color: enabled ? "yellow" : "grey"
+            KeyNavigation.right: blueKeyBtn
+        }
+        Utils.IconToolButton{
+            id: blueKeyBtn
+            enabled: player.teletextEnabled
+            size: VLCStyle.icon_normal
+            text: VLCIcons.record
+            onClicked: player.teletextPage = PlayerController.TELE_BLUE
+            color: enabled ? "blue" : "grey"
+        }
+    }
+}
diff --git a/modules/gui/qt/vlc.qrc b/modules/gui/qt/vlc.qrc
index aa6988cd1e..cb5cbcc926 100644
--- a/modules/gui/qt/vlc.qrc
+++ b/modules/gui/qt/vlc.qrc
@@ -253,6 +253,7 @@
         <file alias="ModalControlBar.qml">qml/player/ModalControlBar.qml</file>
         <file alias="ControlButtons.qml">qml/player/ControlButtons.qml</file>
         <file alias="VolumeWidget.qml">qml/player/VolumeWidget.qml</file>
+        <file alias="TeletextWidget.qml">qml/player/TeletextWidget.qml</file>
     </qresource>
     <qresource prefix="/about">
         <file alias="About.qml">qml/about/About.qml</file>
-- 
2.17.1



More information about the vlc-devel mailing list