Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

(cherry picked from commit ba12736)
  • Loading branch information...
commit 2384a3cb24e2caee24de61ed59216482d4732436 1 parent 07d3b87
Stuart Morgan authored July 15, 2012
15  mythplugins/mythweather/mythweather/weatherScreen.cpp
@@ -169,7 +169,7 @@ void WeatherScreen::prepareWidget(MythUIType *widget)
169 169
 
170 170
 QString WeatherScreen::formatDataItem(const QString &key, const QString &value)
171 171
 {
172  
-    if (key == "relative_humidity")
  172
+    if (key.startsWith("relative_humidity") || key.startsWith("pop"))
173 173
         return value + " %";
174 174
 
175 175
     if (key == "pressure")
@@ -178,9 +178,10 @@ QString WeatherScreen::formatDataItem(const QString &key, const QString &value)
178 178
     if (key == "visibility")
179 179
         return value + (m_units == ENG_UNITS ? " mi" : " km");
180 180
 
181  
-    if (key == "temp" || key == "appt" || key.contains("low",Qt::CaseInsensitive) ||
182  
-        key.contains("high",Qt::CaseInsensitive) ||
183  
-        key.contains("temp",Qt::CaseInsensitive))
  181
+    if (key.startsWith("temp") ||
  182
+        key.startsWith("appt") ||
  183
+        key.startsWith("low") ||
  184
+        key.startsWith("high"))
184 185
     {
185 186
        if ((value == "NA") || (value == "N/A"))
186 187
           return QString();
@@ -188,12 +189,14 @@ QString WeatherScreen::formatDataItem(const QString &key, const QString &value)
188 189
           return value + getTemperatureUnit();
189 190
     }
190 191
 
191  
-    if (key == "wind_gust" || key == "wind_spdgst" || key == "wind_speed")
  192
+    if (key.startsWith("wind_gust") ||
  193
+        key.startsWith("wind_spdgst") ||
  194
+        key.startsWith("wind_speed"))
192 195
         return value + (m_units == ENG_UNITS ? " mph" : " km/h");
193 196
 
194 197
     /*The days of the week will be translated if the script sends elements from
195 198
      the enum DaysOfWeek.*/
196  
-    if (key.startsWith("date-"))
  199
+    if (key.startsWith("date"))
197 200
     {
198 201
         bool isNumber;
199 202
         value.toInt( &isNumber);

0 notes on commit 2384a3c

Please sign in to comment.
Something went wrong with that request. Please try again.