Commit d0eb1058 authored by hjk's avatar hjk

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