[vlc-commits] qml: add CurrentIndicator widget

Prince Gupta git at videolan.org
Thu Jan 14 14:42:03 UTC 2021


vlc | branch: master | Prince Gupta <guptaprince8832 at gmail.com> | Mon Dec 21 20:42:51 2020 +0530| [2c267da876361461c59589fa0d341a9edc2c15c8] | committer: Pierre Lamot

qml: add CurrentIndicator widget

Signed-off-by: Pierre Lamot <pierre at videolabs.io>

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

 modules/gui/qt/Makefile.am                      |  1 +
 modules/gui/qt/vlc.qrc                          |  1 +
 modules/gui/qt/widgets/qml/CurrentIndicator.qml | 61 +++++++++++++++++++++++++
 3 files changed, 63 insertions(+)

diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index 220334ce79..75cf5f28ea 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -700,6 +700,7 @@ libqt_plugin_la_QML = \
 	gui/qt/widgets/qml/CSDWindowButton.qml \
 	gui/qt/widgets/qml/CSDWindowButtonSet.qml \
 	gui/qt/widgets/qml/CSDTitlebarTapNDrapHandler.qml \
+	gui/qt/widgets/qml/CurrentIndicator.qml \
 	gui/qt/widgets/qml/DragItem.qml \
 	gui/qt/widgets/qml/DrawerExt.qml \
 	gui/qt/widgets/qml/ExpandGridView.qml \
diff --git a/modules/gui/qt/vlc.qrc b/modules/gui/qt/vlc.qrc
index 2fae7d1310..3c74a483d3 100644
--- a/modules/gui/qt/vlc.qrc
+++ b/modules/gui/qt/vlc.qrc
@@ -190,6 +190,7 @@
         <file alias="CSDWindowButton.qml">widgets/qml/CSDWindowButton.qml</file>
         <file alias="CSDWindowButtonSet.qml">widgets/qml/CSDWindowButtonSet.qml</file>
         <file alias="CSDTitlebarTapNDrapHandler.qml">widgets/qml/CSDTitlebarTapNDrapHandler.qml</file>
+        <file alias="CurrentIndicator.qml">widgets/qml/CurrentIndicator.qml</file>
         <file alias="GridItem.qml">widgets/qml/GridItem.qml</file>
         <file alias="ListItem.qml">widgets/qml/ListItem.qml</file>
         <file alias="DrawerExt.qml">widgets/qml/DrawerExt.qml</file>
diff --git a/modules/gui/qt/widgets/qml/CurrentIndicator.qml b/modules/gui/qt/widgets/qml/CurrentIndicator.qml
new file mode 100644
index 0000000000..4fb185e51e
--- /dev/null
+++ b/modules/gui/qt/widgets/qml/CurrentIndicator.qml
@@ -0,0 +1,61 @@
+
+/*****************************************************************************
+ * Copyright (C) 2020 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.Controls 2.4
+import "qrc:///style/"
+
+Rectangle {
+
+    property int orientation: Qt.Vertical
+    property int margin: VLCStyle.margin_xxxsmall
+
+    color: VLCStyle.colors.accent
+    width: orientation === Qt.Vertical ? VLCStyle.heightBar_xxxsmall : parent.width
+    height: orientation === Qt.Horizontal ? VLCStyle.heightBar_xxxsmall : parent.height
+
+    onOrientationChanged: {
+        if (orientation == Qt.Vertical) {
+            anchors.horizontalCenter = undefined
+            anchors.verticalCenter = Qt.binding(function () {
+                return parent.verticalCenter
+            })
+            anchors.left = Qt.binding(function () {
+                return parent.left
+            })
+            anchors.right = undefined
+            anchors.leftMargin = Qt.binding(function () {
+                return margin
+            })
+            anchors.bottomMargin = 0
+        } else {
+            anchors.top = undefined
+            anchors.bottom = Qt.binding(function () {
+                return parent.bottom
+            })
+            anchors.horizontalCenter = Qt.binding(function () {
+                return parent.horizontalCenter
+            })
+            anchors.verticalCenter = undefined
+            anchors.leftMargin = 0
+            anchors.bottomMargin = Qt.binding(function () {
+                return margin
+            })
+        }
+    }
+}



More information about the vlc-commits mailing list