KWeather: Better icon name string handling.

Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
Mavridis Philippe 3 years ago
parent 156b6b597b
commit 77aa6cfa2a
Signed by: blu.256
GPG Key ID: F8D2D7E2F989A494

@ -20,9 +20,11 @@ WeatherIcon::WeatherIcon( int condition, bool night )
case Fog:
{
name = "weather-fog";
if( night && iconExists( TQString(name.latin1()).append("-night")) )
if( night )
{
name.append("-night");
TQString night_icon = name + "-night";
if( iconExists(night_icon) )
name = night_icon;
}
iconName = name;
return;
@ -31,9 +33,11 @@ WeatherIcon::WeatherIcon( int condition, bool night )
case Mist:
{
name = "weather-mist";
if( night && iconExists( TQString(name.latin1()).append("-night")) )
if( night )
{
name.append("-night");
TQString night_icon = name + "-night";
if( iconExists(night_icon) )
name = night_icon;
}
iconName = name;
return;
@ -111,7 +115,8 @@ WeatherIcon::WeatherIcon( int condition, bool night, unsigned int strength )
case 2:
{
name = "weather-snow-moderate";
if (! iconExists( TQString(name.latin1()).append("-day")) )
TQString test_icon = name + "-day";
if (! iconExists(test_icon) )
{
name = "weather-snow-scattered";
}
@ -120,7 +125,8 @@ WeatherIcon::WeatherIcon( int condition, bool night, unsigned int strength )
case 3:
{
name = "weather-snow-ample";
if ( iconExists( TQString(name.latin1()).append("-day") ) )
TQString test_icon = name + "-day";
if ( iconExists(test_icon) )
break;
}
case 4: { iconName = "weather-snow-scattered"; return; }
@ -139,7 +145,8 @@ WeatherIcon::WeatherIcon( int condition, bool night, unsigned int strength )
case 2:
{
name = "weather-storm-moderate";
if (! iconExists( TQString(name.latin1()).append("-day")) )
TQString test_icon = name + "-day";
if (! iconExists(test_icon) )
{
name = "weather-storm";
}

Loading…
Cancel
Save