From bee2b453da43cadc324821c4c6a42ee915a4661a Mon Sep 17 00:00:00 2001 From: Mavridis Philippe Date: Sat, 13 Nov 2021 16:54:31 +0200 Subject: KWeather: support for weather icons from icon theme. Signed-off-by: Mavridis Philippe --- kweather/weather_icon.cpp | 4 ++-- kweather/weatherservice.cpp | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'kweather') diff --git a/kweather/weather_icon.cpp b/kweather/weather_icon.cpp index 3c61213..6e2f164 100644 --- a/kweather/weather_icon.cpp +++ b/kweather/weather_icon.cpp @@ -3,9 +3,9 @@ #include "weather_icon.h" WeatherIcon::WeatherIcon( int condition, bool night ) - : iconLoader() { TQString name; + iconLoader = new TDEIconLoader("kweather"); switch( condition ) { @@ -47,8 +47,8 @@ WeatherIcon::WeatherIcon( int condition, bool night ) } WeatherIcon::WeatherIcon( int condition, bool night, unsigned int strength ) - : iconLoader() { + iconLoader = new TDEIconLoader("kweather"); TQString name; switch ( condition ) diff --git a/kweather/weatherservice.cpp b/kweather/weatherservice.cpp index 9bf3561..110a196 100644 --- a/kweather/weatherservice.cpp +++ b/kweather/weatherservice.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include "weatherlib.h" #include "weatherservice.h" @@ -148,8 +149,14 @@ TQString WeatherService::currentIconString(const TQString &stationID) TQString WeatherService::iconFileName(const TQString &stationID) { - TQString icon = m_weatherLib->iconName(stationID); - icon = locate( "data", "kweather/" + icon + ".png" ); + TQString _name = m_weatherLib->iconName(stationID); + TQString icon = kapp->iconLoader()->iconPath(_name, TDEIcon::Desktop); + kdDebug(12006) << "icon: " << icon << endl; + if( icon.isNull() ) + { + kdDebug(12006) << "fallback!" << endl; + icon = locate( "data", "kweather/" + _name + ".png" ); + } return icon; } -- cgit v1.2.1