[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdeartwork/weatherwallpapers
From: Jonathan Michael Thomas <echidnaman () kubuntu ! org>
Date: 2009-04-11 23:57:38
Message-ID: 1239494258.249273.27187.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 952476 by jmthomas:
Switch from assigning wallpapers to weathers in an if statement, but rather associate \
them in a QMap
M +19 -25 weatherwallpaper.cpp
--- trunk/KDE/kdeartwork/weatherwallpapers/weatherwallpaper.cpp #952475:952476
@@ -465,31 +465,25 @@
{
// TODO - Find a better way to retrieve weather than by looking at the icon \
name...
kDebug() << "Current weather is:" << data["Condition Icon"].toString();
- if (data["Condition Icon"].toString() == "N/A") {
- m_wallpaper = Plasma::Theme::defaultTheme()->wallpaperPath();
- kDebug() << "Weather not available";
- } else if (data["Condition Icon"].toString() == "weather-clear") {
- m_wallpaper = QString(m_dir + "Fields_of_Peace");
- } else if (data["Condition Icon"].toString() == "weather-few-clouds" || \
data["Condition Icon"].toString() == "weather-clouds"){
- m_wallpaper = QString(m_dir + "Colorado_Farm");
- } else if (data["Condition Icon"].toString() == "weather-many-clouds") {
- m_wallpaper = QString(m_dir + "Blue_Sun");
- } else if (data["Condition Icon"].toString() == "weather-showers" || \
data["Condition Icon"].toString() == "weather-showers-scattered" || data["Condition \
Icon"].toString() == "weather-rain" ) {
- m_wallpaper = QString(m_dir + "There_is_Rain_on_the_Table");
- } else if (data["Condition Icon"].toString() == "weather-mist") {
- m_wallpaper = QString(m_dir + "Fresh_Morning");
- } else if (data["Condition Icon"].toString() == "weather-storm") {
- m_wallpaper = QString(m_dir + "Lightning");
- } else if (data["Condition Icon"].toString() == "weather-hail") {
- m_wallpaper = QString(m_dir + "Hail");
- } else if (data["Condition Icon"].toString() == "weather-snow" || \
data["Condition Icon"].toString() == "weather-snow-scattered") {
- m_wallpaper = QString(m_dir + "Winter_Track");
- } else if (data["Condition Icon"].toString() == "weather-few-clouds-night" || \
data["Condition Icon"].toString() == "weather-clouds-night") {
- m_wallpaper = QString(m_dir + "JK_Bridge_at_Night");
- } else if (data["Condition Icon"].toString() == "weather-clear-night") {
- m_wallpaper = QString(m_dir + "At_Night");
- } else if (data["Condition Icon"].toString() == "weather-freezing-rain" || \
data["Condition Icon"].toString() == "weather-snow-rain") {
- m_wallpaper = QString(m_dir + "Icy_Tree");
+ // Map each wallpaper to a weather condition
+ QMap<QString,QStringList> weatherMap;
+ weatherMap[Plasma::Theme::defaultTheme()->wallpaperPath()] = QStringList("N/A");
+ weatherMap[m_dir + "Fields_of_Peace"] = QStringList("weather-clear");
+ weatherMap[m_dir + "Colorado_Farm"] = QStringList() << "weather-few-clouds" << \
"weather-clouds"; + weatherMap[m_dir + "Blue_Sun"] = \
QStringList("weather-many-clouds"); + weatherMap[m_dir + \
"There_is_Rain_on_the_Table"] = QStringList() << "weather-showers" << \
"weather-showers-scattered" << "weather-rain"; + weatherMap[m_dir + \
"Fresh_Morning"] = QStringList("weather-mist"); + weatherMap[m_dir + "Lightning"] \
= QStringList("weather-storm"); + weatherMap[m_dir + "Hail"] = \
QStringList("weather-hail"); + weatherMap[m_dir + "Winter_Track"] = QStringList() \
<< "weather-snow" << "weather-snow-scattered"; + weatherMap[m_dir + \
"JK_Bridge_At_Night"] = QStringList() << "weather-few-clouds-night" << \
"weather-clouds-night"; + weatherMap[m_dir + "At_Night"] = \
QStringList("weather-clear-night"); + weatherMap[m_dir + "Icy_Tree"] = \
QStringList() << "weather-freezing-rain" << "weather-snow-rain"; +
+ foreach (QStringList condition, weatherMap) {
+ if (condition.contains(data["Condition Icon"].toString())) {
+ m_wallpaper = weatherMap.key(condition);
+ }
}
loadImage();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic