ProjectExplorer: Clean up IOutputParser interface

- Remove unneeded/unused functions.
- De-virtualize where possible.

In particular, after untangling a number of self-referential
redirections, it became apparent that the outputAdded()
infrastructure was entirely unused.

Change-Id: I51e1beed008df2727b42494b087efa476342397e
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2020-03-31 11:55:48 +02:00
parent cced9c95ea
commit cddaecfe21
15 changed files with 39 additions and 141 deletions

View File

@@ -179,10 +179,6 @@ bool QbsBuildStep::init()
m_activeFileTags = bc->activeFileTags();
m_products = bc->products();
connect(m_parser, &ProjectExplorer::IOutputParser::addOutput,
this, [this](const QString &string, ProjectExplorer::BuildStep::OutputFormat format) {
emit addOutput(string, format);
});
connect(m_parser, &ProjectExplorer::IOutputParser::addTask, this, &QbsBuildStep::addTask);
return true;
@@ -383,7 +379,7 @@ void QbsBuildStep::handleProcessResult(
if (success && !hasOutput)
return;
m_parser->setWorkingDirectory(workingDir.toString());
m_parser->setWorkingDirectory(workingDir);
emit addOutput(executable.toUserOutput() + ' ' + QtcProcess::joinArgs(arguments),
OutputFormat::Stdout);
for (const QString &line : stdErr) {

View File

@@ -29,6 +29,7 @@
#include <utils/fileutils.h>
#include <QDir>
#include <QFileInfo>
namespace QbsProjectManager {
@@ -39,21 +40,13 @@ QbsParser::QbsParser()
setObjectName(QLatin1String("QbsParser"));
}
void QbsParser::setWorkingDirectory(const QString &workingDirectory)
{
m_workingDirectory = QDir(workingDirectory);
IOutputParser::setWorkingDirectory(workingDirectory);
}
// TODO: Is this really needed? qbs never emits relative paths...
void QbsParser::taskAdded(const ProjectExplorer::Task &task, int linkedLines, int skipLines)
{
ProjectExplorer::Task editable(task);
QString filePath = task.file.toString();
const QString filePath = task.file.toString();
if (!filePath.isEmpty())
editable.file = Utils::FilePath::fromUserInput(m_workingDirectory.absoluteFilePath(filePath));
editable.file = workingDirectory().pathAppended(filePath);
IOutputParser::taskAdded(editable, linkedLines, skipLines);
}

View File

@@ -29,8 +29,6 @@
#include <projectexplorer/ioutputparser.h>
#include <QDir>
namespace QbsProjectManager {
namespace Internal {
@@ -42,10 +40,7 @@ public:
explicit QbsParser();
private:
void setWorkingDirectory(const QString &workingDirectory) override;
void taskAdded(const ProjectExplorer::Task &task, int linkedLines, int skipLines) override;
QDir m_workingDirectory;
};
} // namespace Internal