Index: PowerDevilSettings.kcfg
===================================================================
--- PowerDevilSettings.kcfg
+++ PowerDevilSettings.kcfg
@@ -22,6 +22,9 @@
100
+
+ false
+
Index: daemon/powerdevilbrightnesslogic.cpp
===================================================================
--- daemon/powerdevilbrightnesslogic.cpp
+++ daemon/powerdevilbrightnesslogic.cpp
@@ -19,6 +19,9 @@
#include "powerdevilbrightnesslogic.h"
#include "powerdevilbackendinterface.h"
+#include "PowerDevilSettings.h"
+
+#include
namespace PowerDevil
{
@@ -60,13 +63,7 @@
}
// Add 1 and round upwards to the nearest step
- int step = m_steps - (m_valueMax - m_value - 1) * m_steps / m_valueMax;
-
- if (m_valueMax > 100 && qRound(percentage(stepToValue(step))) <= qRound(percentage(m_value))) {
- // When no visible change was made, add 1 step.
- // This can happen only if valueMax > 100, else 1 >= 1%.
- step++;
- }
+ int step = valueToStep(m_value) + 1;
return stepToValue(step);
}
@@ -78,13 +75,7 @@
}
// Subtract 1 and round downwards to the nearest Step
- int step = (m_value - 1) * m_steps / m_valueMax;
-
- if (m_valueMax > 100 && qRound(percentage(stepToValue(step))) >= qRound(percentage(m_value))) {
- // When no visible change was made, subtract 1 step.
- // This can happen only if valueMax > 100, else 1 >= 1%.
- step--;
- }
+ int step = valueToStep(m_value) - 1;
return stepToValue(step);
}
@@ -124,11 +115,17 @@
int BrightnessLogic::stepToValue(int step) const
{
+ if(PowerDevilSettings::quadBrightness()) {
+ return qBound(0, qRound(m_valueMax * 1.0 * (step * step) / (m_steps * m_steps)), m_valueMax);
+ }
return qBound(0, qRound(step * 1.0 * m_valueMax / m_steps), m_valueMax);
}
int BrightnessLogic::valueToStep(int value) const
{
+ if(PowerDevilSettings::quadBrightness()) {
+ return qBound(0, qRound(qSqrt(value * 1.0 * (m_steps * m_steps) / m_valueMax)), m_steps);
+ }
return qBound(0, qRound(value * 1.0 * m_steps / m_valueMax), m_steps);
}
Index: kcmodule/global/GeneralPage.cpp
===================================================================
--- kcmodule/global/GeneralPage.cpp
+++ kcmodule/global/GeneralPage.cpp
@@ -124,6 +124,8 @@
connect(BatteryCriticalCombo, SIGNAL(currentIndexChanged(int)), SLOT(changed()));
connect(pausePlayersCheckBox, SIGNAL(stateChanged(int)), SLOT(changed()));
+
+ connect(quadBrightnessCheckBox, SIGNAL(stateChanged(int)), SLOT(changed()));
if (!hasPowerSupplyBattery) {
BatteryCriticalLabel->hide();
@@ -153,6 +155,8 @@
BatteryCriticalCombo->setCurrentIndex(BatteryCriticalCombo->findData(PowerDevilSettings::batteryCriticalAction()));
pausePlayersCheckBox->setChecked(PowerDevilSettings::pausePlayersOnSuspend());
+
+ quadBrightnessCheckBox->setChecked(PowerDevilSettings::quadBrightness());
}
void GeneralPage::configureNotifications()
@@ -169,6 +173,8 @@
PowerDevilSettings::setBatteryCriticalAction(BatteryCriticalCombo->itemData(BatteryCriticalCombo->currentIndex()).toInt());
PowerDevilSettings::setPausePlayersOnSuspend(pausePlayersCheckBox->checkState() == Qt::Checked);
+
+ PowerDevilSettings::setQuadBrightness(quadBrightnessCheckBox->checkState() == Qt::Checked);
PowerDevilSettings::self()->save();
Index: kcmodule/global/generalPage.ui
===================================================================
--- kcmodule/global/generalPage.ui
+++ kcmodule/global/generalPage.ui
@@ -113,7 +113,24 @@
- -
+
-
+
+
+ Low level for peripheral devices:
+
+
+
+ -
+
+
+ %
+
+
+ 100
+
+
+
+ -
Qt::Vertical
@@ -126,6 +143,33 @@
+ -
+
+
+ Pause media players when suspending:
+
+
+
+ -
+
+
+ Enabled
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 16
+
+
+
+
-
@@ -145,37 +189,20 @@
- -
-
+
-
+
- Low level for peripheral devices:
-
-
-
- -
-
-
- %
-
-
- 100
+ Use quadratic curve for brightness keys:
- -
-
+
-
+
Enabled
- -
-
-
- Pause media players when suspending:
-
-
-
-