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/deployablefile.h>
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/runconfigurationaspects.h> #include <projectexplorer/runconfigurationaspects.h>
#include <projectexplorer/runcontrol.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <remotelinux/remotelinuxenvironmentaspect.h> #include <remotelinux/remotelinuxenvironmentaspect.h>

View File

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

View File

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

View File

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