Commit 85b2017a authored by Tobias Hunger's avatar Tobias Hunger

TaskHub: Move code to be more conform with other singletons

Make methods static and add a instance() method for Signals/Slots.

Remove ProjectExplorerPlugin::taskHub() method and use the new
ones instead.

Change-Id: Ifae24ff19579fc524cbd61bddc826095c443adfa
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 53a49e3a
......@@ -66,8 +66,7 @@ bool AnalyzerPlugin::initialize(const QStringList &arguments, QString *errorStri
// Task integration.
//: Category under which Analyzer tasks are listed in Issues view
ProjectExplorer::ProjectExplorerPlugin::taskHub()
->addCategory(Constants::ANALYZERTASK_ID, tr("Analyzer"));
ProjectExplorer::TaskHub::addCategory(Constants::ANALYZERTASK_ID, tr("Analyzer"));
return true;
}
......
......@@ -167,8 +167,7 @@ public:
m_watchHandler(engine),
m_disassemblerAgent(engine),
m_memoryAgent(engine),
m_isStateDebugging(false),
m_taskHub(0)
m_isStateDebugging(false)
{
connect(&m_locationTimer, SIGNAL(timeout()), SLOT(resetLocation()));
}
......@@ -255,8 +254,6 @@ public slots:
m_disassemblerAgent.resetLocation();
}
TaskHub *taskHub();
public:
DebuggerState state() const { return m_state; }
RemoteSetupState remoteSetupState() const { return m_remoteSetupState; }
......@@ -301,7 +298,6 @@ public:
bool m_isStateDebugging;
Utils::FileInProjectFinder m_fileFinder;
TaskHub *m_taskHub;
};
......@@ -1858,25 +1854,6 @@ void DebuggerEngine::checkForReleaseBuild(const DebuggerStartParameters &sp)
"Setting breakpoints by file name and line number may fail.\n").append(detailedWarning));
}
TaskHub *DebuggerEnginePrivate::taskHub()
{
if (!m_taskHub) {
m_taskHub = ProjectExplorerPlugin::taskHub();
m_taskHub->addCategory(Debugger::Constants::TASK_CATEGORY_DEBUGGER_DEBUGINFO,
tr("Debug Information"));
m_taskHub->addCategory(Debugger::Constants::TASK_CATEGORY_DEBUGGER_TEST,
tr("Debugger Test"));
m_taskHub->addCategory(Debugger::Constants::TASK_CATEGORY_DEBUGGER_RUNTIME,
tr("Debugger Runtime"));
}
return m_taskHub;
}
TaskHub *DebuggerEngine::taskHub()
{
return d->taskHub();
}
} // namespace Debugger
#include "debuggerengine.moc"
......@@ -83,6 +83,7 @@
#include <projectexplorer/localapplicationrunconfiguration.h>
#include <projectexplorer/buildmanager.h>
#include <projectexplorer/taskhub.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/devicesupport/deviceprocesslist.h>
#include <projectexplorer/devicesupport/deviceprocessesdialog.h>
......@@ -1504,6 +1505,13 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
// Cpp/Qml ui setup
m_mainWindow = new DebuggerMainWindow;
TaskHub::addCategory(Debugger::Constants::TASK_CATEGORY_DEBUGGER_DEBUGINFO,
tr("Debug Information"));
TaskHub::addCategory(Debugger::Constants::TASK_CATEGORY_DEBUGGER_TEST,
tr("Debugger Test"));
TaskHub::addCategory(Debugger::Constants::TASK_CATEGORY_DEBUGGER_RUNTIME,
tr("Debugger Runtime"));
return true;
}
......
......@@ -458,10 +458,9 @@ static bool fixupEngineTypes(DebuggerStartParameters &sp, RunConfiguration *rc,
DebuggerRunControl *DebuggerRunControlFactory::doCreate
(const DebuggerStartParameters &sp0, RunConfiguration *rc, QString *errorMessage)
{
TaskHub *th = ProjectExplorerPlugin::taskHub();
th->clearTasks(Debugger::Constants::TASK_CATEGORY_DEBUGGER_DEBUGINFO);
th->clearTasks(Debugger::Constants::TASK_CATEGORY_DEBUGGER_TEST);
th->clearTasks(Debugger::Constants::TASK_CATEGORY_DEBUGGER_RUNTIME);
TaskHub::clearTasks(Debugger::Constants::TASK_CATEGORY_DEBUGGER_DEBUGINFO);
TaskHub::clearTasks(Debugger::Constants::TASK_CATEGORY_DEBUGGER_TEST);
TaskHub::clearTasks(Debugger::Constants::TASK_CATEGORY_DEBUGGER_RUNTIME);
DebuggerStartParameters sp = sp0;
if (!debuggerCore()->boolSetting(AutoEnrichParameters)) {
......
......@@ -32,8 +32,8 @@
#include "buildprogress.h"
#include "buildsteplist.h"
#include "compileoutputwindow.h"
#include "projectexplorer.h"
#include "project.h"
#include "projectexplorer.h"
#include "projectexplorersettings.h"
#include "target.h"
#include "taskwindow.h"
......@@ -126,8 +126,7 @@ BuildManager::BuildManager(ProjectExplorerPlugin *parent, QAction *cancelBuildAc
d->m_outputWindow = new Internal::CompileOutputWindow(this, cancelBuildAction);
ExtensionSystem::PluginManager::addObject(d->m_outputWindow);
d->m_taskHub = ProjectExplorerPlugin::taskHub();
d->m_taskWindow = new Internal::TaskWindow(d->m_taskHub);
d->m_taskWindow = new Internal::TaskWindow;
ExtensionSystem::PluginManager::addObject(d->m_taskWindow);
qRegisterMetaType<ProjectExplorer::BuildStep::OutputFormat>();
......@@ -147,10 +146,10 @@ BuildManager::BuildManager(ProjectExplorerPlugin *parent, QAction *cancelBuildAc
void BuildManager::extensionsInitialized()
{
d->m_taskHub->addCategory(Core::Id(Constants::TASK_CATEGORY_COMPILE),
tr("Compile", "Category for compiler issues listed under 'Issues'"));
d->m_taskHub->addCategory(Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM),
tr("Build System", "Category for build system issues listed under 'Issues'"));
TaskHub::addCategory(Core::Id(Constants::TASK_CATEGORY_COMPILE),
tr("Compile", "Category for compiler issues listed under 'Issues'"));
TaskHub::addCategory(Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM),
tr("Build System", "Category for build system issues listed under 'Issues'"));
}
BuildManager::~BuildManager()
......@@ -294,8 +293,8 @@ void BuildManager::startBuildQueue(const QStringList &preambleMessage)
d->m_outputWindow->clearContents();
foreach (const QString &str, preambleMessage)
addToOutputWindow(str, BuildStep::MessageOutput, BuildStep::DontAppendNewline);
d->m_taskHub->clearTasks(Core::Id(Constants::TASK_CATEGORY_COMPILE));
d->m_taskHub->clearTasks(Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM));
TaskHub::clearTasks(Core::Id(Constants::TASK_CATEGORY_COMPILE));
TaskHub::clearTasks(Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM));
progressManager->setApplicationLabel(QString());
d->m_futureProgress = progressManager->addTask(d->m_progressFutureInterface->future(),
QString(),
......@@ -331,7 +330,7 @@ void BuildManager::addToTaskWindow(const ProjectExplorer::Task &task)
{
d->m_outputWindow->registerPositionOf(task);
// Distribute to all others
d->m_taskHub->addTask(task);
TaskHub::addTask(task);
}
void BuildManager::addToOutputWindow(const QString &string, BuildStep::OutputFormat format,
......
......@@ -345,8 +345,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
addAutoReleasedObject(new Internal::ToolChainOptionsPage);
addAutoReleasedObject(new KitOptionsPage);
d->m_taskHub = new TaskHub;
addAutoReleasedObject(d->m_taskHub);
addAutoReleasedObject(new TaskHub);
connect(Core::ICore::instance(), SIGNAL(newItemsDialogRequested()), this, SLOT(loadCustomWizards()));
......@@ -1656,11 +1655,6 @@ BuildManager *ProjectExplorerPlugin::buildManager() const
return d->m_buildManager;
}
TaskHub *ProjectExplorerPlugin::taskHub()
{
return m_instance->d->m_taskHub;
}
void ProjectExplorerPlugin::buildStateChanged(Project * pro)
{
if (debug) {
......
......@@ -92,7 +92,6 @@ public:
Project *startupProject() const;
BuildManager *buildManager() const;
static TaskHub *taskHub();
bool saveModifiedFiles();
......
......@@ -29,7 +29,6 @@
#include "removetaskhandler.h"
#include "projectexplorer.h"
#include "task.h"
#include "taskhub.h"
......@@ -39,7 +38,7 @@ using namespace ProjectExplorer::Internal;
void RemoveTaskHandler::handle(const ProjectExplorer::Task &task)
{
ProjectExplorerPlugin::taskHub()->removeTask(task);
TaskHub::removeTask(task);
}
QAction *RemoveTaskHandler::createAction(QObject *parent) const
......
......@@ -28,11 +28,13 @@
****************************************************************************/
#include "taskhub.h"
#include "projectexplorer.h"
#include <coreplugin/ioutputpane.h>
using namespace ProjectExplorer;
TaskHub *TaskHub::m_instance = 0;
class TaskMark : public TextEditor::BaseTextMark
{
public:
......@@ -54,19 +56,19 @@ private:
void TaskMark::updateLineNumber(int lineNumber)
{
ProjectExplorerPlugin::taskHub()->updateTaskLineNumber(m_id, lineNumber);
TaskHub::updateTaskLineNumber(m_id, lineNumber);
BaseTextMark::updateLineNumber(lineNumber);
}
void TaskMark::updateFileName(const QString &fileName)
{
ProjectExplorerPlugin::taskHub()->updateTaskFileName(m_id, fileName);
TaskHub::updateTaskFileName(m_id, fileName);
BaseTextMark::updateFileName(fileName);
}
void TaskMark::removedFromEditor()
{
ProjectExplorerPlugin::taskHub()->updateTaskLineNumber(m_id, -1);
TaskHub::updateTaskLineNumber(m_id, -1);
}
bool TaskMark::isClickable() const
......@@ -76,25 +78,26 @@ bool TaskMark::isClickable() const
void TaskMark::clicked()
{
ProjectExplorerPlugin::taskHub()->taskMarkClicked(m_id);
TaskHub::taskMarkClicked(m_id);
}
TaskHub::TaskHub()
: m_errorIcon(QLatin1String(":/projectexplorer/images/compile_error.png")),
m_warningIcon(QLatin1String(":/projectexplorer/images/compile_warning.png"))
{
m_instance = this;
qRegisterMetaType<ProjectExplorer::Task>("ProjectExplorer::Task");
qRegisterMetaType<QList<ProjectExplorer::Task> >("QList<ProjectExplorer::Task>");
}
TaskHub::~TaskHub()
{
m_instance = 0;
}
void TaskHub::addCategory(Core::Id categoryId, const QString &displayName, bool visible)
{
emit categoryAdded(categoryId, displayName, visible);
emit m_instance->categoryAdded(categoryId, displayName, visible);
}
void TaskHub::addTask(Task task)
......@@ -105,60 +108,60 @@ void TaskHub::addTask(Task task)
mark->setIcon(taskTypeIcon(task.type));
mark->setPriority(TextEditor::ITextMark::LowPriority);
task.addMark(mark);
emit taskAdded(task);
emit m_instance->taskAdded(task);
mark->init();
} else {
emit taskAdded(task);
emit m_instance->taskAdded(task);
}
}
void TaskHub::clearTasks(Core::Id categoryId)
{
emit tasksCleared(categoryId);
emit m_instance->tasksCleared(categoryId);
}
void TaskHub::removeTask(const Task &task)
{
emit taskRemoved(task);
emit m_instance->taskRemoved(task);
}
void TaskHub::updateTaskFileName(unsigned int id, const QString &fileName)
{
emit taskFileNameUpdated(id, fileName);
emit m_instance->taskFileNameUpdated(id, fileName);
}
void TaskHub::updateTaskLineNumber(unsigned int id, int line)
{
emit taskLineNumberUpdated(id, line);
emit m_instance->taskLineNumberUpdated(id, line);
}
void TaskHub::taskMarkClicked(unsigned int id)
{
emit showTask(id);
emit m_instance->showTask(id);
}
void TaskHub::showTaskInEditor(unsigned int id)
{
emit openTask(id);
emit m_instance->openTask(id);
}
void TaskHub::setCategoryVisibility(const Core::Id &categoryId, bool visible)
{
emit categoryVisibilityChanged(categoryId, visible);
emit m_instance->categoryVisibilityChanged(categoryId, visible);
}
void TaskHub::requestPopup()
{
emit popupRequested(Core::IOutputPane::NoModeSwitch);
emit m_instance->popupRequested(Core::IOutputPane::NoModeSwitch);
}
QIcon TaskHub::taskTypeIcon(Task::TaskType t) const
QIcon TaskHub::taskTypeIcon(Task::TaskType t)
{
switch (t) {
case Task::Warning:
return m_warningIcon;
return m_instance->m_warningIcon;
case Task::Error:
return m_errorIcon;
return m_instance->m_errorIcon;
case Task::Unknown:
break;
}
......
......@@ -36,31 +36,32 @@
#include <QIcon>
namespace ProjectExplorer {
class ProjectExplorerPlugin;
class Task;
class PROJECTEXPLORER_EXPORT TaskHub : public QObject
{
Q_OBJECT
public:
TaskHub();
virtual ~TaskHub();
static TaskHub *instance();
public slots:
void addCategory(Core::Id categoryId, const QString &displayName, bool visible = true);
void addTask(ProjectExplorer::Task task);
void clearTasks(Core::Id categoryId = Core::Id());
void removeTask(const ProjectExplorer::Task &task);
static void addCategory(Core::Id categoryId, const QString &displayName, bool visible = true);
static void addTask(ProjectExplorer::Task task);
static void clearTasks(Core::Id categoryId = Core::Id());
static void removeTask(const ProjectExplorer::Task &task);
public:
void updateTaskFileName(unsigned int id, const QString &fileName);
void updateTaskLineNumber(unsigned int id, int line);
void taskMarkClicked(unsigned int id);
void showTaskInEditor(unsigned int id);
void setCategoryVisibility(const Core::Id &categoryId, bool visible);
static void updateTaskFileName(unsigned int id, const QString &fileName);
static void updateTaskLineNumber(unsigned int id, int line);
static void taskMarkClicked(unsigned int id);
static void showTaskInEditor(unsigned int id);
static void setCategoryVisibility(const Core::Id &categoryId, bool visible);
void requestPopup();
static void requestPopup();
QIcon taskTypeIcon(ProjectExplorer::Task::TaskType t) const;
static QIcon taskTypeIcon(ProjectExplorer::Task::TaskType t);
signals:
void categoryAdded(Core::Id categoryId, const QString &displayName, bool visible);
......@@ -73,9 +74,18 @@ signals:
void popupRequested(int);
void showTask(unsigned int id);
void openTask(unsigned int id);
private:
TaskHub();
~TaskHub();
const QIcon m_errorIcon;
const QIcon m_warningIcon;
static TaskHub *m_instance;
friend class ProjectExplorerPlugin;
};
} // namespace ProjectExplorer
#endif // TASKHUB_H
......@@ -198,7 +198,6 @@ public:
QToolButton *m_filterWarningsButton;
QToolButton *m_categoriesButton;
QMenu *m_categoriesMenu;
TaskHub *m_taskHub;
int m_badgeCount;
QList<QAction *> m_actions;
};
......@@ -217,7 +216,7 @@ static QToolButton *createFilterButton(QIcon icon, const QString &toolTip,
return button;
}
TaskWindow::TaskWindow(TaskHub *taskhub) : d(new TaskWindowPrivate)
TaskWindow::TaskWindow() : d(new TaskWindowPrivate)
{
d->m_defaultHandler = 0;
......@@ -236,7 +235,6 @@ TaskWindow::TaskWindow(TaskHub *taskhub) : d(new TaskWindowPrivate)
d->m_listview->setAttribute(Qt::WA_MacShowFocusRect, false);
d->m_taskWindowContext = new Internal::TaskWindowContext(d->m_listview);
d->m_taskHub = taskhub;
d->m_badgeCount = 0;
Core::ICore::addContextObject(d->m_taskWindowContext);
......@@ -270,25 +268,26 @@ TaskWindow::TaskWindow(TaskHub *taskhub) : d(new TaskWindowPrivate)
d->m_categoriesButton->setMenu(d->m_categoriesMenu);
connect(d->m_taskHub, SIGNAL(categoryAdded(Core::Id,QString,bool)),
TaskHub *hub = TaskHub::instance();
connect(hub, SIGNAL(categoryAdded(Core::Id,QString,bool)),
this, SLOT(addCategory(Core::Id,QString,bool)));
connect(d->m_taskHub, SIGNAL(taskAdded(ProjectExplorer::Task)),
connect(hub, SIGNAL(taskAdded(ProjectExplorer::Task)),
this, SLOT(addTask(ProjectExplorer::Task)));
connect(d->m_taskHub, SIGNAL(taskRemoved(ProjectExplorer::Task)),
connect(hub, SIGNAL(taskRemoved(ProjectExplorer::Task)),
this, SLOT(removeTask(ProjectExplorer::Task)));
connect(d->m_taskHub, SIGNAL(taskLineNumberUpdated(uint,int)),
connect(hub, SIGNAL(taskLineNumberUpdated(uint,int)),
this, SLOT(updatedTaskLineNumber(uint,int)));
connect(d->m_taskHub, SIGNAL(taskFileNameUpdated(uint,QString)),
connect(hub, SIGNAL(taskFileNameUpdated(uint,QString)),
this, SLOT(updatedTaskFileName(uint,QString)));
connect(d->m_taskHub, SIGNAL(tasksCleared(Core::Id)),
connect(hub, SIGNAL(tasksCleared(Core::Id)),
this, SLOT(clearTasks(Core::Id)));
connect(d->m_taskHub, SIGNAL(categoryVisibilityChanged(Core::Id,bool)),
connect(hub, SIGNAL(categoryVisibilityChanged(Core::Id,bool)),
this, SLOT(setCategoryVisibility(Core::Id,bool)));
connect(d->m_taskHub, SIGNAL(popupRequested(int)),
connect(hub, SIGNAL(popupRequested(int)),
this, SLOT(popup(int)));
connect(d->m_taskHub, SIGNAL(showTask(uint)),
connect(hub, SIGNAL(showTask(uint)),
this, SLOT(showTask(uint)));
connect(d->m_taskHub, SIGNAL(openTask(uint)),
connect(hub, SIGNAL(openTask(uint)),
this, SLOT(openTask(uint)));
}
......@@ -595,7 +594,7 @@ void TaskWindow::clearContents()
{
// clear all tasks in all displays
// Yeah we are that special
d->m_taskHub->clearTasks();
TaskHub::clearTasks();
}
bool TaskWindow::hasFocus() const
......
......@@ -52,7 +52,7 @@ class TaskWindow : public Core::IOutputPane
Q_OBJECT
public:
TaskWindow(ProjectExplorer::TaskHub *taskHub);
TaskWindow();
virtual ~TaskWindow();
void delayedInitialization();
......
......@@ -49,9 +49,9 @@ namespace Internal {
QbsLogSink::QbsLogSink(QObject *parent) : QObject(parent)
{
ProjectExplorer::TaskHub *hub = ProjectExplorer::ProjectExplorerPlugin::taskHub();
connect(this, SIGNAL(newTask(ProjectExplorer::Task)),
hub, SLOT(addTask(ProjectExplorer::Task)), Qt::QueuedConnection);
ProjectExplorer::TaskHub::instance(),
SLOT(addTask(ProjectExplorer::Task)), Qt::QueuedConnection);
}
void QbsLogSink::sendMessages()
......
......@@ -80,16 +80,6 @@ static const char CONFIG_PRECOMPILEDHEADER[] = "precompiledHeader";
static const char CONFIGURATION_PATH[] = "<configuration>";
// --------------------------------------------------------------------
// HELPERS:
// --------------------------------------------------------------------
ProjectExplorer::TaskHub *taskHub()
{
return ProjectExplorer::ProjectExplorerPlugin::taskHub();
}
namespace QbsProjectManager {
namespace Internal {
......@@ -382,11 +372,12 @@ bool QbsProject::fromMap(const QVariantMap &map)
void QbsProject::generateErrors(const qbs::ErrorInfo &e)
{
foreach (const qbs::ErrorItem &item, e.items())
taskHub()->addTask(ProjectExplorer::Task(ProjectExplorer::Task::Error,
item.description(),
Utils::FileName::fromString(item.codeLocation().fileName()),
item.codeLocation().line(),
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
ProjectExplorer::TaskHub::addTask(
ProjectExplorer::Task(ProjectExplorer::Task::Error,
item.description(),
Utils::FileName::fromString(item.codeLocation().fileName()),
item.codeLocation().line(),
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
}
void QbsProject::parse(const QVariantMap &config, const Utils::Environment &env, const QString &dir)
......@@ -394,7 +385,7 @@ void QbsProject::parse(const QVariantMap &config, const Utils::Environment &env,
QTC_ASSERT(!dir.isNull(), return);
// Clear buildsystem related tasks:
taskHub()->clearTasks(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);
ProjectExplorer::TaskHub::clearTasks(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);
qbs::SetupProjectParameters params;
params.setBuildConfiguration(config);
......@@ -452,7 +443,7 @@ void QbsProject::prepareForParsing()
{
m_forceParsing = false;
taskHub()->clearTasks(ProjectExplorer::Constants::TASK_CATEGORY_COMPILE);
ProjectExplorer::TaskHub::clearTasks(ProjectExplorer::Constants::TASK_CATEGORY_COMPILE);
if (m_qbsUpdateFutureInterface)
m_qbsUpdateFutureInterface->reportCanceled();
delete m_qbsUpdateFutureInterface;
......
......@@ -60,7 +60,6 @@
#include <coreplugin/actionmanager/command.h>
#include <coreplugin/editormanager/editormanager.h>
#include <projectexplorer/taskhub.h>
#include <projectexplorer/projectexplorer.h>
#include <texteditor/texteditorconstants.h>
#include <texteditor/texteditorsettings.h>
#include <texteditor/textfilewizard.h>
......@@ -248,9 +247,8 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e
void QmlJSEditorPlugin::extensionsInitialized()
{
TaskHub *taskHub = ProjectExplorerPlugin::taskHub();
taskHub->addCategory(Constants::TASK_CATEGORY_QML, tr("QML"));
taskHub->addCategory(Constants::TASK_CATEGORY_QML_ANALYSIS, tr("QML Analysis"), false);
TaskHub::addCategory(Constants::TASK_CATEGORY_QML, tr("QML"));
TaskHub::addCategory(Constants::TASK_CATEGORY_QML_ANALYSIS, tr("QML Analysis"), false);
}
ExtensionSystem::IPlugin::ShutdownFlag QmlJSEditorPlugin::aboutToShutdown()
......@@ -348,9 +346,8 @@ void QmlJSEditorPlugin::currentEditorChanged(Core::IEditor *editor)
void QmlJSEditorPlugin::runSemanticScan()
{
m_qmlTaskManager->updateSemanticMessagesNow();
TaskHub *hub = ProjectExplorerPlugin::taskHub();
hub->setCategoryVisibility(Constants::TASK_CATEGORY_QML_ANALYSIS, true);
hub->requestPopup();
TaskHub::setCategoryVisibility(Constants::TASK_CATEGORY_QML_ANALYSIS, true);
TaskHub::requestPopup();
}
void QmlJSEditorPlugin::checkCurrentEditorSemanticInfoUpToDate()
......
......@@ -51,11 +51,8 @@ namespace Internal {
QmlTaskManager::QmlTaskManager(QObject *parent) :
QObject(parent),
m_taskHub(0),
m_updatingSemantic(false)
{
m_taskHub = ProjectExplorer::ProjectExplorerPlugin::taskHub();
// displaying results incrementally leads to flickering
// connect(&m_messageCollector, SIGNAL(resultsReadyAt(int,int)),
// SLOT(displayResults(int,int)));
......@@ -195,7 +192,7 @@ void QmlTaskManager::insertTask(const ProjectExplorer::Task &task)
QList<ProjectExplorer::Task> tasks = m_docsWithTasks.value(task.file.toString());
tasks.append(task);
m_docsWithTasks.insert(task.file.toString(), tasks);
m_taskHub->addTask(task);
ProjectExplorer::TaskHub::addTask(task);
}
void QmlTaskManager::removeTasksForFile(const QString &fileName)
......@@ -203,16 +200,16 @@ void QmlTaskManager::removeTasksForFile(const QString &fileName)
if (m_docsWithTasks.contains(fileName)) {
const QList<ProjectExplorer::Task> tasks = m_docsWithTasks.value(fileName);
foreach (const ProjectExplorer::Task &task, tasks)
m_taskHub->removeTask(task);
ProjectExplorer::TaskHub::removeTask(task);
m_docsWithTasks.remove(fileName);
}
}
void QmlTaskManager::removeAllTasks(bool clearSemantic)
{
m_taskHub->clearTasks(Constants::TASK_CATEGORY_QML);
ProjectExplorer::TaskHub::clearTasks(Constants::TASK_CATEGORY_QML);
if (clearSemantic)
m_taskHub->clearTasks(Constants::TASK_CATEGORY_QML_ANALYSIS);
ProjectExplorer::TaskHub::clearTasks(Constants::TASK_CATEGORY_QML_ANALYSIS);
m_docsWithTasks.clear();
}
......
......@@ -89,7 +89,6 @@ private:
bool updateSemantic);
private:
ProjectExplorer::TaskHub *m_taskHub;
QHash<QString, QList<ProjectExplorer::Task> > m_docsWithTasks;
QFutureWatcher<FileErrorMessages> m_messageCollector;
QTimer m_updateDelay;
......
......@@ -35,7 +35,6 @@
#include "bardescriptoreditorwidget.h"
#include "bardescriptordocument.h"
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/task.h>
#include <projectexplorer/taskhub.h>
......@@ -118,7 +117,6 @@ void BarDescriptorEditor::changeEditorPage(QAction *action)
void BarDescriptorEditor::setActivePage(BarDescriptorEditor::EditorPage page)
{
ProjectExplorer::TaskHub *taskHub = ProjectExplorer::ProjectExplorerPlugin::taskHub();
BarDescriptorEditorWidget *editorWidget = qobject_cast<BarDescriptorEditorWidget *>(widget());
QTC_ASSERT(editorWidget, return);
......@@ -130,14 +128,14 @@ void BarDescriptorEditor::setActivePage(BarDescriptorEditor::EditorPage page)
if (page == Source) {
editorWidget->setXmlSource(m_file->xmlSource());
} else if (prevPage == Source) {
taskHub->clearTasks(Constants::QNX_TASK_CATEGORY_BARDESCRIPTOR);
ProjectExplorer::TaskHub::clearTasks(Constants::QNX_TASK_CATEGORY_BARDESCRIPTOR);
QString errorMsg;
int errorLine;
if (!m_file->loadContent(editorWidget->xmlSource(), &errorMsg, &errorLine)) {
const ProjectExplorer::Task task(ProjectExplorer::Task::Error, errorMsg, Utils::FileName::fromString(m_file->filePath()),
errorLine, Constants::QNX_TASK_CATEGORY_BARDESCRIPTOR);