[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 6:19:15
Message-ID: 1252477155.403312.11993.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1021408 by pdamsten:

Fix conversion.
BUG:206808

 M  +1 -1      CMakeLists.txt  
 M  +0 -1      applet.cpp  
 M  +6 -2      temperature.cpp  


--- trunk/KDE/kdebase/workspace/plasma/applets/system-monitor/CMakeLists.txt \
#1021407:1021408 @@ -29,7 +29,7 @@
 )
 kde4_add_ui_files(temparature_SRCS temperature-config.ui)
 kde4_add_plugin(plasma_applet_sm_temperature ${temparature_SRCS})
-target_link_libraries(plasma_applet_sm_temperature ${KDE4_PLASMA_LIBS} \
${KDE4_KDEUI_LIBS} plasma_applet-system-monitor) \
+target_link_libraries(plasma_applet_sm_temperature ${KDE4_PLASMA_LIBS} \
${KDE4_KDEUI_LIBS} ${KDE4_KUNITCONVERSION_LIBS} plasma_applet-system-monitor)  
 # Network Monitor
 
--- trunk/KDE/kdebase/workspace/plasma/applets/system-monitor/applet.cpp \
#1021407:1021408 @@ -197,7 +197,6 @@
     Plasma::SignalPlotter *plotter = m_plotters.values()[0];
     QFontMetrics metrics(plotter->font());
     bool showTopBar = (metrics.height() < plotter->size().height() / 3);
-    kDebug() << metrics.height() << plotter->size().height();
     foreach (plotter, m_plotters) {
         if (showTopBar != plotter->showTopBar()) {
             plotter->setShowTopBar(showTopBar);
--- trunk/KDE/kdebase/workspace/plasma/applets/system-monitor/temperature.cpp \
#1021407:1021408 @@ -24,10 +24,14 @@
 #include <Plasma/Theme>
 #include <Plasma/ToolTipManager>
 #include <KConfigDialog>
+#include <KUnitConversion/Converter>
+#include <KUnitConversion/Value>
 #include <QGraphicsLinearLayout>
 #include <QTimer>
 #include <cmath>
 
+using namespace KUnitConversion;
+
 Temperature::Temperature(QObject *parent, const QVariantList &args)
     : SM::Applet(parent, args), m_tempModel(0)
 {
@@ -226,10 +230,10 @@
 
     if (data["units"].toString() == "F" &&
         KGlobal::locale()->measureSystem() == KLocale::Metric) {
-        value = (value - 32) * (5.0 / 9.0);
+        value = Value(value, Fahrenheit).convertTo(Celsius).number();
     } else if (data["units"].toString() == "C" &&
         KGlobal::locale()->measureSystem() != KLocale::Metric) {
-        value = (value * (5.0 / 9.0)) + 32;
+        value = Value(value, Celsius).convertTo(Fahrenheit).number();
     }
 
     value = int(value * 10) / 10.0;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic