Warning, /utilities/mycroft-plasmoid/plasmoid/contents/ui/MsmView.qml is written in an unsupported language. File is not indexed.

0001 /* Copyright 2019 Aditya Mehra <aix.m@outlook.com>                            
0002 
0003     This library is free software; you can redistribute it and/or
0004     modify it under the terms of the GNU Lesser General Public
0005     License as published by the Free Software Foundation; either
0006     version 2.1 of the License, or (at your option) version 3, or any
0007     later version accepted by the membership of KDE e.V. (or its
0008     successor approved by the membership of KDE e.V.), which shall
0009     act as a proxy defined in Section 6 of version 3 of the license.
0010     
0011     This library is distributed in the hope that it will be useful,
0012     but WITHOUT ANY WARRANTY; without even the implied warranty of
0013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0014     Lesser General Public License for more details.
0015     
0016     You should have received a copy of the GNU Lesser General Public
0017     License along with this library.  If not, see <http://www.gnu.org/licenses/>.
0018 */
0019 
0020 import QtQuick 2.9
0021 import QtQml.Models 2.2
0022 import QtQuick.Controls 2.2
0023 import QtQuick.Layouts 1.3
0024 import org.kde.plasma.core 2.0 as PlasmaCore
0025 import org.kde.plasma.plasmoid 2.0
0026 import org.kde.plasma.components 2.0 as PlasmaComponents
0027 import org.kde.plasma.components 3.0 as PlasmaComponents3
0028 import org.kde.plasma.extras 2.0 as PlasmaExtras
0029 import QtGraphicalEffects 1.0
0030 import org.kde.kirigami 2.5 as Kirigami
0031 import Mycroft 1.0 as Mycroft
0032 
0033 Kirigami.AbstractCard {
0034     id: skillInstallerDelegate
0035     
0036     contentItem: Item {
0037         implicitWidth: delegateLayout.implicitWidth;
0038         implicitHeight: delegateLayout.implicitHeight;
0039     
0040         ColumnLayout{
0041             id: delegateLayout
0042             anchors {
0043                 left: parent.left;
0044                 top: parent.top;
0045                 right: parent.right;
0046             }
0047             
0048             Kirigami.Heading {
0049                 id: skillName
0050                 Layout.fillWidth: true;
0051                 wrapMode: Text.WordWrap;
0052                 font.bold: true;
0053                 text: qsTr(model.name);
0054                 level: 3;
0055                 color: Kirigami.Theme.textColor;
0056             }
0057             
0058             RowLayout {
0059                 id: skillInfoRow
0060                 spacing: Kirigami.Units.largeSpacing
0061                 Layout.fillWidth: true
0062             
0063                 PlasmaCore.IconItem {
0064                     id: innerskImg
0065                     source: "download";
0066                     Layout.preferredWidth: innerskImg.width
0067                     Layout.preferredHeight: innerskImg.height
0068                     width: Kirigami.Units.gridUnit * 2
0069                     height: Kirigami.Units.gridUnit * 2
0070                 }
0071                 
0072                 Label {
0073                     id: skillURL
0074                     wrapMode: Text.WordWrap
0075                     color: theme.textColor
0076                     text: "View Repository"
0077                     Layout.fillWidth: true;
0078 
0079                     MouseArea{
0080                         id: gotoGit
0081                         anchors.fill: parent
0082                         hoverEnabled: true
0083                         onClicked: {Qt.openUrlExternally(model.url)}
0084                         onEntered: {
0085                             skillURL.color = Qt.darker(theme.linkColor, 1.2)
0086                         }
0087                         onExited: {
0088                             skillURL.color = theme.textColor
0089                         }
0090                     }
0091                 }
0092             }
0093         
0094             PlasmaComponents.Button{
0095                 id: actionItem
0096                 text: "Install"
0097                 Layout.fillWidth: true
0098                 onClicked:{
0099                     switch(actionItem.text){
0100                     case "Install":
0101                         Mycroft.MycroftController.sendText("install " + skillName.text)
0102                         break
0103                     case "Uninstall":
0104                         var msmprogress = execUninstall()
0105                         break
0106                     }
0107                 }
0108             }
0109         }
0110     }
0111 }
0112