Warning, /plasma-bigscreen/peertube-voice-application/ui/+mediacenter/delegates/VideoCard.qml is written in an unsupported language. File is not indexed.
0001 import QtQuick 2.9
0002 import QtQuick.Layouts 1.4
0003 import QtGraphicalEffects 1.0
0004 import QtQuick.Controls 2.3
0005 import org.kde.kirigami 2.8 as Kirigami
0006 import org.kde.plasma.core 2.0 as PlasmaCore
0007 import org.kde.plasma.components 3.0 as PlasmaComponents3
0008 import org.kde.plasma.components 2.0 as PlasmaComponents
0009 import Mycroft 1.0 as Mycroft
0010 import org.kde.mycroft.bigscreen 1.0 as BigScreen
0011
0012 BigScreen.AbstractDelegate {
0013 id: delegate
0014
0015 implicitWidth: listView.cellWidth
0016 height: parent.height
0017
0018 contentItem: ColumnLayout {
0019 spacing: Kirigami.Units.smallSpacing
0020
0021 Item {
0022 id: imgRoot
0023 //clip: true
0024 Layout.alignment: Qt.AlignTop
0025 Layout.fillWidth: true
0026 Layout.topMargin: -delegate.topPadding + delegate.topInset + extraBorder
0027 Layout.leftMargin: -delegate.leftPadding + delegate.leftInset + extraBorder
0028 Layout.rightMargin: -delegate.rightPadding + delegate.rightInset + extraBorder
0029 // Any width times 0.5625 is a 16:9 ratio
0030 // Adding baseRadius is needed to prevent the bottom from being rounded
0031 Layout.preferredHeight: width * 0.5625 + delegate.baseRadius
0032 // FIXME: another thing copied from AbstractDelegate
0033 property real extraBorder: 0
0034
0035 layer.enabled: true
0036 layer.effect: OpacityMask {
0037 cached: true
0038 maskSource: Rectangle {
0039 x: imgRoot.x;
0040 y: imgRoot.y
0041 width: imgRoot.width
0042 height: imgRoot.height
0043 radius: delegate.baseRadius
0044 }
0045 }
0046
0047 Image {
0048 id: img
0049 source: "https://" + modelData.channel.host + modelData.thumbnail_path
0050 anchors {
0051 fill: parent
0052 // To not round under
0053 bottomMargin: delegate.baseRadius
0054 }
0055 opacity: 1
0056 fillMode: Image.PreserveAspectCrop
0057
0058 Rectangle {
0059 id: videoDurationTime
0060 anchors.bottom: parent.bottom
0061 anchors.bottomMargin: Kirigami.Units.largeSpacing
0062 anchors.right: parent.right
0063 anchors.rightMargin: Kirigami.Units.largeSpacing
0064 // FIXME: kind of hacky to get the padding around the text right
0065 width: durationText.width + Kirigami.Units.largeSpacing
0066 height: Kirigami.Units.gridUnit
0067 radius: delegate.baseRadius
0068 visible: modelData.duration ? 1 : 0
0069 color: Qt.rgba(0, 0, 0, 0.8)
0070
0071 PlasmaComponents.Label {
0072 id: durationText
0073 anchors.centerIn: parent
0074 text: timeSanitize(modelData.duration)
0075 color: Kirigami.Theme.textColor
0076 }
0077 }
0078 }
0079
0080 states: [
0081 State {
0082 when: delegate.isCurrent
0083 PropertyChanges {
0084 target: imgRoot
0085 extraBorder: delegate.borderSize
0086 }
0087 },
0088 State {
0089 when: !delegate.isCurrent
0090 PropertyChanges {
0091 target: imgRoot
0092 extraBorder: 0
0093 }
0094 }
0095 ]
0096 transitions: Transition {
0097 onRunningChanged: {
0098 // Optimize when animating the thumbnail
0099 img.smooth = !running
0100 }
0101 NumberAnimation {
0102 property: "extraBorder"
0103 duration: Kirigami.Units.longDuration
0104 easing.type: Easing.InOutQuad
0105 }
0106 }
0107 }
0108
0109 ColumnLayout {
0110 Layout.fillWidth: true
0111 Layout.fillHeight: true
0112 // Compensate for blank space created from not rounding thumbnail bottom corners
0113 Layout.topMargin: -delegate.baseRadius
0114 Layout.alignment: Qt.AlignLeft | Qt.AlignTop
0115 spacing: Kirigami.Units.smallSpacing
0116
0117 Kirigami.Heading {
0118 id: videoLabel
0119 Layout.fillWidth: true
0120 Layout.alignment: Qt.AlignLeft | Qt.AlignTop
0121 wrapMode: Text.Wrap
0122 level: 3
0123 maximumLineCount: 1
0124 elide: Text.ElideRight
0125 color: PlasmaCore.ColorScope.textColor
0126 Component.onCompleted: {
0127 text = modelData.name
0128 }
0129 }
0130
0131 PlasmaComponents.Label {
0132 id: videoChannelName
0133 Layout.fillWidth: true
0134 wrapMode: Text.WordWrap
0135 Layout.alignment: Qt.AlignLeft | Qt.AlignTop
0136 maximumLineCount: 1
0137 elide: Text.ElideRight
0138 color: PlasmaCore.ColorScope.textColor
0139 text: modelData.channel.display_name
0140 }
0141
0142 RowLayout {
0143 Layout.fillWidth: true
0144
0145 PlasmaComponents.Label {
0146 id: videoViews
0147 Layout.alignment: Qt.AlignLeft
0148 Layout.rightMargin: Kirigami.Units.largeSpacing
0149 elide: Text.ElideRight
0150 color: PlasmaCore.ColorScope.textColor
0151 text: modelData.views
0152 }
0153
0154 PlasmaComponents.Label {
0155 id: videoUploadDate
0156 Layout.fillWidth: true
0157 Layout.alignment: Qt.AlignRight | Qt.AlignTop
0158 horizontalAlignment: Text.AlignRight
0159 elide: Text.ElideRight
0160 color: PlasmaCore.ColorScope.textColor
0161 text: setPublishedDate(modelData.published_at)
0162 }
0163 }
0164 }
0165 }
0166
0167 onClicked: {
0168 busyIndicatorPop.open()
0169 triggerGuiEvent("PeerTube.WatchVideo", modelData)
0170 }
0171 }