diff options
author | Mavridis Philippe <mavridisf@gmail.com> | 2021-12-12 15:50:37 +0200 |
---|---|---|
committer | Mavridis Philippe <mavridisf@gmail.com> | 2022-01-14 12:39:01 +0200 |
commit | 6668b34bc5deb36e73aa45e0457ed6740f828efd (patch) | |
tree | f2ff95858cc06d5eaad187b6750717a58a175a60 /kweather/weather_icon.h | |
parent | 67e995b6fc4da17811aefb7c8d841c9812e4eec9 (diff) | |
download | tdetoys-6668b34bc5deb36e73aa45e0457ed6740f828efd.tar.gz tdetoys-6668b34bc5deb36e73aa45e0457ed6740f828efd.zip |
Implemented icon theme option.
Changes in this commit include:
* The option itself;
* A method of updating the option right after Apply or Ok is pressed
in the settings dialog;
* A new WeatherIconPrivate class to store the methods previously
in WeatherIcons, as well as the settings;
* Improved icon name helper function in METAR parser;
* A few cleanups to the WeatherIcon class.
Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
Diffstat (limited to 'kweather/weather_icon.h')
-rw-r--r-- | kweather/weather_icon.h | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/kweather/weather_icon.h b/kweather/weather_icon.h index 3ae8ddc..f18c472 100644 --- a/kweather/weather_icon.h +++ b/kweather/weather_icon.h @@ -1,5 +1,28 @@ class TDEIconLoader; +class WeatherIconPrivate { + friend class WeatherIcon; + + public: + WeatherIconPrivate(); + ~WeatherIconPrivate(); + + static WeatherIconPrivate* instance(); + + void useIconTheme( bool use ); + bool usingIconTheme(); + + TQString iconPath( TQString icon, bool inTheme ); + TQString iconPath( TQString icon ); + + private: + static WeatherIconPrivate* s_instance; + TDEIconLoader* iconLoader; + bool m_useIconTheme; + + TQPair<TQString,TQString> findIcon( TQStringList fallback ); +}; + class WeatherIcon { public: enum SimpleCondition { Sunny, Fog, Mist, Overcast, Hail, LightRain, Sleet }; @@ -10,12 +33,10 @@ class WeatherIcon { ~WeatherIcon(); static TQString unknown() { return "weather-none-available"; }; - TQString& name() { return iconName; } + TQString name() { return iconName; } + TQString path() { return iconPath; } private: - TQString findIcon( TQStringList fallback ); - bool iconExists( TQString& icon, bool inTheme = true ); - - TDEIconLoader* iconLoader; TQString iconName; + TQString iconPath; }; |