mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-07-14 22:35:49 +00:00
migrate to ksystemstats
This commit is contained in:
@ -41,6 +41,9 @@ ExtendedSysMon::ExtendedSysMon(QObject *_parent, const QVariantList &_args)
|
||||
|
||||
// init aggregator
|
||||
m_aggregator = new ExtSysMonAggregator(this, m_configuration);
|
||||
connect(m_aggregator, SIGNAL(sourceAdded(const QString &)), this, SIGNAL(sourceAdded(const QString &)));
|
||||
connect(m_aggregator, SIGNAL(sourceRemoved(const QString &)), this, SIGNAL(sourceRemoved(const QString &)));
|
||||
|
||||
for (auto &source : m_aggregator->sources())
|
||||
setData(source, m_aggregator->initialData(source));
|
||||
}
|
||||
@ -127,7 +130,7 @@ QHash<QString, QString> ExtendedSysMon::updateConfiguration(QHash<QString, QStri
|
||||
} else {
|
||||
QStringList deviceList = _rawConfig["HDDDEV"].split(',', Qt::SkipEmptyParts);
|
||||
QStringList devices;
|
||||
QRegExp diskRegexp = QRegExp("^/dev/[hms]d[a-z]$");
|
||||
auto diskRegexp = QRegularExpression("^/dev/[hms]d[a-z]$");
|
||||
for (auto &device : deviceList)
|
||||
if ((QFile::exists(device)) && (device.contains(diskRegexp)))
|
||||
devices.append(device);
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "gpuloadsource.h"
|
||||
#include "gputempsource.h"
|
||||
#include "hddtempsource.h"
|
||||
#include "ksystemstatssource.h"
|
||||
#include "loadsource.h"
|
||||
#include "networksource.h"
|
||||
#include "playersource.h"
|
||||
@ -111,6 +112,12 @@ void ExtSysMonAggregator::init(const QHash<QString, QString> &_config)
|
||||
= new HDDTemperatureSource(this, QStringList({_config["HDDDEV"], _config["HDDTEMPCMD"]}));
|
||||
for (auto &source : hddTempItem->sources())
|
||||
m_map[source] = hddTempItem;
|
||||
// ksystemstats adapter
|
||||
AbstractExtSysMonSource *ksystemstatsItem = new KSystemStatsSource(this, {});
|
||||
connect(ksystemstatsItem, SIGNAL(sourceAdded(const QString &)), this, SIGNAL(sourceAdded(const QString &)));
|
||||
connect(ksystemstatsItem, SIGNAL(sourceRemoved(const QString &)), this, SIGNAL(sourceRemoved(const QString &)));
|
||||
for (auto &source : ksystemstatsItem->sources())
|
||||
m_map[source] = ksystemstatsItem;
|
||||
// network
|
||||
AbstractExtSysMonSource *networkItem = new NetworkSource(this, QStringList());
|
||||
for (auto &source : networkItem->sources())
|
||||
|
@ -35,6 +35,10 @@ public:
|
||||
[[nodiscard]] QVariantMap initialData(const QString &_source) const;
|
||||
[[nodiscard]] QStringList sources() const;
|
||||
|
||||
signals:
|
||||
void sourceAdded(const QString &_source);
|
||||
void sourceRemoved(const QString &_source);
|
||||
|
||||
private:
|
||||
void init(const QHash<QString, QString> &_config);
|
||||
QHash<QString, AbstractExtSysMonSource *> m_map;
|
||||
|
Reference in New Issue
Block a user