forked from qt-creator/qt-creator
ProjectPart: Allow for line/column information in project file
Keep this information separate so that plugins using the information do not need to start parsing the project file. Change-Id: Ibecf431de1b12bbe820c6f8f9c986cffeb4972d2 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -182,6 +182,8 @@ static ProjectPart::Ptr projectPartFromRawProjectPart(const RawProjectPart &rawP
|
||||
part->project = project;
|
||||
part->projectFile = rawProjectPart.projectFile;
|
||||
part->projectConfigFile = rawProjectPart.projectConfigFile;
|
||||
part->projectFileLine = rawProjectPart.projectFileLine;
|
||||
part->projectFileColumn = rawProjectPart.projectFileColumn;
|
||||
part->qtVersion = rawProjectPart.qtVersion;
|
||||
part->projectDefines = rawProjectPart.projectDefines;
|
||||
part->headerPaths = rawProjectPart.headerPaths;
|
||||
|
||||
@@ -54,9 +54,11 @@ void RawProjectPart::setFiles(const QStringList &files, FileClassifier fileClass
|
||||
this->fileClassifier = fileClassifier;
|
||||
}
|
||||
|
||||
void RawProjectPart::setProjectFile(const QString &projectFile)
|
||||
void RawProjectPart::setProjectFile(const QString &projectFile, int line, int column)
|
||||
{
|
||||
this->projectFile = projectFile;
|
||||
projectFileLine = line;
|
||||
projectFileColumn = column;
|
||||
}
|
||||
|
||||
void RawProjectPart::setConfigFileName(const QString &configFileName)
|
||||
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
using FileClassifier = std::function<ProjectFile::Kind (const QString &filePath)>;
|
||||
void setFiles(const QStringList &files, FileClassifier fileClassifier = FileClassifier());
|
||||
|
||||
void setProjectFile(const QString &projectFile);
|
||||
void setProjectFile(const QString &projectFile, int line = -1, int column = -1);
|
||||
void setConfigFileName(const QString &configFileName);
|
||||
|
||||
void setQtVersion(ProjectPart::QtVersion qtVersion);
|
||||
@@ -79,6 +79,8 @@ public:
|
||||
public:
|
||||
QString displayName;
|
||||
QString projectFile;
|
||||
int projectFileLine = -1;
|
||||
int projectFileColumn = -1;
|
||||
QString projectConfigFile; // currently only used by the Generic Project Manager
|
||||
QStringList precompiledHeaders;
|
||||
ProjectPartHeaderPaths headerPaths;
|
||||
|
||||
@@ -64,6 +64,10 @@ ProjectPart::Ptr ProjectPart::copy() const
|
||||
QString ProjectPart::id() const
|
||||
{
|
||||
QString projectPartId = QDir::fromNativeSeparators(projectFile);
|
||||
if (projectFileLine > 0)
|
||||
projectPartId += ":" + QString::number(projectFileLine);
|
||||
if (projectFileColumn > 0)
|
||||
projectPartId += ":" + QString::number(projectFileColumn);
|
||||
if (!displayName.isEmpty())
|
||||
projectPartId.append(QLatin1Char(' ') + displayName);
|
||||
return projectPartId;
|
||||
|
||||
@@ -105,6 +105,8 @@ public:
|
||||
QString displayName;
|
||||
|
||||
QString projectFile;
|
||||
int projectFileLine = -1;
|
||||
int projectFileColumn = -1;
|
||||
QString projectConfigFile; // currently only used by the Generic Project Manager
|
||||
|
||||
ProjectFiles files;
|
||||
|
||||
Reference in New Issue
Block a user