mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-28 14:43:09 +00:00
remove the bool guard on screen brightness
This commit is contained in:
parent
86b6265690
commit
d6f0b8b2fc
1 changed files with 5 additions and 11 deletions
|
|
@ -54,17 +54,14 @@ Item {
|
||||||
Layout.minimumHeight: flow.implicitHeight + units.largeSpacing*2
|
Layout.minimumHeight: flow.implicitHeight + units.largeSpacing*2
|
||||||
|
|
||||||
property int screenBrightness
|
property int screenBrightness
|
||||||
property bool disableBrightnessUpdate: true
|
|
||||||
readonly property int maximumScreenBrightness: pmSource.data["PowerDevil"] ? pmSource.data["PowerDevil"]["Maximum Screen Brightness"] || 0 : 0
|
readonly property int maximumScreenBrightness: pmSource.data["PowerDevil"] ? pmSource.data["PowerDevil"]["Maximum Screen Brightness"] || 0 : 0
|
||||||
|
|
||||||
onScreenBrightnessChanged: {
|
onScreenBrightnessChanged: {
|
||||||
if(!disableBrightnessUpdate) {
|
var service = pmSource.serviceForSource("PowerDevil");
|
||||||
var service = pmSource.serviceForSource("PowerDevil");
|
var operation = service.operationDescription("setBrightness");
|
||||||
var operation = service.operationDescription("setBrightness");
|
operation.brightness = screenBrightness;
|
||||||
operation.brightness = screenBrightness;
|
operation.silent = true
|
||||||
operation.silent = true
|
service.startOperationCall(operation);
|
||||||
service.startOperationCall(operation);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PlasmaCore.DataSource {
|
PlasmaCore.DataSource {
|
||||||
|
|
@ -78,9 +75,7 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onDataChanged: {
|
onDataChanged: {
|
||||||
disableBrightnessUpdate = true;
|
|
||||||
root.screenBrightness = pmSource.data["PowerDevil"]["Screen Brightness"];
|
root.screenBrightness = pmSource.data["PowerDevil"]["Screen Brightness"];
|
||||||
disableBrightnessUpdate = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//HACK: make the list know about the applet delegate which is a qtobject
|
//HACK: make the list know about the applet delegate which is a qtobject
|
||||||
|
|
@ -130,7 +125,6 @@ Item {
|
||||||
brightnessSlider.moved.connect(function() {
|
brightnessSlider.moved.connect(function() {
|
||||||
root.screenBrightness = brightnessSlider.value;
|
root.screenBrightness = brightnessSlider.value;
|
||||||
});
|
});
|
||||||
disableBrightnessUpdate = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ListModel {
|
ListModel {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue