Commit 1afb09bf authored by Natalie Clarius's avatar Natalie Clarius Committed by Natalie Clarius
Browse files

kcms/nightcolor: add configurable daytime temperature

BUG: 390021
parent ce39fee5
Pipeline #225582 passed with stage
in 8 minutes and 37 seconds
{
"KPlugin": {
"Description": "Adjust color temperature at night to reduce eye strain",
"Description": "Adjust color temperature to reduce eye strain",
"Description[ar]": "يضبط درجة حرارة اللون ليلاً لتقليل إجهاد العين",
"Description[az]": "Gözə mənfi təsirini azaltmaq üçün gecə rəng temperaturunu ayarlayın",
"Description[bg]": "Регулирайте цветната температура вечерно време, за да намалите напрежението в очите",
......@@ -92,7 +92,7 @@
"Name[zh_TW]": "夜色模式"
},
"X-DocPath": "https://userbase.kde.org/TODOX",
"X-KDE-Keywords": "kwin,window,manager,night,colors,redshift,eyes,night mode,colour,dark mode,dark,dim,sleep,eye strain,red,shift,orange,yellow,warm,screen tint,temperature",
"X-KDE-Keywords": "kwin,window,manager,night,colors,redshift,eyes,night mode,colour,dark mode,dark,dim,sleep,eye strain,red,shift,orange,yellow,warm,screen tint,temperature,blue,light",
"X-KDE-Keywords[ar]": "ك.وين,نافذة,مدير,ليلي,ألوان,إرهاق العين,الحمرة,البرتقالي,الأصفر,دافئ,تعتيم الشاشة,درجة الحرارة",
"X-KDE-Keywords[az]": "kwin,window,manager,night,colors,redshift,eyes,night mode,colour,dark mode,dark,dim,sleep,eye strain,red,shift,orange,yellow,warm,screen tint,temperature,pəncərə,menecer,gecə,rənglər,rəng sürüşməsi,gözlər,narıncı,sarı,xəbərdarlıq,ekranın tonu,hərarət",
"X-KDE-Keywords[ca]": "kwin,finestra,gestor,nit,colors,desplaçament cap al roig,ulls,mode nit,color,mode fosc,fosc,enfosquiment,dormir,tensió ocular,vermell,desplaçament,taronja,groc,càlid,tint de pantalla,temperatura",
......
......@@ -26,6 +26,11 @@
<entry name="NightTemperatureEnabled" type="Bool">
<default>true</default>
</entry>
<entry name="DayTemperature" type="Int">
<default>6500</default>
<min>1000</min>
<max>6500</max>
</entry>
<entry name="NightTemperature" type="Int">
<default>4500</default>
<min>1000</min>
......
......@@ -29,13 +29,13 @@ ColumnLayout {
wrapMode: Text.Wrap
Layout.fillWidth: true
horizontalAlignment: Qt.AlignHCenter
text: i18n("Night Color begins changing at %1 and is fully changed by %2", prettyTime(eveningTimings.begin), prettyTime(eveningTimings.end))
text: i18n("Color temperature begins changing to night time at %1 and is fully changed by %2", prettyTime(eveningTimings.begin), prettyTime(eveningTimings.end))
}
QQC2.Label {
wrapMode: Text.Wrap
Layout.fillWidth: true
horizontalAlignment: Qt.AlignHCenter
text: i18n("Night Color begins changing back at %1 and ends at %2", prettyTime(morningTimings.begin), prettyTime(morningTimings.end))
text: i18n("Color temperature begings changing to day time at %1 and is fully changed by %2", prettyTime(morningTimings.begin), prettyTime(morningTimings.end))
}
}
......@@ -78,7 +78,7 @@ KCM.SimpleKCM {
Layout.alignment: Qt.AlignHCenter
Layout.maximumWidth: Math.round(root.width - (Kirigami.Units.gridUnit * 2))
text: i18n("Night Color makes the colors on the screen warmer to reduce eye strain at the time of your choosing.")
text: i18n("The blue light filter makes the colors on the screen warmer to reduce eye strain.")
wrapMode: Text.WordWrap
}
......@@ -87,7 +87,7 @@ KCM.SimpleKCM {
QQC2.CheckBox {
id: activator
text: i18n("Activate Night Color")
text: i18n("Activate blue light filter")
checked: kcm.nightColorSettings.active
onCheckedChanged: kcm.nightColorSettings.active = checked
......@@ -106,14 +106,68 @@ KCM.SimpleKCM {
}
GridLayout {
Kirigami.FormData.label: i18n("Night Color Temperature:")
Kirigami.FormData.buddyFor: tempSlider
Kirigami.FormData.label: i18n("Day color temperature:")
Kirigami.FormData.buddyFor: tempSliderDay
enabled: kcm.nightColorSettings.active
columns: 4
QQC2.Slider {
id: tempSlider
id: tempSliderDay
// Match combobox width
Layout.minimumWidth: modeSwitcher.width
from: 1000 // TODO get min/max fron kcfg
to: 6500
stepSize: 100
live: true
value: kcm.nightColorSettings.dayTemperature
onMoved: {
kcm.nightColorSettings.dayTemperature = value
previewMessage.state = "visible"
previewMessage.text = i18n("This is what day color temperature will look like when active.")
cA.preview(value)
}
onPressedChanged: {
previewMessage.state = "invisible"
cA.stopPreview()
}
Layout.columnSpan: 3
KCM.SettingStateBinding {
configObject: kcm.nightColorSettings
settingName: "DayTemperature"
extraEnabledConditions: kcm.nightColorSettings.active
}
}
QQC2.Label {
text: i18nc("Color temperature in Kelvin", "%1K", tempSliderDay.value)
}
//row 2
QQC2.Label {
text: i18nc("Night colour red-ish", "Warm")
}
Item {
Layout.fillWidth: true
}
QQC2.Label {
text: i18nc("Night colour blue-ish", "Cool")
}
Item {}
}
GridLayout {
Kirigami.FormData.label: i18n("Night color temperature:")
Kirigami.FormData.buddyFor: tempSliderNight
enabled: kcm.nightColorSettings.active
columns: 4
QQC2.Slider {
id: tempSliderNight
// Match combobox width
Layout.minimumWidth: modeSwitcher.width
from: 1000 // TODO get min/max fron kcfg
......@@ -126,6 +180,7 @@ KCM.SimpleKCM {
onMoved: {
kcm.nightColorSettings.nightTemperature = value
previewMessage.state = "visible"
previewMessage.text = i18n("This is what night color temperature will look like when active.")
cA.preview(value)
}
......@@ -143,7 +198,7 @@ KCM.SimpleKCM {
}
}
QQC2.Label {
text: i18nc("Color temperature in Kelvin", "%1K", tempSlider.value)
text: i18nc("Color temperature in Kelvin", "%1K", tempSliderNight.value)
}
//row 2
QQC2.Label {
......@@ -160,7 +215,6 @@ KCM.SimpleKCM {
QQC2.Label {
id: previewMessage
text: i18n("This is what Night Color will look like when active.")
opacity: 0
state: "invisible"
states: [
......@@ -191,13 +245,13 @@ KCM.SimpleKCM {
id: modeSwitcher
// Work around https://bugs.kde.org/show_bug.cgi?id=403153
Layout.minimumWidth: Kirigami.Units.gridUnit * 17
Kirigami.FormData.label: i18n("Activation time:")
Kirigami.FormData.label: i18n("Switching times:")
enabled: activator.checked
model: [
i18n("Sunset to sunrise at current location"),
i18n("Sunset to sunrise at manual location"),
i18n("Custom time"),
i18n("Always on")
i18n("Sunset and sunrise at current location"),
i18n("Sunset and sunrise at manual location"),
i18n("Custom times"),
i18n("Always on night color")
]
currentIndex: kcm.nightColorSettings.mode
onCurrentIndexChanged: {
......@@ -268,7 +322,7 @@ KCM.SimpleKCM {
Layout.minimumWidth: modeSwitcher.width
Layout.maximumWidth: modeSwitcher.width
visible: kcm.nightColorSettings.mode === NightColorMode.Timings
Kirigami.FormData.label: i18n("Turn on at:")
Kirigami.FormData.label: i18n("Begin night color at:")
backend: kcm.nightColorSettings.eveningBeginFixed
onBackendChanged: {
kcm.nightColorSettings.eveningBeginFixed = backend;
......@@ -291,7 +345,7 @@ KCM.SimpleKCM {
Layout.minimumWidth: modeSwitcher.width
Layout.maximumWidth: modeSwitcher.width
visible: kcm.nightColorSettings.mode === NightColorMode.Timings
Kirigami.FormData.label: i18n("Turn off at:")
Kirigami.FormData.label: i18n("Begin day color at:")
backend: kcm.nightColorSettings.morningBeginFixed
onBackendChanged: {
kcm.nightColorSettings.morningBeginFixed = backend;
......
Supports Markdown
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