summaryrefslogtreecommitdiffstats
path: root/kweather
diff options
context:
space:
mode:
authorMavridis Philippe <mavridisf@gmail.com>2021-11-15 12:15:01 +0200
committerMavridis Philippe <mavridisf@gmail.com>2022-01-14 12:36:59 +0200
commitdf744f540c939da2f4c329e321582f4729ada839 (patch)
tree856f52147f56213818517e41a1a60865d51d7f09 /kweather
parenta21cf7acf61e3afa00890138d7f8179f9c922b82 (diff)
downloadtdetoys-df744f540c939da2f4c329e321582f4729ada839.tar.gz
tdetoys-df744f540c939da2f4c329e321582f4729ada839.zip
KWeather: Better icon name string handling.
Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
Diffstat (limited to 'kweather')
-rw-r--r--kweather/weather_icon.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/kweather/weather_icon.cpp b/kweather/weather_icon.cpp
index 6e2f164..6ea3287 100644
--- a/kweather/weather_icon.cpp
+++ b/kweather/weather_icon.cpp
@@ -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";
}