forked from qt-creator/qt-creator
Task: Use a static cache for the error and warning icons
Saves around 33% of testGccOutputParsers runtime. Change-Id: I5c6d0f8af8a36c153e84907e77643f4e20c8f6a1 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
@@ -37,17 +37,16 @@
|
|||||||
namespace ProjectExplorer
|
namespace ProjectExplorer
|
||||||
{
|
{
|
||||||
|
|
||||||
static QString taskTypeIcon(Task::TaskType t)
|
static QIcon taskTypeIcon(Task::TaskType t)
|
||||||
{
|
{
|
||||||
switch (t) {
|
static QIcon icons[3] = { QIcon(),
|
||||||
case Task::Warning:
|
QIcon(QLatin1String(Core::Constants::ICON_ERROR)),
|
||||||
return QLatin1String(Core::Constants::ICON_WARNING);
|
QIcon(QLatin1String(Core::Constants::ICON_WARNING)) };
|
||||||
case Task::Error:
|
|
||||||
return QLatin1String(Core::Constants::ICON_ERROR);
|
if (t < 0 || t > 2)
|
||||||
case Task::Unknown:
|
t = Task::Unknown;
|
||||||
break;
|
|
||||||
}
|
return icons[t];
|
||||||
return QString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int Task::s_nextId = 1;
|
unsigned int Task::s_nextId = 1;
|
||||||
@@ -66,7 +65,7 @@ Task::Task(TaskType type_, const QString &description_,
|
|||||||
const Utils::FileName &iconFile) :
|
const Utils::FileName &iconFile) :
|
||||||
taskId(s_nextId), type(type_), description(description_),
|
taskId(s_nextId), type(type_), description(description_),
|
||||||
file(file_), line(line_), movedLine(line_), category(category_),
|
file(file_), line(line_), movedLine(line_), category(category_),
|
||||||
icon(iconFile.isEmpty() ? taskTypeIcon(type_) : iconFile.toString())
|
icon(iconFile.isEmpty() ? taskTypeIcon(type_) : QIcon(iconFile.toString()))
|
||||||
{
|
{
|
||||||
++s_nextId;
|
++s_nextId;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user