diff options
author | hjk <hjk@qt.io> | 2018-01-24 17:41:53 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2018-01-26 10:20:38 +0000 |
commit | 3c91777e487e11992f3b4c26d91dee16b53e67d9 (patch) | |
tree | bc532ac9c9952674a140125cc62a3f4253048ec1 /src/plugins/fakevim | |
parent | 14429198236707bc85cf2d5bae9f171c214e3af5 (diff) | |
download | qt-creator-3c91777e487e11992f3b4c26d91dee16b53e67d9.tar.gz |
Core: Detach status bar handling from global object pool
Instead of relying on addObject notification, provide a
StatusBarManager::addStatusBarWidget() method to create,
register and keep track of an IContext object.
That's essentially what was StatusBarWidget before, but does
not need to be known on the user side. For removal, this
provides a StatusBarManager::destroyStatusBarWidget(),
any not explicitly removed items are handled in response
to ICore::coreAboutToClose()
The StatusBarManager class is fully static now, could
be a namespace.
Change-Id: Ia2bd13b391c3f68c8dfd584b53524a9649cc0787
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/plugins/fakevim')
-rw-r--r-- | src/plugins/fakevim/fakevimplugin.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp index 657a950d3e..4f0b90bec3 100644 --- a/src/plugins/fakevim/fakevimplugin.cpp +++ b/src/plugins/fakevim/fakevimplugin.cpp @@ -47,7 +47,6 @@ #include <coreplugin/idocument.h> #include <coreplugin/messagemanager.h> #include <coreplugin/id.h> -#include <coreplugin/statusbarwidget.h> #include <coreplugin/statusbarmanager.h> #include <projectexplorer/projectexplorerconstants.h> @@ -1177,7 +1176,7 @@ private: UserCommandMap m_userCommandMap; UserCommandMap m_defaultUserCommandMap; - StatusBarWidget *m_statusBar; + MiniBuffer *m_miniBuffer = nullptr; // @TODO: Delete //WordCompletion *m_wordCompletion; FakeVimCompletionAssistProvider *m_wordProvider = nullptr; @@ -1229,8 +1228,6 @@ FakeVimPluginPrivate::FakeVimPluginPrivate(FakeVimPlugin *plugin) QString cmd = QString::fromLatin1(":echo User command %1 executed.<CR>"); defaultUserCommandMap().insert(i, cmd.arg(i)); } - - m_statusBar = 0; } void FakeVimPluginPrivate::onCoreAboutToClose() @@ -2154,8 +2151,8 @@ void FakeVimPluginPrivate::showCommandBuffer(FakeVimHandler *handler, const QStr int messageLevel) { //qDebug() << "SHOW COMMAND BUFFER" << contents; - if (MiniBuffer *w = qobject_cast<MiniBuffer *>(m_statusBar->widget())) - w->setContents(contents, cursorPos, anchorPos, messageLevel, handler); + QTC_ASSERT(m_miniBuffer, return); + m_miniBuffer->setContents(contents, cursorPos, anchorPos, messageLevel, handler); } void FakeVimPluginPrivate::showExtraInformation(FakeVimHandler *, const QString &text) @@ -2273,16 +2270,15 @@ bool FakeVimPlugin::initialize(const QStringList &arguments, QString *errorMessa ExtensionSystem::IPlugin::ShutdownFlag FakeVimPlugin::aboutToShutdown() { - d->aboutToShutdown(); + StatusBarManager::destroyStatusBarWidget(d->m_miniBuffer); + d->m_miniBuffer = nullptr; return SynchronousShutdown; } void FakeVimPlugin::extensionsInitialized() { - d->m_statusBar = new StatusBarWidget; - d->m_statusBar->setWidget(new MiniBuffer); - d->m_statusBar->setPosition(StatusBarWidget::LastLeftAligned); - addAutoReleasedObject(d->m_statusBar); + d->m_miniBuffer = new MiniBuffer; + StatusBarManager::addStatusBarWidget(d->m_miniBuffer, StatusBarManager::LastLeftAligned); } #ifdef WITH_TESTS |