summaryrefslogtreecommitdiff
path: root/src/plugins/projectexplorer
diff options
context:
space:
mode:
authordt <qtc-committer@nokia.com>2010-07-06 12:11:15 +0200
committerdt <qtc-committer@nokia.com>2010-07-07 11:43:03 +0200
commit0a751084eb3831793f398ca9c9d8803242e16b27 (patch)
treeb7a5dfc07d2740fc19dda335c770d51197942f61 /src/plugins/projectexplorer
parentf552e1d0c5bb14d173e6b9661f83e94f1fa04c84 (diff)
downloadqt-creator-0a751084eb3831793f398ca9c9d8803242e16b27.tar.gz
Task hub
Diffstat (limited to 'src/plugins/projectexplorer')
-rw-r--r--src/plugins/projectexplorer/buildmanager.cpp27
-rw-r--r--src/plugins/projectexplorer/buildmanager.h10
-rw-r--r--src/plugins/projectexplorer/projectexplorer.cpp12
-rw-r--r--src/plugins/projectexplorer/projectexplorer.h1
-rw-r--r--src/plugins/projectexplorer/projectexplorer.pro6
-rw-r--r--src/plugins/projectexplorer/taskhub.cpp80
-rw-r--r--src/plugins/projectexplorer/taskhub.h65
-rw-r--r--src/plugins/projectexplorer/taskwindow.cpp34
-rw-r--r--src/plugins/projectexplorer/taskwindow.h28
9 files changed, 207 insertions, 56 deletions
diff --git a/src/plugins/projectexplorer/buildmanager.cpp b/src/plugins/projectexplorer/buildmanager.cpp
index a912b9c07e..dc58861cab 100644
--- a/src/plugins/projectexplorer/buildmanager.cpp
+++ b/src/plugins/projectexplorer/buildmanager.cpp
@@ -38,6 +38,7 @@
#include "projectexplorersettings.h"
#include "target.h"
#include "taskwindow.h"
+#include "taskhub.h"
#include "buildconfiguration.h"
#include <coreplugin/icore.h>
@@ -91,12 +92,10 @@ BuildManager::BuildManager(ProjectExplorerPlugin *parent)
m_outputWindow = new CompileOutputWindow(this);
pm->addObject(m_outputWindow);
- m_taskWindow = new TaskWindow;
+ m_taskHub = pm->getObject<TaskHub>();
+ m_taskWindow = new TaskWindow(m_taskHub);
pm->addObject(m_taskWindow);
- m_taskWindow->addCategory(Constants::TASK_CATEGORY_COMPILE, tr("Compile", "Category for compiler isses listened under 'Build Issues'"));
- m_taskWindow->addCategory(Constants::TASK_CATEGORY_BUILDSYSTEM, tr("Build System", "Category for build system isses listened under 'Build Issues'"));
-
connect(m_taskWindow, SIGNAL(tasksChanged()),
this, SLOT(updateTaskCount()));
@@ -106,6 +105,12 @@ BuildManager::BuildManager(ProjectExplorerPlugin *parent)
this, SLOT(finish()));
}
+void BuildManager::extensionsInitialized()
+{
+ m_taskHub->addCategory(Constants::TASK_CATEGORY_COMPILE, tr("Compile", "Category for compiler isses listened under 'Build Issues'"));
+ m_taskHub->addCategory(Constants::TASK_CATEGORY_BUILDSYSTEM, tr("Build System", "Category for build system isses listened under 'Build Issues'"));
+}
+
BuildManager::~BuildManager()
{
cancel();
@@ -155,7 +160,7 @@ void BuildManager::cancel()
this, SLOT(addToOutputWindow(QString, QTextCharFormat)));
decrementActiveBuildSteps(m_currentBuildStep->buildConfiguration()->target()->project());
- m_progressFutureInterface->setProgressValueAndText(m_progress*100, "Build canceled"); //TODO NBS fix in qtconcurrent
+ m_progressFutureInterface->setProgressValueAndText(m_progress*100, tr("Build canceled")); //TODO NBS fix in qtconcurrent
clearBuildQueue();
}
return;
@@ -231,11 +236,6 @@ bool BuildManager::tasksAvailable() const
return m_taskWindow->taskCount() > 0;
}
-void BuildManager::gotoTaskWindow()
-{
- m_taskWindow->popup(true);
-}
-
void BuildManager::startBuildQueue()
{
if (m_buildQueue.isEmpty()) {
@@ -248,8 +248,8 @@ void BuildManager::startBuildQueue()
m_progressFutureInterface = new QFutureInterface<void>;
m_progressWatcher.setFuture(m_progressFutureInterface->future());
m_outputWindow->clearContents();
- m_taskWindow->clearTasks(Constants::TASK_CATEGORY_COMPILE);
- m_taskWindow->clearTasks(Constants::TASK_CATEGORY_BUILDSYSTEM);
+ m_taskHub->clearTasks(Constants::TASK_CATEGORY_COMPILE);
+ m_taskHub->clearTasks(Constants::TASK_CATEGORY_BUILDSYSTEM);
progressManager->setApplicationLabel("");
Core::FutureProgress *progress = progressManager->addTask(m_progressFutureInterface->future(),
tr("Build"),
@@ -283,7 +283,8 @@ void BuildManager::showBuildResults()
void BuildManager::addToTaskWindow(const ProjectExplorer::Task &task)
{
m_outputWindow->registerPositionOf(task);
- m_taskWindow->addTask(task);
+ // Distribute to all others
+ m_taskHub->addTask(task);
}
void BuildManager::addToOutputWindow(const QString &string, const QTextCharFormat &format)
diff --git a/src/plugins/projectexplorer/buildmanager.h b/src/plugins/projectexplorer/buildmanager.h
index d3e490f008..45b2218d4c 100644
--- a/src/plugins/projectexplorer/buildmanager.h
+++ b/src/plugins/projectexplorer/buildmanager.h
@@ -44,13 +44,14 @@ namespace ProjectExplorer {
namespace Internal {
class CompileOutputWindow;
class BuildProgressFuture;
+ class TaskWindow;
}
class BuildStep;
class Project;
class ProjectExplorerPlugin;
class BuildConfiguration;
-class TaskWindow;
+class TaskHub;
class PROJECTEXPLORER_EXPORT BuildManager
: public QObject
@@ -65,11 +66,11 @@ public:
BuildManager(ProjectExplorerPlugin *parent);
~BuildManager();
+ void extensionsInitialized();
+
bool isBuilding() const;
bool tasksAvailable() const;
- //shows with focus
- void gotoTaskWindow();
void buildProject(BuildConfiguration *bc);
void buildProjects(const QList<BuildConfiguration *> &configurations);
@@ -114,7 +115,8 @@ private:
void decrementActiveBuildSteps(Project *pro);
Internal::CompileOutputWindow *m_outputWindow;
- TaskWindow *m_taskWindow;
+ TaskHub *m_taskHub;
+ Internal::TaskWindow *m_taskWindow;
QList<BuildStep *> m_buildQueue;
QStringList m_configurations; // the corresponding configuration to the m_buildQueue
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index 6d21f7cf44..1390ac19db 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -72,6 +72,7 @@
#include "buildconfiguration.h"
#include "buildconfigdialog.h"
#include "miniprojecttargetselector.h"
+#include "taskhub.h"
#include <coreplugin/basemode.h>
#include <coreplugin/coreconstants.h>
@@ -236,6 +237,9 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
{
if (!parseArguments(arguments, error))
return false;
+ addObject(this);
+
+ addAutoReleasedObject(new TaskHub);
Core::ICore *core = Core::ICore::instance();
Core::ActionManager *am = core->actionManager();
@@ -243,7 +247,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
d->m_welcomePage = new ProjectWelcomePage;
connect(d->m_welcomePage, SIGNAL(manageSessions()), this, SLOT(showSessionManager()));
addObject(d->m_welcomePage);
- addObject(this);
connect(core->fileManager(), SIGNAL(currentFileChanged(QString)),
this, SLOT(setCurrentFile(QString)));
@@ -899,6 +902,8 @@ void ProjectExplorerPlugin::extensionsInitialized()
// class factories
foreach(Core::IWizard *cpw, ProjectExplorer::CustomWizard::createWizards())
addAutoReleasedObject(cpw);
+
+ d->m_buildManager->extensionsInitialized();
}
void ProjectExplorerPlugin::aboutToShutdown()
@@ -1890,11 +1895,6 @@ void ProjectExplorerPlugin::invalidateProject(Project *project)
updateActions();
}
-void ProjectExplorerPlugin::goToTaskWindow()
-{
- d->m_buildManager->gotoTaskWindow();
-}
-
void ProjectExplorerPlugin::updateContextMenuActions(Node *node)
{
d->m_addExistingFilesAction->setEnabled(false);
diff --git a/src/plugins/projectexplorer/projectexplorer.h b/src/plugins/projectexplorer/projectexplorer.h
index a1fe9ba699..13491c3364 100644
--- a/src/plugins/projectexplorer/projectexplorer.h
+++ b/src/plugins/projectexplorer/projectexplorer.h
@@ -162,7 +162,6 @@ private slots:
void runProject();
void runProjectContextMenu();
void savePersistentSettings();
- void goToTaskWindow();
void addNewFile();
void addExistingFiles();
diff --git a/src/plugins/projectexplorer/projectexplorer.pro b/src/plugins/projectexplorer/projectexplorer.pro
index 53a543de1d..d20089a7ee 100644
--- a/src/plugins/projectexplorer/projectexplorer.pro
+++ b/src/plugins/projectexplorer/projectexplorer.pro
@@ -88,7 +88,8 @@ HEADERS += projectexplorer.h \
outputformatter.h \
runconfigurationmodel.h \
buildconfigurationmodel.h \
- abstractprocessstep.h
+ abstractprocessstep.h \
+ taskhub.h
SOURCES += projectexplorer.cpp \
projectwindow.cpp \
buildmanager.cpp \
@@ -161,7 +162,8 @@ SOURCES += projectexplorer.cpp \
linuxiccparser.cpp \
outputformatter.cpp \
runconfigurationmodel.cpp \
- buildconfigurationmodel.cpp
+ buildconfigurationmodel.cpp \
+ taskhub.cpp
FORMS += processstep.ui \
editorsettingspropertiespage.ui \
runsettingspropertiespage.ui \
diff --git a/src/plugins/projectexplorer/taskhub.cpp b/src/plugins/projectexplorer/taskhub.cpp
new file mode 100644
index 0000000000..5854312f69
--- /dev/null
+++ b/src/plugins/projectexplorer/taskhub.cpp
@@ -0,0 +1,80 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#include "taskhub.h"
+#include <QtCore/QMetaType>
+
+using namespace ProjectExplorer;
+
+TaskHub::TaskHub()
+ : m_errorIcon(QLatin1String(":/projectexplorer/images/compile_error.png")),
+ m_warningIcon(QLatin1String(":/projectexplorer/images/compile_warning.png"))
+{
+ qRegisterMetaType<ProjectExplorer::Task>("ProjectExplorer::Task");
+ qRegisterMetaType<QList<ProjectExplorer::Task> >("QList<ProjectExplorer::Task>");
+}
+
+TaskHub::~TaskHub()
+{
+
+}
+
+void TaskHub::addCategory(const QString &categoryId, const QString &displayName)
+{
+ emit categoryAdded(categoryId, displayName);
+}
+
+void TaskHub::addTask(const Task &task)
+{
+ emit taskAdded(task);
+}
+
+void TaskHub::clearTasks(const QString &categoryId)
+{
+ emit tasksCleared(categoryId);
+}
+
+void TaskHub::removeTask(const Task &task)
+{
+ emit taskRemoved(task);
+}
+
+QIcon TaskHub::taskTypeIcon(Task::TaskType t) const
+{
+ switch (t) {
+ case Task::Warning:
+ return m_warningIcon;
+ case Task::Error:
+ return m_errorIcon;
+ case Task::Unknown:
+ break;
+ }
+ return QIcon();
+}
+
diff --git a/src/plugins/projectexplorer/taskhub.h b/src/plugins/projectexplorer/taskhub.h
new file mode 100644
index 0000000000..ec27b0a3c9
--- /dev/null
+++ b/src/plugins/projectexplorer/taskhub.h
@@ -0,0 +1,65 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#ifndef TASKHUB_H
+#define TASKHUB_H
+
+#include "task.h"
+#include "projectexplorer_export.h"
+#include <QtCore/QObject>
+#include <QtGui/QIcon>
+
+namespace ProjectExplorer {
+class Task;
+
+class PROJECTEXPLORER_EXPORT TaskHub : public QObject
+{
+ Q_OBJECT
+public:
+ TaskHub();
+ virtual ~TaskHub();
+
+ void addCategory(const QString &categoryId, const QString &displayName);
+ void addTask(const Task &task);
+ void clearTasks(const QString &categoryId = QString());
+ void removeTask(const Task &task);
+
+ // TODO now there are two places for icons
+ QIcon taskTypeIcon(ProjectExplorer::Task::TaskType t) const;
+signals:
+ void categoryAdded(const QString &categoryId, const QString &displayName);
+ void taskAdded(const ProjectExplorer::Task &task);
+ void taskRemoved(const ProjectExplorer::Task &task);
+ void tasksCleared(const QString &categoryId);
+private:
+ const QIcon m_errorIcon;
+ const QIcon m_warningIcon;
+};
+} // namespace ProjectExplorer
+#endif // TASKHUB_H
diff --git a/src/plugins/projectexplorer/taskwindow.cpp b/src/plugins/projectexplorer/taskwindow.cpp
index b0bc34c11c..e654f842c2 100644
--- a/src/plugins/projectexplorer/taskwindow.cpp
+++ b/src/plugins/projectexplorer/taskwindow.cpp
@@ -32,6 +32,7 @@
#include "itaskhandler.h"
#include "projectexplorerconstants.h"
#include "task.h"
+#include "taskhub.h"
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/command.h>
@@ -476,8 +477,6 @@ bool TaskFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceP
return accept;
}
-} // namespace Internal
-
/////
// TaskWindow
/////
@@ -495,6 +494,7 @@ public:
QToolButton *m_filterWarningsButton;
QToolButton *m_categoriesButton;
QMenu *m_categoriesMenu;
+ TaskHub *m_taskHub;
};
static QToolButton *createFilterButton(QIcon icon, const QString &toolTip,
@@ -511,7 +511,7 @@ static QToolButton *createFilterButton(QIcon icon, const QString &toolTip,
return button;
}
-TaskWindow::TaskWindow() : d(new TaskWindowPrivate)
+TaskWindow::TaskWindow(TaskHub *taskhub) : d(new TaskWindowPrivate)
{
d->m_defaultHandler = 0;
@@ -530,6 +530,8 @@ TaskWindow::TaskWindow() : d(new TaskWindowPrivate)
d->m_listview->setAttribute(Qt::WA_MacShowFocusRect, false);
d->m_taskWindowContext = new Internal::TaskWindowContext(d->m_listview);
+ d->m_taskHub = taskhub;
+
Core::ICore::instance()->addContextObject(d->m_taskWindowContext);
connect(d->m_listview->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
@@ -549,9 +551,9 @@ TaskWindow::TaskWindow() : d(new TaskWindowPrivate)
connect(d->m_listview, SIGNAL(customContextMenuRequested(QPoint)),
this, SLOT(showContextMenu(QPoint)));
- d->m_filterWarningsButton = createFilterButton(taskTypeIcon(Task::Warning),
- tr("Show Warnings"),
- this, SLOT(setShowWarnings(bool)));
+ d->m_filterWarningsButton = createFilterButton(d->m_model->taskTypeIcon(Task::Warning),
+ tr("Show Warnings"),
+ this, SLOT(setShowWarnings(bool)));
d->m_categoriesMenu = new QMenu;
connect(d->m_categoriesMenu, SIGNAL(aboutToShow()), this, SLOT(updateCategoriesMenu()));
@@ -564,8 +566,14 @@ TaskWindow::TaskWindow() : d(new TaskWindowPrivate)
d->m_categoriesButton->setPopupMode(QToolButton::InstantPopup);
d->m_categoriesButton->setMenu(d->m_categoriesMenu);
- qRegisterMetaType<ProjectExplorer::Task>("ProjectExplorer::Task");
- qRegisterMetaType<QList<ProjectExplorer::Task> >("QList<ProjectExplorer::Task>");
+ connect(d->m_taskHub, SIGNAL(categoryAdded(QString, QString)),
+ this, SLOT(addCategory(QString, QString)));
+ connect(d->m_taskHub, SIGNAL(taskAdded(ProjectExplorer::Task)),
+ this, SLOT(addTask(ProjectExplorer::Task)));
+ connect(d->m_taskHub, SIGNAL(taskRemoved(ProjectExplorer::Task)),
+ this, SLOT(removeTask(ProjectExplorer::Task)));
+ connect(d->m_taskHub, SIGNAL(tasksCleared(QString)),
+ this, SLOT(clearTasks(QString)));
}
TaskWindow::~TaskWindow()
@@ -747,7 +755,9 @@ int TaskWindow::priorityInStatusBar() const
void TaskWindow::clearContents()
{
- clearTasks();
+ // clear all tasks in all displays
+ // Yeah we are that special
+ d->m_taskHub->clearTasks(QString());
}
bool TaskWindow::hasFocus()
@@ -819,12 +829,6 @@ bool TaskWindow::canNavigate()
return true;
}
-QIcon TaskWindow::taskTypeIcon(int t) const
-{
- return d->m_model->taskTypeIcon(static_cast<Task::TaskType>(t));
-}
-
-namespace Internal {
/////
// Delegate
/////
diff --git a/src/plugins/projectexplorer/taskwindow.h b/src/plugins/projectexplorer/taskwindow.h
index 086dd0502b..b6f1f4c8fb 100644
--- a/src/plugins/projectexplorer/taskwindow.h
+++ b/src/plugins/projectexplorer/taskwindow.h
@@ -30,10 +30,8 @@
#ifndef TASKWINDOW_H
#define TASKWINDOW_H
-#include "projectexplorer_export.h"
-
+#include "task.h"
#include <coreplugin/ioutputpane.h>
-
#include <QtGui/QIcon>
QT_BEGIN_NAMESPACE
@@ -42,24 +40,20 @@ class QModelIndex;
QT_END_NAMESPACE
namespace ProjectExplorer {
-class Task;
+class TaskHub;
+
+namespace Internal {
class TaskWindowPrivate;
// Show build issues (warnings or errors) and open the editor on click.
-class PROJECTEXPLORER_EXPORT TaskWindow : public Core::IOutputPane
+class TaskWindow : public Core::IOutputPane
{
Q_OBJECT
public:
- TaskWindow();
+ TaskWindow(ProjectExplorer::TaskHub *taskHub);
virtual ~TaskWindow();
- void addCategory(const QString &categoryId, const QString &displayName);
-
- void addTask(const Task &task);
- void removeTask(const Task &task);
- void clearTasks(const QString &categoryId = QString());
-
int taskCount() const;
int errorTaskCount() const;
@@ -82,12 +76,15 @@ public:
void goToNext();
void goToPrev();
- QIcon taskTypeIcon(int t) const;
-
signals:
void tasksChanged();
private slots:
+ void addCategory(const QString &categoryId, const QString &displayName);
+ void addTask(const ProjectExplorer::Task &task);
+ void removeTask(const ProjectExplorer::Task &task);
+ void clearTasks(const QString &categoryId);
+
void triggerDefaultHandler(const QModelIndex &index);
void showContextMenu(const QPoint &position);
void contextMenuEntryTriggered(QAction *);
@@ -102,6 +99,7 @@ private:
TaskWindowPrivate *d;
};
-} //namespace ProjectExplorer
+} // namespace Internal
+} // namespace ProjectExplorer
#endif // TASKWINDOW_H