12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- #ifndef PERFORMWIDGET_H
- #define PERFORMWIDGET_H
- #include <QWidget>
- #include <QTimer>
- #include<QDesktopWidget>
- #include<QProcess>
- #include<QRegularExpression>
- #include<QDebug>
- #include<QTableWidgetItem>
- #include<QMouseEvent>
- #define CPU_SORT "ps ax -o \"%u %p %C\" -o pmem -o \"%c %a\" --sort=-%cpu|head -21"
- #define MEM_SORT "ps ax -o \"%u %p %C\" -o pmem -o \"%c %a\" --sort=-pmem|head -21"
- #define BG_color "#monitorwindow{ background-color:%1; }\
- #pushButton{ color:%2; }"
- #define FD_CALCU_SPRINT_STR "lsof -p %1 | wc -l"
- #define LOW "rgb(50, 162, 106)"
- #define MID "rgb(233, 119, 57)"
- #define HIGH "rgb(179, 10, 13)"
- QT_BEGIN_NAMESPACE
- namespace Ui { class PerformWidget; }
- QT_END_NAMESPACE
- class PerformWidget : public QWidget
- {
- Q_OBJECT
- public:
- PerformWidget(QWidget *parent = nullptr);
- ~PerformWidget();
- static int GetProcessFds(int processID);
- signals:
- void opencpu();
- private:
- static int GetProcessFdsImpl(QProcess* pro, int processID);
- public slots:
- bool GetPerformInfo();
- void UpdateMemUsed();
- void sortByColumn(int selColumn);
- private:
- Ui::PerformWidget *ui;
- QPoint oldpos;
- void makelist();
- bool pidselected(const QString&);
- QTimer *timer;
- QProcess *process;
- QProcess *pro;
- QStringList selectedpid;
- QString cmd;
- QString pressed;
- QStringList selected;
- QStringList listupdate2freshselected;
- int memused;
- QRegularExpression reg;
- };
- #endif // PERFORMWIDGET_H
|