blob: 08d002748b9d46c29e5344236b3ab1fa2d15ad11 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#include <QObject>
#include <QString>
#include <QSharedPointer>
#include <QStringList>
#include <QVector>
#include <QtCore>
#include <QWebSocket>
#include "procinfo.h"
#ifndef TASKMANAGER_H
#define TASKMANAGER_H
class TaskManager : public QObject
{
Q_OBJECT
public:
explicit TaskManager(QObject* parent = nullptr);
Q_INVOKABLE void open(const QUrl& url);
QTimer *timer;
signals:
void updateProcess(const QString& cmd_, int tid_, int euid_, double scpu_, double ucpu_, double resident_memory_, const QString& state_);
void addProcess(const QString& cmd_, int tid_, int euid_, double scpu_, double ucpu_, double resident_memory_, const QString& state_);
void removeProcess(int tid_);
private slots:
void callService();
void onSocketTextReceived(QString msg);
private:
QWebSocket m_socket;
int m_nextCallId;
std::vector<ProcInfo> m_procinfos;
void ProcessResponse(bool r, const QJsonValue &val);
};
#endif // TASKMANAGER_H
|