mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
fix(location): autolocate off by default for privacy, improved UI when no location is set. Fix #2388
This commit is contained in:
@@ -90,6 +90,8 @@ Rectangle {
|
||||
text: {
|
||||
if (!Settings.data.location.weatherEnabled)
|
||||
return "";
|
||||
if (!LocationService.locationConfigured)
|
||||
return I18n.tr("common.weather-no-location");
|
||||
if (!root.weatherReady)
|
||||
return I18n.tr("common.weather-loading");
|
||||
if (Settings.data.location.hideWeatherCityName)
|
||||
|
||||
@@ -97,6 +97,7 @@ NBox {
|
||||
clip: true
|
||||
|
||||
RowLayout {
|
||||
visible: weatherReady
|
||||
Layout.fillWidth: true
|
||||
spacing: Style.marginS
|
||||
|
||||
@@ -115,14 +116,14 @@ NBox {
|
||||
readonly property int mainWeatherIconSide: Math.round(Style.fontSizeXXXL * 1.75 * Style.uiScaleRatio * 1.6)
|
||||
|
||||
NIcon {
|
||||
visible: !LocationService.taliaWeatherMascotActive || !weatherReady
|
||||
visible: !LocationService.taliaWeatherMascotActive
|
||||
anchors.centerIn: parent
|
||||
icon: weatherReady ? LocationService.weatherSymbolFromCode(LocationService.data.weather.current_weather.weathercode) : "weather-cloud-off"
|
||||
icon: weatherReady ? LocationService.weatherSymbolFromCode(LocationService.data.weather.current_weather.weathercode) : ""
|
||||
pointSize: Style.fontSizeXXXL * 1.75
|
||||
color: Color.mPrimary
|
||||
}
|
||||
Loader {
|
||||
active: LocationService.taliaWeatherMascotActive && weatherReady
|
||||
active: LocationService.taliaWeatherMascotActive
|
||||
anchors.fill: parent
|
||||
asynchronous: true
|
||||
sourceComponent: Component {
|
||||
@@ -153,11 +154,9 @@ NBox {
|
||||
|
||||
RowLayout {
|
||||
NText {
|
||||
visible: weatherReady
|
||||
text: {
|
||||
if (!weatherReady) {
|
||||
if (!weatherReady)
|
||||
return "";
|
||||
}
|
||||
var temp = LocationService.data.weather.current_weather.temperature;
|
||||
var suffix = "C";
|
||||
if (Settings.data.location.useFahrenheit) {
|
||||
@@ -258,10 +257,23 @@ NBox {
|
||||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
active: !weatherReady
|
||||
ColumnLayout {
|
||||
visible: !weatherReady
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
sourceComponent: NBusyIndicator {}
|
||||
spacing: Style.marginS
|
||||
|
||||
NBusyIndicator {
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
visible: LocationService.locationConfigured
|
||||
}
|
||||
|
||||
NText {
|
||||
visible: !LocationService.locationConfigured
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
text: I18n.tr("common.weather-no-location")
|
||||
pointSize: Style.fontSizeS
|
||||
color: Color.mOnSurfaceVariant
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ DraggableDesktopWidget {
|
||||
NIcon {
|
||||
visible: !LocationService.taliaWeatherMascotActive || !weatherReady
|
||||
anchors.centerIn: parent
|
||||
icon: weatherReady ? LocationService.weatherSymbolFromCode(currentWeatherCode) : "weather-cloud-off"
|
||||
icon: weatherReady ? LocationService.weatherSymbolFromCode(currentWeatherCode) : (LocationService.locationConfigured ? "weather-cloud-off" : "map-pin-off")
|
||||
pointSize: Math.round(Style.fontSizeXXXL * 2 * widgetScale)
|
||||
color: weatherReady ? Color.mPrimary : Color.mOnSurfaceVariant
|
||||
}
|
||||
@@ -86,7 +86,7 @@ DraggableDesktopWidget {
|
||||
}
|
||||
|
||||
NText {
|
||||
text: weatherReady ? `${currentTemp}°${tempUnit}` : "---"
|
||||
text: weatherReady ? `${currentTemp}°${tempUnit}` : "--"
|
||||
pointSize: Math.round(Style.fontSizeXXXL * widgetScale)
|
||||
font.weight: Style.fontWeightBold
|
||||
color: Color.mOnSurface
|
||||
@@ -99,7 +99,7 @@ DraggableDesktopWidget {
|
||||
|
||||
NText {
|
||||
Layout.fillWidth: true
|
||||
text: locationName || "No location"
|
||||
text: locationName || I18n.tr("common.weather-no-location")
|
||||
pointSize: Math.round(Style.fontSizeS * widgetScale)
|
||||
font.weight: Style.fontWeightRegular
|
||||
color: Color.mOnSurfaceVariant
|
||||
|
||||
Reference in New Issue
Block a user