/
sysinfo.h
60 lines (50 loc) · 989 Bytes
/
sysinfo.h
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef SYSINFO_H
#define SYSINFO_H
#include <QObject>
#include <QThread>
#include <QTimer>
#include <QSettings>
#include <fstream>
#include <iostream>
#include <unistd.h>
#include <QFile>
#include <QTextStream>
#include <QStringList>
class MemInfo;
class CpuInfo;
class MemInfo : public QThread
{
Q_OBJECT
protected:
void run() Q_DECL_OVERRIDE ;
signals:
void meminfo(QString total, QString free, qreal ratio);
};
class CpuInfo : public QThread
{
Q_OBJECT
protected:
void run() Q_DECL_OVERRIDE;
signals:
void cpuinfo(QString info);
};
class SysInfo : public QObject
{
Q_OBJECT
public:
explicit SysInfo(QObject *parent = 0);
~SysInfo();
//Q_INVOKABLE void memoryInfo();
//Q_INVOKABLE void cpuInfo();
signals:
void meminfo(QString total, QString free, qreal ratio);
void cpuinfo(QString info);
public slots:
void getInfo();
private:
CpuInfo ci;
MemInfo mi;
QTimer timer;
QSettings st;
};
#endif // SYSINFO_H