Permalink
Browse files

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

  • Loading branch information...
stuartm committed Jul 15, 2012
1 parent bd82805 commit ba127360b488d5195a1d6823a1433a266390bf3e
Showing with 9 additions and 6 deletions.
  1. +9 −6 mythplugins/mythweather/mythweather/weatherScreen.cpp
@@ -176,7 +176,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")
@@ -185,22 +185,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 value;
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 ba12736

Please sign in to comment.