Warning, /plasma-bigscreen/peertube-voice-application/ui/+mediacenter/PeerTubeSettings.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * Copyright 2020 by Aditya Mehra <aix.m@outlook.com> 0003 * 0004 * Licensed under the Apache License, Version 2.0 (the "License"); 0005 * you may not use this file except in compliance with the License. 0006 * You may obtain a copy of the License at 0007 * 0008 * http://www.apache.org/licenses/LICENSE-2.0 0009 * 0010 * Unless required by applicable law or agreed to in writing, software 0011 * distributed under the License is distributed on an "AS IS" BASIS, 0012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0013 * See the License for the specific language governing permissions and 0014 * limitations under the License. 0015 * 0016 */ 0017 0018 import QtQuick.Layouts 1.4 0019 import QtQuick 2.9 0020 import QtQuick.Controls 2.2 0021 import org.kde.kirigami 2.8 as Kirigami 0022 import Mycroft 1.0 as Mycroft 0023 0024 Mycroft.Delegate { 0025 id: configurePage 0026 property var instances_model: sessionData.instances_model 0027 topPadding: 0 0028 bottomPadding: 0 0029 leftPadding: 0 0030 rightPadding: 0 0031 0032 function getCurrentIndex(list, element) { 0033 if (list && element) { 0034 for (var i = 0; i < list.length; i++) { 0035 console.log(list[i], i) 0036 if (list[i] === element) { 0037 return i 0038 } 0039 } 0040 } 0041 return -1 0042 } 0043 0044 onFocusChanged: { 0045 if(focus){ 0046 instanceSelectorArea.forceActiveFocus() 0047 } 0048 } 0049 0050 Rectangle { 0051 color: "black" 0052 anchors.fill: parent 0053 0054 Item { 0055 id: contactsPageHeading 0056 width: parent.width 0057 height: Kirigami.Units.gridUnit * 3 0058 0059 Button { 0060 id: backButton 0061 anchors.left: parent.left 0062 anchors.leftMargin: Kirigami.Units.largeSpacing 0063 anchors.verticalCenter: parent.verticalCenter 0064 KeyNavigation.down: instanceSelectorArea 0065 height: Kirigami.Units.gridUnit * 3 0066 width: height 0067 0068 background: Rectangle { 0069 color: "transparent" 0070 radius: Kirigami.Units.gridUnit 0071 border.width: backButton.activeFocus ? 1 : 0 0072 border.color: backButton.activeFocus ? Kirigami.Theme.linkColor : "transparent" 0073 } 0074 0075 contentItem: Item { 0076 Image { 0077 anchors.centerIn: parent 0078 width: Kirigami.Units.iconSizes.medium 0079 height: width 0080 source: "./images/back.png" 0081 } 0082 } 0083 0084 Keys.onReturnPressed: { 0085 clicked() 0086 } 0087 0088 onClicked: { 0089 triggerGuiEvent("PeerTube.SettingsPage", {"settings_open": false}) 0090 } 0091 } 0092 0093 Kirigami.Heading { 0094 anchors.left: parent.left 0095 anchors.right: parent.right 0096 height: Kirigami.Units.gridUnit * 3 0097 horizontalAlignment: Text.AlignHCenter 0098 verticalAlignment: Text.AlignVCenter 0099 font.bold: true 0100 text: "Configure" 0101 color: Kirigami.Theme.highlightColor 0102 } 0103 } 0104 0105 Kirigami.Separator { 0106 id: headerSept 0107 anchors.top: contactsPageHeading.bottom 0108 anchors.topMargin: Kirigami.Units.largeSpacing 0109 width: parent.width 0110 height: 1 0111 } 0112 0113 Kirigami.Heading { 0114 level: 2 0115 id: instanceHeaderLabel 0116 anchors.top: headerSept.bottom 0117 anchors.left: parent.left 0118 anchors.right: parent.right 0119 anchors.topMargin: Kirigami.Units.largeSpacing 0120 horizontalAlignment: Text.AlignHCenter 0121 font.bold: true 0122 text: "Select Instance" 0123 color: Kirigami.Theme.highlightColor 0124 } 0125 0126 Rectangle { 0127 id: instanceSelectorArea 0128 anchors.top: instanceHeaderLabel.bottom 0129 anchors.left: parent.left 0130 anchors.right: parent.right 0131 anchors.margins: Kirigami.Units.largeSpacing 0132 height: Kirigami.Units.gridUnit * 4 0133 KeyNavigation.up: backButton 0134 KeyNavigation.down: cmbBxApplyBtn 0135 color: "transparent" 0136 border.width: instanceSelectorArea.activeFocus ? 1 : 0 0137 border.color: instanceSelectorArea.activeFocus ? Kirigami.Theme.linkColor : "transparent" 0138 0139 Keys.onReturnPressed: { 0140 cmbBx.forceActiveFocus() 0141 } 0142 0143 ComboBox { 0144 id: cmbBx 0145 anchors.fill: parent 0146 anchors.margins: Kirigami.Units.largeSpacing 0147 textRole: "hostname" 0148 valueRole: "hosturl" 0149 0150 Keys.onBackPressed: { 0151 instanceSelectorArea.forceActiveFocus() 0152 } 0153 0154 Keys.onEscapePressed: { 0155 instanceSelectorArea.forceActiveFocus() 0156 } 0157 0158 model: instances_model 0159 0160 Component.onCompleted: { 0161 currentIndex = getCurrentIndex(sessionData.instance_string_model, sessionData.current_instance) 0162 } 0163 } 0164 } 0165 0166 0167 Button { 0168 id: cmbBxApplyBtn 0169 anchors.top: instanceSelectorArea.bottom 0170 anchors.left: parent.left 0171 anchors.right: parent.right 0172 anchors.margins: Kirigami.Units.largeSpacing 0173 KeyNavigation.up: instanceSelectorArea 0174 KeyNavigation.down: backButton 0175 height: Kirigami.Units.gridUnit * 3 0176 0177 background: Rectangle { 0178 color: Kirigami.Theme.backgroundColor 0179 radius: Kirigami.Units.gridUnit 0180 border.width: cmbBxApplyBtn.activeFocus ? 1 : 0 0181 border.color: cmbBxApplyBtn.activeFocus ? Kirigami.Theme.linkColor : "transparent" 0182 } 0183 0184 contentItem: Item { 0185 Image { 0186 anchors.centerIn: parent 0187 width: Kirigami.Units.iconSizes.medium 0188 height: width 0189 source: "./images/apply.png" 0190 } 0191 } 0192 0193 onClicked: { 0194 triggerGuiEvent("PeerTube.ConfigureHost", {"selected_instance": cmbBx.currentValue}) 0195 } 0196 0197 Keys.onReturnPressed: { 0198 clicked() 0199 } 0200 } 0201 } 0202 } 0203 0204