From 6448d26ad7f46ca7cc4a204e5cfd529b8be5c665 Mon Sep 17 00:00:00 2001 From: Christian Kandeler <christian.kandeler@digia.com> Date: Wed, 23 Oct 2013 12:53:10 +0200 Subject: [PATCH] Core: Adapt documentation to recent refactoring. ProgressManager and ActionManager are no longer retrieved via ICore, and most accesses do not go via the instance anymore. Change-Id: Ib0c3033270051aaadfb25e0b2b0eaf7bdec63a1d Reviewed-by: hjk <hjk121@nokiamail.com> Reviewed-by: Eike Ziller <eike.ziller@digia.com> --- doc/api/examples/exampleplugin/exampleplugin.cpp | 8 +++----- .../coreplugin/progressmanager/progressmanager.cpp | 11 ++++------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/doc/api/examples/exampleplugin/exampleplugin.cpp b/doc/api/examples/exampleplugin/exampleplugin.cpp index 147a4274b9c..7b2b3c0cead 100644 --- a/doc/api/examples/exampleplugin/exampleplugin.cpp +++ b/doc/api/examples/exampleplugin/exampleplugin.cpp @@ -41,19 +41,17 @@ bool ExamplePlugin::initialize(const QStringList &arguments, QString *errorStrin Q_UNUSED(errorString) //! [add action] - Core::ActionManager *am = Core::ICore::instance()->actionManager(); - QAction *action = new QAction(tr("Example action"), this); - Core::Command *cmd = am->registerAction(action, Constants::ACTION_ID, + Core::Command *cmd = Core::ActionManager::registerAction(action, Constants::ACTION_ID, Core::Context(Core::Constants::C_GLOBAL)); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+Meta+A"))); connect(action, SIGNAL(triggered()), this, SLOT(triggerAction())); //! [add action] //! [add menu] - Core::ActionContainer *menu = am->createMenu(Constants::MENU_ID); + Core::ActionContainer *menu = Core::ActionManager::createMenu(Constants::MENU_ID); menu->menu()->setTitle(tr("Example")); menu->addAction(cmd); - am->actionContainer(Core::Constants::M_TOOLS)->addMenu(menu); + Core::ActionManager::actionContainer(Core::Constants::M_TOOLS)->addMenu(menu); //! [add menu] return true; diff --git a/src/plugins/coreplugin/progressmanager/progressmanager.cpp b/src/plugins/coreplugin/progressmanager/progressmanager.cpp index 444f19296b5..419d8be0b70 100644 --- a/src/plugins/coreplugin/progressmanager/progressmanager.cpp +++ b/src/plugins/coreplugin/progressmanager/progressmanager.cpp @@ -72,7 +72,7 @@ using namespace Core::Internal; The progress indicator also allows the user to cancel the task. You get the single instance of this class via the - Core::ICore::progressManager() function. + ProgressManager::instance() function. \section1 Registering a task The ProgressManager API uses QtConcurrent as the basis for defining @@ -149,9 +149,8 @@ using namespace Core::Internal; in a different thread, looks like this: \code QFuture<void> task = QtConcurrent::run(&ILocatorFilter::refresh, filters); - Core::FutureProgress *progress = Core::ICore::instance() - ->progressManager()->addTask(task, tr("Indexing"), - Locator::Constants::TASK_INDEX); + Core::FutureProgress *progress = Core::ProgressManager::addTask(task, tr("Indexing"), + Locator::Constants::TASK_INDEX); \endcode First, we tell QtConcurrent to start a thread which calls all the filters' refresh function. After that we register the returned QFuture object @@ -166,9 +165,7 @@ using namespace Core::Internal; // We are already running in a different thread here QFutureInterface<void> *progressObject = new QFutureInterface<void>; progressObject->setProgressRange(0, MAX); - Core::ICore::progressManager()->addTask( - progressObject->future(), - tr("DoIt"), MYTASKTYPE); + Core::ProgressManager::addTask(progressObject->future(), tr("DoIt"), MYTASKTYPE); progressObject->reportStarted(); // Do something ... -- GitLab