Warning, /multimedia/haruna/src/qml/PlayListItemWithThumbnail.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2020 George Florea Bănuș <georgefb899@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-3.0-or-later 0005 */ 0006 0007 import QtQuick 0008 import QtQuick.Controls 0009 import QtQuick.Layouts 0010 0011 import org.kde.kirigami as Kirigami 0012 import org.kde.haruna 0013 import org.kde.haruna.settings 0014 0015 ItemDelegate { 0016 id: root 0017 0018 property bool isLocal: model.isLocal 0019 property string rowNumber: (index + 1).toString() 0020 property var alpha: PlaylistSettings.overlayVideo ? 0.6 : 1 0021 0022 implicitWidth: ListView.view.width 0023 implicitHeight: (Kirigami.Units.gridUnit - 6) * 8 0024 padding: 0 0025 highlighted: model.isPlaying 0026 0027 onDoubleClicked: { 0028 mpv.playlistProxyModel.setPlayingItem(index) 0029 mpv.loadFile(path) 0030 mpv.pause = false 0031 } 0032 0033 background: Rectangle { 0034 anchors.fill: parent 0035 color: { 0036 if (hovered) { 0037 return Qt.alpha(Kirigami.Theme.hoverColor, alpha) 0038 } 0039 0040 if (highlighted) { 0041 return Qt.alpha(Kirigami.Theme.highlightColor, alpha) 0042 } 0043 0044 return Qt.alpha(Kirigami.Theme.backgroundColor, alpha) 0045 } 0046 } 0047 0048 contentItem: Item { 0049 anchors.fill: parent 0050 RowLayout { 0051 anchors.fill: parent 0052 anchors.rightMargin: Kirigami.Units.largeSpacing 0053 spacing: Kirigami.Units.largeSpacing 0054 0055 Label { 0056 text: pad(root.rowNumber, playlistView.count.toString().length) 0057 color: root.hovered || root.highlighted ? Kirigami.Theme.highlightedTextColor : Kirigami.Theme.textColor 0058 visible: PlaylistSettings.showRowNumber 0059 font.pointSize: (window.isFullScreen() && PlaylistSettings.bigFontFullscreen) 0060 ? Kirigami.Units.gridUnit 0061 : Kirigami.Units.gridUnit - 6 0062 horizontalAlignment: Qt.AlignCenter 0063 Layout.leftMargin: Kirigami.Units.largeSpacing 0064 0065 function pad(number, length) { 0066 while (number.length < length) 0067 number = "0" + number; 0068 return number; 0069 } 0070 } 0071 0072 Rectangle { 0073 width: 1 0074 color: Kirigami.Theme.alternateBackgroundColor 0075 visible: PlaylistSettings.showRowNumber 0076 Layout.fillHeight: true 0077 } 0078 0079 Item { 0080 width: (root.height - 20) * 1.33 0081 height: root.height - 20 0082 0083 Image { 0084 anchors.fill: parent 0085 source: "image://thumbnail/" + model.path 0086 sourceSize.width: parent.width 0087 sourceSize.height: parent.height 0088 width: parent.width 0089 height: parent.height 0090 asynchronous: true 0091 fillMode: Image.PreserveAspectCrop 0092 0093 Rectangle { 0094 visible: model.duration.length > 0 0095 height: durationLabel.font.pointSize + (Kirigami.Units.smallSpacing * 2) 0096 anchors.left: parent.left 0097 anchors.bottom: parent.bottom 0098 anchors.right: parent.right 0099 color: Qt.alpha(Kirigami.Theme.textColor, 0.4) 0100 0101 Label { 0102 id: durationLabel 0103 0104 anchors.centerIn: parent 0105 anchors.margins: Kirigami.Units.largeSpacing 0106 color: Kirigami.Theme.highlightedTextColor 0107 horizontalAlignment: Qt.AlignCenter 0108 text: model.duration 0109 font.pointSize: (window.isFullScreen() && PlaylistSettings.bigFontFullscreen) 0110 ? Kirigami.Units.gridUnit 0111 : Kirigami.Units.gridUnit - 5 0112 0113 Layout.margins: Kirigami.Units.largeSpacing 0114 } 0115 } 0116 } 0117 } 0118 0119 Kirigami.Icon { 0120 source: "media-playback-start" 0121 color: root.hovered || root.highlighted ? Kirigami.Theme.highlightedTextColor : Kirigami.Theme.textColor 0122 width: Kirigami.Units.iconSizes.small 0123 height: Kirigami.Units.iconSizes.small 0124 visible: model.isPlaying 0125 0126 Layout.leftMargin: PlaylistSettings.showRowNumber ? 0 : Kirigami.Units.largeSpacing 0127 } 0128 0129 LabelWithTooltip { 0130 text: PlaylistSettings.showMediaTitle ? model.title : model.name 0131 color: root.hovered || root.highlighted ? Kirigami.Theme.highlightedTextColor : Kirigami.Theme.textColor 0132 horizontalAlignment: Qt.AlignLeft 0133 verticalAlignment: Qt.AlignVCenter 0134 elide: Text.ElideRight 0135 wrapMode: Text.WrapAtWordBoundaryOrAnywhere 0136 font.pointSize: (window.isFullScreen() && PlaylistSettings.bigFontFullscreen) 0137 ? Kirigami.Units.gridUnit 0138 : Kirigami.Units.gridUnit - 5 0139 font.weight: model.isPlaying ? Font.ExtraBold : Font.Normal 0140 layer.enabled: true 0141 Layout.fillWidth: true 0142 Layout.fillHeight: true 0143 Layout.topMargin: Kirigami.Units.largeSpacing 0144 Layout.bottomMargin: Kirigami.Units.largeSpacing 0145 Layout.leftMargin: PlaylistSettings.showRowNumber || model.isPlaying ? 0 : Kirigami.Units.largeSpacing 0146 } 0147 } 0148 } 0149 }