Commit f249506c authored by Eugene Popov's avatar Eugene Popov Committed by Nate Graham
Browse files

[applets/batterymonitor] Add display of screen brightness as a percentage

At the moment, in the battery widget, the slider displays the brightness of the screen, but
it doesn't have text labels, so it's quite difficult to determine the brightness of the
screen. Adding a label over the slider that will display the current screen brightness as a
percentage will make this applet more descriptive and handy.
parent 0858355c
......@@ -31,6 +31,7 @@ RowLayout {
property alias value: brightnessSlider.value
property alias maximumValue:
property alias stepSize: brightnessSlider.stepSize
property alias showPercentage: brightnessPercent.visible
signal moved()
spacing: units.gridUnit
......@@ -48,9 +49,25 @@ RowLayout {
Layout.alignment: Qt.AlignTop
spacing: 0
PlasmaComponents3.Label {
id: brightnessLabel
RowLayout {
id: infoRow
width: parent.width
spacing: units.smallSpacing
function percentage(from, to, value) {
return Math.floor(100 * (value - from) / (to - from));
PlasmaComponents3.Label {
id: brightnessLabel
Layout.fillWidth: true
PlasmaComponents3.Label {
id: brightnessPercent
horizontalAlignment: Text.AlignRight
text: i18nc("Placeholder is brightness percentage", "%1%", infoRow.percentage(0,, brightnessSlider.value))
PlasmaComponents3.Slider {
......@@ -87,6 +87,7 @@ PlasmaComponents3.Page {
icon: "input-keyboard-brightness"
label: i18n("Keyboard Brightness")
showPercentage: false
value: batterymonitor.keyboardBrightness
maximumValue: batterymonitor.maximumKeyboardBrightness
visible: isKeyboardBrightnessAvailable
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment