diff --git a/src/plugins/projectexplorer/buildmanager.cpp b/src/plugins/projectexplorer/buildmanager.cpp index 13f54b1c6337355c5b38ace41285d62da823324e..ba258e13bb202b7f238208234afd76bcce0c7cf7 100644 --- a/src/plugins/projectexplorer/buildmanager.cpp +++ b/src/plugins/projectexplorer/buildmanager.cpp @@ -228,7 +228,9 @@ void BuildManager::cancel() void BuildManager::updateTaskCount() { Core::ProgressManager *progressManager = Core::ICore::instance()->progressManager(); - const int errors = d->m_taskWindow->errorTaskCount(); + const int errors = + d->m_taskWindow->errorTaskCount(Constants::TASK_CATEGORY_BUILDSYSTEM) + + d->m_taskWindow->errorTaskCount(Constants::TASK_CATEGORY_COMPILE); if (errors > 0) { progressManager->setApplicationLabel(QString::number(errors)); } else { @@ -287,7 +289,10 @@ void BuildManager::toggleTaskWindow() bool BuildManager::tasksAvailable() const { - return d->m_taskWindow->taskCount() > 0; + const int count = + d->m_taskWindow->taskCount(Constants::TASK_CATEGORY_BUILDSYSTEM) + + d->m_taskWindow->taskCount(Constants::TASK_CATEGORY_COMPILE); + return count > 0; } void BuildManager::startBuildQueue() @@ -327,7 +332,7 @@ void BuildManager::startBuildQueue() void BuildManager::showBuildResults() { - if (d->m_taskWindow->taskCount() != 0) + if (tasksAvailable()) toggleTaskWindow(); else toggleOutputWindow(); diff --git a/src/plugins/projectexplorer/taskwindow.cpp b/src/plugins/projectexplorer/taskwindow.cpp index bf959545476666392bbce7c0ab4b37a7de50154d..c7255ee56c2e0e6bdf9a97c7a19b926664ccd153 100644 --- a/src/plugins/projectexplorer/taskwindow.cpp +++ b/src/plugins/projectexplorer/taskwindow.cpp @@ -876,19 +876,38 @@ void TaskWindow::filterCategoryTriggered(QAction *action) setCategoryVisibility(categoryId, action->isChecked()); } -int TaskWindow::taskCount() const +int TaskWindow::taskCount(const QString &category) const { - return d->m_model->taskCount(); + if (category.isEmpty()) + return d->m_model->taskCount(); + + return d->m_model->tasks(category).size(); } -int TaskWindow::errorTaskCount() const +int TaskWindow::errorTaskCount(const QString &category) const { - return d->m_model->errorTaskCount(); + if (category.isEmpty()) + return d->m_model->errorTaskCount(); + + int count = 0; + foreach (const Task &task, d->m_model->tasks(category)) { + if (task.type == Task::Error) + ++count; + } + return count; } -int TaskWindow::warningTaskCount() const +int TaskWindow::warningTaskCount(const QString &category) const { - return d->m_model->warningTaskCount(); + if (category.isEmpty()) + return d->m_model->warningTaskCount(); + + int count = 0; + foreach (const Task &task, d->m_model->tasks(category)) { + if (task.type == Task::Warning) + ++count; + } + return count; } int TaskWindow::priorityInStatusBar() const diff --git a/src/plugins/projectexplorer/taskwindow.h b/src/plugins/projectexplorer/taskwindow.h index bc1f75eb422546878552c06a9cb6e257b940dea1..b5f515af2bc0b3ac658266d0472a029e17f51fda 100644 --- a/src/plugins/projectexplorer/taskwindow.h +++ b/src/plugins/projectexplorer/taskwindow.h @@ -57,9 +57,9 @@ public: TaskWindow(ProjectExplorer::TaskHub *taskHub); virtual ~TaskWindow(); - int taskCount() const; - int warningTaskCount() const; - int errorTaskCount() const; + int taskCount(const QString &category = QString()) const; + int warningTaskCount(const QString &category = QString()) const; + int errorTaskCount(const QString &category = QString()) const; // IOutputPane QWidget *outputWidget(QWidget *);