mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-25 07:57:19 +00:00
small patch to avoid notifications on nan
This commit is contained in:
parent
cc2b1b7b8a
commit
08dae3b02b
@ -8,7 +8,7 @@ ProjectRootRelative=./
|
|||||||
|
|
||||||
[CMake][CMake Build Directory 0]
|
[CMake][CMake Build Directory 0]
|
||||||
Build Directory Path=file:///home/arcanis/Documents/github/awesome-widgets/build
|
Build Directory Path=file:///home/arcanis/Documents/github/awesome-widgets/build
|
||||||
Build Type=Debug
|
Build Type=Release
|
||||||
CMake Binary=file:///usr/bin/cmake
|
CMake Binary=file:///usr/bin/cmake
|
||||||
Environment Profile=
|
Environment Profile=
|
||||||
Extra Arguments=
|
Extra Arguments=
|
||||||
|
@ -502,7 +502,7 @@ void AWKeys::setDataBySource(const QString sourceName, const QVariantMap data,
|
|||||||
// percentage
|
// percentage
|
||||||
float value = 100.0 * values[QString("memmb")].toFloat() / values[QString("memtotmb")].toFloat();
|
float value = 100.0 * values[QString("memmb")].toFloat() / values[QString("memtotmb")].toFloat();
|
||||||
// notification
|
// notification
|
||||||
if ((value >= 90.0) && (values[QString("mem")].toFloat() < 90.0))
|
if ((!isnan(value)) && (value >= 90.0) && (values[QString("mem")].toFloat() < 90.0))
|
||||||
AWActions::sendNotification(QString("event"), i18n("High memory usage"), enablePopup);
|
AWActions::sendNotification(QString("event"), i18n("High memory usage"), enablePopup);
|
||||||
// value
|
// value
|
||||||
values[QString("mem")] = QString("%1").arg(value, 5, 'f', 1);
|
values[QString("mem")] = QString("%1").arg(value, 5, 'f', 1);
|
||||||
@ -578,7 +578,7 @@ void AWKeys::setDataBySource(const QString sourceName, const QVariantMap data,
|
|||||||
// percentage
|
// percentage
|
||||||
float value = 100.0 * values[QString("swapmb")].toFloat() / values[QString("swaptotmb")].toFloat();
|
float value = 100.0 * values[QString("swapmb")].toFloat() / values[QString("swaptotmb")].toFloat();
|
||||||
// notification
|
// notification
|
||||||
if ((value > 0.0) && (values[QString("swap")].toFloat() == 0.0))
|
if ((!isnan(value)) && (value > 0.0) && (values[QString("swap")].toFloat() == 0.0))
|
||||||
AWActions::sendNotification(QString("event"), i18n("Swap is used"), enablePopup);
|
AWActions::sendNotification(QString("event"), i18n("Swap is used"), enablePopup);
|
||||||
// value
|
// value
|
||||||
values[QString("swap")] = QString("%1").arg(value, 5, 'f', 1);
|
values[QString("swap")] = QString("%1").arg(value, 5, 'f', 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user