| 1 | // For license of this file, see <project-root-folder>/LICENSE.md. |
| 2 | |
| 3 | #ifndef EXTERNALTOOL_H |
| 4 | #define EXTERNALTOOL_H |
| 5 | |
| 6 | #include <QMetaType> |
| 7 | #include <QStringList> |
| 8 | |
| 9 | class ExternalTool { |
| 10 | public: |
| 11 | explicit ExternalTool() = default; |
| 12 | ExternalTool(const ExternalTool& other); |
| 13 | explicit ExternalTool(QString executable, QString parameters); |
| 14 | |
| 15 | QString toString(); |
| 16 | QString executable() const; |
| 17 | QString parameters() const; |
| 18 | |
| 19 | bool run(const QString& target); |
| 20 | |
| 21 | public: |
| 22 | static ExternalTool fromString(const QString& str); |
| 23 | static QList<ExternalTool> toolsFromSettings(); |
| 24 | static void setToolsToSettings(QVector<ExternalTool>& tools); |
| 25 | |
| 26 | private: |
| 27 | QString m_executable; |
| 28 | QString m_parameters; |
| 29 | |
| 30 | void sanitizeParameters(); |
| 31 | }; |
| 32 | |
| 33 | Q_DECLARE_METATYPE(ExternalTool) |
| 34 | |
| 35 | #endif // EXTERNALTOOL_H |