Commit 6448d26a authored by Christian Kandeler's avatar Christian Kandeler Committed by Eike Ziller
Browse files

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: default avatarhjk <hjk121@nokiamail.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent 60710f6c
......@@ -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;
......
......@@ -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
...
......
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