Permalink
Browse files

Properly format all data items, including those from the 18hr forecast

(cherry picked from commit ba12736)
  • Loading branch information...
1 parent 07d3b87 commit 2384a3cb24e2caee24de61ed59216482d4732436 @stuartm stuartm committed Jul 15, 2012
Showing with 9 additions and 6 deletions.
  1. +9 −6 mythplugins/mythweather/mythweather/weatherScreen.cpp
@@ -169,7 +169,7 @@ void WeatherScreen::prepareWidget(MythUIType *widget)
QString WeatherScreen::formatDataItem(const QString &key, const QString &value)
{
- if (key == "relative_humidity")
+ if (key.startsWith("relative_humidity") || key.startsWith("pop"))
return value + " %";
if (key == "pressure")
@@ -178,22 +178,25 @@ QString WeatherScreen::formatDataItem(const QString &key, const QString &value)
if (key == "visibility")
return value + (m_units == ENG_UNITS ? " mi" : " km");
- if (key == "temp" || key == "appt" || key.contains("low",Qt::CaseInsensitive) ||
- key.contains("high",Qt::CaseInsensitive) ||
- key.contains("temp",Qt::CaseInsensitive))
+ if (key.startsWith("temp") ||
+ key.startsWith("appt") ||
+ key.startsWith("low") ||
+ key.startsWith("high"))
{
if ((value == "NA") || (value == "N/A"))
return QString();
else
return value + getTemperatureUnit();
}
- if (key == "wind_gust" || key == "wind_spdgst" || key == "wind_speed")
+ if (key.startsWith("wind_gust") ||
+ key.startsWith("wind_spdgst") ||
+ key.startsWith("wind_speed"))
return value + (m_units == ENG_UNITS ? " mph" : " km/h");
/*The days of the week will be translated if the script sends elements from
the enum DaysOfWeek.*/
- if (key.startsWith("date-"))
+ if (key.startsWith("date"))
{
bool isNumber;
value.toInt( &isNumber);

0 comments on commit 2384a3c

Please sign in to comment.