forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -58,7 +58,6 @@ SOURCES += corejsextensions.cpp \
|
||||
progressmanager/progressbar.cpp \
|
||||
progressmanager/futureprogress.cpp \
|
||||
reaper.cpp \
|
||||
statusbarwidget.cpp \
|
||||
coreplugin.cpp \
|
||||
modemanager.cpp \
|
||||
basefilewizard.cpp \
|
||||
@@ -175,7 +174,6 @@ HEADERS += corejsextensions.h \
|
||||
ifilewizardextension.h \
|
||||
versiondialog.h \
|
||||
core_global.h \
|
||||
statusbarwidget.h \
|
||||
coreplugin.h \
|
||||
modemanager.h \
|
||||
basefilewizard.h \
|
||||
|
||||
@@ -159,8 +159,6 @@ Project {
|
||||
"sidebarwidget.h",
|
||||
"statusbarmanager.cpp",
|
||||
"statusbarmanager.h",
|
||||
"statusbarwidget.cpp",
|
||||
"statusbarwidget.h",
|
||||
"styleanimator.cpp",
|
||||
"styleanimator.h",
|
||||
"systemsettings.cpp",
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/settingsdatabase.h>
|
||||
#include <coreplugin/statusbarwidget.h>
|
||||
#include <coreplugin/statusbarmanager.h>
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
@@ -114,11 +114,8 @@ void Locator::initialize(CorePlugin *corePlugin, const QStringList &, QString *)
|
||||
mtools->addAction(cmd);
|
||||
|
||||
auto locatorWidget = LocatorManager::createLocatorInputWidget(ICore::mainWindow());
|
||||
StatusBarWidget *view = new StatusBarWidget;
|
||||
view->setWidget(locatorWidget);
|
||||
view->setContext(Context("LocatorWidget"));
|
||||
view->setPosition(StatusBarWidget::First);
|
||||
m_corePlugin->addAutoReleasedObject(view);
|
||||
StatusBarManager::addStatusBarWidget(locatorWidget, StatusBarManager::First,
|
||||
Context("LocatorWidget"));
|
||||
|
||||
new LocatorManager(this);
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
#include "navigationwidget.h"
|
||||
#include "rightpane.h"
|
||||
#include "editormanager/ieditorfactory.h"
|
||||
#include "statusbarwidget.h"
|
||||
#include "systemsettings.h"
|
||||
#include "externaltoolmanager.h"
|
||||
#include "editormanager/systemeditor.h"
|
||||
@@ -176,7 +175,6 @@ MainWindow::MainWindow() :
|
||||
m_rightNavigationWidget = new NavigationWidget(m_toggleRightSideBarAction, Side::Right);
|
||||
m_rightPaneWidget = new RightPaneWidget();
|
||||
|
||||
m_statusBarManager = new StatusBarManager;
|
||||
m_messageManager = new MessageManager;
|
||||
m_editorManager = new EditorManager(this);
|
||||
m_externalToolManager = new ExternalToolManager();
|
||||
@@ -274,10 +272,6 @@ MainWindow::~MainWindow()
|
||||
// All modes are now gone
|
||||
OutputPaneManager::destroy();
|
||||
|
||||
// Now that the OutputPaneManager is gone, is a good time to delete the view
|
||||
PluginManager::removeObject(m_outputView);
|
||||
delete m_outputView;
|
||||
|
||||
delete m_leftNavigationWidget;
|
||||
delete m_rightNavigationWidget;
|
||||
m_leftNavigationWidget = nullptr;
|
||||
@@ -287,8 +281,7 @@ MainWindow::~MainWindow()
|
||||
m_editorManager = nullptr;
|
||||
delete m_progressManager;
|
||||
m_progressManager = nullptr;
|
||||
delete m_statusBarManager;
|
||||
m_statusBarManager = nullptr;
|
||||
|
||||
PluginManager::removeObject(m_coreImpl);
|
||||
delete m_coreImpl;
|
||||
m_coreImpl = nullptr;
|
||||
@@ -310,7 +303,6 @@ bool MainWindow::init(QString *errorMessage)
|
||||
Q_UNUSED(errorMessage)
|
||||
|
||||
PluginManager::addObject(m_coreImpl);
|
||||
m_statusBarManager->init();
|
||||
m_progressManager->init(); // needs the status bar manager
|
||||
|
||||
PluginManager::addObject(m_generalSettings);
|
||||
@@ -320,12 +312,6 @@ bool MainWindow::init(QString *errorMessage)
|
||||
PluginManager::addObject(m_mimeTypeSettings);
|
||||
PluginManager::addObject(m_systemEditor);
|
||||
|
||||
// Add widget to the bottom, we create the view here instead of inside the
|
||||
// OutputPaneManager, since the StatusBarManager needs to be initialized before
|
||||
m_outputView = new StatusBarWidget;
|
||||
m_outputView->setWidget(OutputPaneManager::instance()->buttonsWidget());
|
||||
m_outputView->setPosition(StatusBarWidget::Second);
|
||||
PluginManager::addObject(m_outputView);
|
||||
MessageManager::init();
|
||||
return true;
|
||||
}
|
||||
@@ -1166,7 +1152,7 @@ void MainWindow::restoreWindowState()
|
||||
restoreState(settings->value(QLatin1String(windowStateKey)).toByteArray());
|
||||
settings->endGroup();
|
||||
show();
|
||||
m_statusBarManager->restoreSettings();
|
||||
StatusBarManager::restoreSettings();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -43,7 +43,6 @@ QT_END_NAMESPACE
|
||||
|
||||
namespace Core {
|
||||
|
||||
class StatusBarWidget;
|
||||
class EditorManager;
|
||||
class ExternalToolManager;
|
||||
class HelpManager;
|
||||
@@ -66,7 +65,6 @@ class ProgressManagerPrivate;
|
||||
class ShortcutSettings;
|
||||
class ToolSettings;
|
||||
class MimeTypeSettings;
|
||||
class StatusBarManager;
|
||||
class VersionDialog;
|
||||
class WindowSupport;
|
||||
class SystemEditor;
|
||||
@@ -159,14 +157,12 @@ private:
|
||||
ProgressManagerPrivate *m_progressManager = nullptr;
|
||||
JsExpander *m_jsExpander = nullptr;
|
||||
VcsManager *m_vcsManager = nullptr;
|
||||
StatusBarManager *m_statusBarManager = nullptr;
|
||||
ModeManager *m_modeManager = nullptr;
|
||||
HelpManager *m_helpManager = nullptr;
|
||||
FancyTabWidget *m_modeStack = nullptr;
|
||||
NavigationWidget *m_leftNavigationWidget = nullptr;
|
||||
NavigationWidget *m_rightNavigationWidget = nullptr;
|
||||
RightPaneWidget *m_rightPaneWidget = nullptr;
|
||||
StatusBarWidget *m_outputView = nullptr;
|
||||
VersionDialog *m_versionDialog = nullptr;
|
||||
|
||||
QList<IContext *> m_activeContext;
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "icore.h"
|
||||
#include "ioutputpane.h"
|
||||
#include "modemanager.h"
|
||||
#include "statusbarmanager.h"
|
||||
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||
@@ -212,11 +213,6 @@ OutputPaneManager::~OutputPaneManager()
|
||||
{
|
||||
}
|
||||
|
||||
QWidget *OutputPaneManager::buttonsWidget()
|
||||
{
|
||||
return m_buttonsWidget;
|
||||
}
|
||||
|
||||
// Return shortcut as Alt+<number> or Cmd+<number> if number is a non-zero digit
|
||||
static inline QKeySequence paneShortCut(int number)
|
||||
{
|
||||
@@ -229,6 +225,8 @@ static inline QKeySequence paneShortCut(int number)
|
||||
|
||||
void OutputPaneManager::init()
|
||||
{
|
||||
StatusBarManager::addStatusBarWidget(m_buttonsWidget, StatusBarManager::Second);
|
||||
|
||||
ActionContainer *mwindow = ActionManager::actionContainer(Constants::M_WINDOW);
|
||||
|
||||
// Window->Output Panes
|
||||
|
||||
@@ -55,7 +55,6 @@ class OutputPaneManager : public QWidget
|
||||
public:
|
||||
void init();
|
||||
static OutputPaneManager *instance();
|
||||
QWidget *buttonsWidget();
|
||||
void updateStatusButtons(bool visible);
|
||||
static void updateMaximizeButton(bool maximized);
|
||||
|
||||
|
||||
@@ -32,8 +32,7 @@
|
||||
#include "../icontext.h"
|
||||
#include "../coreconstants.h"
|
||||
#include "../icore.h"
|
||||
#include "../statusbarwidget.h"
|
||||
|
||||
#include "../statusbarmanager.h"
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
@@ -286,8 +285,8 @@ ProgressManagerPrivate::~ProgressManagerPrivate()
|
||||
stopFadeOfSummaryProgress();
|
||||
qDeleteAll(m_taskList);
|
||||
m_taskList.clear();
|
||||
ExtensionSystem::PluginManager::removeObject(m_statusBarWidgetContainer);
|
||||
delete m_statusBarWidgetContainer;
|
||||
StatusBarManager::destroyStatusBarWidget(m_statusBarWidget);
|
||||
m_statusBarWidget = nullptr;
|
||||
cleanup();
|
||||
m_instance = 0;
|
||||
}
|
||||
@@ -304,7 +303,6 @@ void ProgressManagerPrivate::init()
|
||||
{
|
||||
readSettings();
|
||||
|
||||
m_statusBarWidgetContainer = new StatusBarWidget;
|
||||
m_statusBarWidget = new QWidget;
|
||||
QHBoxLayout *layout = new QHBoxLayout(m_statusBarWidget);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
@@ -326,10 +324,8 @@ void ProgressManagerPrivate::init()
|
||||
layout->addWidget(m_summaryProgressWidget);
|
||||
ToggleButton *toggleButton = new ToggleButton(m_statusBarWidget);
|
||||
layout->addWidget(toggleButton);
|
||||
m_statusBarWidgetContainer->setWidget(m_statusBarWidget);
|
||||
m_statusBarWidgetContainer->setPosition(StatusBarWidget::RightCorner);
|
||||
ExtensionSystem::PluginManager::addObject(m_statusBarWidgetContainer);
|
||||
m_statusBarWidget->installEventFilter(this);
|
||||
StatusBarManager::addStatusBarWidget(m_statusBarWidget, StatusBarManager::RightCorner);
|
||||
|
||||
QAction *toggleProgressView = new QAction(tr("Toggle Progress Details"), this);
|
||||
toggleProgressView->setCheckable(true);
|
||||
|
||||
@@ -27,9 +27,8 @@
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "minisplitter.h"
|
||||
#include "statusbarwidget.h"
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
@@ -37,11 +36,14 @@
|
||||
#include <QSplitter>
|
||||
#include <QStatusBar>
|
||||
|
||||
static const char kSettingsGroup[] = "StatusBar";
|
||||
static const char kLeftSplitWidthKey[] = "LeftSplitWidth";
|
||||
namespace Core {
|
||||
|
||||
using namespace Core;
|
||||
using namespace Core::Internal;
|
||||
const char kSettingsGroup[] = "StatusBar";
|
||||
const char kLeftSplitWidthKey[] = "LeftSplitWidth";
|
||||
|
||||
static QPointer<QSplitter> m_splitter;
|
||||
static QList<QPointer<QWidget>> m_statusBarWidgets;
|
||||
static QList<QPointer<IContext>> m_contexts;
|
||||
|
||||
static QWidget *createWidget(QWidget *parent)
|
||||
{
|
||||
@@ -52,7 +54,7 @@ static QWidget *createWidget(QWidget *parent)
|
||||
return w;
|
||||
}
|
||||
|
||||
StatusBarManager::StatusBarManager()
|
||||
static void createStatusBarManager()
|
||||
{
|
||||
QStatusBar *bar = ICore::statusBar();
|
||||
|
||||
@@ -82,47 +84,54 @@ StatusBarManager::StatusBarManager()
|
||||
QWidget *rightCornerWidget = createWidget(bar);
|
||||
bar->insertPermanentWidget(1, rightCornerWidget);
|
||||
m_statusBarWidgets.append(rightCornerWidget);
|
||||
|
||||
QObject::connect(ICore::instance(), &ICore::saveSettingsRequested, [] {
|
||||
QSettings *s = ICore::settings();
|
||||
s->beginGroup(QLatin1String(kSettingsGroup));
|
||||
s->setValue(QLatin1String(kLeftSplitWidthKey), m_splitter->sizes().at(0));
|
||||
s->endGroup();
|
||||
});
|
||||
|
||||
QObject::connect(ICore::instance(), &ICore::coreAboutToClose, [] {
|
||||
// This is the catch-all on rampdown. Individual items may
|
||||
// have been removed earlier by destroyStatusBarWidget().
|
||||
for (const QPointer<IContext> &context : m_contexts)
|
||||
ICore::removeContextObject(context);
|
||||
m_contexts.clear();
|
||||
});
|
||||
}
|
||||
|
||||
StatusBarManager::~StatusBarManager()
|
||||
void StatusBarManager::addStatusBarWidget(QWidget *widget,
|
||||
StatusBarPosition position,
|
||||
const Context &ctx)
|
||||
{
|
||||
if (!m_splitter)
|
||||
createStatusBarManager();
|
||||
|
||||
QTC_ASSERT(widget, return);
|
||||
QTC_CHECK(widget->parent() == nullptr); // We re-parent, so user code does need / should not set it.
|
||||
m_statusBarWidgets.at(position)->layout()->addWidget(widget);
|
||||
|
||||
auto context = new IContext;
|
||||
context->setWidget(widget);
|
||||
context->setContext(ctx);
|
||||
m_contexts.append(context);
|
||||
|
||||
ICore::addContextObject(context);
|
||||
}
|
||||
|
||||
void StatusBarManager::init()
|
||||
void StatusBarManager::destroyStatusBarWidget(QWidget *widget)
|
||||
{
|
||||
connect(ExtensionSystem::PluginManager::instance(), &ExtensionSystem::PluginManager::objectAdded,
|
||||
this, &StatusBarManager::objectAdded);
|
||||
connect(ExtensionSystem::PluginManager::instance(), &ExtensionSystem::PluginManager::aboutToRemoveObject,
|
||||
this, &StatusBarManager::aboutToRemoveObject);
|
||||
connect(ICore::instance(), &ICore::saveSettingsRequested, this, &StatusBarManager::saveSettings);
|
||||
}
|
||||
|
||||
void StatusBarManager::objectAdded(QObject *obj)
|
||||
{
|
||||
StatusBarWidget *view = qobject_cast<StatusBarWidget *>(obj);
|
||||
if (!view)
|
||||
return;
|
||||
|
||||
QWidget *viewWidget = view->widget();
|
||||
m_statusBarWidgets.at(view->position())->layout()->addWidget(viewWidget);
|
||||
|
||||
ICore::addContextObject(view);
|
||||
}
|
||||
|
||||
void StatusBarManager::aboutToRemoveObject(QObject *obj)
|
||||
{
|
||||
StatusBarWidget *view = qobject_cast<StatusBarWidget *>(obj);
|
||||
if (!view)
|
||||
return;
|
||||
ICore::removeContextObject(view);
|
||||
}
|
||||
|
||||
void StatusBarManager::saveSettings()
|
||||
{
|
||||
QSettings *s = ICore::settings();
|
||||
s->beginGroup(QLatin1String(kSettingsGroup));
|
||||
s->setValue(QLatin1String(kLeftSplitWidthKey), m_splitter->sizes().at(0));
|
||||
s->endGroup();
|
||||
QTC_ASSERT(widget, return);
|
||||
for (const QPointer<IContext> &context : m_contexts) {
|
||||
if (context->widget() == widget) {
|
||||
ICore::removeContextObject(context);
|
||||
m_contexts.removeAll(context);
|
||||
break;
|
||||
}
|
||||
}
|
||||
widget->setParent(nullptr);
|
||||
delete widget;
|
||||
}
|
||||
|
||||
void StatusBarManager::restoreSettings()
|
||||
@@ -140,3 +149,5 @@ void StatusBarManager::restoreSettings()
|
||||
sum += w;
|
||||
m_splitter->setSizes(QList<int>() << leftSplitWidth << (sum - leftSplitWidth));
|
||||
}
|
||||
|
||||
} // Core
|
||||
|
||||
@@ -25,36 +25,20 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QList>
|
||||
#include <QObject>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QSplitter;
|
||||
class QWidget;
|
||||
QT_END_NAMESPACE
|
||||
#include "icontext.h"
|
||||
|
||||
namespace Core {
|
||||
namespace Internal {
|
||||
|
||||
class StatusBarManager : public QObject
|
||||
class CORE_EXPORT StatusBarManager
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
StatusBarManager();
|
||||
~StatusBarManager();
|
||||
enum StatusBarPosition { First=0, Second=1, Third=2, LastLeftAligned=Third, RightCorner};
|
||||
|
||||
void init();
|
||||
void restoreSettings();
|
||||
|
||||
private:
|
||||
void objectAdded(QObject *obj);
|
||||
void aboutToRemoveObject(QObject *obj);
|
||||
void saveSettings();
|
||||
|
||||
QSplitter *m_splitter;
|
||||
QList<QWidget *> m_statusBarWidgets;
|
||||
static void addStatusBarWidget(QWidget *widget,
|
||||
StatusBarPosition position,
|
||||
const Context &ctx = Context());
|
||||
static void destroyStatusBarWidget(QWidget *widget);
|
||||
static void restoreSettings();
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Core
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "statusbarwidget.h"
|
||||
|
||||
using namespace Core;
|
||||
|
||||
StatusBarWidget::StatusBarWidget(QObject *parent)
|
||||
: IContext(parent), m_defaultPosition(StatusBarWidget::First)
|
||||
{
|
||||
}
|
||||
|
||||
StatusBarWidget::~StatusBarWidget()
|
||||
{
|
||||
delete m_widget;
|
||||
}
|
||||
|
||||
StatusBarWidget::StatusBarPosition StatusBarWidget::position() const
|
||||
{
|
||||
return m_defaultPosition;
|
||||
}
|
||||
|
||||
void StatusBarWidget::setPosition(StatusBarWidget::StatusBarPosition position)
|
||||
{
|
||||
m_defaultPosition = position;
|
||||
}
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core_global.h"
|
||||
#include "icontext.h"
|
||||
|
||||
namespace Core {
|
||||
|
||||
class CORE_EXPORT StatusBarWidget : public IContext
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum StatusBarPosition { First=0, Second=1, Third=2, LastLeftAligned=Third, RightCorner};
|
||||
|
||||
StatusBarWidget(QObject *parent = 0);
|
||||
~StatusBarWidget();
|
||||
|
||||
StatusBarWidget::StatusBarPosition position() const;
|
||||
void setPosition(StatusBarWidget::StatusBarPosition position);
|
||||
|
||||
private:
|
||||
StatusBarWidget::StatusBarPosition m_defaultPosition;
|
||||
};
|
||||
|
||||
} // namespace Core
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user