Simplify OSD silencer

Just only show the OSD when the plasmoid isn't expanded.
Much simpler and what I wanted to achieve in the first place anyway.
wilder-5.14
Kai Uwe Broulik 11 years ago
parent 54bcc5cbac
commit 049206bf43
  1. 2
      applets/batterymonitor/package/contents/ui/PopupDialog.qml
  2. 10
      applets/batterymonitor/package/contents/ui/batterymonitor.qml

@ -43,12 +43,10 @@ FocusScope {
// setup handler on slider value manually to avoid change on creation
brightnessSlider.valueChanged.connect(function() {
batterymonitor.screenBrightnessSilent = true
batterymonitor.screenBrightness = brightnessSlider.value
})
keyboardBrightnessSlider.valueChanged.connect(function() {
batterymonitor.keyboardBrightnessSilent = true
batterymonitor.keyboardBrightness = keyboardBrightnessSlider.value
})
}

@ -43,11 +43,9 @@ Item {
property int screenBrightness
readonly property int maximumScreenBrightness: pmSource.data["PowerDevil"] ? pmSource.data["PowerDevil"]["Maximum Screen Brightness"] : 0
property bool screenBrightnessSilent: true // whether to suppress the OSD when changing brightness
property int keyboardBrightness
readonly property int maximumKeyboardBrightness: pmSource.data["PowerDevil"] ? pmSource.data["PowerDevil"]["Maximum Keyboard Brightness"] : 0
property bool keyboardBrightnessSilent: true
readonly property int remainingTime: Number(pmSource.data["Battery"]["Remaining msec"])
@ -58,7 +56,8 @@ Item {
var service = pmSource.serviceForSource("PowerDevil");
var operation = service.operationDescription("setBrightness");
operation.brightness = screenBrightness;
operation.silent = screenBrightnessSilent
// show OSD only when the plasmoid isn't expanded since the moving slider is feedback enough
operation.silent = plasmoid.expanded
service.startOperationCall(operation);
}
onKeyboardBrightnessChanged: {
@ -68,7 +67,7 @@ Item {
var service = pmSource.serviceForSource("PowerDevil");
var operation = service.operationDescription("setKeyboardBrightness");
operation.brightness = keyboardBrightness;
operation.silent = keyboardBrightnessSilent
operation.silent = plasmoid.expanded
service.startOperationCall(operation);
}
@ -99,9 +98,6 @@ Item {
onEntered: wheelDelta = 0
onExited: wheelDelta = 0
onWheel: {
// show OSD when wheeling since when the popup isn't opened this is the only means of feedback
screenBrightnessSilent = plasmoid.expanded
var delta = wheel.angleDelta.y || wheel.angleDelta.x
if ((delta < 0 && wheelDelta > 0) || (delta > 0 && wheelDelta < 0)) { // reset when direction changes
wheelDelta = 0

Loading…
Cancel
Save