1 /* 2 SPDX-FileCopyrightText: 2007 John Tapsell <tapsell@kde.org> 3 4 SPDX-License-Identifier: LGPL-2.0-only 5 */ 6 7 #pragma once 8 9 #include <Plasma/DataEngine> 10 11 #include <ksgrd/SensorClient.h> 12 13 #include <QStringList> 14 #include <QVector> 15 16 class QTimer; 17 18 /** 19 * This class evaluates the basic expressions given in the interface. 20 */ 21 class SystemMonitorEngine : public Plasma::DataEngine, public KSGRD::SensorClient 22 { 23 Q_OBJECT 24 25 public: 26 /** Inherited from Plasma::DataEngine. Returns a list of all the sensors that ksysguardd knows about. */ 27 QStringList sources() const override; 28 SystemMonitorEngine(QObject *parent, const QVariantList &args); 29 ~SystemMonitorEngine() override; 30 31 protected: 32 bool sourceRequestEvent(const QString &name) override; 33 /** inherited from SensorClient */ 34 void answerReceived(int id, const QList<QByteArray> &answer) override; 35 void sensorLost(int) override; 36 bool updateSourceEvent(const QString &sensorName) override; 37 38 protected Q_SLOTS: 39 void updateSensors(); 40 void updateMonitorsList(); 41 42 private: 43 QVector<QString> m_sensors; 44 QTimer *m_timer; 45 int m_waitingFor; 46 }; 47