Warning, /utilities/telly-skout/src/qml/ChannelListDelegate.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2022 Plata Hill <plata.hill@kdemail.net>
0002 // SPDX-License-Identifier: LGPL-2.1-or-later
0003 
0004 import QtQuick 2.14
0005 import QtQuick.Controls 2.14 as Controls
0006 import QtQuick.Layouts 1.14
0007 import org.kde.TellySkout 1.0
0008 import org.kde.kirigami 2.19 as Kirigami
0009 
0010 Kirigami.SwipeListItem {
0011     id: listItem
0012 
0013     property var listView
0014     property bool sortable: false
0015 
0016     actions: [
0017         Kirigami.Action {
0018             icon.name: checked ? "favorite" : "list-add"
0019             text: i18n("Favorite")
0020             checkable: true
0021             checked: model.channel.favorite
0022             onToggled: channelsModel.setFavorite(model.channel.id, checked)
0023         }
0024     ]
0025 
0026     contentItem: RowLayout {
0027         Kirigami.ListItemDragHandle {
0028             listItem: listItem
0029             listView: listItem.listView
0030             onMoveRequested: sortable ? listView.model.move(oldIndex, newIndex) : {
0031             }
0032             visible: listItem.sortable
0033         }
0034 
0035         Kirigami.Icon {
0036             source: model.channel.refreshing ? "view-refresh" : model.channel.image === "" ? "tv" : Fetcher.image(model.channel.image)
0037         }
0038 
0039         Controls.Label {
0040             Layout.fillWidth: true
0041             height: Math.max(implicitHeight, Kirigami.Units.iconSizes.smallMedium)
0042             text: model.channel.displayName || model.channel.name
0043             color: listItem.checked || (listItem.pressed && !listItem.checked && !listItem.sectionDelegate) ? listItem.activeTextColor : listItem.textColor
0044         }
0045 
0046     }
0047 
0048 }