72 lines
3.4 KiB
QML
72 lines
3.4 KiB
QML
pragma ComponentBehavior: Bound
|
|
import QtQuick
|
|
import QtQuick.Controls.Material
|
|
import QtQuick.Controls
|
|
import QtQuick.Layouts
|
|
import Quickshell.Services.Pipewire
|
|
import "services"
|
|
import "components"
|
|
|
|
ScrollView {
|
|
id: page
|
|
Material.theme: Theme.dark ? Material.Dark : Material.Light
|
|
Material.accent: Theme.primary
|
|
clip: true
|
|
contentWidth: availableWidth
|
|
ColumnLayout {
|
|
width: page.availableWidth
|
|
spacing: 16
|
|
Label { text: "Звук"; font.pixelSize: 24; color: Theme.primary }
|
|
Label {
|
|
visible: !Hardware.audioReady
|
|
text: "Аудиосервис недоступен. Проверьте PipeWire и WirePlumber."
|
|
Layout.fillWidth: true; wrapMode: Text.Wrap; color: Theme.foreground
|
|
}
|
|
Repeater {
|
|
model: [{title: "Вывод", nodes: Hardware.outputs, selected: Hardware.sink, sink: true},
|
|
{title: "Ввод", nodes: Hardware.inputs, selected: Hardware.source, sink: false}]
|
|
ColumnLayout {
|
|
id: group
|
|
required property var modelData
|
|
Layout.fillWidth: true
|
|
Label { text: group.modelData.title; font.pixelSize: 20; color: Theme.foreground }
|
|
Label { visible: group.modelData.nodes.length === 0; text: "Нет доступных устройств"; color: Theme.outline }
|
|
Repeater {
|
|
model: group.modelData.nodes
|
|
ColumnLayout {
|
|
id: device
|
|
required property var modelData
|
|
Layout.fillWidth: true
|
|
ActionButton {
|
|
Layout.fillWidth: true
|
|
text: (group.modelData.selected === device.modelData ? "✓ " : "") + (device.modelData.description || device.modelData.name)
|
|
checked: group.modelData.selected === device.modelData
|
|
enabled: device.modelData.ready
|
|
onClicked: {
|
|
if (group.modelData.sink) Pipewire.preferredDefaultAudioSink = device.modelData;
|
|
else Pipewire.preferredDefaultAudioSource = device.modelData;
|
|
}
|
|
}
|
|
RowLayout {
|
|
Layout.fillWidth: true
|
|
enabled: device.modelData.ready && device.modelData.audio !== null
|
|
ActionButton {
|
|
text: device.modelData.audio?.muted ? "Включить" : "Заглушить"
|
|
onClicked: device.modelData.audio.muted = !device.modelData.audio.muted
|
|
}
|
|
Slider {
|
|
Layout.fillWidth: true
|
|
from: 0; to: 1
|
|
value: device.modelData.audio?.volume || 0
|
|
onMoved: device.modelData.audio.volume = value
|
|
Accessible.name: group.modelData.title + ": громкость " + device.modelData.description
|
|
}
|
|
Label { text: Math.round((device.modelData.audio?.volume || 0) * 100) + "%"; color: Theme.foreground; Layout.preferredWidth: 48 }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|