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) : AppOutputPane::RunControlTab::RunControlTab(RunControl *runControl, Core::OutputWindow *w) :
runControl(runControl), window(w) runControl(runControl), window(w)
{ {
if (runControl && w) if (runControl && w) {
w->setLineParsers(runControl->createOutputParsers()); w->reset();
runControl->setupFormatter(w->outputFormatter());
}
} }
AppOutputPane::AppOutputPane() : AppOutputPane::AppOutputPane() :
@@ -405,7 +407,8 @@ void AppOutputPane::createNewOutputWindow(RunControl *rc)
if (tab.runControl) if (tab.runControl)
tab.runControl->initiateFinish(); tab.runControl->initiateFinish();
tab.runControl = rc; tab.runControl = rc;
tab.window->setLineParsers(rc->createOutputParsers()); tab.window->reset();
rc->setupFormatter(tab.window->outputFormatter());
handleOldOutput(tab.window); handleOldOutput(tab.window);

View File

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

View File

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