Commit f82c4ea3 authored by Tobias Hunger's avatar Tobias Hunger

Tasks: Only report warning tasks in build progress

Task-number: QTCREATORBUG-5020
Change-Id: Iead3d76509dd7b6d6c04d0ef64b7b3d2cad316d0
Reviewed-on: http://codereview.qt.nokia.com/369Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarDaniel Teske <daniel.teske@nokia.com>
parent 9f9d7bb1
......@@ -93,7 +93,7 @@ void BuildProgress::updateState()
m_errorIcon->setEnabled(haveErrors);
m_errorLabel->setEnabled(haveErrors);
m_errorLabel->setText(QString("%1").arg(errors));
int warnings = m_taskWindow->taskCount()-errors;
int warnings = m_taskWindow->warningTaskCount();
bool haveWarnings = (warnings > 0);
m_warningIcon->setEnabled(haveWarnings);
m_warningLabel->setEnabled(haveWarnings);
......
......@@ -109,6 +109,7 @@ public:
int taskCount();
int errorTaskCount();
int warningTaskCount();
bool hasFile(const QModelIndex &index) const;
......@@ -124,6 +125,7 @@ private:
const QIcon m_warningIcon;
int m_taskCount;
int m_errorTaskCount;
int m_warningTaskCount;
int m_sizeOfLineNumber;
QString m_lineMeasurementFont;
};
......@@ -292,6 +294,7 @@ TaskModel::TaskModel() :
m_warningIcon(QLatin1String(":/projectexplorer/images/compile_warning.png")),
m_taskCount(0),
m_errorTaskCount(0),
m_warningTaskCount(0),
m_sizeOfLineNumber(0)
{
}
......@@ -306,6 +309,11 @@ int TaskModel::errorTaskCount()
return m_errorTaskCount;
}
int TaskModel::warningTaskCount()
{
return m_warningTaskCount;
}
bool TaskModel::hasFile(const QModelIndex &index) const
{
int row = index.row();
......@@ -362,6 +370,8 @@ void TaskModel::addTask(const Task &task)
++m_taskCount;
if (task.type == Task::Error)
++m_errorTaskCount;
if (task.type == Task::Warning)
++m_warningTaskCount;
}
void TaskModel::removeTask(const Task &task)
......@@ -373,6 +383,8 @@ void TaskModel::removeTask(const Task &task)
--m_taskCount;
if (task.type == Task::Error)
--m_errorTaskCount;
if (task.type == Task::Warning)
--m_warningTaskCount;
endRemoveRows();
}
}
......@@ -387,12 +399,14 @@ void TaskModel::clearTasks(const QString &categoryId)
m_tasksInCategory.clear();
m_taskCount = 0;
m_errorTaskCount = 0;
m_warningTaskCount = 0;
endRemoveRows();
m_maxSizeOfFileName = 0;
} else {
int index = 0;
int start = 0;
int subErrorTaskCount = 0;
int subWarningTaskCount = 0;
while (index < m_tasks.size()) {
while (index < m_tasks.size() && m_tasks.at(index).category != categoryId) {
++start;
......@@ -403,6 +417,8 @@ void TaskModel::clearTasks(const QString &categoryId)
while (index < m_tasks.size() && m_tasks.at(index).category == categoryId) {
if (m_tasks.at(index).type == Task::Error)
++subErrorTaskCount;
if (m_tasks.at(index).type == Task::Warning)
++subWarningTaskCount;
++index;
}
// Index is now on the first non category
......@@ -416,6 +432,7 @@ void TaskModel::clearTasks(const QString &categoryId)
m_taskCount -= index - start;
m_errorTaskCount -= subErrorTaskCount;
m_warningTaskCount -= subWarningTaskCount;
endRemoveRows();
index = start;
......@@ -853,6 +870,11 @@ int TaskWindow::errorTaskCount() const
return d->m_model->errorTaskCount();
}
int TaskWindow::warningTaskCount() const
{
return d->m_model->warningTaskCount();
}
int TaskWindow::priorityInStatusBar() const
{
return 90;
......
......@@ -58,6 +58,7 @@ public:
virtual ~TaskWindow();
int taskCount() const;
int warningTaskCount() const;
int errorTaskCount() const;
// IOutputPane
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment