| 1 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. |
|---|---|
| 2 | // |
| 3 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 4 | |
| 5 | #ifndef VALGRINDRUNNER_H |
| 6 | #define VALGRINDRUNNER_H |
| 7 | |
| 8 | #include "common/widget/outputpane.h" |
| 9 | #include "services/language/languagegenerator.h" |
| 10 | |
| 11 | #include <QObject> |
| 12 | |
| 13 | const QString HELGRIND = "helgrind"; |
| 14 | const QString MEMCHECK = "memcheck"; |
| 15 | |
| 16 | class ValgrindRunnerPrivate; |
| 17 | class ValgrindRunner : public QObject |
| 18 | { |
| 19 | Q_OBJECT |
| 20 | public: |
| 21 | explicit ValgrindRunner(QObject *parent = nullptr); |
| 22 | |
| 23 | void initialize(); |
| 24 | void runValgrind(const QString &type); |
| 25 | void saveCurrentProjectInfo(const dpfservice::ProjectInfo &projectInfo); |
| 26 | void removeProjectInfo(); |
| 27 | void saveCurrentFilePath(const QString &filePath); |
| 28 | void removeCurrentFilePath(); |
| 29 | |
| 30 | static ValgrindRunner *instance(); |
| 31 | |
| 32 | signals: |
| 33 | void valgrindFinished(const QString &xmlFilePath, const QString &type); |
| 34 | void clearValgrindBar(const QString &type); |
| 35 | |
| 36 | private slots: |
| 37 | void printOutput(const QString &content, OutputPane::OutputFormat format); |
| 38 | |
| 39 | private: |
| 40 | void setValgrindArgs(const QString &type); |
| 41 | void setMemcheckArgs(QStringList &args); |
| 42 | void setHelgrindArgs(QStringList &args); |
| 43 | void setActionsStatus(const QString &kitName); |
| 44 | void runBuilding(); |
| 45 | void outputMsg(const QString &content, OutputPane::OutputFormat format); |
| 46 | bool checkValgrindToolPath(); |
| 47 | |
| 48 | ValgrindRunnerPrivate *const d; |
| 49 | }; |
| 50 | |
| 51 | #endif // VALGRINDRUNNER_H |
| 52 |