diff --git a/Assets/Translations/de.json b/Assets/Translations/de.json index ae0618ca..9516d8b6 100644 --- a/Assets/Translations/de.json +++ b/Assets/Translations/de.json @@ -1425,6 +1425,10 @@ "description": "Bevorzugte Temperatureinheit wählen.", "label": "Wetter" }, + "show-effects": { + "description": "Zeigt zusätzliche visuelle Effekte (wie Regen, Schnee oder Blitze) auf der Wetterkarte an.", + "label": "Wettereffekte anzeigen" + }, "show-in-calendar": { "description": "Zeige die tägliche Wettervorhersage direkt in deiner Kalenderansicht an.", "label": "Wetter im Kalender anzeigen" diff --git a/Assets/Translations/en.json b/Assets/Translations/en.json index 55ff382c..7aa43808 100644 --- a/Assets/Translations/en.json +++ b/Assets/Translations/en.json @@ -1425,6 +1425,10 @@ "description": "Choose your preferred temperature unit.", "label": "Weather" }, + "show-effects": { + "description": "Shows additional visual effects (like rain, snow, or lightning) on the weather card.", + "label": "Display weather effects" + }, "show-in-calendar": { "description": "Show the daily weather forecast directly in your calendar view.", "label": "Display weather in calendar" diff --git a/Assets/Translations/es.json b/Assets/Translations/es.json index 2b79eb26..8c0c1ff5 100644 --- a/Assets/Translations/es.json +++ b/Assets/Translations/es.json @@ -1425,6 +1425,10 @@ "description": "Elige tu unidad de temperatura preferida.", "label": "Clima" }, + "show-effects": { + "description": "Muestra efectos visuales adicionales (como lluvia, nieve o relámpagos) en la tarjeta del clima.", + "label": "Mostrar efectos climáticos" + }, "show-in-calendar": { "description": "Muestra el pronóstico del tiempo diario directamente en la vista de tu calendario.", "label": "Mostrar el clima en el calendario" diff --git a/Assets/Translations/fr.json b/Assets/Translations/fr.json index f0f192f3..6475d5ad 100644 --- a/Assets/Translations/fr.json +++ b/Assets/Translations/fr.json @@ -1425,6 +1425,10 @@ "description": "Choisissez votre unité de température préférée.", "label": "Météo" }, + "show-effects": { + "description": "Affiche des effets visuels supplémentaires (comme la pluie, la neige ou la foudre) sur la carte météo.", + "label": "Afficher les effets météorologiques" + }, "show-in-calendar": { "description": "Afficher les prévisions météo quotidiennes directement dans votre vue calendrier.", "label": "Afficher la météo dans le calendrier" diff --git a/Assets/Translations/nl.json b/Assets/Translations/nl.json index e43b6329..03d0776e 100644 --- a/Assets/Translations/nl.json +++ b/Assets/Translations/nl.json @@ -1425,6 +1425,10 @@ "description": "Kies je voorkeurseenheid voor temperatuur.", "label": "Weer" }, + "show-effects": { + "description": "Toont extra visuele effecten (zoals regen, sneeuw of bliksem) op de weerkaart.", + "label": "Weerseffecten weergeven" + }, "show-in-calendar": { "description": "Toon de dagelijkse weersverwachting direct in je kalenderview.", "label": "Weer in kalender weergeven" diff --git a/Assets/Translations/pt.json b/Assets/Translations/pt.json index 93f94a9f..b5334e0d 100644 --- a/Assets/Translations/pt.json +++ b/Assets/Translations/pt.json @@ -1425,6 +1425,10 @@ "description": "Escolha sua unidade de temperatura preferida.", "label": "Clima" }, + "show-effects": { + "description": "Mostra efeitos visuais adicionais (como chuva, neve ou relâmpagos) no cartão de clima.", + "label": "Exibir efeitos climáticos" + }, "show-in-calendar": { "description": "Mostre a previsão do tempo diária diretamente na sua visualização de calendário.", "label": "Exibir clima no calendário" diff --git a/Assets/Translations/ru.json b/Assets/Translations/ru.json index c0fb0d89..0866d7ad 100644 --- a/Assets/Translations/ru.json +++ b/Assets/Translations/ru.json @@ -1425,6 +1425,10 @@ "description": "Выберите предпочитаемую единицу измерения температуры.", "label": "Погода" }, + "show-effects": { + "description": "Отображает дополнительные визуальные эффекты (например, дождь, снег или молнию) на карточке погоды.", + "label": "Отображать погодные эффекты" + }, "show-in-calendar": { "description": "Показывать ежедневный прогноз погоды непосредственно в вашем календаре.", "label": "Отображать погоду в календаре" diff --git a/Assets/Translations/tr.json b/Assets/Translations/tr.json index 55088cb7..0b8b9829 100644 --- a/Assets/Translations/tr.json +++ b/Assets/Translations/tr.json @@ -1425,6 +1425,10 @@ "description": "Tercih ettiğiniz sıcaklık birimini seçin.", "label": "Hava durumu" }, + "show-effects": { + "description": "Hava durumu kartında ek görsel efektler (yağmur, kar veya şimşek gibi) gösterir.", + "label": "Hava efektlerini göster" + }, "show-in-calendar": { "description": "Günlük hava durumu tahminini doğrudan takvim görünümünüzde gösterin.", "label": "Takvimde hava durumunu göster" diff --git a/Assets/Translations/uk-UA.json b/Assets/Translations/uk-UA.json index 664d4916..17ee78b2 100644 --- a/Assets/Translations/uk-UA.json +++ b/Assets/Translations/uk-UA.json @@ -1425,6 +1425,10 @@ "description": "Виберіть бажану одиницю температури.", "label": "Погода" }, + "show-effects": { + "description": "Показує додаткові візуальні ефекти (наприклад, дощ, сніг або блискавку) на картці погоди.", + "label": "Відображати погодні ефекти" + }, "show-in-calendar": { "description": "Показувати щоденний прогноз погоди безпосередньо в календарі.", "label": "Відображати погоду в календарі" diff --git a/Assets/Translations/zh-CN.json b/Assets/Translations/zh-CN.json index 9346021b..9344fed5 100644 --- a/Assets/Translations/zh-CN.json +++ b/Assets/Translations/zh-CN.json @@ -1425,6 +1425,10 @@ "description": "选择您喜欢的温度单位。", "label": "天气" }, + "show-effects": { + "description": "在天气卡片上显示额外的视觉效果(如雨、雪或闪电)。", + "label": "显示天气效果" + }, "show-in-calendar": { "description": "直接在您的日历视图中显示每日天气预报。", "label": "在日历中显示天气" diff --git a/Assets/settings-default.json b/Assets/settings-default.json index 5bd6841b..b59648b7 100644 --- a/Assets/settings-default.json +++ b/Assets/settings-default.json @@ -90,6 +90,7 @@ "location": { "name": "Tokyo", "weatherEnabled": true, + "weatherShowEffects": true, "useFahrenheit": false, "use12hourFormat": false, "showWeekNumberInCalendar": false, diff --git a/Commons/Settings.qml b/Commons/Settings.qml index 568d069c..aa1f471b 100644 --- a/Commons/Settings.qml +++ b/Commons/Settings.qml @@ -239,6 +239,7 @@ Singleton { property JsonObject location: JsonObject { property string name: defaultLocation property bool weatherEnabled: true + property bool weatherShowEffects: true property bool useFahrenheit: false property bool use12hourFormat: false property bool showWeekNumberInCalendar: false diff --git a/Modules/Panels/ControlCenter/Cards/WeatherCard.qml b/Modules/Panels/ControlCenter/Cards/WeatherCard.qml index 29a5d9fa..d4804ff4 100644 --- a/Modules/Panels/ControlCenter/Cards/WeatherCard.qml +++ b/Modules/Panels/ControlCenter/Cards/WeatherCard.qml @@ -1,6 +1,6 @@ import QtQuick -import QtQuick.Layouts import QtQuick.Effects +import QtQuick.Layouts import Quickshell import qs.Commons import qs.Services.Location @@ -12,51 +12,58 @@ NBox { property int forecastDays: 6 property bool showLocation: true + property bool showEffects: Settings.data.location.weatherShowEffects readonly property bool weatherReady: Settings.data.location.weatherEnabled && (LocationService.data.weather !== null) // Test mode: set to "rain" or "snow" - property string testWeatherEffect: "" + property string testEffects: "" // Weather condition detection readonly property int currentWeatherCode: weatherReady ? LocationService.data.weather.current_weather.weathercode : 0 - readonly property bool isRaining: testWeatherEffect === "rain" || (testWeatherEffect === "" && currentWeatherCode >= 51 && currentWeatherCode <= 67) - readonly property bool isSnowing: testWeatherEffect === "snow" || (testWeatherEffect === "" && ((currentWeatherCode >= 71 && currentWeatherCode <= 77) || (currentWeatherCode >= 85 && currentWeatherCode <= 86))) - - // Animated time for shaders - property real shaderTime: 0 - NumberAnimation on shaderTime { - running: root.isRaining || root.isSnowing - loops: Animation.Infinite - from: 0 - to: 1000 - duration: 100000 - } + readonly property bool isRaining: testEffects === "rain" || (testEffects === "" && currentWeatherCode >= 51 && currentWeatherCode <= 67) + readonly property bool isSnowing: testEffects === "snow" || (testEffects === "" && ((currentWeatherCode >= 71 && currentWeatherCode <= 77) || (currentWeatherCode >= 85 && currentWeatherCode <= 86))) visible: Settings.data.location.weatherEnabled implicitHeight: Math.max(100 * Style.uiScaleRatio, content.implicitHeight + (Style.marginXL * 2)) // Weather effect layer (rain/snow) - ShaderEffect { - id: weatherEffect + Loader { + id: weatherEffectLoader anchors.fill: parent - // Snow fills the box, rain matches content margins - anchors.margins: root.isSnowing ? root.border.width : Style.marginXL - visible: root.isRaining || root.isSnowing + active: root.showEffects && (root.isRaining || root.isSnowing) - property var source: ShaderEffectSource { - sourceItem: content - hideSource: root.isRaining // Only hide for rain (distortion), show for snow + sourceComponent: Item { + anchors.fill: parent + + // Animated time for shaders + property real shaderTime: 0 + NumberAnimation on shaderTime { + loops: Animation.Infinite + from: 0 + to: 1000 + duration: 100000 + } + + ShaderEffect { + id: weatherEffect + anchors.fill: parent + // Snow fills the box, rain matches content margins + anchors.margins: root.isSnowing ? root.border.width : Style.marginXL + + property var source: ShaderEffectSource { + sourceItem: content + hideSource: root.isRaining // Only hide for rain (distortion), show for snow + } + + property real time: parent.shaderTime + property real itemWidth: weatherEffect.width + property real itemHeight: weatherEffect.height + property color bgColor: root.color + property real cornerRadius: root.isSnowing ? (root.radius - root.border.width) : 0 + + fragmentShader: root.isSnowing ? Qt.resolvedUrl(Quickshell.shellDir + "/Shaders/qsb/weather_snow.frag.qsb") : Qt.resolvedUrl(Quickshell.shellDir + "/Shaders/qsb/weather_rain.frag.qsb") + } } - - property real time: root.shaderTime - property real itemWidth: weatherEffect.width - property real itemHeight: weatherEffect.height - property color bgColor: root.color - property real cornerRadius: root.isSnowing ? (root.radius - root.border.width) : 0 - - fragmentShader: root.isSnowing ? - Qt.resolvedUrl(Quickshell.shellDir + "/Shaders/qsb/weather_snow.frag.qsb") : - Qt.resolvedUrl(Quickshell.shellDir + "/Shaders/qsb/weather_rain.frag.qsb") } ColumnLayout { diff --git a/Modules/Panels/Settings/Tabs/LocationTab.qml b/Modules/Panels/Settings/Tabs/LocationTab.qml index 78d3c7d6..0311d303 100644 --- a/Modules/Panels/Settings/Tabs/LocationTab.qml +++ b/Modules/Panels/Settings/Tabs/LocationTab.qml @@ -93,6 +93,14 @@ ColumnLayout { onToggled: checked => Settings.data.location.showCalendarWeather = checked enabled: Settings.data.location.weatherEnabled } + + NToggle { + label: I18n.tr("settings.location.weather.show-effects.label") + description: I18n.tr("settings.location.weather.show-effects.description") + checked: Settings.data.location.weatherShowEffects + onToggled: checked => Settings.data.location.weatherShowEffects = checked + enabled: Settings.data.location.weatherEnabled + } } NDivider {