Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit ba127360b488d5195a1d6823a1433a266390bf3e 1 parent bd82805
@stuartm stuartm authored
Showing with 9 additions and 6 deletions.
  1. +9 −6 mythplugins/mythweather/mythweather/weatherScreen.cpp
View
15 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,9 +185,10 @@ 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;
@@ -195,12 +196,14 @@ QString WeatherScreen::formatDataItem(const QString &key, const QString &value)
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);
Please sign in to comment.
Something went wrong with that request. Please try again.