basic audio configurations
This commit is contained in:
parent
8ba0567d28
commit
22cf6cc53e
3 changed files with 90 additions and 7 deletions
71
modules/configuration/AudioView.qml
Normal file
71
modules/configuration/AudioView.qml
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
import qs.components
|
||||
import qs.config
|
||||
import qs.services
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
|
||||
spacing: Styling.layout.spacing.xl
|
||||
|
||||
StyledText {
|
||||
text: "Speaker Settings"
|
||||
}
|
||||
StyledPane {
|
||||
Layout.fillWidth: true
|
||||
padding: 24
|
||||
GridLayout {
|
||||
Layout.fillWidth: true
|
||||
|
||||
columnSpacing: Styling.layout.spacing.xl
|
||||
|
||||
StyledText {
|
||||
Layout.column: 1
|
||||
Layout.row: 1
|
||||
text: "Speakers"
|
||||
}
|
||||
|
||||
StyledComboBox {
|
||||
Layout.column: 2
|
||||
Layout.row: 1
|
||||
Layout.fillWidth: true
|
||||
currentIndex: Pipewire.sinks.indexOf(Pipewire.sink)
|
||||
model: Pipewire.sinks.map(sink => sink.nickname ?? sink.name)
|
||||
onActivated: index => {
|
||||
Pipewire.setSink(Pipewire.sinks[index]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "Microphone Settings"
|
||||
}
|
||||
StyledPane {
|
||||
Layout.fillWidth: true
|
||||
padding: 24
|
||||
GridLayout {
|
||||
Layout.fillWidth: true
|
||||
|
||||
columnSpacing: Styling.layout.spacing.xl
|
||||
|
||||
StyledText {
|
||||
Layout.column: 1
|
||||
Layout.row: 2
|
||||
text: "Microphones"
|
||||
}
|
||||
|
||||
StyledComboBox {
|
||||
Layout.column: 2
|
||||
Layout.row: 2
|
||||
Layout.fillWidth: true
|
||||
currentIndex: Pipewire.sources.indexOf(Pipewire.source)
|
||||
model: Pipewire.sources.map(source => source.nickname ?? source.name)
|
||||
onActivated: index => {
|
||||
Pipewire.setSource(Pipewire.sinks[index]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -26,7 +26,7 @@ StyledPanelWindow {
|
|||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
text: "General"
|
||||
text: "Audio"
|
||||
}
|
||||
StyledTabButton {
|
||||
anchors.left: parent.left
|
||||
|
|
@ -49,14 +49,11 @@ StyledPanelWindow {
|
|||
currentIndex: tabs.currentIndex
|
||||
|
||||
ScrollView {
|
||||
padding: 36
|
||||
StyledPane {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
}
|
||||
padding: 24
|
||||
AudioView {}
|
||||
}
|
||||
ScrollView {
|
||||
padding: 36
|
||||
padding: 24
|
||||
StylingView {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,9 @@ Singleton {
|
|||
readonly property PwNode sink: Pipewire.defaultAudioSink
|
||||
readonly property PwNode source: Pipewire.defaultAudioSource
|
||||
|
||||
readonly property list<PwNode> sinks: Pipewire.nodes.values.filter(node => node.audio != null && node.isSink && !node.isStream)
|
||||
readonly property list<PwNode> sources: Pipewire.nodes.values.filter(node => node.audio != null && !node.isSink && !node.isStream)
|
||||
|
||||
readonly property bool muted: sink?.audio?.muted ?? false
|
||||
readonly property real volume: sink?.audio?.volume ?? 0
|
||||
|
||||
|
|
@ -42,6 +45,18 @@ Singleton {
|
|||
sink.audio.muted = !sink.audio.muted;
|
||||
}
|
||||
|
||||
function setSink(node: PwNode) {
|
||||
if (node.audio != null && node.isSink && !node.isStream) {
|
||||
Pipewire.preferredDefaultAudioSink = node;
|
||||
}
|
||||
}
|
||||
|
||||
function setSource(node: PwNode) {
|
||||
if (node.audio != null && !node.isSink && !node.isStream) {
|
||||
Pipewire.preferredDefaultAudioSource = node;
|
||||
}
|
||||
}
|
||||
|
||||
PwObjectTracker {
|
||||
objects: [Pipewire.defaultAudioSink, Pipewire.defaultAudioSource]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue