ProjectExplorer: Properly set up the output formatter

... for the app output window.

Fixes: QTCREATORBUG-24560
Change-Id: I199d7b16f445db498027094792c6cf344d920a88
Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
Christian Kandeler
2020-09-03 14:23:31 +02:00
parent f6e013c80e
commit 215b284666
3 changed files with 15 additions and 6 deletions

View File

@@ -154,8 +154,10 @@ void TabWidget::slotContextMenuRequested(const QPoint &pos)
AppOutputPane::RunControlTab::RunControlTab(RunControl *runControl, Core::OutputWindow *w) :
runControl(runControl), window(w)
{
if (runControl && w)
w->setLineParsers(runControl->createOutputParsers());
if (runControl && w) {
w->reset();
runControl->setupFormatter(w->outputFormatter());
}
}
AppOutputPane::AppOutputPane() :
@@ -405,7 +407,8 @@ void AppOutputPane::createNewOutputWindow(RunControl *rc)
if (tab.runControl)
tab.runControl->initiateFinish();
tab.runControl = rc;
tab.window->setLineParsers(rc->createOutputParsers());
tab.window->reset();
rc->setupFormatter(tab.window->outputFormatter());
handleOldOutput(tab.window);

View File

@@ -41,6 +41,7 @@
#include <utils/algorithm.h>
#include <utils/checkablemessagebox.h>
#include <utils/detailswidget.h>
#include <utils/fileinprojectfinder.h>
#include <utils/outputformatter.h>
#include <utils/qtcassert.h>
#include <utils/utilsicons.h>
@@ -824,7 +825,7 @@ void RunControlPrivate::showError(const QString &msg)
q->appendMessage(msg + '\n', ErrorMessageFormat);
}
QList<Utils::OutputLineParser *> RunControl::createOutputParsers() const
void RunControl::setupFormatter(OutputFormatter *formatter) const
{
QList<Utils::OutputLineParser *> parsers = OutputFormatterFactory::createFormatters(target());
if (const auto customParsersAspect
@@ -834,7 +835,11 @@ QList<Utils::OutputLineParser *> RunControl::createOutputParsers() const
parsers << parser;
}
}
return parsers;
formatter->setLineParsers(parsers);
Utils::FileInProjectFinder fileFinder;
fileFinder.setProjectDirectory(project()->projectDirectory());
fileFinder.setProjectFiles(project()->files(Project::AllFiles));
formatter->setFileFinder(fileFinder);
}
Utils::Id RunControl::runMode() const

View File

@@ -46,6 +46,7 @@
namespace Utils {
class MacroExpander;
class OutputLineParser;
class OutputFormatter;
} // Utils
namespace ProjectExplorer {
@@ -238,7 +239,7 @@ public:
Utils::FilePath targetFilePath() const;
Utils::FilePath projectFilePath() const;
QList<Utils::OutputLineParser *> createOutputParsers() const;
void setupFormatter(Utils::OutputFormatter *formatter) const;
Utils::Id runMode() const;
const Runnable &runnable() const;