Warning, /plasma-mobile/mycroft-plasmoid-mobile/plasmoid/contents/ui/Suggestions.qml is written in an unsupported language. File is not indexed.
0001 /* Copyright 2016 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 QtQuick.Controls 2.2
0022 import org.kde.plasma.core 2.0 as PlasmaCore
0023 import org.kde.plasma.plasmoid 2.0
0024 import org.kde.plasma.components 2.0 as PlasmaComponents
0025 import org.kde.plasma.extras 2.0 as PlasmaExtras
0026
0027 Rectangle {
0028 id: suggestionsmainitem
0029 color: theme.backgroundColor
0030 //anchors.fill: parent
0031 property alias suggest1: suggestiontext1.text
0032 property alias talkingAnim: midbarAnim
0033 property alias outterAnim: waitanimoutter
0034 property alias suggest3: suggestiontext3.text
0035
0036 Rectangle {
0037 id: suggestionbutton1
0038 color: theme.backgroundColor
0039 anchors.top: parent.top
0040 anchors.topMargin: 0
0041 anchors.bottom: parent.bottom
0042 anchors.bottomMargin: 0
0043 border.width: 0.2
0044 border.color: theme.textColor
0045 anchors.left: parent.left
0046 anchors.leftMargin: 0
0047 width: suggestionsmainitem.width / 3
0048
0049 PlasmaCore.IconItem {
0050 id: suggest1imageicon
0051 anchors.right: suggestiontext1.left
0052 anchors.rightMargin: units.gridUnit * 0.5
0053 anchors.verticalCenter: parent.verticalCenter
0054 source: "set-language"
0055 width: units.gridUnit * 2
0056 height: units.gridUnit * 2
0057 }
0058
0059 MouseArea {
0060 id: mouseArea1
0061 anchors.fill: parent
0062 hoverEnabled: true
0063
0064 onEntered: {
0065 suggestionbutton1.color = theme.textColor
0066 suggestiontext1.color = theme.backgroundColor
0067 }
0068
0069 onExited: {
0070 suggestionbutton1.color = theme.backgroundColor
0071 suggestiontext1.color = theme.textColor
0072 }
0073
0074 onClicked: {
0075 var socketmessage = {};
0076 socketmessage.type = "recognizer_loop:utterance";
0077 socketmessage.data = {};
0078 socketmessage.data.utterances = [qinput.text];
0079 socket.sendTextMessage(JSON.stringify(socketmessage));
0080 }
0081 }
0082
0083 PlasmaComponents.Label {
0084 id: suggestiontext1
0085 text: i18n("Ask Another")
0086 anchors.horizontalCenter: parent.horizontalCenter
0087 anchors.verticalCenter: parent.verticalCenter
0088 font.pixelSize: theme.defaultFont.pointSize - 4
0089 }
0090 }
0091
0092 PlasmaCore.SvgItem {
0093 id: suggestbarDividerline1
0094 anchors {
0095 left: suggestionbutton1.right
0096 //rightMargin: units.gridUnit * 0.25
0097 top: parent.top
0098 topMargin: 0
0099 bottom: parent.bottom
0100 bottomMargin: 0
0101 }
0102
0103 width: linesuggest1vertSvg.elementSize("vertical-line").width
0104 z: 110
0105 elementId: "vertical-line"
0106
0107 svg: PlasmaCore.Svg {
0108 id: linesuggest1vertSvg;
0109 imagePath: "widgets/line"
0110 }
0111 }
0112
0113 Rectangle {
0114 anchors.bottom: parent.bottom
0115 anchors.bottomMargin: 0
0116 anchors.top: parent.top
0117 anchors.topMargin: 0
0118 anchors.right: suggestionbutton3.left
0119 anchors.rightMargin: 0
0120 border.width: 0.2
0121 anchors.left: suggestbarDividerline1.right
0122 anchors.leftMargin: 0
0123 border.color: theme.textColor
0124 color: theme.linkColor
0125 z: 111
0126 clip: true
0127
0128 CustomMicIndicator {
0129 id: waitanimoutter
0130 anchors.top: parent.top
0131 anchors.bottom: parent.bottom
0132 anchors.left: parent.left
0133 anchors.right: parent.right
0134 visible: true
0135 z: 115
0136 }
0137
0138 TopBarAnim {
0139 id: midbarAnim
0140 anchors.verticalCenter: waitanimoutter.verticalCenter
0141 anchors.left: parent.left
0142 anchors.right: parent.right
0143 height: units.gridUnit * 3.5
0144 z: 114
0145 visible: true
0146 }
0147
0148 MouseArea {
0149 anchors.fill: parent
0150 onClicked: {
0151 var socketmessage = {};
0152 socketmessage.type = "mycroft.mic.listen";
0153 socketmessage.data = {};
0154 socketmessage.data.utterances = [];
0155 socket.sendTextMessage(JSON.stringify(socketmessage));
0156 }
0157
0158 }
0159 }
0160
0161 PlasmaCore.SvgItem {
0162 id: suggestbarDividerline2
0163 anchors {
0164 right: suggestionbutton3.left
0165 top: parent.top
0166 topMargin: 0
0167 bottom: parent.bottom
0168 bottomMargin: 0
0169 }
0170
0171 width: linesuggest2vertSvg.elementSize("vertical-line").width
0172 z: 110
0173 elementId: "vertical-line"
0174
0175 svg: PlasmaCore.Svg {
0176 id: linesuggest2vertSvg;
0177 imagePath: "widgets/line"
0178 }
0179 }
0180
0181 Rectangle {
0182 id: suggestionbutton3
0183 color: theme.backgroundColor
0184 anchors.bottom: parent.bottom
0185 anchors.bottomMargin: 0
0186 anchors.top: parent.top
0187 border.color: theme.textColor
0188 anchors.topMargin: 0
0189 anchors.right: parent.right
0190 anchors.rightMargin: 0
0191 border.width: 0.2
0192 width: parent.width / 3
0193
0194 PlasmaCore.IconItem {
0195 id: suggest3imageicon
0196 anchors.right: suggestiontext3.left
0197 anchors.rightMargin: units.gridUnit * 0.5
0198 anchors.verticalCenter: parent.verticalCenter
0199 source: "code-function"
0200 width: units.gridUnit * 2
0201 height: units.gridUnit * 2
0202 }
0203
0204 MouseArea {
0205 id: mouseArea3
0206 anchors.fill: parent
0207 hoverEnabled: true
0208
0209 onEntered: {
0210 suggestionbutton3.color = theme.textColor
0211 suggestiontext3.color = theme.backgroundColor
0212 }
0213
0214 onExited: {
0215 suggestionbutton3.color = theme.backgroundColor
0216 suggestiontext3.color = theme.textColor
0217 }
0218
0219 onClicked: {
0220 convoLmodel.clear()
0221 }
0222 }
0223
0224 PlasmaComponents.Label {
0225 id: suggestiontext3
0226 text: i18n("Clear")
0227 anchors.verticalCenter: parent.verticalCenter
0228 anchors.horizontalCenter: parent.horizontalCenter
0229 font.pixelSize: theme.defaultFont.pointSize - 4
0230 }
0231 }
0232 }