Commit d0eb1058 authored by hjk's avatar hjk
Browse files

TaskHub: De-noise user code



Change-Id: Ieb559e884fb08c96d739cf7684389ff740a6233e
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent f5afaac0
...@@ -66,8 +66,8 @@ bool AnalyzerPlugin::initialize(const QStringList &arguments, QString *errorStri ...@@ -66,8 +66,8 @@ bool AnalyzerPlugin::initialize(const QStringList &arguments, QString *errorStri
// Task integration. // Task integration.
//: Category under which Analyzer tasks are listed in Issues view //: Category under which Analyzer tasks are listed in Issues view
ProjectExplorer::ProjectExplorerPlugin::instance()->taskHub() ProjectExplorer::ProjectExplorerPlugin::taskHub()
->addCategory(Core::Id(Constants::ANALYZERTASK_ID), tr("Analyzer")); ->addCategory(Constants::ANALYZERTASK_ID, tr("Analyzer"));
return true; return true;
} }
......
...@@ -1861,12 +1861,12 @@ void DebuggerEngine::checkForReleaseBuild(const DebuggerStartParameters &sp) ...@@ -1861,12 +1861,12 @@ void DebuggerEngine::checkForReleaseBuild(const DebuggerStartParameters &sp)
TaskHub *DebuggerEnginePrivate::taskHub() TaskHub *DebuggerEnginePrivate::taskHub()
{ {
if (!m_taskHub) { if (!m_taskHub) {
m_taskHub = ProjectExplorerPlugin::instance()->taskHub(); m_taskHub = ProjectExplorerPlugin::taskHub();
m_taskHub->addCategory(Core::Id(Debugger::Constants::TASK_CATEGORY_DEBUGGER_DEBUGINFO), m_taskHub->addCategory(Debugger::Constants::TASK_CATEGORY_DEBUGGER_DEBUGINFO,
tr("Debug Information")); tr("Debug Information"));
m_taskHub->addCategory(Core::Id(Debugger::Constants::TASK_CATEGORY_DEBUGGER_TEST), m_taskHub->addCategory(Debugger::Constants::TASK_CATEGORY_DEBUGGER_TEST,
tr("Debugger Test")); tr("Debugger Test"));
m_taskHub->addCategory(Core::Id(Debugger::Constants::TASK_CATEGORY_DEBUGGER_RUNTIME), m_taskHub->addCategory(Debugger::Constants::TASK_CATEGORY_DEBUGGER_RUNTIME,
tr("Debugger Runtime")); tr("Debugger Runtime"));
} }
return m_taskHub; return m_taskHub;
......
...@@ -458,7 +458,7 @@ static bool fixupEngineTypes(DebuggerStartParameters &sp, RunConfiguration *rc, ...@@ -458,7 +458,7 @@ static bool fixupEngineTypes(DebuggerStartParameters &sp, RunConfiguration *rc,
DebuggerRunControl *DebuggerRunControlFactory::doCreate DebuggerRunControl *DebuggerRunControlFactory::doCreate
(const DebuggerStartParameters &sp0, RunConfiguration *rc, QString *errorMessage) (const DebuggerStartParameters &sp0, RunConfiguration *rc, QString *errorMessage)
{ {
TaskHub *th = ProjectExplorerPlugin::instance()->taskHub(); TaskHub *th = ProjectExplorerPlugin::taskHub();
th->clearTasks(Debugger::Constants::TASK_CATEGORY_DEBUGGER_DEBUGINFO); th->clearTasks(Debugger::Constants::TASK_CATEGORY_DEBUGGER_DEBUGINFO);
th->clearTasks(Debugger::Constants::TASK_CATEGORY_DEBUGGER_TEST); th->clearTasks(Debugger::Constants::TASK_CATEGORY_DEBUGGER_TEST);
th->clearTasks(Debugger::Constants::TASK_CATEGORY_DEBUGGER_RUNTIME); th->clearTasks(Debugger::Constants::TASK_CATEGORY_DEBUGGER_RUNTIME);
......
...@@ -126,7 +126,7 @@ BuildManager::BuildManager(ProjectExplorerPlugin *parent, QAction *cancelBuildAc ...@@ -126,7 +126,7 @@ BuildManager::BuildManager(ProjectExplorerPlugin *parent, QAction *cancelBuildAc
d->m_outputWindow = new Internal::CompileOutputWindow(this, cancelBuildAction); d->m_outputWindow = new Internal::CompileOutputWindow(this, cancelBuildAction);
ExtensionSystem::PluginManager::addObject(d->m_outputWindow); ExtensionSystem::PluginManager::addObject(d->m_outputWindow);
d->m_taskHub = ProjectExplorerPlugin::instance()->taskHub(); d->m_taskHub = ProjectExplorerPlugin::taskHub();
d->m_taskWindow = new Internal::TaskWindow(d->m_taskHub); d->m_taskWindow = new Internal::TaskWindow(d->m_taskHub);
ExtensionSystem::PluginManager::addObject(d->m_taskWindow); ExtensionSystem::PluginManager::addObject(d->m_taskWindow);
......
...@@ -1656,9 +1656,9 @@ BuildManager *ProjectExplorerPlugin::buildManager() const ...@@ -1656,9 +1656,9 @@ BuildManager *ProjectExplorerPlugin::buildManager() const
return d->m_buildManager; return d->m_buildManager;
} }
TaskHub *ProjectExplorerPlugin::taskHub() const TaskHub *ProjectExplorerPlugin::taskHub()
{ {
return d->m_taskHub; return m_instance->d->m_taskHub;
} }
void ProjectExplorerPlugin::buildStateChanged(Project * pro) void ProjectExplorerPlugin::buildStateChanged(Project * pro)
......
...@@ -92,7 +92,7 @@ public: ...@@ -92,7 +92,7 @@ public:
Project *startupProject() const; Project *startupProject() const;
BuildManager *buildManager() const; BuildManager *buildManager() const;
TaskHub *taskHub() const; static TaskHub *taskHub();
bool saveModifiedFiles(); bool saveModifiedFiles();
......
...@@ -39,7 +39,7 @@ using namespace ProjectExplorer::Internal; ...@@ -39,7 +39,7 @@ using namespace ProjectExplorer::Internal;
void RemoveTaskHandler::handle(const ProjectExplorer::Task &task) void RemoveTaskHandler::handle(const ProjectExplorer::Task &task)
{ {
ProjectExplorerPlugin::instance()->taskHub()->removeTask(task); ProjectExplorerPlugin::taskHub()->removeTask(task);
} }
QAction *RemoveTaskHandler::createAction(QObject *parent) const QAction *RemoveTaskHandler::createAction(QObject *parent) const
......
...@@ -44,7 +44,7 @@ Task::Task() : taskId(0), type(Unknown), line(-1) ...@@ -44,7 +44,7 @@ Task::Task() : taskId(0), type(Unknown), line(-1)
{ } { }
Task::Task(TaskType type_, const QString &description_, Task::Task(TaskType type_, const QString &description_,
const Utils::FileName &file_, int line_, const Core::Id &category_) : const Utils::FileName &file_, int line_, Core::Id category_) :
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_)
{ {
...@@ -57,7 +57,9 @@ void Task::addMark(TextEditor::BaseTextMark *mark) ...@@ -57,7 +57,9 @@ void Task::addMark(TextEditor::BaseTextMark *mark)
} }
bool Task::isNull() const bool Task::isNull() const
{ return taskId == 0; } {
return taskId == 0;
}
void Task::clear() void Task::clear()
{ {
......
...@@ -53,8 +53,8 @@ public: ...@@ -53,8 +53,8 @@ public:
}; };
Task(); Task();
Task(TaskType type_, const QString &description_, Task(TaskType type, const QString &description,
const Utils::FileName &file_, int line_, const Core::Id &category_); const Utils::FileName &file, int line, Core::Id category);
bool isNull() const; bool isNull() const;
void clear(); void clear();
......
...@@ -54,19 +54,19 @@ private: ...@@ -54,19 +54,19 @@ private:
void TaskMark::updateLineNumber(int lineNumber) void TaskMark::updateLineNumber(int lineNumber)
{ {
ProjectExplorerPlugin::instance()->taskHub()->updateTaskLineNumber(m_id, lineNumber); ProjectExplorerPlugin::taskHub()->updateTaskLineNumber(m_id, lineNumber);
BaseTextMark::updateLineNumber(lineNumber); BaseTextMark::updateLineNumber(lineNumber);
} }
void TaskMark::updateFileName(const QString &fileName) void TaskMark::updateFileName(const QString &fileName)
{ {
ProjectExplorerPlugin::instance()->taskHub()->updateTaskFileName(m_id, fileName); ProjectExplorerPlugin::taskHub()->updateTaskFileName(m_id, fileName);
BaseTextMark::updateFileName(fileName); BaseTextMark::updateFileName(fileName);
} }
void TaskMark::removedFromEditor() void TaskMark::removedFromEditor()
{ {
ProjectExplorerPlugin::instance()->taskHub()->updateTaskLineNumber(m_id, -1); ProjectExplorerPlugin::taskHub()->updateTaskLineNumber(m_id, -1);
} }
bool TaskMark::isClickable() const bool TaskMark::isClickable() const
...@@ -76,7 +76,7 @@ bool TaskMark::isClickable() const ...@@ -76,7 +76,7 @@ bool TaskMark::isClickable() const
void TaskMark::clicked() void TaskMark::clicked()
{ {
ProjectExplorerPlugin::instance()->taskHub()->taskMarkClicked(m_id); ProjectExplorerPlugin::taskHub()->taskMarkClicked(m_id);
} }
TaskHub::TaskHub() TaskHub::TaskHub()
...@@ -92,7 +92,7 @@ TaskHub::~TaskHub() ...@@ -92,7 +92,7 @@ TaskHub::~TaskHub()
} }
void TaskHub::addCategory(const Core::Id &categoryId, const QString &displayName, bool visible) void TaskHub::addCategory(Core::Id categoryId, const QString &displayName, bool visible)
{ {
emit categoryAdded(categoryId, displayName, visible); emit categoryAdded(categoryId, displayName, visible);
} }
...@@ -112,7 +112,7 @@ void TaskHub::addTask(Task task) ...@@ -112,7 +112,7 @@ void TaskHub::addTask(Task task)
} }
} }
void TaskHub::clearTasks(const Core::Id &categoryId) void TaskHub::clearTasks(Core::Id categoryId)
{ {
emit tasksCleared(categoryId); emit tasksCleared(categoryId);
} }
......
...@@ -46,9 +46,9 @@ public: ...@@ -46,9 +46,9 @@ public:
virtual ~TaskHub(); virtual ~TaskHub();
public slots: public slots:
void addCategory(const Core::Id &categoryId, const QString &displayName, bool visible = true); void addCategory(Core::Id categoryId, const QString &displayName, bool visible = true);
void addTask(ProjectExplorer::Task task); void addTask(ProjectExplorer::Task task);
void clearTasks(const Core::Id &categoryId = Core::Id()); void clearTasks(Core::Id categoryId = Core::Id());
void removeTask(const ProjectExplorer::Task &task); void removeTask(const ProjectExplorer::Task &task);
public: public:
...@@ -63,10 +63,10 @@ public: ...@@ -63,10 +63,10 @@ public:
QIcon taskTypeIcon(ProjectExplorer::Task::TaskType t) const; QIcon taskTypeIcon(ProjectExplorer::Task::TaskType t) const;
signals: signals:
void categoryAdded(const Core::Id &categoryId, const QString &displayName, bool visible); void categoryAdded(Core::Id categoryId, const QString &displayName, bool visible);
void taskAdded(const ProjectExplorer::Task &task); void taskAdded(const ProjectExplorer::Task &task);
void taskRemoved(const ProjectExplorer::Task &task); void taskRemoved(const ProjectExplorer::Task &task);
void tasksCleared(const Core::Id &categoryId); void tasksCleared(Core::Id categoryId);
void taskFileNameUpdated(unsigned int id, const QString &fileName); void taskFileNameUpdated(unsigned int id, const QString &fileName);
void taskLineNumberUpdated(unsigned int id, int line); void taskLineNumberUpdated(unsigned int id, int line);
void categoryVisibilityChanged(const Core::Id &categoryId, bool visible); void categoryVisibilityChanged(const Core::Id &categoryId, bool visible);
......
...@@ -49,7 +49,7 @@ namespace Internal { ...@@ -49,7 +49,7 @@ namespace Internal {
QbsLogSink::QbsLogSink(QObject *parent) : QObject(parent) QbsLogSink::QbsLogSink(QObject *parent) : QObject(parent)
{ {
ProjectExplorer::TaskHub *hub = ProjectExplorer::ProjectExplorerPlugin::instance()->taskHub(); ProjectExplorer::TaskHub *hub = ProjectExplorer::ProjectExplorerPlugin::taskHub();
connect(this, SIGNAL(newTask(ProjectExplorer::Task)), connect(this, SIGNAL(newTask(ProjectExplorer::Task)),
hub, SLOT(addTask(ProjectExplorer::Task)), Qt::QueuedConnection); hub, SLOT(addTask(ProjectExplorer::Task)), Qt::QueuedConnection);
} }
......
...@@ -85,7 +85,7 @@ static const char CONFIGURATION_PATH[] = "<configuration>"; ...@@ -85,7 +85,7 @@ static const char CONFIGURATION_PATH[] = "<configuration>";
ProjectExplorer::TaskHub *taskHub() ProjectExplorer::TaskHub *taskHub()
{ {
return ProjectExplorer::ProjectExplorerPlugin::instance()->taskHub(); return ProjectExplorer::ProjectExplorerPlugin::taskHub();
} }
...@@ -393,8 +393,7 @@ void QbsProject::parse(const QVariantMap &config, const Utils::Environment &env, ...@@ -393,8 +393,7 @@ void QbsProject::parse(const QVariantMap &config, const Utils::Environment &env,
QTC_ASSERT(!dir.isNull(), return); QTC_ASSERT(!dir.isNull(), return);
// Clear buildsystem related tasks: // Clear buildsystem related tasks:
ProjectExplorer::ProjectExplorerPlugin::instance()->taskHub() taskHub()->clearTasks(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);
->clearTasks(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);
qbs::SetupProjectParameters params; qbs::SetupProjectParameters params;
params.setBuildConfiguration(config); params.setBuildConfiguration(config);
......
...@@ -248,7 +248,7 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e ...@@ -248,7 +248,7 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e
void QmlJSEditorPlugin::extensionsInitialized() void QmlJSEditorPlugin::extensionsInitialized()
{ {
TaskHub *taskHub = ProjectExplorerPlugin::instance()->taskHub(); TaskHub *taskHub = ProjectExplorerPlugin::taskHub();
taskHub->addCategory(Constants::TASK_CATEGORY_QML, tr("QML")); 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_ANALYSIS, tr("QML Analysis"), false);
} }
...@@ -348,7 +348,7 @@ void QmlJSEditorPlugin::currentEditorChanged(Core::IEditor *editor) ...@@ -348,7 +348,7 @@ void QmlJSEditorPlugin::currentEditorChanged(Core::IEditor *editor)
void QmlJSEditorPlugin::runSemanticScan() void QmlJSEditorPlugin::runSemanticScan()
{ {
m_qmlTaskManager->updateSemanticMessagesNow(); m_qmlTaskManager->updateSemanticMessagesNow();
TaskHub *hub = ProjectExplorerPlugin::instance()->taskHub(); TaskHub *hub = ProjectExplorerPlugin::taskHub();
hub->setCategoryVisibility(Constants::TASK_CATEGORY_QML_ANALYSIS, true); hub->setCategoryVisibility(Constants::TASK_CATEGORY_QML_ANALYSIS, true);
hub->requestPopup(); hub->requestPopup();
} }
......
...@@ -54,7 +54,7 @@ QmlTaskManager::QmlTaskManager(QObject *parent) : ...@@ -54,7 +54,7 @@ QmlTaskManager::QmlTaskManager(QObject *parent) :
m_taskHub(0), m_taskHub(0),
m_updatingSemantic(false) m_updatingSemantic(false)
{ {
m_taskHub = ProjectExplorer::ProjectExplorerPlugin::instance()->taskHub(); m_taskHub = ProjectExplorer::ProjectExplorerPlugin::taskHub();
// displaying results incrementally leads to flickering // displaying results incrementally leads to flickering
// connect(&m_messageCollector, SIGNAL(resultsReadyAt(int,int)), // connect(&m_messageCollector, SIGNAL(resultsReadyAt(int,int)),
......
...@@ -116,13 +116,9 @@ void BarDescriptorEditor::changeEditorPage(QAction *action) ...@@ -116,13 +116,9 @@ void BarDescriptorEditor::changeEditorPage(QAction *action)
setActivePage(static_cast<EditorPage>(action->data().toInt())); setActivePage(static_cast<EditorPage>(action->data().toInt()));
} }
ProjectExplorer::TaskHub *BarDescriptorEditor::taskHub()
{
return ProjectExplorer::ProjectExplorerPlugin::instance()->taskHub();
}
void BarDescriptorEditor::setActivePage(BarDescriptorEditor::EditorPage page) void BarDescriptorEditor::setActivePage(BarDescriptorEditor::EditorPage page)
{ {
ProjectExplorer::TaskHub *taskHub = ProjectExplorer::ProjectExplorerPlugin::taskHub();
BarDescriptorEditorWidget *editorWidget = qobject_cast<BarDescriptorEditorWidget *>(widget()); BarDescriptorEditorWidget *editorWidget = qobject_cast<BarDescriptorEditorWidget *>(widget());
QTC_ASSERT(editorWidget, return); QTC_ASSERT(editorWidget, return);
...@@ -134,14 +130,14 @@ void BarDescriptorEditor::setActivePage(BarDescriptorEditor::EditorPage page) ...@@ -134,14 +130,14 @@ void BarDescriptorEditor::setActivePage(BarDescriptorEditor::EditorPage page)
if (page == Source) { if (page == Source) {
editorWidget->setXmlSource(m_file->xmlSource()); editorWidget->setXmlSource(m_file->xmlSource());
} else if (prevPage == Source) { } else if (prevPage == Source) {
taskHub()->clearTasks(Constants::QNX_TASK_CATEGORY_BARDESCRIPTOR); taskHub->clearTasks(Constants::QNX_TASK_CATEGORY_BARDESCRIPTOR);
QString errorMsg; QString errorMsg;
int errorLine; int errorLine;
if (!m_file->loadContent(editorWidget->xmlSource(), &errorMsg, &errorLine)) { if (!m_file->loadContent(editorWidget->xmlSource(), &errorMsg, &errorLine)) {
const ProjectExplorer::Task task(ProjectExplorer::Task::Error, errorMsg, Utils::FileName::fromString(m_file->filePath()), const ProjectExplorer::Task task(ProjectExplorer::Task::Error, errorMsg, Utils::FileName::fromString(m_file->filePath()),
errorLine, Constants::QNX_TASK_CATEGORY_BARDESCRIPTOR); errorLine, Constants::QNX_TASK_CATEGORY_BARDESCRIPTOR);
taskHub()->addTask(task); taskHub->addTask(task);
taskHub()->requestPopup(); taskHub->requestPopup();
foreach (QAction *action, m_actionGroup->actions()) foreach (QAction *action, m_actionGroup->actions())
if (action->data().toInt() == Source) if (action->data().toInt() == Source)
......
...@@ -39,15 +39,10 @@ class QActionGroup; ...@@ -39,15 +39,10 @@ class QActionGroup;
class QToolBar; class QToolBar;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace ProjectExplorer {
class TaskHub;
}
namespace Qnx { namespace Qnx {
namespace Internal { namespace Internal {
class BarDescriptorDocument; class BarDescriptorDocument;
class BarDescriptorEditorWidget; class BarDescriptorEditorWidget;
class BarDescriptorEditor : public Core::IEditor class BarDescriptorEditor : public Core::IEditor
...@@ -74,8 +69,6 @@ private slots: ...@@ -74,8 +69,6 @@ private slots:
void changeEditorPage(QAction *action); void changeEditorPage(QAction *action);
private: private:
ProjectExplorer::TaskHub *taskHub();
void setActivePage(EditorPage page); void setActivePage(EditorPage page);
BarDescriptorDocument *m_file; BarDescriptorDocument *m_file;
......
...@@ -121,7 +121,7 @@ bool QNXPlugin::initialize(const QStringList &arguments, QString *errorString) ...@@ -121,7 +121,7 @@ bool QNXPlugin::initialize(const QStringList &arguments, QString *errorString)
void QNXPlugin::extensionsInitialized() void QNXPlugin::extensionsInitialized()
{ {
ProjectExplorer::ProjectExplorerPlugin::instance()->taskHub()->addCategory(Constants::QNX_TASK_CATEGORY_BARDESCRIPTOR, ProjectExplorer::ProjectExplorerPlugin::taskHub()->addCategory(Constants::QNX_TASK_CATEGORY_BARDESCRIPTOR,
tr("Bar Descriptor")); tr("Bar Descriptor"));
} }
......
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