mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-07-15 06:45:48 +00:00
update translations
add notifications edit resizing fix reading ps some fixes
This commit is contained in:
@ -67,8 +67,8 @@ Item {
|
||||
|
||||
Layout.fillWidth: plasmoid.formFactor != PlasmaCore.Planar
|
||||
Layout.fillHeight: plasmoid.formFactor != PlasmaCore.Planar
|
||||
Layout.minimumHeight: text.height
|
||||
Layout.minimumWidth: text.width
|
||||
Layout.minimumHeight: text.contentHeight
|
||||
Layout.minimumWidth: text.contentWidth
|
||||
|
||||
Plasmoid.icon: "utilities-system-monitor"
|
||||
Plasmoid.backgroundHints: plasmoid.configuration.background ? "DefaultBackground" : "NoBackground"
|
||||
@ -144,9 +144,12 @@ Item {
|
||||
text: plasmoid.configuration.text
|
||||
|
||||
PlasmaCore.ToolTipArea {
|
||||
id: rootTooltip
|
||||
height: tooltip.height
|
||||
width: tooltip.width
|
||||
mainItem: Text {
|
||||
id: tooltip
|
||||
height: contentHeight
|
||||
width: contentWidth
|
||||
textFormat: Text.RichText
|
||||
}
|
||||
}
|
||||
@ -170,13 +173,6 @@ Item {
|
||||
|
||||
text.text = AWKeys.parsePattern(plasmoid.configuration.text)
|
||||
tooltip.text = AWKeys.toolTipImage()
|
||||
// update geometry
|
||||
text.update()
|
||||
height = text.height
|
||||
width = text.width
|
||||
update()
|
||||
rootTooltip.height = AWKeys.toolTipSize().height
|
||||
rootTooltip.width = AWKeys.toolTipSize().width
|
||||
}
|
||||
|
||||
Plasmoid.onUserConfiguringChanged: {
|
||||
|
@ -437,6 +437,14 @@ bool AWKeys::setDataBySource(const QString sourceName,
|
||||
// battery
|
||||
for (int i=0; i<data.keys().count(); i++) {
|
||||
if (data.keys()[i] == QString("ac")) {
|
||||
// notification
|
||||
if ((values[QString("ac")] == params[QString("acOnline")].toString()) != data[QString("ac")].toBool()) {
|
||||
if (data[QString("ac")].toBool())
|
||||
AWActions::sendNotification(QString("event"), i18n("AC online"));
|
||||
else
|
||||
AWActions::sendNotification(QString("event"), i18n("AC offline"));
|
||||
}
|
||||
// value
|
||||
values[QString("ac")] = data.keys()[i];
|
||||
if (data[QString("ac")].toBool())
|
||||
values[QString("ac")] = params[QString("acOnline")].toString();
|
||||
@ -449,6 +457,10 @@ bool AWKeys::setDataBySource(const QString sourceName,
|
||||
}
|
||||
} else if (sourceName == QString("cpu/system/TotalLoad")) {
|
||||
// cpu
|
||||
// notification
|
||||
if ((data[QString("value")].toFloat() >= 90.0) && (values[QString("cpu")].toFloat() < 90.0))
|
||||
AWActions::sendNotification(QString("event"), i18n("High CPU load"));
|
||||
// value
|
||||
values[QString("cpu")] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 1);
|
||||
toolTip->setData(QString("cpuTooltip"), data[QString("value")].toFloat());
|
||||
} else if (sourceName.contains(cpuRegExp)) {
|
||||
@ -505,6 +517,8 @@ bool AWKeys::setDataBySource(const QString sourceName,
|
||||
mount.remove(QString("partitions")).remove(QString("/filllevel"));
|
||||
for (int i=0; i<mountDevices.count(); i++)
|
||||
if (mountDevices[i] == mount) {
|
||||
if ((data[QString("value")].toFloat() >= 90.0) && (values[QString("hdd") + QString::number(i)].toFloat() < 90.0))
|
||||
AWActions::sendNotification(QString("event"), i18n("Free space on %1 less than 10%", mount));
|
||||
values[QString("hdd") + QString::number(i)] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 1);
|
||||
break;
|
||||
}
|
||||
@ -567,14 +581,20 @@ bool AWKeys::setDataBySource(const QString sourceName,
|
||||
values[QString("memtotgb")] = QString("%1").arg(
|
||||
values[QString("memusedgb")].toFloat() + values[QString("memfreegb")].toFloat(), 4, 'f', 1);
|
||||
// percentage
|
||||
values[QString("mem")] = QString("%1").arg(
|
||||
100.0 * values[QString("memmb")].toFloat() / values[QString("memtotmb")].toFloat(), 5, 'f', 1);
|
||||
float value = 100.0 * values[QString("memmb")].toFloat() / values[QString("memtotmb")].toFloat();
|
||||
// notification
|
||||
if ((value >= 90.0) && (values[QString("mem")].toFloat() < 90.0))
|
||||
AWActions::sendNotification(QString("event"), i18n("High memory usage"));
|
||||
// value
|
||||
values[QString("mem")] = QString("%1").arg(value, 5, 'f', 1);
|
||||
toolTip->setData(QString("memTooltip"), values[QString("mem")].toFloat());
|
||||
} else if (sourceName == QString("netdev")) {
|
||||
// network device
|
||||
// notification
|
||||
if (values[QString("netdev")] != data[QString("value")].toString())
|
||||
AWActions::sendNotification(QString("event"), i18n("Network device has been changed to %1",
|
||||
data[QString("value")].toString()));
|
||||
// value
|
||||
values[QString("netdev")] = data[QString("value")].toString();
|
||||
} else if (sourceName.contains(netRecRegExp)) {
|
||||
// download speed
|
||||
@ -634,8 +654,12 @@ bool AWKeys::setDataBySource(const QString sourceName,
|
||||
values[QString("swaptotgb")] = QString("%1").arg(
|
||||
values[QString("swapgb")].toFloat() + values[QString("swapfreegb")].toFloat(), 4, 'f', 1);
|
||||
// percentage
|
||||
values[QString("swap")] = QString("%1").arg(
|
||||
100.0 * values[QString("swapmb")].toFloat() / values[QString("swaptotmb")].toFloat(), 5, 'f', 1);
|
||||
float value = 100.0 * values[QString("swapmb")].toFloat() / values[QString("swaptotmb")].toFloat();
|
||||
// notification
|
||||
if ((value > 0.0) && (values[QString("swap")].toFloat() == 0.0))
|
||||
AWActions::sendNotification(QString("event"), i18n("Swap is used"));
|
||||
// value
|
||||
values[QString("swap")] = QString("%1").arg(value, 5, 'f', 1);
|
||||
toolTip->setData(QString("swapTooltip"), values[QString("swap")].toFloat());
|
||||
} else if (sourceName.contains(tempRegExp)) {
|
||||
// temperature devices
|
||||
|
@ -17,16 +17,12 @@
|
||||
|
||||
#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)
|
||||
@ -156,12 +152,5 @@ 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