KWeather: support for weather icons from icon theme.

Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
pull/18/head
Mavridis Philippe 3 years ago
parent 76aebc5aa6
commit bee2b453da
No known key found for this signature in database
GPG Key ID: F8D2D7E2F989A494

@ -3,9 +3,9 @@
#include "weather_icon.h" #include "weather_icon.h"
WeatherIcon::WeatherIcon( int condition, bool night ) WeatherIcon::WeatherIcon( int condition, bool night )
: iconLoader()
{ {
TQString name; TQString name;
iconLoader = new TDEIconLoader("kweather");
switch( condition ) switch( condition )
{ {
@ -47,8 +47,8 @@ WeatherIcon::WeatherIcon( int condition, bool night )
} }
WeatherIcon::WeatherIcon( int condition, bool night, unsigned int strength ) WeatherIcon::WeatherIcon( int condition, bool night, unsigned int strength )
: iconLoader()
{ {
iconLoader = new TDEIconLoader("kweather");
TQString name; TQString name;
switch ( condition ) switch ( condition )

@ -25,6 +25,7 @@
#include <tdeglobal.h> #include <tdeglobal.h>
#include <tdelocale.h> #include <tdelocale.h>
#include <kstandarddirs.h> #include <kstandarddirs.h>
#include <kiconloader.h>
#include "weatherlib.h" #include "weatherlib.h"
#include "weatherservice.h" #include "weatherservice.h"
@ -148,8 +149,14 @@ TQString WeatherService::currentIconString(const TQString &stationID)
TQString WeatherService::iconFileName(const TQString &stationID) TQString WeatherService::iconFileName(const TQString &stationID)
{ {
TQString icon = m_weatherLib->iconName(stationID); TQString _name = m_weatherLib->iconName(stationID);
icon = locate( "data", "kweather/" + icon + ".png" ); 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; return icon;
} }

Loading…
Cancel
Save