Ticket #8356: wind-source.patch

File wind-source.patch, 2.7 KB (added by Alec leamas <gmail: leamas.alec>, 16 years ago)
  • mythweather/weather-screens.xml

    Display the average windspeed if gusting wind speed is not available.
    
    From: Alec Leamas <leamas.alec%AT%gmail.com>
    
    Also updates the label depending on what's displayed.
    ---
    
     mythweather/weather-screens.xml   |    1 +
     mythweather/weatherSource.cpp     |   19 +++++++++++++++++++
     theme/default-wide/weather-ui.xml |    1 -
     theme/default/weather-ui.xml      |    1 -
     4 files changed, 20 insertions(+), 2 deletions(-)
    
    
    diff --git a/mythweather/weather-screens.xml b/mythweather/weather-screens.xml
    index e743e52..980f29c 100644
    a b  
    66        <datum name="pressure" />
    77        <!-- <datum name="wind_dir" />  -->
    88        <datum name="wind_spdgst" />
     9        <datum name="windlbl" />
    910        <!-- <datum name="wind_gust" /> -->
    1011        <datum name="wind_dir" />
    1112        <datum name="visibility" />
  • mythweather/weatherSource.cpp

    diff --git a/mythweather/weatherSource.cpp b/mythweather/weatherSource.cpp
    index c0e7f9a..d0b05eb 100644
    a b static void processPrecip(DataMap& data)  
    645645    }
    646646}
    647647
     648static void processWind(DataMap& data)
     649{
     650    QString label = QObject::tr( "Wind (Gust)");
     651
     652    QString w = data["wind_spdgst"];
     653    if (w == "" || w == "NA")
     654    {
     655        w = data["wind_speed"];
     656        if (w != "" && w != "NA")
     657        {
     658            data.changeKey( "wind_speed", "wind_spdgst");
     659            label = QObject::tr( "Wind (avg)");
     660        }
     661    }
     662    VERBOSE(VB_MOST, QString("Wind label: %1").arg(label));
     663    data[ "windlbl"] = label;
     664}
     665
    648666void WeatherSource::processData()
    649667{
    650668    QStringList data = QString(m_buffer).split('\n', QString::SkipEmptyParts);
    void WeatherSource::processData()  
    671689            m_data[temp[0]] = temp[1];
    672690    }
    673691    processPrecip(m_data);
     692    processWind(m_data);
    674693}
    675694
    676695void WeatherSource::scriptTimeout()
  • theme/default-wide/weather-ui.xml

    diff --git a/theme/default-wide/weather-ui.xml b/theme/default-wide/weather-ui.xml
    index 5c8054d..4b6519a 100644
    a b  
    8989
    9090        <textarea name="windlbl" from="humiditylbl">
    9191            <area>220,336,245,32</area>
    92             <value>Wind(Gust)</value>
    9392        </textarea>
    9493
    9594        <textarea name="wind_spdgst" from="basetextarea">
  • theme/default/weather-ui.xml

    diff --git a/theme/default/weather-ui.xml b/theme/default/weather-ui.xml
    index 3ec8d8f..4d50c24 100644
    a b  
    9595
    9696        <textarea name="windlbl" from="humiditylbl">
    9797            <area>60,276,420,32</area>
    98             <value>Wind(Gust)</value>
    9998        </textarea>
    10099
    101100        <textarea name="wind_spdgst" from="relative_humidity">