[vlc-devel] [PATCH 01/39] qml: add CurrentIndicator widget

Prince Gupta guptaprince8832 at gmail.com
Thu Jan 7 11:49:57 UTC 2021


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

diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index 37984f3a95..5aa94e2036 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/DNDLabel.qml \
 	gui/qt/widgets/qml/DragItem.qml \
 	gui/qt/widgets/qml/DrawerExt.qml \
diff --git a/modules/gui/qt/vlc.qrc b/modules/gui/qt/vlc.qrc
index 70a72ac09e..2c83b1edf0 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
+            })
+        }
+    }
+}
-- 
2.25.1



More information about the vlc-devel mailing list