Warning, /multimedia/plasmatube/src/ui/components/PlaylistGridItem.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2019 Linus Jahn <lnj@kaidan.im>
0002 // SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
0003 // SPDX-License-Identifier: GPL-3.0-or-later
0004 
0005 import QtQuick
0006 import QtQuick.Layouts
0007 import Qt5Compat.GraphicalEffects
0008 
0009 import org.kde.kirigami as Kirigami
0010 
0011 BaseGridItem {
0012     id: root
0013 
0014     property string title
0015     property string thumbnail
0016     property int videoCount
0017 
0018     contentItem: ColumnLayout {
0019         id: column
0020         anchors.fill: parent
0021         anchors.topMargin: root.topPadding
0022         anchors.bottomMargin: root.bottomPadding
0023         anchors.leftMargin: root.leftPadding
0024         anchors.rightMargin: root.rightPadding
0025 
0026         spacing: 0
0027 
0028         Image {
0029             id: thumb
0030             Layout.alignment: Qt.AlignTop
0031             Layout.preferredWidth: column.width
0032             Layout.maximumWidth: column.width
0033             Layout.preferredHeight: column.width / 16 * 9
0034             Layout.maximumHeight: column.width / 16 * 9
0035             layer.enabled: true
0036             layer.effect: OpacityMask {
0037                 maskSource: mask
0038             }
0039             source: thumbnail
0040             fillMode: Image.PreserveAspectCrop
0041             Rectangle {
0042                 id: mask
0043                 radius: 7
0044                 anchors.fill: thumb
0045                 visible: false
0046             }
0047 
0048             PlaceholderItem {
0049                 anchors.fill: parent
0050                 visible: thumb.status !== Image.Ready
0051             }
0052 
0053             Text {
0054                 text: i18np("%1 video", "%1 videos", videoCount)
0055                 color: "white"
0056                 font.pointSize: Kirigami.Theme.smallFont.pointSize
0057 
0058                 z: 2
0059 
0060                 anchors.right: parent.right
0061                 anchors.bottom: parent.bottom
0062                 anchors.rightMargin: Kirigami.Units.smallSpacing * 2
0063                 anchors.bottomMargin: Kirigami.Units.smallSpacing * 2
0064 
0065                 Rectangle {
0066                     anchors.fill: parent
0067                     anchors.topMargin: -Kirigami.Units.smallSpacing
0068                     anchors.bottomMargin: -Kirigami.Units.smallSpacing
0069                     anchors.leftMargin: -Kirigami.Units.smallSpacing
0070                     anchors.rightMargin: -Kirigami.Units.smallSpacing
0071                     z: -1
0072                     color: "#90000000"
0073                     radius: 2
0074                     width: 60
0075                     height: 15
0076                 }
0077             }
0078 
0079             MouseArea {
0080                 id: thumbnailMouseArea
0081                 anchors.fill: parent
0082                 cursorShape: Qt.PointingHandCursor
0083                 onClicked: (event) => root.clicked(event)
0084             }
0085         }
0086 
0087         ColumnLayout {
0088             id: videoInfo
0089             Layout.fillWidth: true
0090             Layout.alignment: Qt.AlignTop
0091             Layout.topMargin: Kirigami.Units.largeSpacing + Kirigami.Units.smallSpacing
0092             spacing: Kirigami.Units.largeSpacing
0093 
0094             Kirigami.Heading {
0095                 Layout.alignment: Qt.AlignTop
0096                 Layout.fillWidth: true
0097 
0098                 text: title
0099                 level: 4
0100                 maximumLineCount: 2
0101                 wrapMode: Text.Wrap
0102                 elide: Text.ElideRight
0103 
0104                 MouseArea {
0105                     id: titleMouseArea
0106                     anchors.fill: parent
0107                     cursorShape: Qt.PointingHandCursor
0108                     onClicked: root.clicked(mouse)
0109                 }
0110             }
0111         }
0112 
0113         Item { Layout.fillHeight: true }
0114     }
0115 }
0116