QtSupport: Use setup pattern for QtOutputFormatter

Change-Id: Ic570a6503bedc4685d3d7f6222f1edab33fb6bad
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2024-01-18 08:39:46 +01:00
parent e0582b5ddd
commit 9f937d04b1
4 changed files with 21 additions and 14 deletions

View File

@@ -10,6 +10,7 @@
#include <projectexplorer/deployablefile.h>
#include <projectexplorer/project.h>
#include <projectexplorer/runconfigurationaspects.h>
#include <projectexplorer/runcontrol.h>
#include <projectexplorer/target.h>
#include <remotelinux/remotelinuxenvironmentaspect.h>

View File

@@ -8,6 +8,8 @@
#include "qttestparser.h"
#include <coreplugin/editormanager/editormanager.h>
#include <projectexplorer/runcontrol.h>
#include <projectexplorer/project.h>
#include <projectexplorer/target.h>
@@ -218,13 +220,22 @@ void QtOutputLineParser::updateProjectFileList()
// QtOutputFormatterFactory
QtOutputFormatterFactory::QtOutputFormatterFactory()
class QtOutputFormatterFactory final : public OutputFormatterFactory
{
setFormatterCreator([](Target *t) -> QList<OutputLineParser *> {
if (QtKitAspect::qtVersion(t ? t->kit() : nullptr))
return {new QtTestParser, new QtOutputLineParser(t)};
return {};
});
public:
QtOutputFormatterFactory()
{
setFormatterCreator([](Target *t) -> QList<OutputLineParser *> {
if (QtKitAspect::qtVersion(t ? t->kit() : nullptr))
return {new QtTestParser, new QtOutputLineParser(t)};
return {};
});
}
};
void setupQtOutputFormatter()
{
static QtOutputFormatterFactory theQtOutputFormatterFactory;
}
} // QtSupport::Internal

View File

@@ -3,7 +3,7 @@
#pragma once
#include <projectexplorer/runcontrol.h>
#include <QObject>
// "file" or "qrc", colon, optional '//', '/' and further characters
#define QT_QML_URL_REGEXP "(?:file|qrc):(?://)?/.+?"
@@ -14,11 +14,7 @@
namespace QtSupport::Internal {
class QtOutputFormatterFactory : public ProjectExplorer::OutputFormatterFactory
{
public:
QtOutputFormatterFactory();
};
void setupQtOutputFormatter();
#ifdef WITH_TESTS
QObject *createQtOutputFormatterTest();

View File

@@ -48,8 +48,6 @@ namespace QtSupport::Internal {
class QtSupportPluginPrivate
{
public:
QtOutputFormatterFactory qtOutputFormatterFactory;
UicGeneratorFactory uicGeneratorFactory;
QScxmlcGeneratorFactory qscxmlcGeneratorFactory;
@@ -110,6 +108,7 @@ void QtSupportPlugin::initialize()
setupEmbeddedLinuxQtVersion();
setupGettingStartedWelcomePage();
setupQtSettingsPage();
setupQtOutputFormatter();
theProcessRunner() = processRunnerCallback;