From 049206bf4351a6a658b0327cfe6b3fcfdbd5724d Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Sun, 4 Jan 2015 14:15:23 +0100 Subject: [PATCH] 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. --- .../batterymonitor/package/contents/ui/PopupDialog.qml | 2 -- .../package/contents/ui/batterymonitor.qml | 10 +++------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/applets/batterymonitor/package/contents/ui/PopupDialog.qml b/applets/batterymonitor/package/contents/ui/PopupDialog.qml index 3448b34b8..a2acf3180 100644 --- a/applets/batterymonitor/package/contents/ui/PopupDialog.qml +++ b/applets/batterymonitor/package/contents/ui/PopupDialog.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 }) } diff --git a/applets/batterymonitor/package/contents/ui/batterymonitor.qml b/applets/batterymonitor/package/contents/ui/batterymonitor.qml index 9fe2d577e..77f5c4aa6 100755 --- a/applets/batterymonitor/package/contents/ui/batterymonitor.qml +++ b/applets/batterymonitor/package/contents/ui/batterymonitor.qml @@ -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