Merge pull request #1506 from turannul/pr/weather-night-icons

Adds moon and moon-stars, cloud-off icons
This commit is contained in:
Lysec
2026-01-23 12:45:27 +01:00
committed by GitHub
5 changed files with 10 additions and 7 deletions
+3
View File
@@ -98,6 +98,9 @@ Singleton {
"volume-low": "volume-2",
"volume-high": "volume",
"weather-sun": "sun",
"weather-moon": "moon",
"weather-moon-stars": "moon-stars",
"weather-cloud-off": "cloud-off",
"weather-cloud": "cloud",
"weather-cloud-haze": "cloud-fog",
"weather-cloud-lightning": "cloud-bolt",
+1 -1
View File
@@ -87,7 +87,7 @@ NBox {
NIcon {
Layout.alignment: Qt.AlignVCenter
icon: weatherReady ? LocationService.weatherSymbolFromCode(LocationService.data.weather.current_weather.weathercode) : ""
icon: weatherReady ? LocationService.weatherSymbolFromCode(LocationService.data.weather.current_weather.weathercode, LocationService.data.weather.current_weather.is_day) : "weather-cloud-off"
pointSize: Style.fontSizeXXXL * 1.75
color: Color.mPrimary
}
@@ -63,7 +63,7 @@ DraggableDesktopWidget {
NIcon {
anchors.centerIn: parent
icon: weatherReady ? LocationService.weatherSymbolFromCode(currentWeatherCode) : "cloud"
icon: weatherReady ? LocationService.weatherSymbolFromCode(currentWeatherCode, LocationService.data.weather.current_weather.is_day) : "weather-cloud-off"
pointSize: Math.round(Style.fontSizeXXXL * 2 * widgetScale)
color: weatherReady ? Color.mPrimary : Color.mOnSurfaceVariant
}
+1 -1
View File
@@ -323,7 +323,7 @@ Item {
NIcon {
Layout.alignment: Qt.AlignVCenter
icon: LocationService.weatherSymbolFromCode(LocationService.data.weather.current_weather.weathercode)
icon: weatherReady ? LocationService.weatherSymbolFromCode(LocationService.data.weather.current_weather.weathercode, LocationService.data.weather.current_weather.is_day) : "weather-cloud-off"
pointSize: Style.fontSizeXXXL
color: Color.mPrimary
}
+4 -4
View File
@@ -198,7 +198,7 @@ Singleton {
// Fetch weather data from Open-Meteo API
function fetchWeatherData(latitude, longitude, errorCallback) {
Logger.d("Location", "Fetching weather from api.open-meteo.com");
var url = "https://api.open-meteo.com/v1/forecast?latitude=" + latitude + "&longitude=" + longitude + "&current_weather=true&current=relativehumidity_2m,surface_pressure&daily=temperature_2m_max,temperature_2m_min,weathercode,sunset,sunrise&timezone=auto";
var url = "https://api.open-meteo.com/v1/forecast?latitude=" + latitude + "&longitude=" + longitude + "&current_weather=true&current=relativehumidity_2m,surface_pressure,is_day&daily=temperature_2m_max,temperature_2m_min,weathercode,sunset,sunrise&timezone=auto";
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
if (xhr.readyState === XMLHttpRequest.DONE) {
@@ -237,11 +237,11 @@ Singleton {
}
// --------------------------------
function weatherSymbolFromCode(code) {
function weatherSymbolFromCode(code, isDay) {
if (code === 0)
return "weather-sun";
return isDay ? "weather-sun" : "weather-moon";
if (code === 1 || code === 2)
return "weather-cloud-sun";
return isDay ? "weather-cloud-sun" : "weather-moon-stars";
if (code === 3)
return "weather-cloud";
if (code >= 45 && code <= 48)