Warning, /plasma/plasma-bigscreen/kcms/audio-device-chooser/ui/SettingsItem.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2019 Aditya Mehra <aix.m@outlook.com> 0003 SPDX-FileCopyrightText: 2019 Marco Martin <mart@kde.org> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 import QtQuick 2.14 0009 import QtQuick.Layouts 1.14 0010 import QtQuick.Controls 2.14 0011 import org.kde.plasma.components 3.0 as PlasmaComponents 0012 import org.kde.plasma.extras 2.0 as PlasmaExtras 0013 import org.kde.kirigami 2.12 as Kirigami 0014 import org.kde.mycroft.bigscreen 1.0 as BigScreen 0015 import Qt5Compat.GraphicalEffects 0016 import org.kde.plasma.private.volume 0.1 0017 0018 import "delegates" as Delegates 0019 import "code/icon.js" as Icon 0020 0021 Item { 0022 id: delegateSettingsItem 0023 property bool isPlayback: type.substring(0, 4) == "sink" 0024 property string type 0025 readonly property var currentPort: Ports[ActivePortIndex] 0026 readonly property ListView listView: ListView.view 0027 width: listView.width 0028 height: listView.height 0029 0030 onActiveFocusChanged: { 0031 if(activeFocus){ 0032 if(model.PulseObject.default){ 0033 volObj.forceActiveFocus() 0034 } else { 0035 setDefBtn.forceActiveFocus() 0036 } 0037 } 0038 } 0039 0040 Keys.onBackPressed: { 0041 backBtnSettingsItem.clicked() 0042 } 0043 0044 Item { 0045 id: colLayoutSettingsItem 0046 clip: true 0047 anchors { 0048 top: parent.top 0049 left: parent.left 0050 right: parent.right 0051 bottom: footerAreaSettingsSept.top 0052 margins: Kirigami.Units.largeSpacing * 2 0053 } 0054 0055 Item { 0056 anchors.centerIn: parent 0057 width: parent.width 0058 height: dIcon.height + label1.paintedHeight + label2.paintedHeight + lblSept.height + lblSept2.height + setDefBtn.height + (volObj.height * 2) 0059 0060 Kirigami.Icon { 0061 id: dIcon 0062 anchors.top: parent.top 0063 anchors.horizontalCenter: parent.horizontalCenter 0064 width: parent.width 0065 height: width / 4 0066 source: Icon.name(Volume, Muted, isPlayback ? "audio-volume" : "microphone-sensitivity") 0067 } 0068 0069 Kirigami.Heading { 0070 id: label1 0071 width: parent.width 0072 anchors.top: dIcon.bottom 0073 anchors.topMargin: Kirigami.Units.largeSpacing 0074 horizontalAlignment: Text.AlignHCenter 0075 wrapMode: Text.WordWrap 0076 level: 2 0077 maximumLineCount: 2 0078 elide: Text.ElideRight 0079 color: Kirigami.Theme.textColor 0080 font.pixelSize: textMetrics.font.pixelSize * 1.25 0081 text: currentPort.description 0082 } 0083 0084 Kirigami.Heading { 0085 id: label2 0086 width: parent.width 0087 anchors.top: label1.bottom 0088 anchors.topMargin: Kirigami.Units.largeSpacing 0089 horizontalAlignment: Text.AlignHCenter 0090 wrapMode: Text.WordWrap 0091 level: 2 0092 maximumLineCount: 2 0093 elide: Text.ElideRight 0094 color: Kirigami.Theme.textColor 0095 font.pixelSize: textMetrics.font.pixelSize * 0.9 0096 text: Description 0097 } 0098 0099 Kirigami.Separator { 0100 id: lblSept 0101 anchors.top: label2.bottom 0102 anchors.topMargin: Kirigami.Units.largeSpacing 0103 height: 1 0104 width: parent.width 0105 } 0106 0107 Button { 0108 id: setDefBtn 0109 //enabled: PulseObject.default ? 1 : 0 0110 KeyNavigation.up: backBtnSettingsItem 0111 KeyNavigation.down: volObj 0112 width: parent.width 0113 height: Kirigami.Units.gridUnit * 2 0114 anchors.top: lblSept.bottom 0115 anchors.topMargin: Kirigami.Units.smallSpacing 0116 0117 Keys.onReturnPressed: { 0118 model.PulseObject.default = true; 0119 listView.currentIndex = index 0120 volObj.forceActiveFocus() 0121 } 0122 0123 background: Rectangle { 0124 color: setDefBtn.activeFocus ? Kirigami.Theme.highlightColor : Kirigami.Theme.backgroundColor 0125 } 0126 0127 contentItem: Item { 0128 RowLayout { 0129 anchors.centerIn: parent 0130 Kirigami.Icon { 0131 Layout.preferredWidth: Kirigami.Units.iconSizes.medium 0132 Layout.preferredHeight: Kirigami.Units.iconSizes.medium 0133 source: Qt.resolvedUrl("images/green-tick-thick.svg") 0134 enabled: model.PulseObject.default ? 1 : 0 0135 } 0136 } 0137 } 0138 0139 onClicked: { 0140 model.PulseObject.default = true; 0141 listView.currentIndex = index 0142 } 0143 } 0144 0145 Kirigami.Separator { 0146 id: lblSept2 0147 anchors.top: setDefBtn.bottom 0148 anchors.topMargin: Kirigami.Units.smallSpacing 0149 height: 1 0150 width: parent.width 0151 } 0152 0153 Item { 0154 anchors.top: lblSept2.bottom 0155 anchors.topMargin: Kirigami.Units.largeSpacing 0156 width: parent.width 0157 height: volObj.height 0158 0159 Delegates.VolumeObject { 0160 id: volObj 0161 anchors.left: parent.left 0162 anchors.right: parent.right 0163 anchors.verticalCenter: parent.verticalCenter 0164 0165 Keys.onRightPressed: { 0166 increaseVal() 0167 } 0168 Keys.onLeftPressed: { 0169 decreaseVal() 0170 } 0171 0172 Keys.onDownPressed: { 0173 backBtnSettingsItem.forceActiveFocus() 0174 } 0175 } 0176 0177 PlasmaExtras.Highlight { 0178 z: -2 0179 anchors.fill: parent 0180 anchors.margins: -Kirigami.Units.gridUnit / 4 0181 visible: volObj.activeFocus ? 1 : 0 0182 } 0183 } 0184 } 0185 } 0186 0187 Kirigami.Separator { 0188 id: footerAreaSettingsSept 0189 anchors.bottom: footerAreaSettingsItem.top 0190 anchors.bottomMargin: Kirigami.Units.largeSpacing 0191 anchors.left: parent.left 0192 anchors.right: parent.right 0193 anchors.leftMargin: Kirigami.Units.largeSpacing * 2 0194 anchors.rightMargin: Kirigami.Units.largeSpacing * 2 0195 height: 1 0196 } 0197 0198 RowLayout { 0199 id: footerAreaSettingsItem 0200 anchors.bottom: parent.bottom 0201 anchors.left: parent.left 0202 anchors.right: parent.right 0203 anchors.margins: Kirigami.Units.largeSpacing * 2 0204 height: Kirigami.Units.gridUnit * 2 0205 0206 PlasmaComponents.Button { 0207 id: backBtnSettingsItem 0208 icon.name: "arrow-left" 0209 Layout.alignment: Qt.AlignLeft 0210 KeyNavigation.up: volObj 0211 0212 PlasmaExtras.Highlight { 0213 z: -2 0214 anchors.fill: parent 0215 anchors.margins: -Kirigami.Units.gridUnit / 4 0216 visible: backBtnSettingsItem.activeFocus ? 1 : 0 0217 } 0218 0219 Keys.onReturnPressed: { 0220 clicked() 0221 } 0222 0223 onClicked: { 0224 if(type == "sink"){ 0225 sinkView.forceActiveFocus() 0226 } else if (type == "source") { 0227 sourceView.forceActiveFocus() 0228 } 0229 } 0230 } 0231 0232 Label { 0233 id: backbtnlabelHeading 0234 text: i18n("Press the [←] Back button to return to device selection") 0235 wrapMode: Text.WordWrap 0236 maximumLineCount: 2 0237 Layout.fillWidth: true 0238 Layout.alignment: Qt.AlignRight 0239 } 0240 } 0241 } 0242