summaryrefslogtreecommitdiffstats
path: root/kweather/weather_icon.h
diff options
context:
space:
mode:
authorMavridis Philippe <mavridisf@gmail.com>2021-11-13 14:17:53 +0200
committerMavridis Philippe <mavridisf@gmail.com>2022-01-14 12:36:53 +0200
commit0e7033dd09c78eed673bfcde768483f6ad925ff7 (patch)
treea4f4484e6c154ff28c5d67697d6de976807fbf83 /kweather/weather_icon.h
parent5fea80f5693a74ee736300944c0c7204a663b92b (diff)
downloadtdetoys-0e7033dd09c78eed673bfcde768483f6ad925ff7.tar.gz
tdetoys-0e7033dd09c78eed673bfcde768483f6ad925ff7.zip
KWeather: updated icon handling.
The newly added class abstracts away icon names from the main code and has the ability to fall back to "safer" icon choices so as to ensure (if possible) icon theme consistency. Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
Diffstat (limited to 'kweather/weather_icon.h')
-rw-r--r--kweather/weather_icon.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/kweather/weather_icon.h b/kweather/weather_icon.h
new file mode 100644
index 0000000..732e266
--- /dev/null
+++ b/kweather/weather_icon.h
@@ -0,0 +1,20 @@
+class TDEIconLoader;
+
+class WeatherIcon {
+ public:
+ enum SimpleCondition { Sunny, Fog, Mist, Overcast, Hail, LightRain, Sleet };
+ enum RangedCondition { Cloudy, Showers, Snow, Thunderstorm };
+
+ WeatherIcon( int condition /* SimpleCondition */, bool night );
+ WeatherIcon( int condition /* RangedCondition */, bool night, unsigned int strength );
+ ~WeatherIcon();
+
+ static TQString unknown() { return "weather-none-available"; };
+ TQString& name() { return iconName; }
+
+ private:
+ bool iconExists( TQString& icon, bool inTheme = true );
+
+ TDEIconLoader* iconLoader;
+ TQString iconName = unknown();
+};