C++ / fmt (pull_request) Successful in 4s
JS/TS / fmt (pull_request) Successful in 20s
JS/TS / lint (pull_request) Successful in 22s
Python / static (pull_request) Successful in 57s
Rust / fmt (pull_request) Successful in 1m2s
C++ / build (pull_request) Successful in 2m10s
Rust / build (pull_request) Successful in 1m50s
Rust / clippy (pull_request) Successful in 1m25s
Python / verify (pull_request) Successful in 2m58s
C++ / clang-tidy (pull_request) Successful in 7m8s
139 lines
3.3 KiB
QML
139 lines
3.3 KiB
QML
pragma ComponentBehavior: Bound
|
|
|
|
import QtQuick
|
|
import QtQuick.Layouts
|
|
import qs.Components
|
|
import qs.Helpers
|
|
import ZShell.Config
|
|
import qs.Daemons
|
|
import qs.Services
|
|
|
|
Item {
|
|
id: root
|
|
|
|
required property real brightness
|
|
required property Brightness.Monitor monitor
|
|
required property bool muted
|
|
required property bool sourceMuted
|
|
required property real sourceVolume
|
|
required property var visibilities
|
|
required property real volume
|
|
|
|
implicitHeight: layout.implicitHeight + Tokens.padding.smaller * 2
|
|
implicitWidth: layout.implicitWidth + Tokens.padding.smaller * 2
|
|
|
|
ColumnLayout {
|
|
id: layout
|
|
|
|
anchors.centerIn: parent
|
|
spacing: Tokens.spacing.medium
|
|
|
|
// Speaker volume
|
|
CustomMouseArea {
|
|
function onWheel(event: WheelEvent) {
|
|
if (event.angleDelta.y > 0)
|
|
Audio.incrementVolume();
|
|
else if (event.angleDelta.y < 0)
|
|
Audio.decrementVolume();
|
|
}
|
|
|
|
implicitHeight: Config.osd.sizes.sliderHeight
|
|
implicitWidth: Config.osd.sizes.sliderWidth
|
|
|
|
FilledSlider {
|
|
anchors.fill: parent
|
|
color: Audio.muted ? Colors.palette.m3error : Colors.palette.m3secondary
|
|
icon: Icons.getVolumeIcon(value, root.muted)
|
|
to: Config.services.maxVolume
|
|
value: root.volume
|
|
|
|
onMoved: Audio.setVolume(value)
|
|
}
|
|
}
|
|
|
|
// Microphone volume
|
|
WrappedLoader {
|
|
shouldBeActive: Config.osd.enableMicrophone && (!Config.osd.enableBrightness || !root.visibilities.session)
|
|
|
|
sourceComponent: CustomMouseArea {
|
|
function onWheel(event: WheelEvent) {
|
|
if (event.angleDelta.y > 0)
|
|
Audio.incrementSourceVolume();
|
|
else if (event.angleDelta.y < 0)
|
|
Audio.decrementSourceVolume();
|
|
}
|
|
|
|
implicitHeight: Config.osd.sizes.sliderHeight
|
|
implicitWidth: Config.osd.sizes.sliderWidth
|
|
|
|
FilledSlider {
|
|
anchors.fill: parent
|
|
color: Audio.sourceMuted ? Colors.palette.m3error : Colors.palette.m3secondary
|
|
icon: Icons.getMicVolumeIcon(value, root.sourceMuted)
|
|
to: Config.services.maxVolume
|
|
value: root.sourceVolume
|
|
|
|
onMoved: Audio.setSourceVolume(value)
|
|
}
|
|
}
|
|
}
|
|
|
|
// Brightness
|
|
WrappedLoader {
|
|
shouldBeActive: Config.osd.enableBrightness
|
|
|
|
sourceComponent: CustomMouseArea {
|
|
function onWheel(event: WheelEvent) {
|
|
const monitor = root.monitor;
|
|
if (!monitor)
|
|
return;
|
|
if (event.angleDelta.y > 0)
|
|
monitor.setBrightness(monitor.brightness + Config.services.brightnessIncrement);
|
|
else if (event.angleDelta.y < 0)
|
|
monitor.setBrightness(monitor.brightness - Config.services.brightnessIncrement);
|
|
}
|
|
|
|
implicitHeight: Config.osd.sizes.sliderHeight
|
|
implicitWidth: Config.osd.sizes.sliderWidth
|
|
|
|
FilledSlider {
|
|
anchors.fill: parent
|
|
from: Config.services.minBrightness
|
|
icon: `brightness_${(Math.round(value * 6) + 1)}`
|
|
to: 1.0
|
|
value: root.brightness
|
|
|
|
onMoved: {
|
|
if (Config.osd.allMonBrightness) {
|
|
for (const mon of Brightness.monitors) {
|
|
mon.setBrightness(value);
|
|
}
|
|
} else {
|
|
root.monitor?.setBrightness(value);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
component WrappedLoader: Loader {
|
|
required property bool shouldBeActive
|
|
|
|
Layout.preferredHeight: shouldBeActive ? Config.osd.sizes.sliderHeight : 0
|
|
active: opacity > 0
|
|
opacity: shouldBeActive ? 1 : 0
|
|
visible: active
|
|
|
|
Behavior on Layout.preferredHeight {
|
|
Anim {
|
|
easing: Tokens.anim.emphasized
|
|
}
|
|
}
|
|
Behavior on opacity {
|
|
Anim {
|
|
}
|
|
}
|
|
}
|
|
}
|