[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/base/plasma/applets/weather
From: Shawn Starr <shawn.starr () rogers ! com>
Date: 2008-12-25 0:39:08
Message-ID: 1230165548.989565.23078.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 901298 by spstarr:
Implement converting temperature to celsius, fahrenheit and kelvin
M +24 -2 weatherapplet.cpp
--- trunk/playground/base/plasma/applets/weather/weatherapplet.cpp #901297:901298
@@ -544,7 +544,30 @@
m_conditionsLabel->setText(i18n("%1", data["Current Conditions"].toString()));
if (data["Temperature"] != "N/A" && data["Temperature"].toString().isEmpty() == \
false) {
- m_tempLabel->setText(i18n("%1%2", data["Temperature"].toString(), \
WeatherUtils::getUnitString(data["Temperature Unit"].toInt(), false))); + \
switch (m_weatherTempFormat) { + case WeatherUtils::Celsius:
+ if (data["Temperature Unit"].toInt() != WeatherUtils::Celsius) {
+ m_tempLabel->setText(i18n("%1%2", \
QString::number(WeatherUtils::convert(data["Temperature"].toDouble(), \
data["Temperature Unit"].toInt(), WeatherUtils::Celsius), 'f', 1), \
WeatherUtils::getUnitString(WeatherUtils::Celsius, false))); + } else {
+ m_tempLabel->setText(i18n("%1%2", data["Temperature"].toString(), \
WeatherUtils::getUnitString(data["Temperature Unit"].toInt(), false))); + \
} + break;
+ case WeatherUtils::Fahrenheit:
+ if (data["Temperature Unit"].toInt() != WeatherUtils::Fahrenheit) {
+ m_tempLabel->setText(i18n("%1%2", \
QString::number(WeatherUtils::convert(data["Temperature"].toDouble(), \
data["Temperature Unit"].toInt(), WeatherUtils::Fahrenheit), 'f', 1), \
WeatherUtils::getUnitString(WeatherUtils::Fahrenheit, false))); + } else {
+ m_tempLabel->setText(i18n("%1%2", data["Temperature"].toString(), \
WeatherUtils::getUnitString(data["Temperature Unit"].toInt(), false))); + \
} + break;
+ case WeatherUtils::Kelvin:
+ if (data["Temperature Unit"].toInt() != WeatherUtils::Kelvin) {
+ m_tempLabel->setText(i18n("%1%2", \
QString::number(WeatherUtils::convert(data["Temperature"].toDouble(), \
data["Temperature Unit"].toInt(), WeatherUtils::Kelvin), 'f', 1), \
WeatherUtils::getUnitString(WeatherUtils::Kelvin, false))); + } else {
+ m_tempLabel->setText(i18n("%1%2", data["Temperature"].toString(), \
WeatherUtils::getUnitString(data["Temperature Unit"].toInt(), false))); + \
} + break;
+ }
+
} else {
m_tempLabel->setText(NULL);
}
@@ -798,7 +821,6 @@
if (data["Wind Gust"] != "N/A" && data["Wind Gust"].toString().isEmpty() == \
false) { // Convert the wind format for nonstandard types
QStandardItem *dataGust = new QStandardItem();
- kDebug() << "WIND FORMAT MATCH: " << m_weatherWindFormat;
switch (m_weatherWindFormat) {
case WeatherUtils::MetersPerSecond:
dataGust->setText(i18n("Wind Gust: %1%2", \
QString::number(WeatherUtils::convert(data["Wind Gust"].toDouble(), data["Wind Gust \
Unit"].toInt(), WeatherUtils::MetersPerSecond), 'f', 2), "m/s"));
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic