mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 21:42:51 -05:00
@@ -363,6 +363,25 @@ Item {
|
||||
onToggled: checked => SettingsData.set("useFahrenheit", checked)
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 1
|
||||
color: Theme.outline
|
||||
opacity: 0.15
|
||||
visible: !SettingsData.useFahrenheit
|
||||
}
|
||||
|
||||
SettingsToggleRow {
|
||||
tab: "time"
|
||||
tags: ["weather", "wind", "speed", "units", "metric"]
|
||||
settingKey: "windSpeedUnit"
|
||||
text: I18n.tr("Wind Speed in m/s")
|
||||
description: I18n.tr("Use meters per second instead of km/h for wind speed")
|
||||
checked: SettingsData.windSpeedUnit === "ms"
|
||||
onToggled: checked => SettingsData.set("windSpeedUnit", checked ? "ms" : "kmh")
|
||||
visible: !SettingsData.useFahrenheit
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 1
|
||||
@@ -689,6 +708,13 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
StyledText {
|
||||
property var feelsLike: SettingsData.useFahrenheit ? (WeatherService.weather.feelsLikeF || WeatherService.weather.tempF) : (WeatherService.weather.feelsLike || WeatherService.weather.temp)
|
||||
text: I18n.tr("Feels Like %1°").arg(feelsLike)
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.5)
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: WeatherService.weather.city || ""
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
@@ -891,20 +917,24 @@ Item {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
StyledText {
|
||||
id: windText
|
||||
text: {
|
||||
if (!WeatherService.weather.wind)
|
||||
return "--";
|
||||
const windKmh = parseFloat(WeatherService.weather.wind);
|
||||
if (isNaN(windKmh))
|
||||
return WeatherService.weather.wind;
|
||||
if (SettingsData.useFahrenheit)
|
||||
return Math.round(windKmh * 0.621371) + " mph";
|
||||
return WeatherService.weather.wind;
|
||||
SettingsData.windSpeedUnit;
|
||||
SettingsData.useFahrenheit;
|
||||
return WeatherService.formatSpeed(WeatherService.weather.wind) || "--";
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall + 1
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: SettingsData.useFahrenheit ? Qt.ArrowCursor : Qt.PointingHandCursor
|
||||
enabled: !SettingsData.useFahrenheit
|
||||
onClicked: SettingsData.set("windSpeedUnit", SettingsData.windSpeedUnit === "kmh" ? "ms" : "kmh")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user