* Added option to disable brightness slider * Removed unwanted imports * Renamed WrappedLoader.name to brightnessSlider * fixes --------- Co-authored-by: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>
73 lines
1.9 KiB
QML
73 lines
1.9 KiB
QML
pragma ComponentBehavior: Bound
|
|
|
|
import qs.components.controls
|
|
import qs.services
|
|
import qs.config
|
|
import qs.utils
|
|
import QtQuick
|
|
|
|
Column {
|
|
id: root
|
|
|
|
required property Brightness.Monitor monitor
|
|
|
|
padding: Appearance.padding.large
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
anchors.left: parent.left
|
|
|
|
spacing: Appearance.spacing.normal
|
|
|
|
// Speaker volume
|
|
CustomMouseArea {
|
|
implicitWidth: Config.osd.sizes.sliderWidth
|
|
implicitHeight: Config.osd.sizes.sliderHeight
|
|
|
|
onWheel: event => {
|
|
if (event.angleDelta.y > 0)
|
|
Audio.incrementVolume();
|
|
else if (event.angleDelta.y < 0)
|
|
Audio.decrementVolume();
|
|
}
|
|
|
|
FilledSlider {
|
|
anchors.fill: parent
|
|
|
|
icon: Icons.getVolumeIcon(value, Audio.muted)
|
|
value: Audio.volume
|
|
onMoved: Audio.setVolume(value)
|
|
}
|
|
}
|
|
|
|
// Brightness
|
|
WrappedLoader {
|
|
active: Config.osd.enableBrightness
|
|
|
|
sourceComponent: CustomMouseArea {
|
|
implicitWidth: Config.osd.sizes.sliderWidth
|
|
implicitHeight: Config.osd.sizes.sliderHeight
|
|
|
|
onWheel: event => {
|
|
const monitor = root.monitor;
|
|
if (!monitor)
|
|
return;
|
|
if (event.angleDelta.y > 0)
|
|
monitor.setBrightness(monitor.brightness + 0.1);
|
|
else if (event.angleDelta.y < 0)
|
|
monitor.setBrightness(monitor.brightness - 0.1);
|
|
}
|
|
|
|
FilledSlider {
|
|
anchors.fill: parent
|
|
|
|
icon: `brightness_${(Math.round(value * 6) + 1)}`
|
|
value: root.monitor?.brightness ?? 0
|
|
onMoved: root.monitor?.setBrightness(value)
|
|
}
|
|
}
|
|
}
|
|
component WrappedLoader: Loader {
|
|
asynchronous: true
|
|
visible: active
|
|
}
|
|
}
|