mirror of
https://github.com/danbulant/dots-hyprland
synced 2026-05-24 12:22:09 +00:00
weather: make the °C not look ass, move "feels like" to popup
This commit is contained in:
parent
f56308b6e3
commit
4065142830
2 changed files with 34 additions and 19 deletions
|
|
@ -18,26 +18,37 @@ StyledPopup {
|
|||
spacing: 5
|
||||
|
||||
// Header
|
||||
RowLayout {
|
||||
ColumnLayout {
|
||||
id: header
|
||||
spacing: 5
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
spacing: 2
|
||||
|
||||
MaterialSymbol {
|
||||
fill: 0
|
||||
font.weight: Font.Medium
|
||||
text: "location_on"
|
||||
iconSize: Appearance.font.pixelSize.large
|
||||
color: Appearance.colors.colOnSurfaceVariant
|
||||
}
|
||||
RowLayout {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
spacing: 6
|
||||
|
||||
StyledText {
|
||||
text: Weather.data.city
|
||||
font {
|
||||
weight: Font.Medium
|
||||
pixelSize: Appearance.font.pixelSize.normal
|
||||
MaterialSymbol {
|
||||
fill: 0
|
||||
font.weight: Font.Medium
|
||||
text: "location_on"
|
||||
iconSize: Appearance.font.pixelSize.large
|
||||
color: Appearance.colors.colOnSurfaceVariant
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: Weather.data.city
|
||||
font {
|
||||
weight: Font.Medium
|
||||
pixelSize: Appearance.font.pixelSize.normal
|
||||
}
|
||||
color: Appearance.colors.colOnSurfaceVariant
|
||||
}
|
||||
}
|
||||
StyledText {
|
||||
id: temp
|
||||
font.pixelSize: Appearance.font.pixelSize.smaller
|
||||
color: Appearance.colors.colOnSurfaceVariant
|
||||
text: Weather.data.temp + " • " + Translation.tr("Feels like %1").arg(Weather.data.tempFeelsLike)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,8 @@ Singleton {
|
|||
precip: 0,
|
||||
visib: 0,
|
||||
press: 0,
|
||||
temp: 0
|
||||
temp: 0,
|
||||
tempFeelsLike: 0
|
||||
})
|
||||
|
||||
function refineData(data) {
|
||||
|
|
@ -47,22 +48,25 @@ Singleton {
|
|||
temp.wCode = data?.current?.weatherCode || "113";
|
||||
temp.city = data?.location?.areaName[0]?.value || "City";
|
||||
temp.temp = "";
|
||||
temp.tempFeelsLike = "";
|
||||
if (root.useUSCS) {
|
||||
temp.wind = (data?.current?.windspeedMiles || 0) + " mph";
|
||||
temp.precip = (data?.current?.precipInches || 0) + " in";
|
||||
temp.visib = (data?.current?.visibilityMiles || 0) + " m";
|
||||
temp.press = (data?.current?.pressureInches || 0) + " psi";
|
||||
temp.temp += (data?.current?.temp_F || 0);
|
||||
temp.temp += " (" + (data?.current?.FeelsLikeF || 0) + ") ";
|
||||
temp.temp += "\u{02109}";
|
||||
temp.tempFeelsLike += (data?.current?.FeelsLikeF || 0);
|
||||
temp.temp += "°F";
|
||||
temp.tempFeelsLike += "°F";
|
||||
} else {
|
||||
temp.wind = (data?.current?.windspeedKmph || 0) + " km/h";
|
||||
temp.precip = (data?.current?.precipMM || 0) + " mm";
|
||||
temp.visib = (data?.current?.visibility || 0) + " km";
|
||||
temp.press = (data?.current?.pressure || 0) + " hPa";
|
||||
temp.temp += (data?.current?.temp_C || 0);
|
||||
temp.temp += " (" + (data?.current?.FeelsLikeC || 0) + ") ";
|
||||
temp.temp += "\u{02103}";
|
||||
temp.tempFeelsLike += (data?.current?.FeelsLikeC || 0);
|
||||
temp.temp += "°C";
|
||||
temp.tempFeelsLike += "°C";
|
||||
}
|
||||
root.data = temp;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue