Warning, /plasma-bigscreen/mycroft-skill-installer/app/qml/delegates/TileDelegate.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *   SPDX-FileCopyrightText: 2019-2020 Aditya Mehra <aix.m@outlook.org>
0003  *   SPDX-FileCopyrightText: 2019-2020 Marco Martin <mart@kde.org>
0004  *
0005  *   SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-KDE-Accepted-GPL
0006  */
0007 
0008 import QtQuick 2.9
0009 import QtQuick.Layouts 1.3
0010 import QtQuick.Controls 2.3 as Controls
0011 import org.kde.plasma.core 2.0 as PlasmaCore
0012 import org.kde.kirigami 2.12 as Kirigami
0013 import QtGraphicalEffects 1.0
0014 import org.kde.mycroft.bigscreen 1.0 as BigScreen
0015 import GlobalConfiguration 1.0
0016 import SysInfo 1.0
0017 
0018 import "../code/SkillUtils.js" as SkillUtils
0019 
0020 BigScreen.AbstractDelegate {
0021     id: delegate
0022 
0023     implicitWidth: listView.cellWidth
0024     implicitHeight: listView.height
0025 
0026     property var skillInfo
0027     property bool delDisbaled: false
0028     property var backendType: GlobalConfiguration.backendConfig
0029     property var systemUser: GlobalConfiguration.getSystemUser()
0030 
0031     onClicked: {
0032         if(!delDisbaled){
0033             listView.currentIndex = index
0034             lview.setItem()
0035             installerBox.open()
0036         }
0037     }
0038 
0039     Keys.onReturnPressed: {
0040         clicked()
0041     }
0042 
0043     Component.onCompleted: {
0044         if (downloadlink1.substring(downloadlink1.lastIndexOf('/') + 1) != "skill.json"){
0045             delegate.delDisbaled = true;
0046         } else {
0047             SkillUtils.populateSkillInfo(backendType, systemUser)
0048         }
0049     }
0050 
0051     onSkillInfoChanged: {
0052         installedBox.visible = skillInfo.skillInstalled
0053     }
0054 
0055     contentItem: Item {
0056 
0057         Rectangle {
0058             anchors.fill: parent
0059             visible: delDisbaled
0060             enabled: delDisbaled
0061             color: Qt.rgba(0, 0, 0, 0.95)
0062             z: 200
0063 
0064             Kirigami.Heading {
0065                 anchors.top: parent.top
0066                 anchors.topMargin: Kirigami.Units.largeSpacing
0067                 width: parent.width
0068                 horizontalAlignment: Text.AlignHCenter
0069                 level: 3
0070                 text: name
0071             }
0072 
0073             Kirigami.Heading {
0074                 anchors.verticalCenter: parent.verticalCenter
0075                 anchors.horizontalCenter: parent.horizontalCenter
0076                 level: 3
0077                 text: "Skill Disabled\nContact Author\n" + personid
0078             }
0079 
0080             Kirigami.Heading {
0081                 anchors.bottom: parent.bottom
0082                 anchors.bottomMargin: Kirigami.Units.largeSpacing
0083                 width: parent.width
0084                 horizontalAlignment: Text.AlignHCenter
0085                 level: 3
0086                 color: Kirigami.Theme.linkColor
0087                 text: "Error: Invalid JSON"
0088             }
0089         }
0090 
0091         Kirigami.Heading {
0092             id: label
0093             visible: text.length > 0
0094             level: 3
0095             width: parent.width
0096             height: Kirigami.Units.gridUnit * 1.5
0097             wrapMode: Text.WordWrap
0098             horizontalAlignment: Text.AlignHCenter
0099             maximumLineCount: 2
0100             elide: Text.ElideRight
0101             color: PlasmaCore.ColorScope.textColor
0102             text: name
0103         }
0104 
0105         Image {
0106             id: icon
0107             width: parent.width * 0.5625
0108             height: width
0109             sourceSize.height: parent.width
0110             sourceSize.width: parent.height
0111             anchors.top: label.bottom
0112             anchors.topMargin: Kirigami.Units.largeSpacing * 2
0113             anchors.horizontalCenter: parent.horizontalCenter
0114             fillMode: Image.Stretch
0115             source: previewpic1
0116         }
0117 
0118         Kirigami.Separator {
0119             id: descSep
0120             anchors.top: icon.bottom
0121             anchors.topMargin: Kirigami.Units.largeSpacing * 2
0122             width: parent.width
0123             height: 1
0124             color: Kirigami.Theme.textColor
0125             visible: true
0126         }
0127 
0128         Kirigami.Heading {
0129             visible: text.length > 0
0130             wrapMode: Text.WordWrap
0131             horizontalAlignment: Text.AlignHCenter
0132             anchors.top: descSep.bottom
0133             anchors.topMargin: Kirigami.Units.largeSpacing * 2
0134             width: parent.width
0135             level: 3
0136             maximumLineCount: 4
0137             elide: Text.ElideRight
0138             color: PlasmaCore.ColorScope.textColor
0139             text: description
0140         }
0141 
0142         Item {
0143             id: installedBox
0144             visible: false
0145             anchors.bottom: parent.bottom
0146             width: parent.width
0147             height: Kirigami.Units.gridUnit * 3
0148 
0149             Kirigami.Separator {
0150                 id: iconSep
0151                 width: parent.width
0152                 height: 1
0153                 color: Kirigami.Theme.textColor
0154                 visible: true
0155             }
0156 
0157             RowLayout {
0158                 anchors.top: iconSep.bottom
0159                 anchors.horizontalCenter: parent.horizontalCenter
0160 
0161                 Image {
0162                     id: iconInstall
0163                     Layout.topMargin: Kirigami.Units.largeSpacing
0164                     Layout.alignment: Qt.AlignHCenter
0165                     Layout.preferredWidth: Kirigami.Units.iconSizes.medium
0166                     Layout.preferredHeight: width
0167                     source: "qrc:/qml/images/green-tick-thick.svg"
0168                     visible: true
0169                 }
0170 
0171                 Kirigami.Heading {
0172                     level: 3
0173                     Layout.topMargin: Kirigami.Units.largeSpacing
0174                     Layout.alignment: Qt.AlignHCenter
0175                     text: "Installed"
0176                 }
0177 
0178                 Kirigami.Icon {
0179                     visible: itemUpdateStatus
0180                     enabled: visible
0181                     source: "update-none"
0182                     Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
0183                     Layout.preferredWidth: iconInstall.width
0184                     Layout.preferredHeight: iconInstall.height
0185                     color: Kirigami.Theme.highlightColor
0186                 }
0187             }
0188         }
0189     }
0190 }