Rename getIcon(...) to saveIconNamePath(...)

Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
pull/18/head
Mavridis Philippe 3 years ago
parent 2eeaa5f49b
commit 432bc8184c
No known key found for this signature in database
GPG Key ID: F8D2D7E2F989A494

@ -259,7 +259,7 @@ bool MetarParser::parseCurrent(const TQString &s)
if (sCode.contains("DZ"))
{
phenomena = i18n("Drizzle");
getIcon( WeatherIcon::LightRain, false );
saveIconNamePath( WeatherIcon::LightRain, false );
}
else if (sCode.contains("RA"))
{
@ -274,32 +274,32 @@ bool MetarParser::parseCurrent(const TQString &s)
else if (sCode.contains("SG"))
{
phenomena = i18n("Snow Grains");
getIcon( WeatherIcon::Snow, false, 4 );
saveIconNamePath( WeatherIcon::Snow, false, 4 );
}
else if (sCode.contains("IC"))
{
phenomena = i18n("Ice Crystals");
getIcon( WeatherIcon::Hail, false );
saveIconNamePath( WeatherIcon::Hail, false );
}
else if (sCode.contains("PE"))
{
phenomena = i18n("Ice Pellets");
getIcon( WeatherIcon::Hail, false );
saveIconNamePath( WeatherIcon::Hail, false );
}
else if (s.contains("GR"))
{
phenomena = i18n("Hail");
getIcon( WeatherIcon::Hail, false );
saveIconNamePath( WeatherIcon::Hail, false );
}
else if (sCode.contains("GS"))
{
phenomena = i18n("Small Hail Pellets");
getIcon( WeatherIcon::Hail, false );
saveIconNamePath( WeatherIcon::Hail, false );
}
else if (s.contains("UP"))
{
phenomena = i18n("Unknown Precipitation");
getIcon( WeatherIcon::Showers, isNight(weatherInfo.reportLocation), 1);
saveIconNamePath( WeatherIcon::Showers, isNight(weatherInfo.reportLocation), 1);
}
else if (sCode.contains("BR"))
{
@ -728,17 +728,17 @@ void MetarParser::calcCurrentIcon()
if (weatherInfo.theWeather.isEmpty())
{
if (weatherInfo.clouds == 0)
getIcon( WeatherIcon::Sunny, night );
saveIconNamePath( WeatherIcon::Sunny, night );
else if (weatherInfo.clouds > 0 && weatherInfo.clouds <= 2)
getIcon( WeatherIcon::Cloudy, night, 1 );
saveIconNamePath( WeatherIcon::Cloudy, night, 1 );
else if ( weatherInfo.clouds > 2 && weatherInfo.clouds <= 4)
getIcon( WeatherIcon::Cloudy, night, 2 );
saveIconNamePath( WeatherIcon::Cloudy, night, 2 );
else if ( weatherInfo.clouds > 4 && weatherInfo.clouds <= 8)
getIcon( WeatherIcon::Cloudy, night, 3 );
saveIconNamePath( WeatherIcon::Cloudy, night, 3 );
else if ( weatherInfo.clouds > 8 && weatherInfo.clouds < 63)
getIcon( WeatherIcon::Cloudy, night, 4 );
saveIconNamePath( WeatherIcon::Cloudy, night, 4 );
else
getIcon( WeatherIcon::Cloudy, night, 5 );
saveIconNamePath( WeatherIcon::Cloudy, night, 5 );
}
else if (weatherInfo.theWeather == "tstorm")
{
@ -746,11 +746,11 @@ void MetarParser::calcCurrentIcon()
weatherInfo.clouds = 30;
if (weatherInfo.clouds >= 0 && weatherInfo.clouds <= 10)
getIcon( WeatherIcon::Thunderstorm, night, 1 );
saveIconNamePath( WeatherIcon::Thunderstorm, night, 1 );
else if ( weatherInfo.clouds > 10 && weatherInfo.clouds <= 20)
getIcon( WeatherIcon::Thunderstorm, night, 2 );
saveIconNamePath( WeatherIcon::Thunderstorm, night, 2 );
else
getIcon( WeatherIcon::Thunderstorm, night, 3 );
saveIconNamePath( WeatherIcon::Thunderstorm, night, 3 );
}
else if (weatherInfo.theWeather == "shower")
{
@ -758,11 +758,11 @@ void MetarParser::calcCurrentIcon()
weatherInfo.clouds = 30;
if (weatherInfo.clouds >= 0 && weatherInfo.clouds <= 10)
getIcon( WeatherIcon::Showers, night, 1 );
saveIconNamePath( WeatherIcon::Showers, night, 1 );
else if ( weatherInfo.clouds > 10 && weatherInfo.clouds <= 20)
getIcon( WeatherIcon::Showers, night, 2 );
saveIconNamePath( WeatherIcon::Showers, night, 2 );
else
getIcon( WeatherIcon::Showers, night, 3 );
saveIconNamePath( WeatherIcon::Showers, night, 3 );
}
else if (weatherInfo.theWeather == "snow")
{
@ -770,22 +770,22 @@ void MetarParser::calcCurrentIcon()
weatherInfo.clouds = 30;
if (weatherInfo.clouds >= 0 && weatherInfo.clouds <= 8)
getIcon( WeatherIcon::Snow, night, 1 );
saveIconNamePath( WeatherIcon::Snow, night, 1 );
else if ( weatherInfo.clouds > 8 && weatherInfo.clouds <= 16)
getIcon( WeatherIcon::Snow, night, 2 );
saveIconNamePath( WeatherIcon::Snow, night, 2 );
else if (weatherInfo.clouds > 16 && weatherInfo.clouds <= 24)
getIcon( WeatherIcon::Snow, night, 3 );
saveIconNamePath( WeatherIcon::Snow, night, 3 );
else
getIcon( WeatherIcon::Snow, night, 5 );
saveIconNamePath( WeatherIcon::Snow, night, 5 );
}
else if ( weatherInfo.theWeather == "mist" || weatherInfo.theWeather == "fog" )
{
if ( weatherInfo.clouds >= 63 )
getIcon( WeatherIcon::Cloudy, night, 5 );
saveIconNamePath( WeatherIcon::Cloudy, night, 5 );
else if ( weatherInfo.theWeather == "mist" )
getIcon( WeatherIcon::Mist, night );
saveIconNamePath( WeatherIcon::Mist, night );
else if ( weatherInfo.theWeather == "fog" )
getIcon( WeatherIcon::Fog, night );
saveIconNamePath( WeatherIcon::Fog, night );
}
kdDebug(12006) << "Clouds: " << weatherInfo.clouds << ", Icon: "
@ -861,7 +861,7 @@ bool MetarParser::isNight(const TQString &stationID) const
}
}
void MetarParser::getIcon( int condition, bool night, int strength )
void MetarParser::saveIconNamePath( int condition, bool night, int strength )
{
if( strength != 0 )
{

@ -94,7 +94,7 @@ class MetarParser
void calcCurrentIcon();
void calcWindChill();
bool isNight(const TQString &stationID) const;
void getIcon( int condition, bool night, int strength = 0 );
void saveIconNamePath( int condition, bool night, int strength = 0 );
/*
* Reset the internal WeatherInfo struct of the class so that

Loading…
Cancel
Save