[vlc-devel] [PATCH 05/16] qml: add ContextButton, VideoQualityLabel, VideoProgress and RoundImage

Abel Tesfaye abeltesfaye45 at gmail.com
Fri Aug 9 17:23:42 CEST 2019


From: Abel Tesfaye <Abeltesfaye45 at gmail.com>

---
 modules/gui/qt/Makefile.am                    |  4 ++
 modules/gui/qt/qml/utils/ContextButton.qml    | 54 +++++++++++++++++++
 modules/gui/qt/qml/utils/RoundImage.qml       | 38 +++++++++++++
 modules/gui/qt/qml/utils/VideoProgressBar.qml | 36 +++++++++++++
 .../gui/qt/qml/utils/VideoQualityLabel.qml    | 37 +++++++++++++
 modules/gui/qt/vlc.qrc                        |  4 ++
 6 files changed, 173 insertions(+)
 create mode 100644 modules/gui/qt/qml/utils/ContextButton.qml
 create mode 100644 modules/gui/qt/qml/utils/RoundImage.qml
 create mode 100644 modules/gui/qt/qml/utils/VideoProgressBar.qml
 create mode 100644 modules/gui/qt/qml/utils/VideoQualityLabel.qml

diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index 94d5da6fe9..ab8cdfb11c 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -566,6 +566,7 @@ libqt_plugin_la_QML = \
 	gui/qt/qml/utils/ToolTipArea.qml \
 	gui/qt/qml/utils/DrawerExt.qml \
 	gui/qt/qml/utils/GridItem.qml \
+	gui/qt/qml/utils/ContextButton.qml \
 	gui/qt/qml/utils/IconToolButton.qml \
 	gui/qt/qml/utils/ImageToolButton.qml \
 	gui/qt/qml/utils/TextToolButton.qml \
@@ -585,6 +586,9 @@ libqt_plugin_la_QML = \
 	gui/qt/qml/utils/ScanProgressBar.qml \
 	gui/qt/qml/utils/LabelSeparator.qml \
 	gui/qt/qml/utils/RoundButton.qml \
+	gui/qt/qml/utils/RoundImage.qml \
+	gui/qt/qml/utils/VideoQualityLabel.qml \
+	gui/qt/qml/utils/VideoProgressBar.qml \
         gui/qt/qml/utils/SearchBox.qml \
         gui/qt/qml/utils/SortControl.qml \
 	gui/qt/qml/menus/CheckableModelSubMenu.qml \
diff --git a/modules/gui/qt/qml/utils/ContextButton.qml b/modules/gui/qt/qml/utils/ContextButton.qml
new file mode 100644
index 0000000000..9da324c07c
--- /dev/null
+++ b/modules/gui/qt/qml/utils/ContextButton.qml
@@ -0,0 +1,54 @@
+/*****************************************************************************
+ * 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.Controls 2.4
+
+import "qrc:///utils/" as Utils
+import "qrc:///style/"
+
+
+Button {
+    id: contextButton
+    width: VLCStyle.icon_normal
+    height: VLCStyle.icon_normal
+    text: VLCIcons.ellipsis
+    font.family: VLCIcons.fontFamily
+    font.pointSize: VLCStyle.icon_small
+
+    property alias color: contextButtonContent.color
+    property alias backgroundColor: contextButtonBg.color
+
+    hoverEnabled: true
+    background: Rectangle {
+        id: contextButtonBg
+        anchors.fill: contextButton
+        color: "transparent"
+    }
+    contentItem: Text {
+        id: contextButtonContent
+        text: contextButton.text
+        font: contextButton.font
+        color: VLCStyle.colors.text
+        horizontalAlignment: Text.AlignHCenter
+        verticalAlignment: Text.AlignVCenter
+        //                                layer.enabled: true
+        //                                layer.effect: DropShadow {
+        //                                    color: VLCStyle.colors.text
+        //                                }
+    }
+}
diff --git a/modules/gui/qt/qml/utils/RoundImage.qml b/modules/gui/qt/qml/utils/RoundImage.qml
new file mode 100644
index 0000000000..d45b9c5e1e
--- /dev/null
+++ b/modules/gui/qt/qml/utils/RoundImage.qml
@@ -0,0 +1,38 @@
+/*****************************************************************************
+ * 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.Controls 2.4
+import QtGraphicalEffects 1.0
+
+import "qrc:///style/"
+
+Image {
+    id: cover
+    property real radius: 3
+    fillMode: Image.PreserveAspectCrop
+    sourceSize: Qt.size(width, height)
+    layer.enabled: true
+    layer.effect: OpacityMask {
+        maskSource: Rectangle {
+            radius: cover.radius
+            width: cover.width
+            height: cover.height
+            visible: false
+        }
+    }
+}
diff --git a/modules/gui/qt/qml/utils/VideoProgressBar.qml b/modules/gui/qt/qml/utils/VideoProgressBar.qml
new file mode 100644
index 0000000000..f554ec21e3
--- /dev/null
+++ b/modules/gui/qt/qml/utils/VideoProgressBar.qml
@@ -0,0 +1,36 @@
+/*****************************************************************************
+ * 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.Controls 2.4
+
+import "qrc:///style/"
+
+ProgressBar {
+    id: progressBar
+    background: Rectangle {
+        implicitHeight: 2 * VLCStyle.scale
+        color: VLCStyle.colors.text
+    }
+    contentItem: Item {
+        Rectangle {
+            width: progressBar.visualPosition * parent.width
+            height: parent.height
+            color: VLCStyle.colors.accent
+        }
+    }
+}
diff --git a/modules/gui/qt/qml/utils/VideoQualityLabel.qml b/modules/gui/qt/qml/utils/VideoQualityLabel.qml
new file mode 100644
index 0000000000..7ae151e13a
--- /dev/null
+++ b/modules/gui/qt/qml/utils/VideoQualityLabel.qml
@@ -0,0 +1,37 @@
+/*****************************************************************************
+ * 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.Controls 2.4
+
+import "qrc:///style/"
+
+Label {
+    id: label
+    color: "white"
+    bottomPadding: VLCStyle.margin_xxxsmall
+    topPadding: VLCStyle.margin_xxxsmall
+    leftPadding: VLCStyle.margin_xxxsmall
+    rightPadding: VLCStyle.margin_xxxsmall
+    font.pixelSize: VLCStyle.fontSize_normal
+    background: Rectangle {
+        anchors.fill: label
+        color: "black"
+        opacity: 0.5
+        radius: 3
+    }
+}
diff --git a/modules/gui/qt/vlc.qrc b/modules/gui/qt/vlc.qrc
index 1325024318..ca4aa48c6d 100644
--- a/modules/gui/qt/vlc.qrc
+++ b/modules/gui/qt/vlc.qrc
@@ -200,6 +200,10 @@
         <file alias="SortControl.qml">qml/utils/SortControl.qml</file>
         <file alias="RoundButton.qml">qml/utils/RoundButton.qml</file>
         <file alias="LabelSeparator.qml">qml/utils/LabelSeparator.qml</file>
+        <file alias="ContextButton.qml">qml/utils/ContextButton.qml</file>
+        <file alias="RoundImage.qml">qml/utils/RoundImage.qml</file>
+        <file alias="VideoQualityLabel.qml">qml/utils/VideoQualityLabel.qml</file>
+        <file alias="VideoProgressBar.qml">qml/utils/VideoProgressBar.qml</file>
     </qresource>
     <qresource prefix="/mediacenter">
         <file alias="MCMusicDisplay.qml">qml/mediacenter/MCMusicDisplay.qml</file>
-- 
2.21.0



More information about the vlc-devel mailing list