[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/workspace/plasma/applets/system-monitor
From: Petri Damstén <petri.damsten () kdemail ! net>
Date: 2009-09-09 13:28:51
Message-ID: 1252502931.010703.6158.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1021535 by pdamsten:
Fix unit issues.
BUG: 191835
M +11 -8 temperature.cpp
--- trunk/KDE/kdebase/workspace/plasma/applets/system-monitor/temperature.cpp #1021534:1021535
@@ -144,7 +144,7 @@
QString Temperature::temperatureTitle(const QString& source)
{
KConfigGroup cg = globalConfig();
- return cg.readEntry(source, source.mid(source.lastIndexOf('/') + 1));
+ return cg.readEntry(source, source.mid(source.lastIndexOf('/') + 1).replace('_',' '));
}
bool Temperature::addMeter(const QString& source)
@@ -229,13 +229,16 @@
Plasma::Meter *w = meters().value(source);
Plasma::SignalPlotter *plotter = plotters().value(source);
QString temp;
- qreal value = (qreal)data["value"].toDouble();
+ double value = data["value"].toDouble();
+ QString unit = data["units"].toString();
- if (data["units"].toString() == "F" &&
- KGlobal::locale()->measureSystem() == KLocale::Metric) {
+ if (unit.startsWith(i18n("\u00b0"))) { // remove degrees symbol
+ unit = unit.mid(1);
+ }
+
+ if (unit == "F" && KGlobal::locale()->measureSystem() == KLocale::Metric) {
value = Value(value, Fahrenheit).convertTo(Celsius).number();
- } else if (data["units"].toString() == "C" &&
- KGlobal::locale()->measureSystem() != KLocale::Metric) {
+ } else if (unit == "C" && KGlobal::locale()->measureSystem() != KLocale::Metric) {
value = Value(value, Celsius).convertTo(Fahrenheit).number();
}
@@ -248,13 +251,13 @@
}
if (w) {
- w->setValue(data["value"].toDouble());
+ w->setValue(value);
if (mode() != SM::Applet::Panel) {
w->setLabel(1, temp);
}
}
if (plotter) {
- plotter->addSample(QList<double>() << data["value"].toDouble());
+ plotter->addSample(QList<double>() << value);
}
if (mode() == SM::Applet::Panel) {
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic