shift-shell/components/mobileshell/qml/volumeosd/AudioApplet.qml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

236 lines
7.1 KiB
QML
Raw Normal View History

2021-06-05 03:40:54 +00:00
/*
* SPDX-FileCopyrightText: 2014-2015 Harald Sitter <sitter@kde.org>
* SPDX-FileCopyrightText: 2021 Devin Lin <espidev@gmail.com>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQuick
import QtQuick.Layouts
import QtQuick.Window
2023-05-13 02:07:48 +00:00
import QtQuick.Controls as Controls
2021-06-05 03:40:54 +00:00
import org.kde.kirigami 2.20 as Kirigami
2021-06-05 03:40:54 +00:00
import org.kde.plasma.components 3.0 as PlasmaComponents
import org.kde.kquickcontrolsaddons as KQCAddons
import org.kde.plasma.private.mobileshell as MobileShell
2021-06-05 03:40:54 +00:00
import org.kde.plasma.private.volume
2021-06-05 03:40:54 +00:00
// capture presses on the audio applet so it doesn't close the overlay
ColumnLayout {
id: audioApplet
2021-06-05 03:40:54 +00:00
spacing: 0
2024-07-27 03:47:44 +00:00
Kirigami.Theme.colorSet: Kirigami.Theme.View
Kirigami.Theme.inherit: false
property real scale: 1.0
2021-06-05 03:40:54 +00:00
PulseObjectFilterModel {
id: paSinkFilterModel
sortRoleName: "SortByDefault"
2021-06-05 03:40:54 +00:00
sortOrder: Qt.DescendingOrder
filterOutInactiveDevices: true
sourceModel: MobileShell.AudioInfo.paSinkModel
2021-06-05 03:40:54 +00:00
}
SourceModel {
id: paSourceModel
}
PulseObjectFilterModel {
id: paSourceFilterModel
sortRoleName: "SortByDefault"
2021-06-05 03:40:54 +00:00
sortOrder: Qt.DescendingOrder
filterOutInactiveDevices: true
sourceModel: paSourceModel
}
CardModel {
id: paCardModel
}
// ui elements
2024-07-27 03:47:44 +00:00
2021-06-05 03:40:54 +00:00
PopupCard {
Layout.alignment: Qt.AlignHCenter
Layout.bottomMargin: Kirigami.Units.gridUnit
transform: Scale {
origin.x: Math.round(implicitWidth / 2)
origin.y: Math.round(height / 2)
xScale: audioApplet.scale
yScale: audioApplet.scale
}
2021-06-05 03:40:54 +00:00
contentItem: ColumnLayout {
anchors.rightMargin: Kirigami.Units.smallSpacing
anchors.leftMargin: Kirigami.Units.smallSpacing
2024-07-27 03:47:44 +00:00
Kirigami.Heading {
2021-06-05 03:40:54 +00:00
level: 2
text: i18n("Outputs")
Layout.fillWidth: true
Layout.topMargin: Kirigami.Units.smallSpacing
Layout.leftMargin: Kirigami.Units.smallSpacing
2021-06-05 03:40:54 +00:00
}
2024-07-27 03:47:44 +00:00
2021-06-05 03:40:54 +00:00
Repeater {
id: sinkView
Layout.fillWidth: true
2024-07-27 03:47:44 +00:00
2021-06-05 03:40:54 +00:00
model: paSinkFilterModel
delegate: DeviceListItem {
Layout.fillWidth: true
Layout.margins: Kirigami.Units.smallSpacing
2021-06-05 03:40:54 +00:00
type: "sink"
onlyone: sinkView.count === 1
}
}
}
}
2024-07-27 03:47:44 +00:00
2021-06-05 03:40:54 +00:00
PopupCard {
Layout.alignment: Qt.AlignHCenter
Layout.bottomMargin: Kirigami.Units.gridUnit
transform: Scale {
origin.x: Math.round(implicitWidth / 2)
origin.y: Math.round(height / 2)
xScale: audioApplet.scale
yScale: audioApplet.scale
}
2021-06-05 03:40:54 +00:00
contentItem: ColumnLayout {
anchors.rightMargin: Kirigami.Units.smallSpacing
anchors.leftMargin: Kirigami.Units.smallSpacing
2024-07-27 03:47:44 +00:00
Kirigami.Heading {
2021-06-05 03:40:54 +00:00
level: 2
text: i18n("Inputs")
Layout.fillWidth: true
Layout.topMargin: Kirigami.Units.smallSpacing
Layout.leftMargin: Kirigami.Units.smallSpacing
2021-06-05 03:40:54 +00:00
}
2024-07-27 03:47:44 +00:00
2021-06-05 03:40:54 +00:00
Repeater {
id: sourceView
Layout.fillWidth: true
2024-07-27 03:47:44 +00:00
2021-06-05 03:40:54 +00:00
model: paSourceFilterModel
delegate: DeviceListItem {
Layout.fillWidth: true
Layout.margins: Kirigami.Units.smallSpacing
2021-06-05 03:40:54 +00:00
type: "source"
onlyone: sinkView.count === 1
}
}
}
}
2024-07-27 03:47:44 +00:00
2021-06-05 03:40:54 +00:00
PopupCard {
visible: sourceInputView.model.count + sourceMediaInputView.model.count !== 0
Layout.alignment: Qt.AlignHCenter
Layout.bottomMargin: Kirigami.Units.gridUnit
transform: Scale {
origin.x: Math.round(implicitWidth / 2)
origin.y: Math.round(height / 2)
xScale: audioApplet.scale
yScale: audioApplet.scale
}
2021-06-05 03:40:54 +00:00
contentItem: ColumnLayout {
anchors.rightMargin: Kirigami.Units.smallSpacing
anchors.leftMargin: Kirigami.Units.smallSpacing
2024-07-27 03:47:44 +00:00
Kirigami.Heading {
2021-06-05 03:40:54 +00:00
level: 2
text: i18n("Playback Streams")
Layout.fillWidth: true
Layout.topMargin: Kirigami.Units.smallSpacing
Layout.leftMargin: Kirigami.Units.smallSpacing
2021-06-05 03:40:54 +00:00
}
2024-07-27 03:47:44 +00:00
2021-06-05 03:40:54 +00:00
Repeater {
id: sourceMediaInputView
Layout.fillWidth: true
2024-07-27 03:47:44 +00:00
2021-06-05 03:40:54 +00:00
model: PulseObjectFilterModel {
filters: [ { role: "Name", value: "sink-input-by-media-role:event" } ]
sourceModel: StreamRestoreModel {}
}
delegate: StreamListItem {
Layout.fillWidth: true
Layout.margins: Kirigami.Units.smallSpacing
2021-06-05 03:40:54 +00:00
width: sourceOutputView.width
type: "sink-input"
devicesModel: sourceView.model
}
}
2024-07-27 03:47:44 +00:00
2021-06-05 03:40:54 +00:00
Repeater {
id: sourceInputView
Layout.fillWidth: true
2024-07-27 03:47:44 +00:00
2021-06-05 03:40:54 +00:00
model: PulseObjectFilterModel {
filters: [ { role: "VirtualStream", value: false } ]
sourceModel: SinkInputModel {}
}
delegate: StreamListItem {
Layout.fillWidth: true
Layout.margins: Kirigami.Units.smallSpacing
2021-06-05 03:40:54 +00:00
width: sourceOutputView.width
type: "sink-input"
devicesModel: sourceView.model
}
}
}
}
2024-07-27 03:47:44 +00:00
2021-06-05 03:40:54 +00:00
PopupCard {
visible: sourceOutputView.model.count !== 0
Layout.alignment: Qt.AlignHCenter
Layout.bottomMargin: Kirigami.Units.gridUnit
transform: Scale {
origin.x: Math.round(implicitWidth / 2)
origin.y: Math.round(height / 2)
xScale: audioApplet.scale
yScale: audioApplet.scale
}
2021-06-05 03:40:54 +00:00
contentItem: ColumnLayout {
anchors.rightMargin: Kirigami.Units.smallSpacing
anchors.leftMargin: Kirigami.Units.smallSpacing
2024-07-27 03:47:44 +00:00
Kirigami.Heading {
2021-06-05 03:40:54 +00:00
level: 2
text: i18n("Recording Streams")
Layout.fillWidth: true
Layout.topMargin: Kirigami.Units.smallSpacing
Layout.leftMargin: Kirigami.Units.smallSpacing
2021-06-05 03:40:54 +00:00
}
2024-07-27 03:47:44 +00:00
2021-06-05 03:40:54 +00:00
Repeater {
id: sourceOutputView
Layout.fillWidth: true
2024-07-27 03:47:44 +00:00
2021-06-05 03:40:54 +00:00
model: PulseObjectFilterModel {
filters: [ { role: "VirtualStream", value: false } ]
sourceModel: SourceOutputModel {}
}
delegate: StreamListItem {
Layout.fillWidth: true
Layout.margins: Kirigami.Units.smallSpacing
2021-06-05 03:40:54 +00:00
width: sourceOutputView.width
type: "source-output"
devicesModel: sourceView.model
}
}
}
}
}