aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/projectexplorer/customparser.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/projectexplorer/customparser.h')
-rw-r--r--src/plugins/projectexplorer/customparser.h68
1 files changed, 55 insertions, 13 deletions
diff --git a/src/plugins/projectexplorer/customparser.h b/src/plugins/projectexplorer/customparser.h
index dafb0e8da1..0d431487e1 100644
--- a/src/plugins/projectexplorer/customparser.h
+++ b/src/plugins/projectexplorer/customparser.h
@@ -26,12 +26,18 @@
#pragma once
#include "ioutputparser.h"
+#include "projectconfiguration.h"
#include <projectexplorer/task.h>
+#include <utils/detailswidget.h>
#include <QRegularExpression>
+#include <QVariantMap>
namespace ProjectExplorer {
+class Target;
+
+namespace Internal {
class CustomParserExpression
{
@@ -62,6 +68,9 @@ public:
int messageCap() const;
void setMessageCap(int messageCap);
+ QVariantMap toMap() const;
+ void fromMap(const QVariantMap &map);
+
private:
QRegularExpression m_regExp;
CustomParserExpression::CustomParserChannel m_channel = ParseBothChannels;
@@ -77,36 +86,69 @@ public:
bool operator ==(const CustomParserSettings &other) const;
bool operator !=(const CustomParserSettings &other) const { return !operator==(other); }
+ QVariantMap toMap() const;
+ void fromMap(const QVariantMap &map);
+
+ Utils::Id id;
+ QString displayName;
CustomParserExpression error;
CustomParserExpression warning;
};
-class CustomParser : public ProjectExplorer::IOutputParser
+class CustomParser : public ProjectExplorer::OutputTaskParser
{
public:
CustomParser(const CustomParserSettings &settings = CustomParserSettings());
- void stdError(const QString &line) override;
- void stdOutput(const QString &line) override;
-
- void setWorkingDirectory(const QString &workingDirectory) override;
-
void setSettings(const CustomParserSettings &settings);
- static Core::Id id();
+ static CustomParser *createFromId(Utils::Id id);
+ static Utils::Id id();
private:
- Utils::FilePath absoluteFilePath(const QString &filePath) const;
- bool hasMatch(const QString &line, CustomParserExpression::CustomParserChannel channel,
- const CustomParserExpression &expression, Task::TaskType taskType);
- bool parseLine(const QString &rawLine, CustomParserExpression::CustomParserChannel channel);
+ Result handleLine(const QString &line, Utils::OutputFormat type) override;
+
+ Result hasMatch(const QString &line, CustomParserExpression::CustomParserChannel channel,
+ const CustomParserExpression &expression, Task::TaskType taskType);
+ Result parseLine(const QString &rawLine, CustomParserExpression::CustomParserChannel channel);
CustomParserExpression m_error;
CustomParserExpression m_warning;
+};
+
+class CustomParsersSelectionWidget : public Utils::DetailsWidget
+{
+ Q_OBJECT
+public:
+ CustomParsersSelectionWidget(QWidget *parent = nullptr);
+
+ void setSelectedParsers(const QList<Utils::Id> &parsers);
+ QList<Utils::Id> selectedParsers() const;
+
+signals:
+ void selectionChanged();
+
+private:
+ void updateSummary();
+};
+
+class CustomParsersAspect : public ProjectConfigurationAspect
+{
+ Q_OBJECT
+public:
+ CustomParsersAspect(Target *target);
+
+ void setParsers(const QList<Utils::Id> &parsers) { m_parsers = parsers; }
+ const QList<Utils::Id> parsers() const { return m_parsers; }
+
+private:
+ void fromMap(const QVariantMap &map) override;
+ void toMap(QVariantMap &map) const override;
- QString m_workingDirectory;
+ QList<Utils::Id> m_parsers;
};
+} // namespace Internal
} // namespace ProjectExplorer
-Q_DECLARE_METATYPE(ProjectExplorer::CustomParserExpression::CustomParserChannel);
+Q_DECLARE_METATYPE(ProjectExplorer::Internal::CustomParserExpression::CustomParserChannel);