[vlc-devel] [PATCH 3/5] qml: implement GridShadow widget

Prince Gupta guptaprince8832 at gmail.com
Fri Apr 9 14:47:30 UTC 2021


provides cached selected and unselected type shadows for use in GridItem
---
 modules/gui/qt/Makefile.am                 |  3 +-
 modules/gui/qt/vlc.qrc                     |  1 +
 modules/gui/qt/widgets/qml/GridShadows.qml | 70 ++++++++++++++++++++++
 3 files changed, 73 insertions(+), 1 deletion(-)
 create mode 100644 modules/gui/qt/widgets/qml/GridShadows.qml

diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index 52cf6b4344..1195de8cc6 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -751,7 +751,7 @@ libqt_plugin_la_QML = \
 	gui/qt/widgets/qml/ExpandGridView.qml \
 	gui/qt/widgets/qml/FocusBackground.qml \
 	gui/qt/widgets/qml/GridItem.qml \
-	gui/qt/widgets/qml/GridShadow.qml \
+	gui/qt/widgets/qml/GridShadows.qml \
 	gui/qt/widgets/qml/HorizontalResizeHandle.qml \
 	gui/qt/widgets/qml/IconLabel.qml \
 	gui/qt/widgets/qml/IconButton.qml \
@@ -782,6 +782,7 @@ libqt_plugin_la_QML = \
 	gui/qt/widgets/qml/ScanProgressBar.qml \
 	gui/qt/widgets/qml/ScrollingText.qml \
 	gui/qt/widgets/qml/SearchBox.qml \
+	gui/qt/widgets/qml/ShadowCoverGenerator.qml \
 	gui/qt/widgets/qml/SortControl.qml \
 	gui/qt/widgets/qml/SpinBoxExt.qml \
 	gui/qt/widgets/qml/StackViewExt.qml \
diff --git a/modules/gui/qt/vlc.qrc b/modules/gui/qt/vlc.qrc
index 01809a40fd..4d7f12bb53 100644
--- a/modules/gui/qt/vlc.qrc
+++ b/modules/gui/qt/vlc.qrc
@@ -252,6 +252,7 @@
         <file alias="OverlayMenu.qml">widgets/qml/OverlayMenu.qml</file>
         <file alias="IconControlButton.qml">widgets/qml/IconControlButton.qml</file>
         <file alias="ShadowCoverGenerator.qml">widgets/qml/ShadowCoverGenerator.qml</file>
+        <file alias="GridShadows.qml">widgets/qml/GridShadows.qml</file>
     </qresource>
     <qresource prefix="/network">
         <file alias="AddressbarButton.qml">network/qml/AddressbarButton.qml</file>
diff --git a/modules/gui/qt/widgets/qml/GridShadows.qml b/modules/gui/qt/widgets/qml/GridShadows.qml
new file mode 100644
index 0000000000..9977ba0626
--- /dev/null
+++ b/modules/gui/qt/widgets/qml/GridShadows.qml
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (C) 2021 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 "qrc:///style/"
+
+Item {
+    id: root
+
+    property alias leftPadding: unselectedShadow.leftPadding
+    property alias topPadding: unselectedShadow.topPadding
+    property alias coverMargins: unselectedShadow.coverMargins
+    property alias coverWidth: unselectedShadow.coverWidth
+    property alias coverHeight: unselectedShadow.coverHeight
+    property alias coverRadius: unselectedShadow.coverRadius
+
+    property alias unselected: unselectedShadow.imageComponent
+    property alias selected: selectedShadow.imageComponent
+
+    ShadowCoverGenerator {
+        id: unselectedShadow
+
+        leftPadding: 0
+        topPadding: 0
+        coverMargins: 1
+        coverWidth: VLCStyle.colWidth(1)
+        coverHeight: VLCStyle.colWidth(1)
+        coverRadius: VLCStyle.gridCover_radius
+
+        secondaryVerticalOffset: VLCStyle.dp(1, VLCStyle.scale)
+        secondaryRadius: VLCStyle.dp(2, VLCStyle.scale)
+        secondarySamples: 1 + VLCStyle.dp(2, VLCStyle.scale) * 2
+        primaryVerticalOffset: VLCStyle.dp(4, VLCStyle.scale)
+        primaryRadius: VLCStyle.dp(9, VLCStyle.scale)
+        primarySamples: 1 + VLCStyle.dp(9, VLCStyle.scale) * 2
+    }
+
+    ShadowCoverGenerator {
+        id: selectedShadow
+
+        leftPadding: root.leftPadding
+        topPadding: root.topPadding
+        coverMargins: root.coverMargins
+        coverWidth: root.coverWidth
+        coverHeight: root.coverHeight
+        coverRadius: root.coverRadius
+
+        secondaryVerticalOffset: VLCStyle.dp(6, VLCStyle.scale)
+        secondaryRadius: VLCStyle.dp(18, VLCStyle.scale)
+        secondarySamples: 1 + VLCStyle.dp(18, VLCStyle.scale) * 2
+        primaryVerticalOffset: VLCStyle.dp(32, VLCStyle.scale)
+        primaryRadius: VLCStyle.dp(72, VLCStyle.scale)
+        primarySamples: 1 + VLCStyle.dp(72, VLCStyle.scale) * 2
+    }
+}
-- 
2.27.0



More information about the vlc-devel mailing list