ProjectExplorer: Streamline OutputFormatter creation a bit

Note that the concept of a single monolithic OutputFormatter per
RunConfiguration (and why RunConfiguration, not RunControl to start
with?) is unchanged and suboptimal as one cannot easily combine
existing use cases, e.g. Python_and_Qt.

Change-Id: Ibeb8191020387324f22ed313230293597f96e36a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2018-04-06 09:21:44 +02:00
parent 845541c89d
commit 83c6a4916c
19 changed files with 26 additions and 63 deletions

View File

@@ -144,7 +144,7 @@ static QTextCharFormat linkFormat(const QTextCharFormat &inputFormat, const QStr
class PythonOutputFormatter : public OutputFormatter
{
public:
PythonOutputFormatter()
PythonOutputFormatter(Project *)
// Note that moc dislikes raw string literals.
: filePattern("^(\\s*)(File \"([^\"]+)\", line (\\d+), .*$)")
{
@@ -239,7 +239,6 @@ public:
QWidget *createConfigurationWidget() override;
QVariantMap toMap() const override;
bool fromMap(const QVariantMap &map) override;
OutputFormatter *createOutputFormatter() const override;
Runnable runnable() const override;
void doAdditionalSetup(const RunConfigurationCreationInfo &info) override;
@@ -266,6 +265,7 @@ PythonRunConfiguration::PythonRunConfiguration(Target *target)
addExtraAspect(new LocalEnvironmentAspect(this, LocalEnvironmentAspect::BaseEnvironmentModifier()));
addExtraAspect(new ArgumentsAspect(this, "PythonEditor.RunConfiguration.Arguments"));
addExtraAspect(new TerminalAspect(this, "PythonEditor.RunConfiguration.UseTerminal"));
setOutputFormatter<PythonOutputFormatter>();
}
QVariantMap PythonRunConfiguration::toMap() const
@@ -315,11 +315,6 @@ Runnable PythonRunConfiguration::runnable() const
return r;
}
OutputFormatter *PythonRunConfiguration::createOutputFormatter() const
{
return new PythonOutputFormatter;
}
QString PythonRunConfiguration::arguments() const
{
auto aspect = extraAspect<ArgumentsAspect>();