forked from Shinonome/dots-hyprland
weather: make the °C not look ass, move "feels like" to popup
This commit is contained in:
@@ -18,26 +18,37 @@ StyledPopup {
|
|||||||
spacing: 5
|
spacing: 5
|
||||||
|
|
||||||
// Header
|
// Header
|
||||||
RowLayout {
|
ColumnLayout {
|
||||||
id: header
|
id: header
|
||||||
spacing: 5
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
spacing: 2
|
||||||
|
|
||||||
MaterialSymbol {
|
RowLayout {
|
||||||
fill: 0
|
Layout.alignment: Qt.AlignHCenter
|
||||||
font.weight: Font.Medium
|
spacing: 6
|
||||||
text: "location_on"
|
|
||||||
iconSize: Appearance.font.pixelSize.large
|
|
||||||
color: Appearance.colors.colOnSurfaceVariant
|
|
||||||
}
|
|
||||||
|
|
||||||
StyledText {
|
MaterialSymbol {
|
||||||
text: Weather.data.city
|
fill: 0
|
||||||
font {
|
font.weight: Font.Medium
|
||||||
weight: Font.Medium
|
text: "location_on"
|
||||||
pixelSize: Appearance.font.pixelSize.normal
|
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
|
color: Appearance.colors.colOnSurfaceVariant
|
||||||
|
text: Weather.data.temp + " • " + Translation.tr("Feels like %1").arg(Weather.data.tempFeelsLike)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ Singleton {
|
|||||||
precip: 0,
|
precip: 0,
|
||||||
visib: 0,
|
visib: 0,
|
||||||
press: 0,
|
press: 0,
|
||||||
temp: 0
|
temp: 0,
|
||||||
|
tempFeelsLike: 0
|
||||||
})
|
})
|
||||||
|
|
||||||
function refineData(data) {
|
function refineData(data) {
|
||||||
@@ -47,22 +48,25 @@ Singleton {
|
|||||||
temp.wCode = data?.current?.weatherCode || "113";
|
temp.wCode = data?.current?.weatherCode || "113";
|
||||||
temp.city = data?.location?.areaName[0]?.value || "City";
|
temp.city = data?.location?.areaName[0]?.value || "City";
|
||||||
temp.temp = "";
|
temp.temp = "";
|
||||||
|
temp.tempFeelsLike = "";
|
||||||
if (root.useUSCS) {
|
if (root.useUSCS) {
|
||||||
temp.wind = (data?.current?.windspeedMiles || 0) + " mph";
|
temp.wind = (data?.current?.windspeedMiles || 0) + " mph";
|
||||||
temp.precip = (data?.current?.precipInches || 0) + " in";
|
temp.precip = (data?.current?.precipInches || 0) + " in";
|
||||||
temp.visib = (data?.current?.visibilityMiles || 0) + " m";
|
temp.visib = (data?.current?.visibilityMiles || 0) + " m";
|
||||||
temp.press = (data?.current?.pressureInches || 0) + " psi";
|
temp.press = (data?.current?.pressureInches || 0) + " psi";
|
||||||
temp.temp += (data?.current?.temp_F || 0);
|
temp.temp += (data?.current?.temp_F || 0);
|
||||||
temp.temp += " (" + (data?.current?.FeelsLikeF || 0) + ") ";
|
temp.tempFeelsLike += (data?.current?.FeelsLikeF || 0);
|
||||||
temp.temp += "\u{02109}";
|
temp.temp += "°F";
|
||||||
|
temp.tempFeelsLike += "°F";
|
||||||
} else {
|
} else {
|
||||||
temp.wind = (data?.current?.windspeedKmph || 0) + " km/h";
|
temp.wind = (data?.current?.windspeedKmph || 0) + " km/h";
|
||||||
temp.precip = (data?.current?.precipMM || 0) + " mm";
|
temp.precip = (data?.current?.precipMM || 0) + " mm";
|
||||||
temp.visib = (data?.current?.visibility || 0) + " km";
|
temp.visib = (data?.current?.visibility || 0) + " km";
|
||||||
temp.press = (data?.current?.pressure || 0) + " hPa";
|
temp.press = (data?.current?.pressure || 0) + " hPa";
|
||||||
temp.temp += (data?.current?.temp_C || 0);
|
temp.temp += (data?.current?.temp_C || 0);
|
||||||
temp.temp += " (" + (data?.current?.FeelsLikeC || 0) + ") ";
|
temp.tempFeelsLike += (data?.current?.FeelsLikeC || 0);
|
||||||
temp.temp += "\u{02103}";
|
temp.temp += "°C";
|
||||||
|
temp.tempFeelsLike += "°C";
|
||||||
}
|
}
|
||||||
root.data = temp;
|
root.data = temp;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user