mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
LocationTab: add toggle to fully disable weather (as requested in #488)
This commit is contained in:
@@ -576,6 +576,10 @@
|
||||
"label": "Wetter",
|
||||
"description": "Bevorzugte Temperatureinheit wählen."
|
||||
},
|
||||
"enabled": {
|
||||
"label": "Wetter aktivieren",
|
||||
"description": "Wetterinformationen in der gesamten Benutzeroberfläche anzeigen und Wetterdaten abrufen. Wenn deaktiviert, werden alle Wetterelemente ausgeblendet und es werden keine Netzwerkanfragen gestellt."
|
||||
},
|
||||
"fahrenheit": {
|
||||
"label": "Temperatur in Fahrenheit (°F) anzeigen",
|
||||
"description": "Temperatur in Fahrenheit statt Celsius anzeigen."
|
||||
@@ -1203,6 +1207,9 @@
|
||||
"calendar": {
|
||||
"panel": {
|
||||
"week": "Woche"
|
||||
},
|
||||
"weather": {
|
||||
"loading": "Wetter wird geladen…"
|
||||
}
|
||||
},
|
||||
"tooltips": {
|
||||
|
||||
@@ -576,6 +576,10 @@
|
||||
"label": "Weather",
|
||||
"description": "Choose your preferred temperature unit."
|
||||
},
|
||||
"enabled": {
|
||||
"label": "Enable weather",
|
||||
"description": "Show weather information throughout the interface and fetch weather data. When disabled, all weather elements will be hidden and no network requests will be made."
|
||||
},
|
||||
"fahrenheit": {
|
||||
"label": "Display temperature in Fahrenheit (°F)",
|
||||
"description": "Display temperature in Fahrenheit instead of Celsius."
|
||||
@@ -1183,11 +1187,7 @@
|
||||
"scan-again": "Scan again"
|
||||
}
|
||||
},
|
||||
"calendar": {
|
||||
"panel": {
|
||||
"week": "Week"
|
||||
}
|
||||
},
|
||||
|
||||
"tooltips": {
|
||||
"refresh": "Refresh",
|
||||
"close": "Close",
|
||||
@@ -1244,6 +1244,14 @@
|
||||
"clock": {
|
||||
"tooltip": "Open calendar"
|
||||
},
|
||||
"calendar": {
|
||||
"panel": {
|
||||
"week": "Week"
|
||||
},
|
||||
"weather": {
|
||||
"loading": "Loading weather…"
|
||||
}
|
||||
},
|
||||
"dock": {
|
||||
"menu": {
|
||||
"focus": "Focus",
|
||||
|
||||
@@ -576,6 +576,10 @@
|
||||
"label": "Clima",
|
||||
"description": "Elige tu unidad de temperatura preferida."
|
||||
},
|
||||
"enabled": {
|
||||
"label": "Activar clima",
|
||||
"description": "Mostrar información del clima en toda la interfaz y obtener datos meteorológicos. Cuando está desactivado, todos los elementos del clima estarán ocultos y no se realizarán solicitudes de red."
|
||||
},
|
||||
"fahrenheit": {
|
||||
"label": "Mostrar temperatura en Fahrenheit (°F)",
|
||||
"description": "Muestra la temperatura en Fahrenheit en lugar de Celsius."
|
||||
@@ -1186,6 +1190,9 @@
|
||||
"calendar": {
|
||||
"panel": {
|
||||
"week": "Semana"
|
||||
},
|
||||
"weather": {
|
||||
"loading": "Cargando el clima…"
|
||||
}
|
||||
},
|
||||
"tooltips": {
|
||||
|
||||
@@ -576,6 +576,10 @@
|
||||
"label": "Météo",
|
||||
"description": "Choisissez votre unité de température préférée."
|
||||
},
|
||||
"enabled": {
|
||||
"label": "Activer la météo",
|
||||
"description": "Afficher les informations météorologiques dans toute l'interface et récupérer les données météo. Lorsque désactivé, tous les éléments météo seront masqués et aucune requête réseau ne sera effectuée."
|
||||
},
|
||||
"fahrenheit": {
|
||||
"label": "Afficher la température en Fahrenheit (°F)",
|
||||
"description": "Afficher la température en Fahrenheit au lieu de Celsius."
|
||||
@@ -1186,6 +1190,9 @@
|
||||
"calendar": {
|
||||
"panel": {
|
||||
"week": "Semaine"
|
||||
},
|
||||
"weather": {
|
||||
"loading": "Chargement de la météo…"
|
||||
}
|
||||
},
|
||||
"tooltips": {
|
||||
|
||||
@@ -538,6 +538,10 @@
|
||||
"label": "Clima",
|
||||
"description": "Escolha sua unidade de temperatura preferida."
|
||||
},
|
||||
"enabled": {
|
||||
"label": "Ativar clima",
|
||||
"description": "Mostrar informações meteorológicas em toda a interface e buscar dados do clima. Quando desativado, todos os elementos do clima serão ocultados e nenhuma solicitação de rede será feita."
|
||||
},
|
||||
"fahrenheit": {
|
||||
"label": "Exibir temperatura em Fahrenheit (°F)",
|
||||
"description": "Exibe a temperatura em Fahrenheit em vez de Celsius."
|
||||
@@ -1186,6 +1190,9 @@
|
||||
"calendar": {
|
||||
"panel": {
|
||||
"week": "Semana"
|
||||
},
|
||||
"weather": {
|
||||
"loading": "Carregando o clima…"
|
||||
}
|
||||
},
|
||||
"tooltips": {
|
||||
|
||||
@@ -576,6 +576,10 @@
|
||||
"label": "天气",
|
||||
"description": "选择您喜欢的温度单位。"
|
||||
},
|
||||
"enabled": {
|
||||
"label": "启用天气",
|
||||
"description": "在整个界面中显示天气信息并获取天气数据。禁用后,所有天气元素将被隐藏,不会进行网络请求。"
|
||||
},
|
||||
"fahrenheit": {
|
||||
"label": "以华氏度显示温度 (°F)",
|
||||
"description": "以华氏度而非摄氏度显示温度。"
|
||||
@@ -1186,6 +1190,9 @@
|
||||
"calendar": {
|
||||
"panel": {
|
||||
"week": "周"
|
||||
},
|
||||
"weather": {
|
||||
"loading": "正在加载天气…"
|
||||
}
|
||||
},
|
||||
"tooltips": {
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
},
|
||||
"location": {
|
||||
"name": "Tokyo",
|
||||
"weatherEnabled": true,
|
||||
"useFahrenheit": false,
|
||||
"use12hourFormat": false,
|
||||
"showWeekNumberInCalendar": false
|
||||
|
||||
@@ -195,6 +195,7 @@ Singleton {
|
||||
// location
|
||||
property JsonObject location: JsonObject {
|
||||
property string name: defaultLocation
|
||||
property bool weatherEnabled: true
|
||||
property bool useFahrenheit: false
|
||||
property bool use12hourFormat: false
|
||||
property bool showWeekNumberInCalendar: false
|
||||
|
||||
@@ -24,7 +24,7 @@ NPanel {
|
||||
|
||||
readonly property int firstDayOfWeek: Qt.locale().firstDayOfWeek
|
||||
property bool isCurrentMonth: checkIsCurrentMonth()
|
||||
readonly property bool weatherReady: (LocationService.data.weather !== null)
|
||||
readonly property bool weatherReady: Settings.data.location.weatherEnabled && (LocationService.data.weather !== null)
|
||||
|
||||
function checkIsCurrentMonth() {
|
||||
return (Time.date.getMonth() === grid.month) && (Time.date.getFullYear() === grid.year)
|
||||
@@ -78,12 +78,13 @@ NPanel {
|
||||
|
||||
// Weather icon and temperature
|
||||
ColumnLayout {
|
||||
visible: Settings.data.location.weatherEnabled && weatherReady
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
spacing: Style.marginXXS
|
||||
|
||||
NIcon {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
icon: weatherReady ? LocationService.weatherSymbolFromCode(LocationService.data.weather.current_weather.weathercode) : "cloud"
|
||||
icon: Settings.data.location.weatherEnabled && weatherReady ? LocationService.weatherSymbolFromCode(LocationService.data.weather.current_weather.weathercode) : ""
|
||||
pointSize: Style.fontSizeXXL
|
||||
color: Color.mOnPrimary
|
||||
}
|
||||
@@ -91,6 +92,8 @@ NPanel {
|
||||
NText {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
text: {
|
||||
if (!Settings.data.location.weatherEnabled)
|
||||
return ""
|
||||
if (!weatherReady)
|
||||
return ""
|
||||
var temp = LocationService.data.weather.current_weather.temperature
|
||||
@@ -168,6 +171,8 @@ NPanel {
|
||||
|
||||
NText {
|
||||
text: {
|
||||
if (!Settings.data.location.weatherEnabled)
|
||||
return ""
|
||||
if (!weatherReady)
|
||||
return I18n.tr("calendar.weather.loading")
|
||||
const chunks = Settings.data.location.name.split(",")
|
||||
@@ -323,7 +328,7 @@ NPanel {
|
||||
}
|
||||
}
|
||||
RowLayout {
|
||||
visible: !weatherReady
|
||||
visible: Settings.data.location.weatherEnabled && !weatherReady
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
NBusyIndicator {}
|
||||
|
||||
@@ -106,17 +106,27 @@ Item {
|
||||
return I18n.tr("battery.no-battery-detected")
|
||||
}
|
||||
if (battery.timeToEmpty > 0) {
|
||||
lines.push(I18n.tr("battery.time-left", {"time": Time.formatVagueHumanReadableDuration(battery.timeToEmpty)}))
|
||||
lines.push(I18n.tr("battery.time-left", {
|
||||
"time": Time.formatVagueHumanReadableDuration(battery.timeToEmpty)
|
||||
}))
|
||||
}
|
||||
if (battery.timeToFull > 0) {
|
||||
lines.push(I18n.tr("battery.time-until-full", {"time": Time.formatVagueHumanReadableDuration(battery.timeToFull)}))
|
||||
lines.push(I18n.tr("battery.time-until-full", {
|
||||
"time": Time.formatVagueHumanReadableDuration(battery.timeToFull)
|
||||
}))
|
||||
}
|
||||
if (battery.changeRate !== undefined) {
|
||||
const rate = battery.changeRate
|
||||
if (rate > 0) {
|
||||
lines.push(charging ? I18n.tr("battery.charging-rate", {"rate": rate.toFixed(2)}) : I18n.tr("battery.discharging-rate", {"rate": rate.toFixed(2)}))
|
||||
lines.push(charging ? I18n.tr("battery.charging-rate", {
|
||||
"rate": rate.toFixed(2)
|
||||
}) : I18n.tr("battery.discharging-rate", {
|
||||
"rate": rate.toFixed(2)
|
||||
}))
|
||||
} else if (rate < 0) {
|
||||
lines.push(I18n.tr("battery.discharging-rate", {"rate": Math.abs(rate).toFixed(2)}))
|
||||
lines.push(I18n.tr("battery.discharging-rate", {
|
||||
"rate": Math.abs(rate).toFixed(2)
|
||||
}))
|
||||
} else {
|
||||
// Rate is 0 - check if plugged in (charging state) or idle
|
||||
lines.push(charging ? I18n.tr("battery.plugged-in") : I18n.tr("battery.idle"))
|
||||
@@ -125,7 +135,9 @@ Item {
|
||||
lines.push(charging ? I18n.tr("battery.charging") : I18n.tr("battery.discharging"))
|
||||
}
|
||||
if (battery.healthPercentage !== undefined && battery.healthPercentage > 0) {
|
||||
lines.push(I18n.tr("battery.health", {"percent": Math.round(battery.healthPercentage)}))
|
||||
lines.push(I18n.tr("battery.health", {
|
||||
"percent": Math.round(battery.healthPercentage)
|
||||
}))
|
||||
}
|
||||
return lines.join("\n")
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import qs.Widgets
|
||||
NBox {
|
||||
id: root
|
||||
|
||||
readonly property bool weatherReady: (LocationService.data.weather !== null)
|
||||
readonly property bool weatherReady: Settings.data.location.weatherEnabled && (LocationService.data.weather !== null)
|
||||
|
||||
ColumnLayout {
|
||||
id: content
|
||||
|
||||
@@ -17,9 +17,13 @@ NPanel {
|
||||
var count = 0
|
||||
for (var i = 0; i < Settings.data.controlCenter.cards.length; i++) {
|
||||
const card = Settings.data.controlCenter.cards[i]
|
||||
if (!card.enabled) {
|
||||
if (!card.enabled)
|
||||
continue
|
||||
}
|
||||
|
||||
const contributes = (card.id !== "weather-card" || Settings.data.location.weatherEnabled)
|
||||
if (!contributes)
|
||||
continue
|
||||
|
||||
count++
|
||||
switch (card.id) {
|
||||
case "profile-card":
|
||||
@@ -72,7 +76,7 @@ NPanel {
|
||||
Repeater {
|
||||
model: Settings.data.controlCenter.cards
|
||||
Loader {
|
||||
active: modelData.enabled
|
||||
active: modelData.enabled && (modelData.id !== "weather-card" || Settings.data.location.weatherEnabled)
|
||||
visible: active
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: {
|
||||
|
||||
@@ -548,16 +548,18 @@ Loader {
|
||||
anchors.margins: 14
|
||||
spacing: 14
|
||||
|
||||
// Weather section
|
||||
// Top info row
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 65
|
||||
spacing: 18
|
||||
visible: !Settings.data.general.compactLockScreen && LocationService.coordinatesReady && LocationService.data.weather !== null
|
||||
visible: !Settings.data.general.compactLockScreen
|
||||
|
||||
// Media widget with visualizer
|
||||
Rectangle {
|
||||
Layout.preferredWidth: 220
|
||||
// Expand to take remaining space when weather is hidden
|
||||
Layout.fillWidth: !(Settings.data.location.weatherEnabled && LocationService.data.weather !== null)
|
||||
Layout.preferredHeight: 50
|
||||
radius: 25
|
||||
color: Color.transparent
|
||||
@@ -666,6 +668,7 @@ Loader {
|
||||
|
||||
// Current weather
|
||||
RowLayout {
|
||||
visible: Settings.data.location.weatherEnabled && LocationService.data.weather !== null
|
||||
Layout.preferredWidth: 180
|
||||
spacing: 8
|
||||
|
||||
@@ -738,6 +741,7 @@ Loader {
|
||||
|
||||
// 3-day forecast
|
||||
RowLayout {
|
||||
visible: Settings.data.location.weatherEnabled && LocationService.data.weather !== null
|
||||
Layout.preferredWidth: 260
|
||||
Layout.rightMargin: 8
|
||||
spacing: 4
|
||||
@@ -785,9 +789,16 @@ Loader {
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
visible: !(Settings.data.location.weatherEnabled && LocationService.data.weather !== null)
|
||||
Layout.preferredWidth: visible ? 1 : 0
|
||||
}
|
||||
|
||||
// Battery and Keyboard Layout (full mode only)
|
||||
ColumnLayout {
|
||||
Layout.preferredWidth: 60
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||
spacing: 8
|
||||
|
||||
// Battery
|
||||
|
||||
@@ -71,11 +71,20 @@ ColumnLayout {
|
||||
description: I18n.tr("settings.location.weather.section.description")
|
||||
}
|
||||
|
||||
NToggle {
|
||||
label: I18n.tr("settings.location.weather.enabled.label")
|
||||
description: I18n.tr("settings.location.weather.enabled.description")
|
||||
checked: Settings.data.location.weatherEnabled
|
||||
onToggled: checked => Settings.data.location.weatherEnabled = checked
|
||||
}
|
||||
|
||||
NToggle {
|
||||
label: I18n.tr("settings.location.weather.fahrenheit.label")
|
||||
description: I18n.tr("settings.location.weather.fahrenheit.description")
|
||||
checked: Settings.data.location.useFahrenheit
|
||||
onToggled: checked => Settings.data.location.useFahrenheit = checked
|
||||
enabled: Settings.data.location.weatherEnabled
|
||||
opacity: Settings.data.location.weatherEnabled ? 1.0 : 0.5
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ Singleton {
|
||||
Timer {
|
||||
id: updateTimer
|
||||
interval: 20 * 1000
|
||||
running: true
|
||||
running: Settings.data.location.weatherEnabled
|
||||
repeat: true
|
||||
onTriggered: {
|
||||
updateWeather()
|
||||
@@ -114,6 +114,10 @@ Singleton {
|
||||
|
||||
// --------------------------------
|
||||
function updateWeather() {
|
||||
if (!Settings.data.location.weatherEnabled) {
|
||||
return
|
||||
}
|
||||
|
||||
if (isFetchingWeather) {
|
||||
Logger.warn("Location", "Weather is still fetching")
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user