Warning, /system/mycroft-gui/application/SettingsPage.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * Copyright 2018 Marco Martin <mart@kde.org> 0003 * Copyright 2018 by Aditya Mehra <aix.m@outlook.com> 0004 * 0005 * Licensed under the Apache License, Version 2.0 (the "License"); 0006 * you may not use this file except in compliance with the License. 0007 * You may obtain a copy of the License at 0008 * 0009 * http://www.apache.org/licenses/LICENSE-2.0 0010 * 0011 * Unless required by applicable law or agreed to in writing, software 0012 * distributed under the License is distributed on an "AS IS" BASIS, 0013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0014 * See the License for the specific language governing permissions and 0015 * limitations under the License. 0016 * 0017 */ 0018 0019 import QtQuick 2.15 0020 import QtQuick.Layouts 1.15 0021 import QtQuick.Controls 2.15 as Controls 0022 import org.kde.kirigami 2.19 as Kirigami 0023 import Mycroft 1.0 as Mycroft 0024 0025 Kirigami.ScrollablePage { 0026 title: "Settings" 0027 objectName: "Settings" 0028 0029 globalToolBarStyle: Kirigami.ApplicationHeaderStyle.Titles 0030 Kirigami.Theme.colorSet: nightSwitch.checked ? Kirigami.Theme.Complementary : Kirigami.Theme.Window 0031 0032 ColumnLayout { 0033 id: settingsLayout 0034 width: parent.width 0035 implicitHeight: childrenRect.height 0036 spacing: Kirigami.Units.largeSpacing 0037 0038 Kirigami.Heading { 0039 id: websocketLabel 0040 level: 2 0041 font.bold: true 0042 color: Kirigami.Theme.textColor; 0043 Layout.fillWidth: true 0044 text: "Mycroft Core Address" 0045 } 0046 0047 Controls.Label { 0048 id: exampleLabel 0049 text: "Example: <tt>ws://192.168.1.1</tt>" 0050 Layout.fillWidth: true 0051 } 0052 0053 Controls.Control { 0054 Layout.fillWidth: true 0055 Layout.preferredHeight: Kirigami.Units.gridUnit * 3 0056 leftPadding: Kirigami.Units.largeSpacing 0057 rightPadding: Kirigami.Units.largeSpacing 0058 0059 background: Rectangle { 0060 Kirigami.Theme.colorSet: nightSwitch.checked ? Kirigami.Theme.Complementary : Kirigami.Theme.Window 0061 color: Kirigami.Theme.backgroundColor 0062 radius: 5 0063 } 0064 0065 contentItem: Controls.TextField { 0066 id: webSocketAddressField 0067 Kirigami.Theme.colorSet: nightSwitch.checked ? Kirigami.Theme.Complementary : Kirigami.Theme.Window 0068 0069 Component.onCompleted: { 0070 webSocketAddressField.text = Mycroft.GlobalSettings.webSocketAddress 0071 } 0072 } 0073 } 0074 0075 RowLayout { 0076 Layout.fillWidth: true 0077 Layout.preferredHeight: Kirigami.Units.gridUnit * 4 0078 0079 Controls.Button { 0080 id: applySettings 0081 Kirigami.Theme.colorSet: nightSwitch.checked ? Kirigami.Theme.Complementary : Kirigami.Theme.Window 0082 Layout.fillWidth: true 0083 Layout.preferredHeight: Kirigami.Units.gridUnit * 3 0084 text: "Apply" 0085 0086 onClicked:(mouse)=> { 0087 Mycroft.GlobalSettings.webSocketAddress = webSocketAddressField.text 0088 Mycroft.MycroftController.reconnect() 0089 } 0090 } 0091 0092 Controls.Button{ 0093 id: reverSettings 0094 Kirigami.Theme.colorSet: nightSwitch.checked ? Kirigami.Theme.Complementary : Kirigami.Theme.Window 0095 Layout.fillWidth: true 0096 Layout.preferredHeight: Kirigami.Units.gridUnit * 3 0097 text: "Revert" 0098 0099 onClicked:(mouse)=> { 0100 webSocketAddressField.text = "ws://0.0.0.0" 0101 Mycroft.GlobalSettings.webSocketAddress = webSocketAddressField.text 0102 Mycroft.MycroftController.reconnect() 0103 } 0104 } 0105 } 0106 0107 Item { 0108 Layout.preferredHeight: Kirigami.Units.largeSpacing * 2 0109 } 0110 0111 Controls.Switch { 0112 text: "Connect Automatically" 0113 checked: Mycroft.GlobalSettings.autoConnect 0114 onCheckedChanged: Mycroft.GlobalSettings.autoConnect = checked 0115 } 0116 0117 Controls.Switch { 0118 id: remoteSTTSwitch 0119 text: "Remote STT" 0120 checked: applicationSettings.usesRemoteSTT 0121 onCheckedChanged: applicationSettings.usesRemoteSTT = checked 0122 visible: Mycroft.GlobalSettings.displayRemoteConfig 0123 } 0124 0125 Controls.Switch { 0126 text: "Remote TTS" 0127 checked: Mycroft.GlobalSettings.usesRemoteTTS 0128 onCheckedChanged: Mycroft.GlobalSettings.usesRemoteTTS = checked 0129 visible: Mycroft.GlobalSettings.displayRemoteConfig 0130 } 0131 0132 Controls.Switch { 0133 text: "Bus Isolation" 0134 checked: Mycroft.GlobalSettings.useHivemindProtocol 0135 onCheckedChanged: Mycroft.GlobalSettings.useHivemindProtocol = checked 0136 } 0137 } 0138 }