Warning, /plasma/plasma-bigscreen/kcms/audio-device-chooser/ui/DeviceChooserPage.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2019-2020 Aditya Mehra <aix.m@outlook.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 import QtQuick 2.14 0008 import QtQuick.Layouts 1.14 0009 import QtQuick.Controls 2.14 as Controls 0010 import QtQuick.Window 2.14 0011 import org.kde.plasma.core 2.0 as PlasmaCore 0012 import org.kde.kquickcontrolsaddons 2.0 0013 import org.kde.kirigami 2.12 as Kirigami 0014 import org.kde.plasma.private.volume 0.1 0015 import org.kde.mycroft.bigscreen 1.0 as BigScreen 0016 0017 import "delegates" as Delegates 0018 import "views" as Views 0019 0020 FocusScope { 0021 id: mainFlick 0022 0023 Rectangle { 0024 id: headerAreaTop 0025 anchors.left: parent.left 0026 anchors.right: parent.right 0027 anchors.leftMargin: -Kirigami.Units.largeSpacing 0028 anchors.rightMargin: -Kirigami.Units.largeSpacing 0029 height: parent.height * 0.075 0030 z: 10 0031 gradient: Gradient { 0032 GradientStop { position: 0.1; color: Qt.rgba(0, 0, 0, 0.5) } 0033 GradientStop { position: 0.9; color: Qt.rgba(0, 0, 0, 0.25) } 0034 } 0035 0036 Kirigami.Heading { 0037 level: 1 0038 anchors.fill: parent 0039 anchors.topMargin: Kirigami.Units.largeSpacing 0040 anchors.leftMargin: Kirigami.Units.largeSpacing * 2 0041 anchors.bottomMargin: Kirigami.Units.largeSpacing 0042 color: Kirigami.Theme.textColor 0043 text: "Audio Settings" 0044 } 0045 } 0046 0047 Item { 0048 id: footerMain 0049 anchors.left: parent.left 0050 anchors.right: settingsView.left 0051 anchors.leftMargin: -Kirigami.Units.largeSpacing 0052 anchors.bottom: parent.bottom 0053 implicitHeight: Kirigami.Units.gridUnit * 2 0054 0055 Controls.Button { 0056 id: kcmcloseButton 0057 implicitHeight: Kirigami.Units.gridUnit * 2 0058 anchors.left: parent.left 0059 anchors.right: parent.right 0060 0061 background: Rectangle { 0062 color: kcmcloseButton.activeFocus ? Kirigami.Theme.highlightColor : Kirigami.Theme.backgroundColor 0063 } 0064 0065 contentItem: Item { 0066 RowLayout { 0067 anchors.centerIn: parent 0068 Kirigami.Icon { 0069 Layout.preferredWidth: PlasmaCore.Units.iconSizes.small 0070 Layout.preferredHeight: PlasmaCore.Units.iconSizes.small 0071 source: "window-close" 0072 } 0073 Controls.Label { 0074 text: i18n("Exit") 0075 } 0076 } 0077 } 0078 0079 Keys.onUpPressed: root.activateDeviceView() 0080 0081 onClicked: { 0082 Window.window.close() 0083 } 0084 0085 Keys.onReturnPressed: { 0086 Window.window.close() 0087 } 0088 } 0089 } 0090 0091 0092 SourceModel { 0093 id: paSourceModel 0094 } 0095 0096 SinkModel { 0097 id: paSinkModel 0098 } 0099 0100 Item { 0101 anchors.top: headerAreaTop.bottom 0102 anchors.topMargin: Kirigami.Units.largeSpacing * 2 0103 width: parent.width - settingsView.width 0104 anchors.bottom: footerMain.top 0105 clip: true 0106 0107 ColumnLayout { 0108 id: contentLayout 0109 width: parent.width 0110 property Item currentSection 0111 y: currentSection ? (currentSection.y > parent.height / 2 ? -currentSection.y + Kirigami.Units.gridUnit * 3 : 0) : 0 0112 anchors.left: parent.left 0113 anchors.leftMargin: Kirigami.Units.largeSpacing 0114 0115 Behavior on y { 0116 NumberAnimation { 0117 duration: Kirigami.Units.longDuration * 2 0118 easing.type: Easing.InOutQuad 0119 } 0120 } 0121 0122 BigScreen.TileView { 0123 id: sinkView 0124 model: paSinkModel 0125 focus: true 0126 Layout.alignment: Qt.AlignTop 0127 title: i18n("Playback Devices") 0128 currentIndex: 0 0129 onActiveFocusChanged: { 0130 if(activeFocus){ 0131 contentLayout.currentSection = sinkView 0132 settingsViewDetails.model = sinkView.model 0133 settingsViewDetails.positionViewAtIndex(currentIndex, ListView.Center); 0134 settingsViewDetails.checkPlayBack = true 0135 settingsViewDetails.typeDevice = "sink" 0136 } 0137 } 0138 delegate: Delegates.AudioDelegate { 0139 isPlayback: true 0140 type: "sink" 0141 } 0142 navigationDown: sourceView.visible ? sourceView : kcmcloseButton 0143 0144 onCurrentItemChanged: { 0145 settingsViewDetails.currentIndex = sinkView.currentIndex 0146 settingsViewDetails.positionViewAtIndex(sinkView.currentIndex, ListView.Center); 0147 } 0148 } 0149 0150 Item { 0151 id: extraSpacing 0152 Layout.preferredHeight: Kirigami.Units.largeSpacing 0153 Layout.fillWidth: true 0154 } 0155 0156 BigScreen.TileView { 0157 id: sourceView 0158 model: paSourceModel 0159 title: i18n("Recording Devices") 0160 currentIndex: 0 0161 focus: false 0162 Layout.alignment: Qt.AlignTop 0163 visible: sourceView.view.count > 0 ? 1 : 0 0164 onActiveFocusChanged: { 0165 if(activeFocus){ 0166 contentLayout.currentSection = sourceView 0167 settingsViewDetails.model = sourceView.model 0168 settingsViewDetails.positionViewAtIndex(currentIndex, ListView.Center); 0169 settingsViewDetails.checkPlayBack = false 0170 settingsViewDetails.typeDevice = "source" 0171 } 0172 } 0173 delegate: Delegates.AudioDelegate { 0174 isPlayback: false 0175 type: "source" 0176 } 0177 navigationUp: sinkView 0178 navigationDown: kcmcloseButton 0179 0180 onCurrentItemChanged: { 0181 settingsViewDetails.currentIndex = sourceView.currentIndex 0182 settingsViewDetails.positionViewAtIndex(currentIndex, ListView.Center); 0183 } 0184 } 0185 0186 Component.onCompleted: { 0187 sinkView.forceActiveFocus(); 0188 } 0189 0190 Connections { 0191 target: root 0192 onActivateDeviceView: { 0193 sinkView.forceActiveFocus(); 0194 } 0195 } 0196 0197 Item { 0198 Layout.preferredHeight: Kirigami.Units.gridUnit * 5 0199 } 0200 } 0201 } 0202 0203 Kirigami.Separator { 0204 id: viewSept 0205 anchors.right: settingsView.left 0206 anchors.top: settingsView.top 0207 anchors.bottom: settingsView.bottom 0208 width: 1 0209 } 0210 0211 Rectangle { 0212 id: settingsView 0213 anchors.top: parent.top 0214 anchors.right: parent.right 0215 anchors.rightMargin: -Kirigami.Units.smallSpacing 0216 height: parent.height 0217 width: Kirigami.Units.gridUnit * 15 0218 color: Kirigami.Theme.backgroundColor 0219 0220 ListView { 0221 id: settingsViewDetails 0222 anchors.fill: parent 0223 anchors.topMargin: parent.height * 0.075 0224 layoutDirection: Qt.LeftToRight 0225 orientation: ListView.Horizontal 0226 snapMode: ListView.SnapOneItem; 0227 highlightRangeMode: ListView.StrictlyEnforceRange 0228 highlightFollowsCurrentItem: true 0229 spacing: Kirigami.Units.largeSpacing 0230 clip: true 0231 interactive: false 0232 implicitHeight: settingsView.implicitHeight 0233 currentIndex: 0 0234 property bool checkPlayBack 0235 property string typeDevice 0236 delegate: SettingsItem { 0237 isPlayback: settingsViewDetails.checkPlayBack 0238 type: settingsViewDetails.typeDevice 0239 } 0240 } 0241 } 0242 }