add popup for audio management
This commit is contained in:
parent
f409062ba6
commit
5005ba24db
11 changed files with 298 additions and 120 deletions
102
modules/bar/VolPopup.qml
Normal file
102
modules/bar/VolPopup.qml
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
import qs
|
||||
import qs.settings
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
import qs.widgets
|
||||
import qs.modules.Services
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import Quickshell.Widgets
|
||||
import QtQuick.Effects
|
||||
|
||||
PopupWindow {
|
||||
implicitWidth: 400
|
||||
implicitHeight: audioLayout.implicitHeight + 24
|
||||
anchor.edges: Edges.Top | Edges.Right
|
||||
anchor.gravity: Edges.Bottom | Edges.Left
|
||||
anchor.margins.top: 40
|
||||
color: 'transparent'
|
||||
Rectangle {
|
||||
id: test
|
||||
anchors.fill: parent
|
||||
color: Colors.moduleBg
|
||||
radius: Config.rounding
|
||||
ColumnLayout {
|
||||
id: audioLayout
|
||||
anchors.fill: parent
|
||||
anchors.margins: 12
|
||||
spacing: 8
|
||||
Repeater {
|
||||
model: Audio.sinks
|
||||
delegate: Rectangle {
|
||||
id: audioDelContainer
|
||||
color: Colors.activeModuleBg
|
||||
radius: Config.rounding
|
||||
required property var modelData
|
||||
implicitWidth: 380
|
||||
implicitHeight: audioRow.implicitHeight + 8
|
||||
|
||||
RowLayout {
|
||||
id: audioRow
|
||||
anchors.left: parent.left
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.fill: parent
|
||||
|
||||
StyledText {
|
||||
text: audioDelContainer.modelData.nickname
|
||||
Layout.leftMargin: 10
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
IconImage {
|
||||
source: Quickshell.iconPath(Audio.getVolumeIcon(audioDelContainer.modelData))
|
||||
implicitSize: 16
|
||||
layer.enabled: true
|
||||
layer.effect: MultiEffect {
|
||||
colorization: 1.0
|
||||
colorizationColor: Colors.text
|
||||
brightness: 0.5
|
||||
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
acceptedButtons: Qt.LeftButton
|
||||
onClicked: {
|
||||
audioDelContainer.modelData.audio.muted = !audioDelContainer.modelData.audio.muted
|
||||
}
|
||||
}
|
||||
}
|
||||
IconImage {
|
||||
source: Quickshell.iconPath(audioDelContainer.modelData === Audio.preferredAudio ? "radio-checked-symbolic" : "radio-symbolic")
|
||||
implicitSize: 16
|
||||
layer.enabled: true
|
||||
layer.effect: MultiEffect {
|
||||
colorization: 1.0
|
||||
colorizationColor: Colors.text
|
||||
brightness: 0.5
|
||||
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
acceptedButtons: Qt.LeftButton
|
||||
onClicked: {
|
||||
Audio.preferredAudio = audioDelContainer.modelData
|
||||
}
|
||||
}
|
||||
}
|
||||
Slider {
|
||||
Layout.rightMargin: 10
|
||||
value: audioDelContainer.modelData.audio.volume
|
||||
from: 0
|
||||
to: 1
|
||||
onMoved: {
|
||||
audioDelContainer.modelData.audio.volume = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue