forked from qt-creator/qt-creator
QtSupport: Some FilePathification in the OutputParser
Change-Id: I618bb47608593b5a60636c5e740f4d19e68e4f5a Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -29,8 +29,7 @@
|
|||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
namespace QtSupport {
|
namespace QtSupport::Internal {
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class QtOutputFormatterPrivate
|
class QtOutputFormatterPrivate
|
||||||
{
|
{
|
||||||
@@ -65,10 +64,10 @@ public:
|
|||||||
~QtOutputLineParser() override;
|
~QtOutputLineParser() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void openEditor(const QString &fileName, int line, int column = -1);
|
virtual void openEditor(const FilePath &filePath, int line, int column = -1);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Result handleLine(const QString &text, Utils::OutputFormat format) override;
|
Result handleLine(const QString &text, OutputFormat format) override;
|
||||||
bool handleLink(const QString &href) override;
|
bool handleLink(const QString &href) override;
|
||||||
|
|
||||||
void updateProjectFileList();
|
void updateProjectFileList();
|
||||||
@@ -148,7 +147,7 @@ bool QtOutputLineParser::handleLink(const QString &href)
|
|||||||
const QRegularExpressionMatch qmlLineColumnMatch = qmlLineColumnLink.match(href);
|
const QRegularExpressionMatch qmlLineColumnMatch = qmlLineColumnLink.match(href);
|
||||||
|
|
||||||
const auto getFileToOpen = [this](const QUrl &fileUrl) {
|
const auto getFileToOpen = [this](const QUrl &fileUrl) {
|
||||||
return chooseFileFromList(d->projectFinder.findFile(fileUrl)).toString();
|
return chooseFileFromList(d->projectFinder.findFile(fileUrl));
|
||||||
};
|
};
|
||||||
if (qmlLineColumnMatch.hasMatch()) {
|
if (qmlLineColumnMatch.hasMatch()) {
|
||||||
const QUrl fileUrl = QUrl(qmlLineColumnMatch.captured(1));
|
const QUrl fileUrl = QUrl(qmlLineColumnMatch.captured(1));
|
||||||
@@ -198,16 +197,16 @@ bool QtOutputLineParser::handleLink(const QString &href)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!fileName.isEmpty()) {
|
if (!fileName.isEmpty()) {
|
||||||
fileName = getFileToOpen(QUrl::fromLocalFile(fileName));
|
const FilePath filePath = getFileToOpen(QUrl::fromLocalFile(fileName));
|
||||||
openEditor(fileName, line);
|
openEditor(filePath, line);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtOutputLineParser::openEditor(const QString &fileName, int line, int column)
|
void QtOutputLineParser::openEditor(const FilePath &filePath, int line, int column)
|
||||||
{
|
{
|
||||||
Core::EditorManager::openEditorAt({FilePath::fromString(fileName), line, column});
|
Core::EditorManager::openEditorAt({filePath, line, column});
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtOutputLineParser::updateProjectFileList()
|
void QtOutputLineParser::updateProjectFileList()
|
||||||
@@ -227,8 +226,7 @@ QtOutputFormatterFactory::QtOutputFormatterFactory()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // QtSupport::Internal
|
||||||
} // namespace QtSupport
|
|
||||||
|
|
||||||
// Unit tests:
|
// Unit tests:
|
||||||
|
|
||||||
@@ -252,9 +250,9 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void openEditor(const QString &fileName, int line, int column = -1)
|
void openEditor(const FilePath &filePath, int line, int column = -1) override
|
||||||
{
|
{
|
||||||
this->fileName = fileName;
|
this->fileName = filePath.toString();
|
||||||
this->line = line;
|
this->line = line;
|
||||||
this->column = column;
|
this->column = column;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user