[vlc-commits] qml: Add Teletext widget
Rohan Rajpal
git at videolan.org
Tue Jul 16 16:24:42 CEST 2019
vlc | branch: master | Rohan Rajpal <rohan17089 at iiitd.ac.in> | Tue Jul 16 18:45:44 2019 +0530| [18412e455ab1cb8a066057030aa39c387b3ca14d] | committer: Jean-Baptiste Kempf
qml: Add Teletext widget
Add the teletxt widget to the player controller
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=18412e455ab1cb8a066057030aa39c387b3ca14d
---
modules/gui/qt/Makefile.am | 1 +
modules/gui/qt/components/player_controller.hpp | 9 ++
modules/gui/qt/qml/player/ControlButtons.qml | 6 ++
modules/gui/qt/qml/player/TeletextWidget.qml | 121 ++++++++++++++++++++++++
modules/gui/qt/qml/style/VLCStyle.qml | 1 +
modules/gui/qt/vlc.qrc | 1 +
6 files changed, 139 insertions(+)
diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index 50b4d9f3ad..0e41ca2ddf 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -545,6 +545,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 24373e2d8f..1064a581b2 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 95b5f1c3d9..a69f9f7dcf 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
@@ -405,6 +406,11 @@ Item{
}
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..e63ec52f1b
--- /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 : VLCStyle.widthTeletext * 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/qml/style/VLCStyle.qml b/modules/gui/qt/qml/style/VLCStyle.qml
index 1b98d20953..bf0ca04933 100644
--- a/modules/gui/qt/qml/style/VLCStyle.qml
+++ b/modules/gui/qt/qml/style/VLCStyle.qml
@@ -96,6 +96,7 @@ Item {
property int widthSearchInput: 200 * scale;
property int widthSortBox: 150 * scale;
+ property int widthTeletext: 280 * scale;
property int heightInput: 22 * scale;
property int selectedBorder: 2
diff --git a/modules/gui/qt/vlc.qrc b/modules/gui/qt/vlc.qrc
index 93d4d21384..6ed9849c70 100644
--- a/modules/gui/qt/vlc.qrc
+++ b/modules/gui/qt/vlc.qrc
@@ -252,6 +252,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>
More information about the vlc-commits
mailing list