diff options
author | Mavridis Philippe <mavridisf@gmail.com> | 2021-12-12 15:50:37 +0200 |
---|---|---|
committer | Mavridis Philippe <mavridisf@gmail.com> | 2022-01-14 12:39:01 +0200 |
commit | 6668b34bc5deb36e73aa45e0457ed6740f828efd (patch) | |
tree | f2ff95858cc06d5eaad187b6750717a58a175a60 /kweather/weatherlib.cpp | |
parent | 67e995b6fc4da17811aefb7c8d841c9812e4eec9 (diff) | |
download | tdetoys-6668b34bc5deb36e73aa45e0457ed6740f828efd.tar.gz tdetoys-6668b34bc5deb36e73aa45e0457ed6740f828efd.zip |
Implemented icon theme option.
Changes in this commit include:
* The option itself;
* A method of updating the option right after Apply or Ok is pressed
in the settings dialog;
* A new WeatherIconPrivate class to store the methods previously
in WeatherIcons, as well as the settings;
* Improved icon name helper function in METAR parser;
* A few cleanups to the WeatherIcon class.
Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
Diffstat (limited to 'kweather/weatherlib.cpp')
-rw-r--r-- | kweather/weatherlib.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/kweather/weatherlib.cpp b/kweather/weatherlib.cpp index 32d653c..a7bb13c 100644 --- a/kweather/weatherlib.cpp +++ b/kweather/weatherlib.cpp @@ -272,14 +272,34 @@ TQString WeatherLib::windChill(const TQString &stationID){ TQString WeatherLib::iconName(const TQString &stationID){ - TQString result = WeatherIcon::unknown(); + TQString result; + + // isEmpty is true for null or 0 length strings + if ( !stationID.isEmpty() ) + { + Data *d = findData(stationID); + result = d->wi.iconName; + } + + if( result == TQString::null ) + result = WeatherIcon::unknown(); + + return result; +} + +TQString WeatherLib::iconPath(const TQString &stationID){ + + TQString result; // isEmpty is true for null or 0 length strings if ( !stationID.isEmpty() ) { Data *d = findData(stationID); - result = d->wi.theWeather; + result = d->wi.iconPath; } + + if( result == TQString::null ) + result = WeatherIconPrivate::instance()->iconPath(WeatherIcon::unknown()); return result; } |