From fe6de6f4bc8a0a7d86c2c3dc6413170214206cff Mon Sep 17 00:00:00 2001 From: Mavridis Philippe Date: Thu, 1 Jun 2023 16:30:11 +0300 Subject: 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 (cherry picked from commit bc71670331e16b15fc30214cb85c409b8c91bb9c) --- kweather/weather_icon.h | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'kweather/weather_icon.h') 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 + +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 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; }; -- cgit v1.2.1