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/weatherservice.cpp | |
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/weatherservice.cpp')
-rw-r--r-- | kweather/weatherservice.cpp | 35 |
1 files changed, 28 insertions, 7 deletions
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); |