Warning, /utilities/mycroft-plasmoid/plasmoid/contents/ui/TopBarViewComponent.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 as Controls 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.extras 2.0 as PlasmaExtras 0028 import org.kde.kirigami 2.5 as Kirigami 0029 import QtGraphicalEffects 1.0 0030 import Mycroft 1.0 as Mycroft 0031 0032 Item { 0033 id: topBarBGrect 0034 property alias talkAnimation: midbarAnim 0035 property alias micIcon: qinputmicbx.iconSource 0036 0037 Connections { 0038 target: Mycroft.MycroftController 0039 onSpeakingChanged: { 0040 if (Mycroft.MycroftController.speaking){ 0041 midbarAnim.startTalking() 0042 } 0043 else { 0044 midbarAnim.stopTalking() 0045 } 0046 } 0047 onListeningChanged: { 0048 if (Mycroft.MycroftController.listening){ 0049 midbarAnim.startTalking() 0050 } 0051 else { 0052 midbarAnim.stopTalking() 0053 } 0054 } 0055 } 0056 0057 RowLayout { 0058 anchors.fill: parent 0059 0060 Image { 0061 id: logoImageArea 0062 Layout.alignment: Qt.AlignLeft 0063 Layout.preferredWidth: Kirigami.Units.gridUnit * 1.4 0064 Layout.preferredHeight: Kirigami.Units.gridUnit * 1.5 0065 source: "../images/mycroftsmaller.png" 0066 } 0067 0068 PlasmaComponents.Label { 0069 Layout.alignment: Qt.AlignLeft 0070 Layout.leftMargin: Kirigami.Units.smallSpacing 0071 font.capitalization: Font.SmallCaps 0072 id: logoTextArea 0073 text: i18n("Mycroft") 0074 font.bold: false; 0075 color: theme.textColor 0076 } 0077 0078 PlasmaCore.SvgItem { 0079 id: topbarLeftDividerline 0080 Layout.fillHeight: true 0081 Layout.preferredWidth: linetopleftvertSvg.elementSize("vertical-line").width 0082 elementId: "vertical-line" 0083 0084 svg: PlasmaCore.Svg { 0085 id: linetopleftvertSvg; 0086 imagePath: "widgets/line" 0087 } 0088 } 0089 0090 TopBarAnim { 0091 id: midbarAnim 0092 Layout.fillWidth: true 0093 Layout.preferredHeight: Kirigami.Units.gridUnit * 2 - Kirigami.Units.largeSpacing * 2 0094 Layout.topMargin: Kirigami.Units.largeSpacing + Kirigami.Units.smallSpacing 0095 0096 PlasmaComponents.Label { 0097 anchors.centerIn: parent 0098 opacity: Mycroft.MycroftController.status != Mycroft.MycroftController.Open 0099 text: i18n("Disconnected") 0100 wrapMode: Text.WordWrap 0101 } 0102 } 0103 0104 PlasmaCore.SvgItem { 0105 id: topbarDividerline 0106 Layout.fillHeight: true 0107 Layout.preferredWidth: linetopvertSvg.elementSize("vertical-line").width 0108 elementId: "vertical-line" 0109 0110 svg: PlasmaCore.Svg { 0111 id: linetopvertSvg; 0112 imagePath: "widgets/line" 0113 } 0114 } 0115 0116 PlasmaComponents.ToolButton { 0117 id: startBtn 0118 Layout.alignment: Qt.AlignRight 0119 iconSource: Mycroft.MycroftController.status != Mycroft.MycroftController.Open ? "draw-triangle2" : "media-playback-pause" 0120 tooltip: i18n("Connect") 0121 flat: true 0122 Layout.preferredWidth: Math.round(Kirigami.Units.gridUnit * 2) 0123 height: Layout.preferredWidth 0124 onClicked: { 0125 if(Mycroft.MycroftController.status != Mycroft.MycroftController.Open) { 0126 Mycroft.MycroftController.start(); 0127 } else { 0128 Mycroft.MycroftController.disconnectSocket(); 0129 } 0130 } 0131 } 0132 0133 0134 PlasmaComponents.ToolButton { 0135 id: qinputmicbx 0136 Layout.alignment: Qt.AlignRight 0137 iconSource: "mic-on" 0138 tooltip: i18n("Toggle Mic") 0139 flat: true 0140 Layout.preferredWidth: Math.round(Kirigami.Units.gridUnit * 2) 0141 height: Layout.preferredWidth 0142 } 0143 0144 PlasmaComponents.ToolButton { 0145 id: pinButton 0146 Layout.alignment: Qt.AlignRight 0147 Layout.preferredWidth: Math.round(Kirigami.Units.gridUnit * 1.5) 0148 height: Layout.preferredWidth 0149 checkable: true 0150 iconSource: "window-pin" 0151 onCheckedChanged: plasmoid.hideOnWindowDeactivate = !checked 0152 } 0153 } 0154 }