From 3a2cb33e605e75758f2409da25edc01039a65928 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Thu, 15 Jul 2021 22:41:16 +0300 Subject: [PATCH] plasma: deal with FIXME related to system monitor applet Signed-off-by: Ivailo Monev --- plasma/applets/system-monitor/CMakeLists.txt | 2 +- plasma/applets/system-monitor/temperature.cpp | 19 ++++++------------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/plasma/applets/system-monitor/CMakeLists.txt b/plasma/applets/system-monitor/CMakeLists.txt index aa0f7ae4..d1499913 100644 --- a/plasma/applets/system-monitor/CMakeLists.txt +++ b/plasma/applets/system-monitor/CMakeLists.txt @@ -38,7 +38,7 @@ set(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} ${KDE4_KUNITCONVERSION_LIBS} plasma_applet-system-monitor) +target_link_libraries(plasma_applet_sm_temperature ${KDE4_PLASMA_LIBS} ${KDE4_KDEUI_LIBS} plasma_applet-system-monitor) # Network Monitor diff --git a/plasma/applets/system-monitor/temperature.cpp b/plasma/applets/system-monitor/temperature.cpp index 74a679c6..94aaabaa 100644 --- a/plasma/applets/system-monitor/temperature.cpp +++ b/plasma/applets/system-monitor/temperature.cpp @@ -24,8 +24,7 @@ #include #include #include -#include -#include +#include #include #include #include @@ -197,30 +196,24 @@ void Temperature::dataUpdated(const QString& source, return; } SM::Plotter *plotter = qobject_cast(visualization(source)); - QString temp; QString unit = data["units"].toString(); double doubleValue = data["value"].toDouble() + temperatureOffset(source); - KUnitConversion::Value value = KUnitConversion::Value(doubleValue, unit); + KTemperature value(doubleValue, unit); -#warning FIXME: temporary crash fix, KUnitConversion basically has to be rewriten -#if 0 if (KGlobal::locale()->measureSystem() == KLocale::Metric) { - value = value.convertTo(KUnitConversion::Celsius); + doubleValue = value.convertTo(KTemperature::Celsius); } else { - value = value.convertTo(KUnitConversion::Fahrenheit); + doubleValue = value.convertTo(KTemperature::Fahrenheit); } -#endif - value.round(1); + doubleValue = KTemperature::round(doubleValue, 1); if (plotter) { plotter->addSample(QList() << value.number()); } - temp = value.toSymbolString(); - if (mode() == SM::Applet::Panel) { setToolTip(source, - QString("%1%2").arg(temperatureTitle(source)).arg(temp)); + QString("%1%2").arg(temperatureTitle(source)).arg(value.toString())); } } -- 2.11.0