diff options
author | Tobias Hunger <tobias.hunger@digia.com> | 2013-08-02 12:18:06 +0200 |
---|---|---|
committer | hjk <hjk121@nokiamail.com> | 2013-08-02 12:20:25 +0200 |
commit | f67275dc15192e18856562d225ceb3883b346773 (patch) | |
tree | 59e202e437bd1c0d18ef9156fe0c5c21b1ee97a7 /src/plugins/tasklist | |
parent | 6e4aa21aee9aee21cba3f6541d9541906383b596 (diff) | |
download | qt-creator-f67275dc15192e18856562d225ceb3883b346773.tar.gz |
TaskListPlugin: Clean up APIs
Clean up singleton APIs.
Task-number: QTCREATORBUG-9761
Change-Id: I42b691449dea75dc88f37db107221d4421f73529
Reviewed-by: hjk <hjk121@nokiamail.com>
Diffstat (limited to 'src/plugins/tasklist')
-rw-r--r-- | src/plugins/tasklist/stopmonitoringhandler.cpp | 2 | ||||
-rw-r--r-- | src/plugins/tasklist/taskfile.cpp | 2 | ||||
-rw-r--r-- | src/plugins/tasklist/tasklistplugin.cpp | 28 | ||||
-rw-r--r-- | src/plugins/tasklist/tasklistplugin.h | 10 |
4 files changed, 17 insertions, 25 deletions
diff --git a/src/plugins/tasklist/stopmonitoringhandler.cpp b/src/plugins/tasklist/stopmonitoringhandler.cpp index c5a42dcd53..35a7ec2513 100644 --- a/src/plugins/tasklist/stopmonitoringhandler.cpp +++ b/src/plugins/tasklist/stopmonitoringhandler.cpp @@ -54,7 +54,7 @@ void StopMonitoringHandler::handle(const ProjectExplorer::Task &task) { QTC_ASSERT(canHandle(task), return); Q_UNUSED(task); - TaskList::TaskListPlugin::instance()->stopMonitoring(); + TaskList::TaskListPlugin::stopMonitoring(); } QAction *StopMonitoringHandler::createAction(QObject *parent) const diff --git a/src/plugins/tasklist/taskfile.cpp b/src/plugins/tasklist/taskfile.cpp index ab20c1119c..9f84664edb 100644 --- a/src/plugins/tasklist/taskfile.cpp +++ b/src/plugins/tasklist/taskfile.cpp @@ -101,7 +101,7 @@ bool TaskFile::reload(QString *errorString, ReloadFlag flag, ChangeType type) bool TaskFile::open(QString *errorString, const QString &fileName) { setFilePath(fileName); - return TaskList::TaskListPlugin::instance()->loadFile(errorString, m_context, fileName); + return TaskList::TaskListPlugin::loadFile(errorString, m_context, fileName); } ProjectExplorer::Project *TaskFile::context() const diff --git a/src/plugins/tasklist/tasklistplugin.cpp b/src/plugins/tasklist/tasklistplugin.cpp index 18ed2c3068..4f9ff86b07 100644 --- a/src/plugins/tasklist/tasklistplugin.cpp +++ b/src/plugins/tasklist/tasklistplugin.cpp @@ -36,7 +36,7 @@ #include <coreplugin/icore.h> #include <coreplugin/mimedatabase.h> -#include <extensionsystem/pluginmanager.h> +#include <projectexplorer/projectexplorer.h> #include <projectexplorer/project.h> #include <projectexplorer/task.h> #include <projectexplorer/taskhub.h> @@ -119,9 +119,10 @@ public: } description = unescape(description); - hub->addTask(ProjectExplorer::Task(type, description, - Utils::FileName::fromUserInput(file), line, - Core::Id(Constants::TASKLISTTASK_ID))); + ProjectExplorer::ProjectExplorerPlugin::taskHub() + ->addTask(ProjectExplorer::Task(type, description, + Utils::FileName::fromUserInput(file), line, + Core::Id(Constants::TASKLISTTASK_ID))); } return true; } @@ -163,7 +164,6 @@ public: return result; } - ProjectExplorer::TaskHub *hub; TaskFileFactory *fileFactory; }; @@ -182,19 +182,13 @@ TaskListPlugin::~TaskListPlugin() delete d; } -TaskListPlugin *TaskListPlugin::instance() -{ - return m_instance; -} - bool TaskListPlugin::initialize(const QStringList &arguments, QString *errorMessage) { Q_UNUSED(arguments) - d->hub = ExtensionSystem::PluginManager::getObject<ProjectExplorer::TaskHub>(); - //: Category under which tasklist tasks are listed in Issues view - d->hub->addCategory(Core::Id(Constants::TASKLISTTASK_ID), tr("My Tasks")); + ProjectExplorer::ProjectExplorerPlugin::taskHub() + ->addCategory(Core::Id(Constants::TASKLISTTASK_ID), tr("My Tasks")); if (!Core::ICore::mimeDatabase()->addMimeTypes(QLatin1String(":tasklist/TaskList.mimetypes.xml"), errorMessage)) return false; @@ -211,22 +205,22 @@ void TaskListPlugin::extensionsInitialized() bool TaskListPlugin::loadFile(QString *errorString, ProjectExplorer::Project *context, const QString &fileName) { clearTasks(); - return d->parseTaskFile(errorString, context, fileName); + return m_instance->d->parseTaskFile(errorString, context, fileName); } bool TaskListPlugin::monitorFile(ProjectExplorer::Project *context, const QString &fileName) { - return d->fileFactory->open(context, fileName); + return m_instance->d->fileFactory->open(context, fileName); } void TaskListPlugin::stopMonitoring() { - d->fileFactory->closeAllFiles(); + m_instance->d->fileFactory->closeAllFiles(); } void TaskListPlugin::clearTasks() { - d->hub->clearTasks(Core::Id(Constants::TASKLISTTASK_ID)); + ProjectExplorer::ProjectExplorerPlugin::taskHub()->clearTasks(Core::Id(Constants::TASKLISTTASK_ID)); } Q_EXPORT_PLUGIN(TaskListPlugin) diff --git a/src/plugins/tasklist/tasklistplugin.h b/src/plugins/tasklist/tasklistplugin.h index e22ffd33b2..63b23eadc3 100644 --- a/src/plugins/tasklist/tasklistplugin.h +++ b/src/plugins/tasklist/tasklistplugin.h @@ -50,17 +50,15 @@ public: TaskListPlugin(); ~TaskListPlugin(); - static TaskListPlugin *instance(); - bool initialize(const QStringList &arguments, QString *errorMessage); void extensionsInitialized(); - bool loadFile(QString *errorString, ProjectExplorer::Project *context, const QString &fileName); - bool monitorFile(ProjectExplorer::Project *context, const QString &fileName); + static bool loadFile(QString *errorString, ProjectExplorer::Project *context, const QString &fileName); + static bool monitorFile(ProjectExplorer::Project *context, const QString &fileName); - void stopMonitoring(); - void clearTasks(); + static void stopMonitoring(); + static void clearTasks(); private: static TaskListPlugin *m_instance; |