Skip to content

Commit

Permalink
Properly format all data items, including those from the 18hr forecast
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartm committed Jul 15, 2012
1 parent bd82805 commit ba12736
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions mythplugins/mythweather/mythweather/weatherScreen.cpp
Expand Up @@ -176,7 +176,7 @@ void WeatherScreen::prepareWidget(MythUIType *widget)


QString WeatherScreen::formatDataItem(const QString &key, const QString &value) QString WeatherScreen::formatDataItem(const QString &key, const QString &value)
{ {
if (key == "relative_humidity") if (key.startsWith("relative_humidity") || key.startsWith("pop"))
return value + " %"; return value + " %";


if (key == "pressure") if (key == "pressure")
Expand All @@ -185,22 +185,25 @@ QString WeatherScreen::formatDataItem(const QString &key, const QString &value)
if (key == "visibility") if (key == "visibility")
return value + (m_units == ENG_UNITS ? " mi" : " km"); return value + (m_units == ENG_UNITS ? " mi" : " km");


if (key == "temp" || key == "appt" || key.contains("low",Qt::CaseInsensitive) || if (key.startsWith("temp") ||
key.contains("high",Qt::CaseInsensitive) || key.startsWith("appt") ||
key.contains("temp",Qt::CaseInsensitive)) key.startsWith("low") ||
key.startsWith("high"))
{ {
if ( (value == "NA") || (value == "N/A") ) if ( (value == "NA") || (value == "N/A") )
return value; return value;
else else
return value + getTemperatureUnit(); 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"); return value + (m_units == ENG_UNITS ? " mph" : " km/h");


/*The days of the week will be translated if the script sends elements from /*The days of the week will be translated if the script sends elements from
the enum DaysOfWeek.*/ the enum DaysOfWeek.*/
if (key.startsWith("date-")) if (key.startsWith("date"))
{ {
bool isNumber; bool isNumber;
value.toInt( &isNumber); value.toInt( &isNumber);
Expand Down

0 comments on commit ba12736

Please sign in to comment.