Warning, /plasma/plasma-bigscreen/kcms/kdeconnect/ui/delegates/DeviceDelegate.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2020 Aditya Mehra <aix.m@outlook.com>
0003     SPDX-FileCopyrightText: 2019 Marco Martin <mart@kde.org>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 import QtQuick 2.14
0009 import QtQuick.Layouts 1.14
0010 import QtQuick.Controls 2.14
0011 import org.kde.plasma.core 2.0 as PlasmaCore
0012 import org.kde.plasma.components 3.0 as PlasmaComponents
0013 import org.kde.kirigami 2.12 as Kirigami
0014 import org.kde.mycroft.bigscreen 1.0 as BigScreen
0015 import Qt5Compat.GraphicalEffects
0016 
0017 BigScreen.AbstractDelegate {
0018     id: delegate
0019 
0020     implicitWidth: listView.cellWidth * 2
0021     implicitHeight: listView.height
0022     property QtObject deviceObj: device
0023     
0024     Behavior on implicitWidth {
0025         NumberAnimation {
0026             duration: Kirigami.Units.longDuration
0027             easing.type: Easing.InOutQuad
0028         }
0029     }
0030     
0031     Keys.onReturnPressed: {
0032         clicked();
0033     }
0034     
0035     onClicked: {
0036         listView.currentIndex = index
0037         deviceConnectionView.forceActiveFocus()
0038     }
0039 
0040     contentItem: Item {
0041         id: deviceItemLayout
0042         
0043         Item {
0044             id: deviceSvgIcon
0045             width: PlasmaCore.Units.iconSizes.huge
0046             height: width
0047             y: deviceItemLayout.height / 2 - deviceSvgIcon.height / 2
0048             
0049             Kirigami.Icon {
0050                 anchors.centerIn: parent
0051                 source: model.iconName
0052                 width: Kirigami.Units.iconSizes.large
0053                 height: width
0054             }
0055         }
0056         
0057         ColumnLayout {
0058             id: textLayout
0059             
0060             anchors {
0061                 left: deviceSvgIcon.right
0062                 right: deviceItemLayout.right
0063                 top: deviceSvgIcon.top
0064                 bottom: deviceSvgIcon.bottom
0065                 leftMargin: Kirigami.Units.smallSpacing
0066             }
0067 
0068             PlasmaComponents.Label {
0069                 id: deviceNameLabel
0070                 Layout.fillWidth: true
0071                 visible: text.length > 0
0072                 elide: Text.ElideRight
0073                 wrapMode: Text.WordWrap
0074                 horizontalAlignment: Text.AlignHCenter
0075                 maximumLineCount: 2
0076                 textFormat: Text.PlainText
0077                 color: Kirigami.Theme.textColor
0078                 text: i18n(model.display)
0079             }
0080             
0081             PlasmaComponents.Label {
0082                 id: deviceToolTip
0083                 Layout.fillWidth: true
0084                 visible: text.length > 0
0085                 elide: Text.ElideRight
0086                 wrapMode: Text.WordWrap
0087                 horizontalAlignment: Text.AlignHCenter
0088                 maximumLineCount: 2
0089                 textFormat: Text.PlainText
0090                 color: Kirigami.Theme.textColor
0091                 text: i18n(model.toolTip)
0092             }
0093         }
0094     }
0095 }