[vlc-commits] qml: add new indicator for GridItem

Prince Gupta git at videolan.org
Fri Jul 3 14:59:36 CEST 2020


vlc | branch: master | Prince Gupta <guptaprince8832 at gmail.com> | Mon Jun 22 19:57:49 2020 +0530| [b58fcbda9994fceb4e380c56cec8de98de1b082b] | committer: Pierre Lamot

qml: add new indicator for GridItem

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

 modules/gui/qt/medialibrary/qml/VideoGridItem.qml |  1 +
 modules/gui/qt/widgets/qml/GridItem.qml           | 23 ++++++++++++++++++++++-
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/modules/gui/qt/medialibrary/qml/VideoGridItem.qml b/modules/gui/qt/medialibrary/qml/VideoGridItem.qml
index 9e374ab4e8..1d8ef2ef12 100644
--- a/modules/gui/qt/medialibrary/qml/VideoGridItem.qml
+++ b/modules/gui/qt/medialibrary/qml/VideoGridItem.qml
@@ -36,6 +36,7 @@ Widgets.GridItem {
     pictureHeight: VLCStyle.gridCover_video_height
     playCoverBorder.width: VLCStyle.gridCover_video_border
     titleMargin: VLCStyle.margin_xxsmall
+    showNewIndicator: true
     onItemDoubleClicked: {
         if ( model.id !== undefined ) {
             medialib.addAndPlay( model.id )
diff --git a/modules/gui/qt/widgets/qml/GridItem.qml b/modules/gui/qt/widgets/qml/GridItem.qml
index 19d3dacf4d..30b5e69187 100644
--- a/modules/gui/qt/widgets/qml/GridItem.qml
+++ b/modules/gui/qt/widgets/qml/GridItem.qml
@@ -36,6 +36,7 @@ Item {
 
     property alias progress: picture.progress
     property alias labels: picture.labels
+    property bool showNewIndicator: false
     property real pictureWidth: VLCStyle.colWidth(1)
     property real pictureHeight: pictureWidth
     property int titleMargin: VLCStyle.margin_xsmall
@@ -63,6 +64,8 @@ Item {
     property alias _secondaryShadowVerticalOffset: secondaryShadow.verticalOffset
     property alias _secondaryShadowRadius: secondaryShadow.radius
 
+    property int _newIndicatorMedian: VLCStyle.margin_xsmall
+
     states: [
         State {
             name: "unselected"
@@ -73,6 +76,7 @@ Item {
                 _primaryShadowRadius: VLCStyle.dp(14, VLCStyle.scale)
                 _secondaryShadowVerticalOffset: VLCStyle.dp(1, VLCStyle.scale)
                 _secondaryShadowRadius: VLCStyle.dp(3, VLCStyle.scale)
+                _newIndicatorMedian: VLCStyle.margin_xsmall
             }
         },
         State {
@@ -84,6 +88,7 @@ Item {
                 _primaryShadowRadius: VLCStyle.dp(72, VLCStyle.scale)
                 _secondaryShadowVerticalOffset: VLCStyle.dp(6, VLCStyle.scale)
                 _secondaryShadowRadius: VLCStyle.dp(8, VLCStyle.scale)
+                _newIndicatorMedian: VLCStyle.margin_small
             }
         }
     ]
@@ -92,7 +97,7 @@ Item {
         to: "*"
         SmoothedAnimation {
           duration: 64
-          properties: "_primaryShadowVerticalOffset,_primaryShadowRadius,_secondaryShadowVerticalOffset,_secondaryShadowRadius"
+          properties: "_primaryShadowVerticalOffset,_primaryShadowRadius,_secondaryShadowVerticalOffset,_secondaryShadowRadius,_newIndicatorMedian"
        }
     }
 
@@ -191,6 +196,22 @@ Item {
 
                     Layout.preferredWidth: pictureWidth
                     Layout.preferredHeight: pictureHeight
+
+                    /* new indicator (triangle at top-left of cover)*/
+                    Rectangle {
+                        id: newIndicator
+
+                        // consider this Rectangle as a triangle, then following property is its median length
+                        property alias median: root._newIndicatorMedian
+
+                        x: parent.width - median
+                        y: - median
+                        width: 2 * median
+                        height: 2 * median
+                        color: VLCStyle.colors.accent
+                        rotation: 45
+                        visible: root.showNewIndicator && root.progress === 0
+                    }
                 }
 
                 Widgets.ScrollingText {



More information about the vlc-commits mailing list