feat: latitude/longitude configuráveis para o céu realista

Padrão Toledo-PR (-24.72, -53.74); campos aceitam vírgula ou ponto.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015HtPHsTnDcLVSCiF5FGHZj
This commit is contained in:
vini 2026-07-19 10:52:05 -03:00
parent 05e465e33f
commit 6415112f9a
3 changed files with 35 additions and 0 deletions

View file

@ -14,5 +14,11 @@
<entry name="ChuvaMode" type="Bool">
<default>false</default>
</entry>
<entry name="Latitude" type="Double">
<default>-24.72</default>
</entry>
<entry name="Longitude" type="Double">
<default>-53.74</default>
</entry>
</group>
</kcfg>

View file

@ -9,6 +9,8 @@ ColumnLayout {
property alias cfg_ShowSkeleton: skeletonCheck.checked
property alias cfg_BaladaMode: baladaCheck.checked
property alias cfg_ChuvaMode: chuvaCheck.checked
property double cfg_Latitude
property double cfg_Longitude
spacing: Kirigami.Units.largeSpacing
@ -34,5 +36,28 @@ ColumnLayout {
text: i18n("Lua + chuva + relâmpagos")
onCheckedChanged: if (checked) baladaCheck.checked = false
}
Kirigami.Separator { Kirigami.FormData.isSection: true }
// Observador do céu realista (aceita vírgula ou ponto decimal)
TextField {
id: latField
Kirigami.FormData.label: i18n("Latitude:")
Component.onCompleted: text = root.cfg_Latitude
onTextChanged: {
const v = parseFloat(text.replace(",", "."))
if (!isNaN(v) && v >= -90 && v <= 90) root.cfg_Latitude = v
}
}
TextField {
id: lonField
Kirigami.FormData.label: i18n("Longitude:")
Component.onCompleted: text = root.cfg_Longitude
onTextChanged: {
const v = parseFloat(text.replace(",", "."))
if (!isNaN(v) && v >= -180 && v <= 180) root.cfg_Longitude = v
}
}
}
}

View file

@ -11,6 +11,8 @@ WallpaperItem {
webView.runJavaScript("setShowSkeleton(" + Plasmoid.configuration.ShowSkeleton + ")")
webView.runJavaScript("setBaladaMode(" + Plasmoid.configuration.BaladaMode + ")")
webView.runJavaScript("setChuvaMode(" + Plasmoid.configuration.ChuvaMode + ")")
webView.runJavaScript("setObserverLocation(" + Plasmoid.configuration.Latitude + ","
+ Plasmoid.configuration.Longitude + ")")
}
Connections {
@ -18,6 +20,8 @@ WallpaperItem {
function onShowSkeletonChanged() { applyConfig() }
function onBaladaModeChanged() { applyConfig() }
function onChuvaModeChanged() { applyConfig() }
function onLatitudeChanged() { applyConfig() }
function onLongitudeChanged() { applyConfig() }
}
WebEngineView {