diff options
author | Mavridis Philippe <mavridisf@gmail.com> | 2023-06-01 16:30:11 +0300 |
---|---|---|
committer | Mavridis Philippe <mavridisf@gmail.com> | 2023-06-14 17:42:21 +0300 |
commit | fe6de6f4bc8a0a7d86c2c3dc6413170214206cff (patch) | |
tree | d86bbc14c9c16c52b9d2b5b750de15ece38c7c5a /kweather/weather_icon.h | |
parent | 6b56a1befc9f510d4467cd5652cbb8fb49563070 (diff) | |
download | tdetoys-fe6de6f4bc8a0a7d86c2c3dc6413170214206cff.tar.gz tdetoys-fe6de6f4bc8a0a7d86c2c3dc6413170214206cff.zip |
KWeather: improve icon loading and other fixes
- Fix pixelated icons (issue #19)
- Fix "network offline" state
- Add helper `bool weatherDataAvailable(TQString stationID)` DCOP function
- Fix compatibility with old DCOP function signatures
- Prevent double "Network is offline" strings in weather data.
This commit introduces some new and renamed DCOP calls. Old function signatures
are kept for compatibility, but are mraked as deprecated.
Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
(cherry picked from commit bc71670331e16b15fc30214cb85c409b8c91bb9c)
Diffstat (limited to 'kweather/weather_icon.h')
-rw-r--r-- | kweather/weather_icon.h | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/kweather/weather_icon.h b/kweather/weather_icon.h index f18c472..011fb06 100644 --- a/kweather/weather_icon.h +++ b/kweather/weather_icon.h @@ -1,4 +1,11 @@ -class TDEIconLoader; +#include <kiconloader.h> + +struct WeatherSingleIconData { + TQString name; + TQString path; + bool inTheme; + uint size; +}; class WeatherIconPrivate { friend class WeatherIcon; @@ -9,18 +16,18 @@ class WeatherIconPrivate { static WeatherIconPrivate* instance(); - void useIconTheme( bool use ); + void useIconTheme(bool use); bool usingIconTheme(); - TQString iconPath( TQString icon, bool inTheme ); - TQString iconPath( TQString icon ); + TQString iconPath(TQString icon, uint size, bool inTheme); + TQString iconPath(TQString icon, uint size); private: static WeatherIconPrivate* s_instance; TDEIconLoader* iconLoader; bool m_useIconTheme; - TQPair<TQString,TQString> findIcon( TQStringList fallback ); + struct WeatherSingleIconData findIcon(TQStringList fallback, uint size); }; class WeatherIcon { @@ -30,13 +37,15 @@ class WeatherIcon { WeatherIcon( int condition /* SimpleCondition */, bool night ); WeatherIcon( int condition /* RangedCondition */, bool night, unsigned int strength ); + WeatherIcon(); /* Unknown conditions */ ~WeatherIcon(); - static TQString unknown() { return "weather-none-available"; }; - TQString name() { return iconName; } - TQString path() { return iconPath; } + static struct WeatherSingleIconData unknown(uint size); // for convenience + + struct WeatherSingleIconData iconData(uint size); + TQString name(uint size); + TQString path(uint size); private: - TQString iconName; - TQString iconPath; + TQStringList fallback; }; |