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

@@ -33,6 +33,15 @@
using namespace ProjectExplorer;
static Task::TaskType taskType(const QString &capture)
{
if (capture == QLatin1String("warning"))
return Task::Warning;
else if (capture == QLatin1String("note"))
return Task::Unknown;
return Task::Error;
}
// opt. drive letter + filename: (2 brackets)
static const char * const FILE_PATTERN = "(<command line>|([A-Za-z]:)?[^:]+\\.[^:]+)";
@@ -60,15 +69,11 @@ void ClangParser::stdError(const QString &line)
if (m_commandRegExp.indexIn(lne) > -1) {
m_expectSnippet = true;
Task task(Task::Error,
Task task(taskType(m_commandRegExp.cap(3)),
m_commandRegExp.cap(4),
Utils::FileName(), /* filename */
-1, /* line */
Constants::TASK_CATEGORY_COMPILE);
if (m_commandRegExp.cap(3) == QLatin1String("warning"))
task.type = Task::Warning;
else if (m_commandRegExp.cap(3) == QLatin1String("note"))
task.type = Task::Unknown;
newTask(task);
return;
}
@@ -89,15 +94,11 @@ void ClangParser::stdError(const QString &line)
int lineNo = m_messageRegExp.cap(4).toInt(&ok);
if (!ok)
lineNo = m_messageRegExp.cap(5).toInt(&ok);
Task task(Task::Error,
Task task(taskType(m_messageRegExp.cap(7)),
m_messageRegExp.cap(8),
Utils::FileName::fromUserInput(m_messageRegExp.cap(1)), /* filename */
lineNo,
Core::Id(Constants::TASK_CATEGORY_COMPILE));
if (m_messageRegExp.cap(7) == QLatin1String("warning"))
task.type = Task::Warning;
else if (m_messageRegExp.cap(7) == QLatin1String("note"))
task.type = Task::Unknown;
newTask(task);
return;
}