Warning, /utilities/mycroft-plasmoid/plasmoid/contents/ui/FullRepresentation.qml is written in an unsupported language. File is not indexed.
0001 /* Copyright 2019 Aditya Mehra <aix.m@outlook.com>
0002 Copyright 2018 Marco Martin <mart@kde.org>
0003
0004 This library is free software; you can redistribute it and/or
0005 modify it under the terms of the GNU Lesser General Public
0006 License as published by the Free Software Foundation; either
0007 version 2.1 of the License, or (at your option) version 3, or any
0008 later version accepted by the membership of KDE e.V. (or its
0009 successor approved by the membership of KDE e.V.), which shall
0010 act as a proxy defined in Section 6 of version 3 of the license.
0011
0012 This library is distributed in the hope that it will be useful,
0013 but WITHOUT ANY WARRANTY; without even the implied warranty of
0014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0015 Lesser General Public License for more details.
0016
0017 You should have received a copy of the GNU Lesser General Public
0018 License along with this library. If not, see <http://www.gnu.org/licenses/>.
0019 */
0020
0021 import QtQuick 2.9
0022 import QtQml.Models 2.2
0023 import QtQuick.Controls 2.2 as Controls
0024 import QtQuick.Layouts 1.3
0025 import org.kde.plasma.core 2.0 as PlasmaCore
0026 import org.kde.plasma.components 2.0 as PlasmaComponents
0027 import org.kde.plasma.extras 2.0 as PlasmaExtras
0028 import org.kde.plasma.plasmoid 2.0
0029 import org.kde.kirigami 2.5 as Kirigami
0030 import org.kde.private.mycroftplasmoid 1.0 as MycroftPlasmoid
0031 import Mycroft 1.0 as Mycroft
0032
0033 Item {
0034 id: root
0035 implicitWidth: Kirigami.Units.gridUnit * 20
0036 implicitHeight: Kirigami.Units.gridUnit * 32
0037 property bool cfg_notifications: plasmoid.configuration.notifications
0038 property var incomingString
0039
0040 Connections {
0041 target: Mycroft.MycroftController
0042 onIntentRecevied: {
0043 if(type == "recognizer_loop:utterance") {
0044 incomingString = data.utterances[0]
0045 }
0046 }
0047 }
0048
0049 Item {
0050 id: topBar
0051 anchors.top: parent.top
0052 anchors.left: parent.left
0053 anchors.right: parent.right
0054 height: Kirigami.Units.gridUnit * 4
0055
0056 ColumnLayout{
0057 anchors.fill: parent
0058
0059 TopBarViewComponent {
0060 id: topBarView
0061 Layout.fillWidth: true
0062 Layout.preferredHeight: Kirigami.Units.gridUnit * 2
0063 }
0064
0065 PlasmaCore.SvgItem {
0066 Layout.fillWidth: true
0067 Layout.preferredHeight: horlineSvg.elementSize("horizontal-line").height
0068
0069 elementId: "horizontal-line"
0070 svg: PlasmaCore.Svg {
0071 id: horlineSvg2;
0072 imagePath: "widgets/line"
0073 }
0074 }
0075
0076 PlasmaComponents.TabBar {
0077 id: tabBar
0078 visible: true
0079 Layout.fillWidth: true
0080 Layout.preferredHeight: Kirigami.Units.gridUnit * 1.5
0081
0082 PlasmaComponents.TabButton {
0083 id: mycroftTab
0084 iconSource: "go-home"
0085 text: i18n("Conversation")
0086 }
0087
0088 PlasmaComponents.TabButton {
0089 id: mycroftSkillsTab
0090 iconSource: "games-hint"
0091 text: i18n("Hints & Tips")
0092 }
0093
0094 PlasmaComponents.TabButton {
0095 id: mycroftMSMinstTab
0096 iconSource: "kmouth-phresebook-new"
0097 text: i18n("Skill Browser")
0098 }
0099 }
0100
0101 PlasmaCore.SvgItem {
0102 Layout.fillWidth: true
0103 Layout.preferredHeight: horlineSvg.elementSize("horizontal-line").height
0104
0105 elementId: "horizontal-line"
0106 svg: PlasmaCore.Svg {
0107 id: horlineSvg;
0108 imagePath: "widgets/line"
0109 }
0110 }
0111 }
0112 }
0113
0114 ColumnLayout {
0115 anchors.left: parent.left
0116 anchors.right: parent.right
0117 anchors.bottom: bottomBar.top
0118 anchors.top: topBar.bottom
0119 anchors.topMargin: Kirigami.Units.largeSpacing + Kirigami.Units.smallSpacing
0120 opacity: Mycroft.MycroftController.status == Mycroft.MycroftController.Open
0121 visible: tabBar.currentTab == mycroftTab;
0122
0123 Behavior on opacity {
0124 OpacityAnimator {
0125 duration: Kirigami.Units.longDuration
0126 easing.type: Easing.InOutCubic
0127 }
0128 }
0129
0130 Item {
0131 id: delegateItem
0132 Layout.fillWidth: true
0133 Layout.fillHeight: true
0134
0135 Mycroft.SkillView {
0136 id: skillView
0137 anchors.fill: parent
0138 Kirigami.Theme.colorSet: Kirigami.Theme.View
0139 anchors.margins: Kirigami.Units.largeSpacing
0140 clip: true
0141 onCurrentItemChanged: {
0142 backgroundVisible = false
0143 }
0144
0145 Connections {
0146 id: mycroftConnection
0147 target: Mycroft.MycroftController
0148
0149 onFallbackTextRecieved: {
0150 Mycroft.MycroftController.sendRequest("skill.desktop.applet.conversation", {"query": incomingString, "speak": data.utterance})
0151 if (!plasmoid.expanded && cfg_notifications == true) {
0152 var post = data.utterance;
0153 var title = "Mycroft's Reply:"
0154 var notiftext = " " + post;
0155 MycroftPlasmoid.Notify.mycroftResponse(title, notiftext);
0156 }
0157 }
0158 }
0159 }
0160 }
0161 }
0162
0163 Item {
0164 id: bottomBar
0165 anchors.bottom: root.bottom
0166 anchors.left: root.left
0167 anchors.right: root.right
0168 height: Kirigami.Units.gridUnit * 2
0169
0170 BottomBarViewComponent {
0171 id: bottomBarView
0172 }
0173 }
0174
0175 Image {
0176 anchors.centerIn: parent
0177 opacity: Mycroft.MycroftController.status != Mycroft.MycroftController.Open
0178 source: "../images/logo.png"
0179
0180 Behavior on opacity {
0181 OpacityAnimator {
0182 duration: Kirigami.Units.longDuration
0183 easing.type: Easing.InOutCubic
0184 }
0185 }
0186 }
0187
0188 ColumnLayout {
0189 id: mycroftSkillscolumntab
0190 visible: tabBar.currentTab == mycroftSkillsTab;
0191 anchors.left: parent.left
0192 anchors.right: parent.right
0193 anchors.bottom: bottomBar.top
0194 anchors.top: topBar.bottom
0195 anchors.topMargin: Kirigami.Units.largeSpacing + Kirigami.Units.smallSpacing
0196 anchors.bottomMargin: Kirigami.Units.smallSpacing
0197
0198 HintsViewComponent {
0199 id: hintsView
0200 }
0201 }
0202
0203 ColumnLayout {
0204 id: mycroftMsmColumn
0205 visible: tabBar.currentTab == mycroftMSMinstTab;
0206 anchors.left: parent.left
0207 anchors.right: parent.right
0208 anchors.bottom: bottomBar.top
0209 anchors.top: topBar.bottom
0210 anchors.topMargin: Kirigami.Units.largeSpacing + Kirigami.Units.smallSpacing
0211 anchors.bottomMargin: Kirigami.Units.smallSpacing
0212
0213 SkillsInstallerComponent{
0214 id: skillsInstallerView
0215 }
0216 }
0217 }