Warning, /plasma/plasma-mobile/components/mobileshell/qml/volumeosd/AudioApplet.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 * SPDX-FileCopyrightText: 2014-2015 Harald Sitter <sitter@kde.org>
0003 * SPDX-FileCopyrightText: 2021 Devin Lin <espidev@gmail.com>
0004 *
0005 * SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007
0008 import QtQuick
0009 import QtQuick.Layouts
0010 import QtQuick.Window
0011 import QtQuick.Controls as Controls
0012
0013 import org.kde.kirigami 2.20 as Kirigami
0014 import org.kde.plasma.components 3.0 as PlasmaComponents
0015 import org.kde.kquickcontrolsaddons as KQCAddons
0016 import org.kde.plasma.private.mobileshell as MobileShell
0017
0018 import org.kde.plasma.private.volume
0019
0020 // capture presses on the audio applet so it doesn't close the overlay
0021 ColumnLayout {
0022 spacing: 0
0023
0024 PulseObjectFilterModel {
0025 id: paSinkFilterModel
0026 sortRoleName: "SortByDefault"
0027 sortOrder: Qt.DescendingOrder
0028 filterOutInactiveDevices: true
0029 sourceModel: MobileShell.AudioInfo.paSinkModel
0030 }
0031
0032 SourceModel {
0033 id: paSourceModel
0034 }
0035
0036 PulseObjectFilterModel {
0037 id: paSourceFilterModel
0038 sortRoleName: "SortByDefault"
0039 sortOrder: Qt.DescendingOrder
0040 filterOutInactiveDevices: true
0041 sourceModel: paSourceModel
0042 }
0043
0044 CardModel {
0045 id: paCardModel
0046 }
0047
0048 // ui elements
0049
0050 PopupCard {
0051 Layout.alignment: Qt.AlignHCenter
0052 Layout.bottomMargin: Kirigami.Units.gridUnit
0053 contentItem: ColumnLayout {
0054 anchors.rightMargin: Kirigami.Units.smallSpacing
0055 anchors.leftMargin: Kirigami.Units.smallSpacing
0056
0057 Kirigami.Heading {
0058 level: 2
0059 text: i18n("Outputs")
0060 Layout.fillWidth: true
0061 Layout.topMargin: Kirigami.Units.smallSpacing
0062 Layout.leftMargin: Kirigami.Units.smallSpacing
0063 }
0064
0065 Repeater {
0066 id: sinkView
0067 Layout.fillWidth: true
0068
0069 model: paSinkFilterModel
0070 delegate: DeviceListItem {
0071 Layout.fillWidth: true
0072 Layout.margins: Kirigami.Units.smallSpacing
0073 type: "sink"
0074 onlyone: sinkView.count === 1
0075 }
0076 }
0077 }
0078 }
0079
0080 PopupCard {
0081 Layout.alignment: Qt.AlignHCenter
0082 Layout.bottomMargin: Kirigami.Units.gridUnit
0083 contentItem: ColumnLayout {
0084 anchors.rightMargin: Kirigami.Units.smallSpacing
0085 anchors.leftMargin: Kirigami.Units.smallSpacing
0086
0087 Kirigami.Heading {
0088 level: 2
0089 text: i18n("Inputs")
0090 Layout.fillWidth: true
0091 Layout.topMargin: Kirigami.Units.smallSpacing
0092 Layout.leftMargin: Kirigami.Units.smallSpacing
0093 }
0094
0095 Repeater {
0096 id: sourceView
0097 Layout.fillWidth: true
0098
0099 model: paSourceFilterModel
0100 delegate: DeviceListItem {
0101 Layout.fillWidth: true
0102 Layout.margins: Kirigami.Units.smallSpacing
0103 type: "source"
0104 onlyone: sinkView.count === 1
0105 }
0106 }
0107 }
0108 }
0109
0110 PopupCard {
0111 visible: sourceInputView.model.count + sourceMediaInputView.model.count !== 0
0112 Layout.alignment: Qt.AlignHCenter
0113 Layout.bottomMargin: Kirigami.Units.gridUnit
0114 contentItem: ColumnLayout {
0115 anchors.rightMargin: Kirigami.Units.smallSpacing
0116 anchors.leftMargin: Kirigami.Units.smallSpacing
0117
0118 Kirigami.Heading {
0119 level: 2
0120 text: i18n("Playback Streams")
0121 Layout.fillWidth: true
0122 Layout.topMargin: Kirigami.Units.smallSpacing
0123 Layout.leftMargin: Kirigami.Units.smallSpacing
0124 }
0125
0126 Repeater {
0127 id: sourceMediaInputView
0128 Layout.fillWidth: true
0129
0130 model: PulseObjectFilterModel {
0131 filters: [ { role: "Name", value: "sink-input-by-media-role:event" } ]
0132 sourceModel: StreamRestoreModel {}
0133 }
0134 delegate: StreamListItem {
0135 Layout.fillWidth: true
0136 Layout.margins: Kirigami.Units.smallSpacing
0137 width: sourceOutputView.width
0138 type: "sink-input"
0139 devicesModel: sourceView.model
0140 }
0141 }
0142
0143 Repeater {
0144 id: sourceInputView
0145 Layout.fillWidth: true
0146
0147 model: PulseObjectFilterModel {
0148 filters: [ { role: "VirtualStream", value: false } ]
0149 sourceModel: SinkInputModel {}
0150 }
0151
0152 delegate: StreamListItem {
0153 Layout.fillWidth: true
0154 Layout.margins: Kirigami.Units.smallSpacing
0155 width: sourceOutputView.width
0156 type: "sink-input"
0157 devicesModel: sourceView.model
0158 }
0159 }
0160 }
0161 }
0162
0163 PopupCard {
0164 visible: sourceOutputView.model.count !== 0
0165 Layout.alignment: Qt.AlignHCenter
0166 Layout.bottomMargin: Kirigami.Units.gridUnit
0167 contentItem: ColumnLayout {
0168 anchors.rightMargin: Kirigami.Units.smallSpacing
0169 anchors.leftMargin: Kirigami.Units.smallSpacing
0170
0171 Kirigami.Heading {
0172 level: 2
0173 text: i18n("Recording Streams")
0174 Layout.fillWidth: true
0175 Layout.topMargin: Kirigami.Units.smallSpacing
0176 Layout.leftMargin: Kirigami.Units.smallSpacing
0177 }
0178
0179 Repeater {
0180 id: sourceOutputView
0181 Layout.fillWidth: true
0182
0183 model: PulseObjectFilterModel {
0184 filters: [ { role: "VirtualStream", value: false } ]
0185 sourceModel: SourceOutputModel {}
0186 }
0187 delegate: StreamListItem {
0188 Layout.fillWidth: true
0189 Layout.margins: Kirigami.Units.smallSpacing
0190 width: sourceOutputView.width
0191 type: "source-output"
0192 devicesModel: sourceView.model
0193 }
0194 }
0195 }
0196 }
0197 }