Fix icons in tasks

Create Tasks in such a way that they have the correct TaskType from
the start. This makes sure the icon chosen by default is the correct
one for that type and avoids the need to override the icon again later.

Change-Id: Ic47f1d119a7d8f85fcb6f2ee9aaaeadf074f8348
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Tobias Hunger
2014-01-14 10:28:16 +01:00
parent e6b8f046e4
commit fbd9a3509e
6 changed files with 55 additions and 61 deletions

View File

@@ -87,38 +87,34 @@ void GccParser::stdError(const QString &line)
return;
} else if (m_regExpGccNames.indexIn(lne) > -1) {
QString description = lne.mid(m_regExpGccNames.matchedLength());
Task task(Task::Error,
description,
Utils::FileName(), /* filename */
-1, /* line */
Constants::TASK_CATEGORY_COMPILE);
Task::TaskType type = Task::Error;
if (description.startsWith(QLatin1String("warning: "))) {
task.type = Task::Warning;
task.description = description.mid(9);
type = Task::Warning;
description = description.mid(9);
} else if (description.startsWith(QLatin1String("fatal: "))) {
task.description = description.mid(7);
description = description.mid(7);
}
Task task(type, description, Utils::FileName(), /* filename */
-1, /* line */ Constants::TASK_CATEGORY_COMPILE);
newTask(task);
return;
} else if (m_regExp.indexIn(lne) > -1) {
Utils::FileName filename = Utils::FileName::fromUserInput(m_regExp.cap(1));
int lineno = m_regExp.cap(3).toInt();
Task task(Task::Unknown,
m_regExp.cap(8) /* description */,
filename, lineno,
Constants::TASK_CATEGORY_COMPILE);
Task::TaskType type = Task::Unknown;
QString description = m_regExp.cap(8);
if (m_regExp.cap(7) == QLatin1String("warning"))
task.type = Task::Warning;
type = Task::Warning;
else if (m_regExp.cap(7) == QLatin1String("error") ||
task.description.startsWith(QLatin1String("undefined reference to")) ||
task.description.startsWith(QLatin1String("multiple definition of")))
task.type = Task::Error;
description.startsWith(QLatin1String("undefined reference to")) ||
description.startsWith(QLatin1String("multiple definition of")))
type = Task::Error;
// Prepend "#warning" or "#error" if that triggered the match on (warning|error)
// We want those to show how the warning was triggered
if (m_regExp.cap(5).startsWith(QLatin1Char('#')))
task.description = m_regExp.cap(5) + task.description;
description = m_regExp.cap(5) + description;
Task task(type, description, filename, lineno, Constants::TASK_CATEGORY_COMPILE);
newTask(task);
return;
} else if (m_regExpIncluded.indexIn(lne) > -1) {