forked from qt-creator/qt-creator
ProjectExplorer: Introduce new Task::setFile() method
This method can be useful when need to update a task file later, after the task creation. Change-Id: I42419e4c975e8644335a5f33a7bbf9a7c068322f Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -97,7 +97,7 @@ void IarParser::amendFilePath()
|
||||
QString filePath;
|
||||
while (!m_filePathParts.isEmpty())
|
||||
filePath.append(m_filePathParts.takeFirst().trimmed());
|
||||
m_lastTask.file = Utils::FileName::fromUserInput(filePath);
|
||||
m_lastTask.setFile(Utils::FileName::fromUserInput(filePath));
|
||||
m_expectFilePath = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,17 +65,11 @@ Task::Task(TaskType type_, const QString &description_,
|
||||
const Utils::FileName &file_, int line_, Core::Id category_,
|
||||
const QIcon &icon, Options options) :
|
||||
taskId(s_nextId), type(type_), options(options), description(description_),
|
||||
file(file_), line(line_), movedLine(line_), category(category_),
|
||||
line(line_), movedLine(line_), category(category_),
|
||||
icon(icon.isNull() ? taskTypeIcon(type_) : icon)
|
||||
{
|
||||
++s_nextId;
|
||||
if (!file.isEmpty() && !file.toFileInfo().isAbsolute()) {
|
||||
Utils::FileNameList possiblePaths = Internal::findFileInSession(file);
|
||||
if (possiblePaths.length() == 1)
|
||||
file = possiblePaths.first();
|
||||
else
|
||||
fileCandidates = possiblePaths;
|
||||
}
|
||||
setFile(file_);
|
||||
}
|
||||
|
||||
Task Task::compilerMissingTask()
|
||||
@@ -126,6 +120,18 @@ void Task::clear()
|
||||
m_mark.clear();
|
||||
}
|
||||
|
||||
void Task::setFile(const Utils::FileName &file_)
|
||||
{
|
||||
file = file_;
|
||||
if (!file.isEmpty() && !file.toFileInfo().isAbsolute()) {
|
||||
Utils::FileNameList possiblePaths = Internal::findFileInSession(file);
|
||||
if (possiblePaths.length() == 1)
|
||||
file = possiblePaths.first();
|
||||
else
|
||||
fileCandidates = possiblePaths;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// functions
|
||||
//
|
||||
|
||||
@@ -70,6 +70,7 @@ public:
|
||||
|
||||
bool isNull() const;
|
||||
void clear();
|
||||
void setFile(const Utils::FileName &file);
|
||||
|
||||
unsigned int taskId = 0;
|
||||
TaskType type = Unknown;
|
||||
|
||||
Reference in New Issue
Block a user