mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-07-21 17:49:57 +00:00
add notifications
edit widget.qml fix bug in monitor
This commit is contained in:
@ -17,12 +17,16 @@
|
||||
|
||||
#include "awtooltip.h"
|
||||
|
||||
#include <KI18n/KLocalizedString>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QProcessEnvironment>
|
||||
#include <math.h>
|
||||
|
||||
#include <pdebug/pdebug.h>
|
||||
|
||||
#include "awactions.h"
|
||||
|
||||
|
||||
AWToolTip::AWToolTip(QObject *parent,
|
||||
QMap<QString, QVariant> settings)
|
||||
@ -139,7 +143,7 @@ void AWToolTip::setData(const QString source, float value, const bool ac)
|
||||
data[source].append(0.0);
|
||||
else if (data[source].count() > configuration[QString("tooltipNumber")].toInt())
|
||||
data[source].takeFirst();
|
||||
if (isnan(value)) value = 100.0;
|
||||
if (isnan(value)) value = 0.0;
|
||||
|
||||
if (ac)
|
||||
data[source].append(value);
|
||||
@ -155,5 +159,12 @@ void AWToolTip::setData(const QString source, float value, const bool ac)
|
||||
boundaries[QString("downTooltip")] = data[QString("upTooltip")][i];
|
||||
boundaries[QString("downTooltip")] *= 1.2;
|
||||
boundaries[QString("upTooltip")] = boundaries[QString("downTooltip")];
|
||||
} else if (source == QString("batTooltip")) {
|
||||
int size = data[source].count();
|
||||
if (data[source][size-1] * data[source][size-2] >= 0) return;
|
||||
if (data[source].last() > 0.0)
|
||||
AWActions::sendNotification(QString("event"), i18n("AC online"));
|
||||
else
|
||||
AWActions::sendNotification(QString("event"), i18n("AC offline"));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user