Warning, /multimedia/haruna/src/qml/PlayListItemCompact.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 0010 import org.kde.kirigami as Kirigami 0011 import org.kde.haruna 0012 import org.kde.haruna.settings 0013 0014 ItemDelegate { 0015 id: root 0016 0017 property bool isLocal: model.isLocal 0018 property string rowNumber: (index + 1).toString() 0019 property var alpha: PlaylistSettings.overlayVideo ? 0.6 : 1 0020 0021 implicitWidth: ListView.view.width 0022 padding: 0 0023 highlighted: model.isPlaying 0024 0025 background: Rectangle { 0026 anchors.fill: parent 0027 color: { 0028 if (hovered) { 0029 return Qt.alpha(Kirigami.Theme.hoverColor, alpha) 0030 } 0031 0032 if (highlighted) { 0033 return Qt.alpha(Kirigami.Theme.highlightColor, alpha) 0034 } 0035 0036 return Qt.alpha(Kirigami.Theme.backgroundColor, alpha) 0037 } 0038 } 0039 0040 contentItem: Kirigami.IconTitleSubtitle { 0041 icon.name: model.isPlaying ? "media-playback-start" : "" 0042 icon.color: color 0043 title: mainText() 0044 subtitle: model.duration 0045 color: root.hovered || root.highlighted ? Kirigami.Theme.highlightedTextColor : Kirigami.Theme.textColor 0046 ToolTip.text: title 0047 ToolTip.visible: root.hovered 0048 } 0049 0050 onDoubleClicked: { 0051 mpv.playlistProxyModel.setPlayingItem(index) 0052 mpv.loadFile(path) 0053 mpv.pause = false 0054 } 0055 0056 function mainText() { 0057 const rowNumber = pad(root.rowNumber, playlistView.count.toString().length) + ". " 0058 0059 if(PlaylistSettings.showRowNumber) { 0060 return rowNumber + (PlaylistSettings.showMediaTitle ? model.title : model.name) 0061 } 0062 return (PlaylistSettings.showMediaTitle ? model.title : model.name) 0063 } 0064 0065 function pad(number, length) { 0066 while (number.length < length) 0067 number = "0" + number; 0068 return number; 0069 } 0070 }