-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.h
93 lines (84 loc) · 2.59 KB
/
mainwindow.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QTextStream>
#include <QDateTime>
#include <QDate>
#include <QTime>
#include <QtCharts>
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
struct ProcessDetails {
QString name;
QString user;
QString state;
QString memory;
QString vmemory;
QString rmemory;
QString smemory;
QString cpuTime;
QDateTime startTime;
};
struct ProcessInfo {
int pid;
int ppid;
int uid;
QString name;
QString status;
QString memory;
// Other fields as needed
};
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
double hardDiskCheck(const QString &disk);
void updateSystemInfo();
void updateFileSystemInfo();
void printAll(QString info, QTextStream &in);
QString bytesToMebibytesString(unsigned long bytes);
void processActions(const QPoint &pos);
void updateProcesses();
void createCpuBarChart();
void updateCpuBarChart();
void createRamSwapBarChart();
void updateRamSwapBarChart();
void createNetworkBarChart();
void updateNetworkBarChart();
void updateGraphs();
void updateNetworkResourceInfo();
void updateRamSwapResourceInfo();
std::vector<QLineSeries*> cpuLineSeriesVector; // Vector of QLineSeries pointers
std::vector<QLineSeries*> ramSwapLineSeriesVector; // Vector of QLineSeries pointers
std::vector<QLineSeries*> networkLineSeriesVector;
QChartView *cpuChartView;
QChartView *ramSwapChartView;
QChartView *networkChartView;
long recievedLast;
long uploadLast;
void updateProcesses(bool showOnlyUserProcess, bool treeView);
QString kbToMiB(const QString &memLine);
QString getProcessUid(const QString &statusPath);
QMap<int, ProcessInfo> readAllProcesses(bool showOnlyUserProcess);
ProcessInfo readProcessInfo(const QString &statusPath);
void buildProcessTree(const QMap<int, ProcessInfo> &processes);
MainWindow(QWidget *parent = nullptr);
~MainWindow();
private slots:
void updateCPUResourceInfo(); // Declaration for the CPU info update function
void onProcessFilterChanged(int index);
void pushButton_clicked();
void stopProcess(int pid);
void continueProcess(int pid);
void killProcess(int pid);
void listMapsProcess(int pid);
void showMemoryMapsDialog(const QStringList &lines);
void listFilesProcess(int pid);
void propertiesProcess(int pid);
ProcessDetails getProcessDetails(int pid);
private:
Ui::MainWindow *ui;
QTimer *graphInfoTimer; // QTimer object to trigger updates
};
#endif // MAINWINDOW_H