diff options
author | Mavridis Philippe <mavridisf@gmail.com> | 2023-06-01 16:30:11 +0300 |
---|---|---|
committer | Mavridis Philippe <mavridisf@gmail.com> | 2023-06-14 14:22:13 +0300 |
commit | bc71670331e16b15fc30214cb85c409b8c91bb9c (patch) | |
tree | acdd9b544beb14c0c201945a4a83ff206ba8fa40 /kweather/weatherservice.cpp | |
parent | 98f2adda028489a51a9bf825b08b125ac69e127f (diff) | |
download | tdetoys-bc71670331e16b15fc30214cb85c409b8c91bb9c.tar.gz tdetoys-bc71670331e16b15fc30214cb85c409b8c91bb9c.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>
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); |