Warning, /plasma/plasma-bigscreen/containments/homescreen/package/contents/ui/MycroftIndicator.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2019 Marco Martin <mart@kde.org>
0003     SPDX-FileCopyrightText: 2019 Aditya Mehra <aix.m@outlook.com>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 import QtQuick 2.14
0009 import QtQuick.Window 2.14
0010 import QtQuick.Layouts 1.14
0011 import QtQuick.Controls 2.14 as Controls
0012 import org.kde.kirigami 2.12 as Kirigami
0013 import Mycroft 1.0 as Mycroft
0014 
0015 RowLayout {
0016     id: mycroftStatusIndicator
0017 
0018     function disconnectclose() {
0019         Mycroft.MycroftController.disconnectSocket();
0020         mycroftIndicatorLoader.active = false;
0021     }
0022 
0023     Kirigami.Heading {
0024         id: inputQuery
0025         level: 3
0026         opacity: 0
0027         onTextChanged: {
0028             opacity = 1;
0029             utteranceTimer.restart();
0030         }
0031         Timer {
0032             id: utteranceTimer
0033             interval: 8000
0034             onTriggered: {
0035                 inputQuery.text = "";
0036                 inputQuery.opacity = 0
0037             }
0038         }
0039         Behavior on opacity {
0040             OpacityAnimator {
0041                 duration: Kirigami.Units.longDuration
0042                 easing.type: Easing.InOutQuad
0043             }
0044         }
0045 
0046         Connections {
0047             target: Mycroft.MycroftController
0048             onIntentRecevied: {
0049                 if(type == "recognizer_loop:utterance") {
0050                     inputQuery.text = data.utterances[0]
0051                 }
0052             }
0053             onServerReadyChanged: {
0054                 if (Mycroft.MycroftController.serverReady) {
0055                     inputQuery.text = "";
0056                 } else {
0057                     inputQuery.text = i18n("Getting Ready... Please Wait");
0058                     utteranceTimer.running = false;
0059                 }
0060             }
0061             onStatusChanged: {
0062                 switch (Mycroft.MycroftController.status) {
0063                 case Mycroft.MycroftController.Connecting:
0064                 case Mycroft.MycroftController.Error:
0065                 case Mycroft.MycroftController.Stopped:
0066                     inputQuery.text = i18n("Getting Ready... Please Wait");
0067                     utteranceTimer.running = false;
0068                     break;
0069                 default:
0070                     if (Mycroft.MycroftController.serverReady) {
0071                         inputQuery.text = "";
0072                     }
0073                     break;
0074                 }
0075 
0076             }
0077         }
0078     }
0079     Mycroft.StatusIndicator {
0080         id: si
0081         z: 2
0082         Layout.preferredWidth: height
0083         Layout.fillHeight: true
0084         hasShadow: false
0085     }
0086 }