forked from qt-creator/qt-creator
QtSupport: Add QtTestParser to the list of output formatters
... when creating a run control for a Qt project. Now tasks will appear in the issues pane for QtTest application output in the app output pane. Task-number: QTCREATORBUG-22665 Change-Id: I2674f3d4f9aabc0a4db4178dcd5495b822f14022 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -1604,15 +1604,12 @@ OutputFormatterFactory::~OutputFormatterFactory()
|
||||
QList<OutputLineParser *> OutputFormatterFactory::createFormatters(Target *target)
|
||||
{
|
||||
QList<OutputLineParser *> formatters;
|
||||
for (auto factory : qAsConst(g_outputFormatterFactories)) {
|
||||
if (auto formatter = factory->m_creator(target))
|
||||
formatters << formatter;
|
||||
}
|
||||
for (auto factory : qAsConst(g_outputFormatterFactories))
|
||||
formatters << factory->m_creator(target);
|
||||
return formatters;
|
||||
}
|
||||
|
||||
void OutputFormatterFactory::setFormatterCreator
|
||||
(const std::function<OutputLineParser *(Target *)> &creator)
|
||||
void OutputFormatterFactory::setFormatterCreator(const FormatterCreator &creator)
|
||||
{
|
||||
m_creator = creator;
|
||||
}
|
||||
|
@@ -312,10 +312,11 @@ public:
|
||||
static QList<Utils::OutputLineParser *> createFormatters(Target *target);
|
||||
|
||||
protected:
|
||||
void setFormatterCreator(const std::function<Utils::OutputLineParser *(Target *)> &creator);
|
||||
using FormatterCreator = std::function<QList<Utils::OutputLineParser *>(Target *)>;
|
||||
void setFormatterCreator(const FormatterCreator &creator);
|
||||
|
||||
private:
|
||||
std::function<Utils::OutputLineParser *(Target *)> m_creator;
|
||||
FormatterCreator m_creator;
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
@@ -331,10 +331,10 @@ PythonRunConfigurationFactory::PythonRunConfigurationFactory()
|
||||
|
||||
PythonOutputFormatterFactory::PythonOutputFormatterFactory()
|
||||
{
|
||||
setFormatterCreator([](Target *t) -> OutputLineParser * {
|
||||
setFormatterCreator([](Target *t) -> QList<OutputLineParser *> {
|
||||
if (t && t->project()->mimeType() == Constants::C_PY_MIMETYPE)
|
||||
return new PythonOutputLineParser;
|
||||
return nullptr;
|
||||
return {new PythonOutputLineParser};
|
||||
return {};
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -27,6 +27,7 @@
|
||||
|
||||
#include "qtkitinformation.h"
|
||||
#include "qtsupportconstants.h"
|
||||
#include "qttestparser.h"
|
||||
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <projectexplorer/project.h>
|
||||
@@ -242,9 +243,10 @@ void QtOutputLineParser::updateProjectFileList()
|
||||
|
||||
QtOutputFormatterFactory::QtOutputFormatterFactory()
|
||||
{
|
||||
setFormatterCreator([](Target *t) -> OutputLineParser * {
|
||||
BaseQtVersion *qt = QtKitAspect::qtVersion(t ? t->kit() : nullptr);
|
||||
return qt ? new QtOutputLineParser(t) : nullptr;
|
||||
setFormatterCreator([](Target *t) -> QList<OutputLineParser *> {
|
||||
if (QtKitAspect::qtVersion(t ? t->kit() : nullptr))
|
||||
return {new QtTestParser, new QtOutputLineParser(t)};
|
||||
return {};
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user