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/weatherservice.cpp | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) (limited to 'kweather/weatherservice.cpp') diff --git a/kweather/weatherservice.cpp b/kweather/weatherservice.cpp index aa8454a..e61138b 100644 --- a/kweather/weatherservice.cpp +++ b/kweather/weatherservice.cpp @@ -139,18 +139,33 @@ TQString WeatherService::pressure(const TQString &stationID) return m_weatherLib->pressure(stationID); } +TQPixmap WeatherService::icon(const TQString &stationID, uint iconSize) +{ + return kapp->iconLoader()->loadIcon( + iconPath(stationID, iconSize), + TDEIcon::Panel, iconSize + ); +} + +TQString WeatherService::iconName(const TQString &stationID, uint iconSize) +{ + return m_weatherLib->iconName(stationID, iconSize); +} + +TQString WeatherService::iconPath(const TQString &stationID, uint iconSize) +{ + return m_weatherLib->iconPath(stationID, iconSize); +} + +/*** (Begin) Deprecated: functions kept for compatibility reasons */ TQPixmap WeatherService::currentIcon(const TQString &stationID) { - return icon( stationID ); + return icon(stationID, IconSize(TDEIcon::Panel)); } TQPixmap WeatherService::icon(const TQString &stationID) { - kdDebug(12006) << "Get the current weather icon.." << endl; - return kapp->iconLoader()->loadIcon( - iconFileName(stationID), - TDEIcon::Desktop - ); + return icon(stationID, IconSize(TDEIcon::Panel)); } TQString WeatherService::currentIconString(const TQString &stationID) @@ -160,8 +175,9 @@ TQString WeatherService::currentIconString(const TQString &stationID) TQString WeatherService::iconFileName(const TQString &stationID) { - return m_weatherLib->iconPath(stationID); + return iconPath(stationID, IconSize(TDEIcon::Panel)); } +/*** (End) Deprecated: functions kept for compatibility reasons */ void WeatherService::useIconTheme(bool use) { @@ -199,6 +215,11 @@ bool WeatherService::stationNeedsMaintenance(const TQString &stationID) return m_weatherLib->stationNeedsMaintenance(stationID); } +bool WeatherService::weatherDataAvailable(const TQString &stationID) +{ + return m_weatherLib->weatherDataAvailable(stationID); +} + void WeatherService::update(const TQString &stationID) { m_weatherLib->update(stationID); -- cgit v1.2.1