plugins/nightcolor: add configurable day temperature
BUG: 390021
This commit is contained in:
parent
6b38b03724
commit
8e8b614500
4 changed files with 10 additions and 6 deletions
|
@ -14,7 +14,7 @@ namespace KWin
|
||||||
|
|
||||||
static const int MSC_DAY = 86400000;
|
static const int MSC_DAY = 86400000;
|
||||||
static const int MIN_TEMPERATURE = 1000;
|
static const int MIN_TEMPERATURE = 1000;
|
||||||
static const int NEUTRAL_TEMPERATURE = 6500;
|
static const int DEFAULT_DAY_TEMPERATURE = 6500;
|
||||||
static const int DEFAULT_NIGHT_TEMPERATURE = 4500;
|
static const int DEFAULT_NIGHT_TEMPERATURE = 4500;
|
||||||
static const int FALLBACK_SLOW_UPDATE_TIME = 1800000; /* 30 minutes */
|
static const int FALLBACK_SLOW_UPDATE_TIME = 1800000; /* 30 minutes */
|
||||||
|
|
||||||
|
|
|
@ -266,7 +266,8 @@ void NightColorManager::readConfig()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_nightTargetTemp = qBound(MIN_TEMPERATURE, s->nightTemperature(), NEUTRAL_TEMPERATURE);
|
m_dayTargetTemp = qBound(MIN_TEMPERATURE, s->dayTemperature(), DEFAULT_DAY_TEMPERATURE);
|
||||||
|
m_nightTargetTemp = qBound(MIN_TEMPERATURE, s->nightTemperature(), DEFAULT_DAY_TEMPERATURE);
|
||||||
|
|
||||||
double lat, lng;
|
double lat, lng;
|
||||||
auto correctReadin = [&lat, &lng]() {
|
auto correctReadin = [&lat, &lng]() {
|
||||||
|
@ -628,7 +629,7 @@ bool NightColorManager::daylight() const
|
||||||
int NightColorManager::currentTargetTemp() const
|
int NightColorManager::currentTargetTemp() const
|
||||||
{
|
{
|
||||||
if (!m_running) {
|
if (!m_running) {
|
||||||
return NEUTRAL_TEMPERATURE;
|
return DEFAULT_DAY_TEMPERATURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_mode == NightColorMode::Constant) {
|
if (m_mode == NightColorMode::Constant) {
|
||||||
|
|
|
@ -300,9 +300,9 @@ private:
|
||||||
QTimer *m_quickAdjustTimer = nullptr;
|
QTimer *m_quickAdjustTimer = nullptr;
|
||||||
QTimer *m_previewTimer = nullptr;
|
QTimer *m_previewTimer = nullptr;
|
||||||
|
|
||||||
int m_currentTemp = NEUTRAL_TEMPERATURE;
|
int m_currentTemp = DEFAULT_DAY_TEMPERATURE;
|
||||||
int m_targetTemperature = NEUTRAL_TEMPERATURE;
|
int m_targetTemperature = DEFAULT_DAY_TEMPERATURE;
|
||||||
int m_dayTargetTemp = NEUTRAL_TEMPERATURE;
|
int m_dayTargetTemp = DEFAULT_DAY_TEMPERATURE;
|
||||||
int m_nightTargetTemp = DEFAULT_NIGHT_TEMPERATURE;
|
int m_nightTargetTemp = DEFAULT_NIGHT_TEMPERATURE;
|
||||||
|
|
||||||
int m_inhibitReferenceCount = 0;
|
int m_inhibitReferenceCount = 0;
|
||||||
|
|
|
@ -17,6 +17,9 @@
|
||||||
</choices>
|
</choices>
|
||||||
<default>NightColorMode::Automatic</default>
|
<default>NightColorMode::Automatic</default>
|
||||||
</entry>
|
</entry>
|
||||||
|
<entry name="DayTemperature" type="Int">
|
||||||
|
<default>6500</default>
|
||||||
|
</entry>
|
||||||
<entry name="NightTemperature" type="Int">
|
<entry name="NightTemperature" type="Int">
|
||||||
<default>4500</default>
|
<default>4500</default>
|
||||||
</entry>
|
</entry>
|
||||||
|
|
Loading…
Reference in a new issue