Adds support for keyboard backlight controls in powerdevil
Review Request #107329 - Created Nov. 14, 2012 and submitted
| Information | |
|---|---|
| Michael Zanetti | |
| kde-workspace | |
| master | |
| Reviewers | |
| afiestas, dafre | |
This adds Keyboard backlight control support to powerdevil.
-
powerdevil/daemon/actions/bundled/kbdbrightnesscontrolconfig.cpp (Diff revision 1) -
use "@label:slider" here.
-
powerdevil/daemon/kbdbrightnessosdwidget.h (Diff revision 1) -
the parameter can be const here.
-
powerdevil/daemon/kbdbrightnessosdwidget.cpp (Diff revision 1) -
The translation team does not like things like this. You should use setText(i18nc("@info:textbox", "%1 %%", brightnessLevel)). More info about i18nc in https://techbase.kde.org/Development/Tutorials/Localization/i18n_Semantics -
powerdevil/daemon/kbdbrightnessosdwidget.cpp (Diff revision 1) -
Usually I would use Q_UNSED(rectF) here to prevent compiler warnings. Does just commenting the parameter name also does that trick?
-
powerdevil/daemon/kbdbrightnessosdwidget.cpp (Diff revision 1) -
I think you can use one of the font size from KDE configuration here.
-
powerdevil/daemon/powerdevilcore.cpp (Diff revision 1) -
prepend "Global shortcut" with "@action:inmenu". Do the same for the others below this line.
-
powerdevil/daemon/powerdevilcore.cpp (Diff revision 1) -
type can be const, brightness too but since your patch does not add it I do not know if you should change it.
-
powerdevil/daemon/backends/hal/powerdevilhalbackend.cpp (Diff revision 1) -
Add space: if (…)
-
powerdevil/daemon/backends/hal/powerdevilhalbackend.cpp (Diff revision 1) -
Add space: } else if (…) { -
powerdevil/daemon/backends/upower/powerdevilupowerbackend.cpp (Diff revision 1) -
Add space: if (…)
-
powerdevil/daemon/backends/upower/powerdevilupowerbackend.cpp (Diff revision 1) -
Add space: } else if (…) { -
powerdevil/daemon/kbdbrightnessosdwidget.cpp (Diff revision 1) -
I think duplicating all this code is not good, we already use a similar thing for KMix and having them all synchronized for changes is really a pain. Can't we somehow merge both OSDs and use a single one, at least for powerdevil?
-
powerdevil/daemon/kbdbrightnessosdwidget.cpp (Diff revision 1) -
I think we should use Keyboard instead of abbreviated Kbd? I often misspell such things (Valid for all other cases, of course)
-
powerdevil/daemon/kbdbrightnessosdwidget.cpp (Diff revision 1) -
Why that commented rectF?
-
powerdevil/daemon/powerdevilcore.h (Diff revision 1) -
Patch doesn't apply: It misses the void onBatteryChargeStateChanged I added to allow a "Charge Complete" notification to be emitted. Please re-base your patch.
Review request changed
Change Summary:
reworked patch according to review comments
I just installed the patch and I get the config option in the KCM but nothing happened. Neither pressing the associated keys, nor changing the slider in the KCM did change the brightness. Also you should check for the maximum brightness available. My notebook only offers four steps (0 = off, 1, 2, 3), so having a 100% slider is counterproductive.
Review request changed
Change Summary:
Ok. I have found the reason why it didn't work for you: As your hardware has only 4 steps, increasing by 10% isn't enough to go up to the next level because the number is truncated. I now round the result instead of truncate and increase/decrease by 30% in case there are less than 6 possible values. 30% works fine to increase/decrease exactly one step for keyboards with 2 (on,off), 3, 4, and 5 steps. For everything else the 10% are fine. That said, this still doesn't change the slider in the kcm module, however, it distributes the values more naturally on it. Making the slider aware of the possible steps would require introducing some API functions in the daemon which don't really fit with the rest of the intended hardware abstraction.
Diff: |
Revision 3 (+536 -66)
|
|---|
Okay that makes sense :-) Why would that need a change in the API? If the slider is aware of the possible range of values, then you can directly take the values the slider is set to and store them and use them for the backlight. (Btw I didn't say I like the way the display backlight slider works :P) Or does the API require a range of 0-100? That would be bad since the UPower dbus calls also use absolute numbers.
Sorry for joining the party late. The patch is amazingly slick, so thanks for such a useful feature. Not sure if we'll make it for 4.10, for now I'd throw this to master, and right after bring attention to this on the release list. Let's coordinate on IRC for that. Thanks again, amazing job.
This review has been submitted with commit d9f08307177fd56d98b58dfe87cbea062a1516e0 by Michael Zanetti to branch master.
