forked from qt-creator/qt-creator
EditorManager: Use interface directly instead of going through ICore
In the majority of cases we were doing that anyways, having two ways is just needlessly confusing. Change-Id: Ied362a702c23beee528368d74df1f2aabe5807f8 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
@@ -637,7 +637,7 @@ void BazaarPlugin::commitFromEditor()
|
||||
{
|
||||
// Close the submit editor
|
||||
m_submitActionTriggered = true;
|
||||
Core::ICore::editorManager()->closeEditor();
|
||||
Core::EditorManager::closeEditor();
|
||||
}
|
||||
|
||||
bool BazaarPlugin::submitEditorAboutToClose()
|
||||
|
||||
@@ -128,10 +128,9 @@ bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *)
|
||||
this, SLOT(bookmarkMarginActionTriggered()));
|
||||
|
||||
// EditorManager
|
||||
QObject *editorManager = Core::ICore::editorManager();
|
||||
connect(editorManager, SIGNAL(editorAboutToClose(Core::IEditor*)),
|
||||
connect(Core::EditorManager::instance(), SIGNAL(editorAboutToClose(Core::IEditor*)),
|
||||
this, SLOT(editorAboutToClose(Core::IEditor*)));
|
||||
connect(editorManager, SIGNAL(editorOpened(Core::IEditor*)),
|
||||
connect(Core::EditorManager::instance(), SIGNAL(editorOpened(Core::IEditor*)),
|
||||
this, SLOT(editorOpened(Core::IEditor*)));
|
||||
|
||||
return true;
|
||||
|
||||
@@ -155,10 +155,9 @@ EditorView *EditorView::findNextView()
|
||||
|
||||
void EditorView::closeView()
|
||||
{
|
||||
EditorManager *em = ICore::editorManager();
|
||||
IEditor *editor = currentEditor();
|
||||
if (editor)
|
||||
em->closeEditor(editor);
|
||||
EditorManager::closeEditor(editor);
|
||||
}
|
||||
|
||||
void EditorView::showEditorStatusBar(const QString &id,
|
||||
@@ -226,7 +225,7 @@ void EditorView::updateEditorHistory(IEditor *editor, QList<EditLocation> &histo
|
||||
|
||||
void EditorView::paintEvent(QPaintEvent *)
|
||||
{
|
||||
EditorView *editorView = ICore::editorManager()->currentEditorView();
|
||||
EditorView *editorView = EditorManager::currentEditorView();
|
||||
if (editorView != this)
|
||||
return;
|
||||
|
||||
@@ -251,7 +250,7 @@ void EditorView::mousePressEvent(QMouseEvent *e)
|
||||
|
||||
void EditorView::focusInEvent(QFocusEvent *)
|
||||
{
|
||||
ICore::editorManager()->setCurrentView(this);
|
||||
EditorManager::setCurrentView(this);
|
||||
}
|
||||
|
||||
void EditorView::addEditor(IEditor *editor)
|
||||
@@ -459,18 +458,17 @@ void EditorView::updateCurrentPositionInNavigationHistory()
|
||||
|
||||
void EditorView::goBackInNavigationHistory()
|
||||
{
|
||||
EditorManager *em = ICore::editorManager();
|
||||
updateCurrentPositionInNavigationHistory();
|
||||
while (m_currentNavigationHistoryPosition > 0) {
|
||||
--m_currentNavigationHistoryPosition;
|
||||
EditLocation location = m_navigationHistory.at(m_currentNavigationHistoryPosition);
|
||||
IEditor *editor = 0;
|
||||
if (location.document) {
|
||||
editor = em->activateEditorForDocument(this, location.document,
|
||||
editor = EditorManager::activateEditorForDocument(this, location.document,
|
||||
EditorManager::IgnoreNavigationHistory);
|
||||
}
|
||||
if (!editor) {
|
||||
editor = em->openEditor(this, location.fileName, location.id,
|
||||
editor = EditorManager::openEditor(this, location.fileName, location.id,
|
||||
EditorManager::IgnoreNavigationHistory);
|
||||
if (!editor) {
|
||||
m_navigationHistory.removeAt(m_currentNavigationHistoryPosition);
|
||||
@@ -485,7 +483,6 @@ void EditorView::goBackInNavigationHistory()
|
||||
|
||||
void EditorView::goForwardInNavigationHistory()
|
||||
{
|
||||
EditorManager *em = ICore::editorManager();
|
||||
updateCurrentPositionInNavigationHistory();
|
||||
if (m_currentNavigationHistoryPosition >= m_navigationHistory.size()-1)
|
||||
return;
|
||||
@@ -493,11 +490,11 @@ void EditorView::goForwardInNavigationHistory()
|
||||
EditLocation location = m_navigationHistory.at(m_currentNavigationHistoryPosition);
|
||||
IEditor *editor = 0;
|
||||
if (location.document) {
|
||||
editor = em->activateEditorForDocument(this, location.document,
|
||||
editor = EditorManager::activateEditorForDocument(this, location.document,
|
||||
EditorManager::IgnoreNavigationHistory);
|
||||
}
|
||||
if (!editor) {
|
||||
editor = em->openEditor(this, location.fileName, location.id, EditorManager::IgnoreNavigationHistory);
|
||||
editor = EditorManager::openEditor(this, location.fileName, location.id, EditorManager::IgnoreNavigationHistory);
|
||||
if (!editor) {
|
||||
//TODO
|
||||
qDebug() << Q_FUNC_INFO << "can't open file" << location.fileName;
|
||||
@@ -607,12 +604,11 @@ void SplitterOrView::split(Qt::Orientation orientation)
|
||||
m_layout->removeWidget(m_view);
|
||||
EditorView *editorView = m_view;
|
||||
m_view = 0;
|
||||
EditorManager *em = ICore::editorManager();
|
||||
Core::IEditor *e = editorView->currentEditor();
|
||||
IEditor *e = editorView->currentEditor();
|
||||
|
||||
SplitterOrView *view = 0;
|
||||
SplitterOrView *otherView = 0;
|
||||
Core::IEditor *duplicate = e && e->duplicateSupported() ? em->duplicateEditor(e) : 0;
|
||||
IEditor *duplicate = e && e->duplicateSupported() ? EditorManager::duplicateEditor(e) : 0;
|
||||
m_splitter->addWidget((view = new SplitterOrView(duplicate)));
|
||||
m_splitter->addWidget((otherView = new SplitterOrView(editorView)));
|
||||
|
||||
@@ -630,9 +626,9 @@ void SplitterOrView::split(Qt::Orientation orientation)
|
||||
}
|
||||
|
||||
if (e)
|
||||
em->activateEditor(otherView->view(), e);
|
||||
EditorManager::activateEditor(otherView->view(), e);
|
||||
else
|
||||
em->setCurrentView(otherView->view());
|
||||
EditorManager::setCurrentView(otherView->view());
|
||||
}
|
||||
|
||||
void SplitterOrView::unsplitAll()
|
||||
@@ -657,7 +653,7 @@ void SplitterOrView::unsplitAll()
|
||||
void SplitterOrView::unsplitAll_helper()
|
||||
{
|
||||
if (m_view)
|
||||
ICore::editorManager()->emptyView(m_view);
|
||||
EditorManager::emptyView(m_view);
|
||||
if (m_splitter) {
|
||||
for (int i = 0; i < m_splitter->count(); ++i) {
|
||||
if (SplitterOrView *splitterOrView = qobject_cast<SplitterOrView*>(m_splitter->widget(i)))
|
||||
@@ -672,7 +668,6 @@ void SplitterOrView::unsplit()
|
||||
return;
|
||||
|
||||
Q_ASSERT(m_splitter->count() == 1);
|
||||
EditorManager *em = ICore::editorManager();
|
||||
SplitterOrView *childSplitterOrView = qobject_cast<SplitterOrView*>(m_splitter->widget(0));
|
||||
QSplitter *oldSplitter = m_splitter;
|
||||
m_splitter = 0;
|
||||
@@ -692,7 +687,7 @@ void SplitterOrView::unsplit()
|
||||
m_view->addEditor(e);
|
||||
m_view->setCurrentEditor(e);
|
||||
}
|
||||
em->emptyView(childView);
|
||||
EditorManager::emptyView(childView);
|
||||
} else {
|
||||
m_view = childSplitterOrView->takeView();
|
||||
m_view->setParentSplitterOrView(this);
|
||||
@@ -715,7 +710,7 @@ void SplitterOrView::unsplit()
|
||||
m_layout->setCurrentWidget(m_view);
|
||||
}
|
||||
delete oldSplitter;
|
||||
em->setCurrentView(findFirstView());
|
||||
EditorManager::setCurrentView(findFirstView());
|
||||
}
|
||||
|
||||
|
||||
@@ -772,27 +767,26 @@ void SplitterOrView::restoreState(const QByteArray &state)
|
||||
static_cast<SplitterOrView*>(m_splitter->widget(0))->restoreState(first);
|
||||
static_cast<SplitterOrView*>(m_splitter->widget(1))->restoreState(second);
|
||||
} else if (mode == "editor" || mode == "currenteditor") {
|
||||
EditorManager *em = ICore::editorManager();
|
||||
QString fileName;
|
||||
QString id;
|
||||
QByteArray editorState;
|
||||
stream >> fileName >> id >> editorState;
|
||||
if (!QFile::exists(fileName))
|
||||
return;
|
||||
IEditor *e = em->openEditor(view(), fileName, Id::fromString(id), Core::EditorManager::IgnoreNavigationHistory
|
||||
IEditor *e = EditorManager::openEditor(view(), fileName, Id::fromString(id), Core::EditorManager::IgnoreNavigationHistory
|
||||
| Core::EditorManager::DoNotChangeCurrentEditor);
|
||||
|
||||
if (!e) {
|
||||
DocumentModel::Entry *entry = EditorManager::documentModel()->firstRestoredDocument();
|
||||
if (entry)
|
||||
em->activateEditorForEntry(view(), entry, Core::EditorManager::IgnoreNavigationHistory
|
||||
EditorManager::activateEditorForEntry(view(), entry, Core::EditorManager::IgnoreNavigationHistory
|
||||
| Core::EditorManager::DoNotChangeCurrentEditor);
|
||||
}
|
||||
|
||||
if (e) {
|
||||
e->restoreState(editorState);
|
||||
if (mode == "currenteditor")
|
||||
em->setCurrentEditor(e);
|
||||
EditorManager::setCurrentEditor(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -422,11 +422,6 @@ MessageManager *ICore::messageManager()
|
||||
return m_mainwindow->messageManager();
|
||||
}
|
||||
|
||||
EditorManager *ICore::editorManager()
|
||||
{
|
||||
return m_mainwindow->editorManager();
|
||||
}
|
||||
|
||||
ProgressManager *ICore::progressManager()
|
||||
{
|
||||
return m_mainwindow->progressManager();
|
||||
|
||||
@@ -96,7 +96,6 @@ public:
|
||||
static QT_DEPRECATED ActionManager *actionManager(); // Use Actionmanager::... directly.
|
||||
static QT_DEPRECATED DocumentManager *documentManager(); // Use DocumentManager::... directly.
|
||||
static QT_DEPRECATED MessageManager *messageManager(); // Use MessageManager::... directly.
|
||||
static EditorManager *editorManager();
|
||||
static ProgressManager *progressManager();
|
||||
static QT_DEPRECATED VariableManager *variableManager(); // Use VariableManager::... directly.
|
||||
static VcsManager *vcsManager();
|
||||
|
||||
@@ -286,7 +286,7 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
|
||||
connect(Core::ICore::progressManager(), SIGNAL(allTasksFinished(QString)),
|
||||
this, SLOT(onAllTasksFinished(QString)));
|
||||
|
||||
connect(Core::ICore::editorManager(), SIGNAL(currentEditorChanged(Core::IEditor*)), SLOT(currentEditorChanged(Core::IEditor*)));
|
||||
connect(Core::EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)), SLOT(currentEditorChanged(Core::IEditor*)));
|
||||
|
||||
readSettings();
|
||||
return true;
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
using namespace CppTools::Internal;
|
||||
using namespace CPlusPlus;
|
||||
|
||||
CppCurrentDocumentFilter::CppCurrentDocumentFilter(CppModelManager *manager, Core::EditorManager *editorManager)
|
||||
CppCurrentDocumentFilter::CppCurrentDocumentFilter(CppModelManager *manager)
|
||||
: m_modelManager(manager)
|
||||
{
|
||||
setId("Methods in current Document");
|
||||
@@ -51,9 +51,9 @@ CppCurrentDocumentFilter::CppCurrentDocumentFilter(CppModelManager *manager, Cor
|
||||
|
||||
connect(manager, SIGNAL(documentUpdated(CPlusPlus::Document::Ptr)),
|
||||
this, SLOT(onDocumentUpdated(CPlusPlus::Document::Ptr)));
|
||||
connect(editorManager, SIGNAL(currentEditorChanged(Core::IEditor*)),
|
||||
connect(Core::EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)),
|
||||
this, SLOT(onCurrentEditorChanged(Core::IEditor*)));
|
||||
connect(editorManager, SIGNAL(editorAboutToClose(Core::IEditor*)),
|
||||
connect(Core::EditorManager::instance(), SIGNAL(editorAboutToClose(Core::IEditor*)),
|
||||
this, SLOT(onEditorAboutToClose(Core::IEditor*)));
|
||||
}
|
||||
|
||||
|
||||
@@ -33,10 +33,7 @@
|
||||
|
||||
#include <locator/ilocatorfilter.h>
|
||||
|
||||
namespace Core {
|
||||
class EditorManager;
|
||||
class IEditor;
|
||||
}
|
||||
namespace Core { class IEditor; }
|
||||
|
||||
namespace CppTools {
|
||||
namespace Internal {
|
||||
@@ -48,7 +45,7 @@ class CppCurrentDocumentFilter : public Locator::ILocatorFilter
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CppCurrentDocumentFilter(CppModelManager *manager, Core::EditorManager *editorManager);
|
||||
explicit CppCurrentDocumentFilter(CppModelManager *manager);
|
||||
~CppCurrentDocumentFilter() {}
|
||||
|
||||
QList<Locator::FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry);
|
||||
|
||||
@@ -104,7 +104,7 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
|
||||
addAutoReleasedObject(new CppLocatorFilter(modelManager));
|
||||
addAutoReleasedObject(new CppClassesFilter(modelManager));
|
||||
addAutoReleasedObject(new CppFunctionsFilter(modelManager));
|
||||
addAutoReleasedObject(new CppCurrentDocumentFilter(modelManager, Core::ICore::editorManager()));
|
||||
addAutoReleasedObject(new CppCurrentDocumentFilter(modelManager));
|
||||
addAutoReleasedObject(new CppFileSettingsPage(m_fileSettings));
|
||||
addAutoReleasedObject(new SymbolsFindFilter(modelManager));
|
||||
addAutoReleasedObject(new CppCodeStyleSettingsPage);
|
||||
|
||||
@@ -3223,10 +3223,9 @@ void DebuggerPluginPrivate::extensionsInitialized()
|
||||
SLOT(updateDebugActions()));
|
||||
|
||||
// EditorManager
|
||||
QObject *editorManager = ICore::editorManager();
|
||||
connect(editorManager, SIGNAL(editorOpened(Core::IEditor*)),
|
||||
connect(EditorManager::instance(), SIGNAL(editorOpened(Core::IEditor*)),
|
||||
SLOT(editorOpened(Core::IEditor*)));
|
||||
connect(editorManager, SIGNAL(currentEditorChanged(Core::IEditor*)),
|
||||
connect(EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)),
|
||||
SLOT(updateBreakMenuItem(Core::IEditor*)));
|
||||
|
||||
// Application interaction
|
||||
|
||||
@@ -169,7 +169,7 @@ FormEditorW::FormEditorW() :
|
||||
m_settingsPages.append(settingsPage);
|
||||
}
|
||||
|
||||
connect(Core::ICore::editorManager(), SIGNAL(currentEditorChanged(Core::IEditor*)),
|
||||
connect(Core::EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)),
|
||||
this, SLOT(currentEditorChanged(Core::IEditor*)));
|
||||
connect(m_shortcutMapper, SIGNAL(mapped(QObject*)),
|
||||
this, SLOT(updateShortcut(QObject*)));
|
||||
@@ -289,7 +289,7 @@ void FormEditorW::fullInit()
|
||||
delete initTime;
|
||||
}
|
||||
|
||||
connect(Core::ICore::editorManager(), SIGNAL(editorsClosed(QList<Core::IEditor*>)),
|
||||
connect(Core::EditorManager::instance(), SIGNAL(editorsClosed(QList<Core::IEditor*>)),
|
||||
SLOT(closeFormEditorsForXmlEditors(QList<Core::IEditor*>)));
|
||||
// Nest toolbar and editor widget
|
||||
m_editorWidget = new EditorWidget(this);
|
||||
|
||||
@@ -1041,7 +1041,7 @@ FakeVimPluginPrivate::~FakeVimPluginPrivate()
|
||||
void FakeVimPluginPrivate::onCoreAboutToClose()
|
||||
{
|
||||
// Don't attach to editors anymore.
|
||||
disconnect(ICore::editorManager(), SIGNAL(editorOpened(Core::IEditor*)),
|
||||
disconnect(EditorManager::instance(), SIGNAL(editorOpened(Core::IEditor*)),
|
||||
this, SLOT(editorOpened(Core::IEditor*)));
|
||||
}
|
||||
|
||||
@@ -1051,8 +1051,6 @@ void FakeVimPluginPrivate::aboutToShutdown()
|
||||
|
||||
bool FakeVimPluginPrivate::initialize()
|
||||
{
|
||||
EditorManager *editorManager = ICore::editorManager();
|
||||
|
||||
//m_wordCompletion = new WordCompletion;
|
||||
//q->addAutoReleasedObject(m_wordCompletion);
|
||||
m_wordProvider = new FakeVimCompletionAssistProvider;
|
||||
@@ -1102,9 +1100,9 @@ bool FakeVimPluginPrivate::initialize()
|
||||
connect(ICore::instance(), SIGNAL(coreAboutToClose()), this, SLOT(onCoreAboutToClose()));
|
||||
|
||||
// EditorManager
|
||||
connect(editorManager, SIGNAL(editorAboutToClose(Core::IEditor*)),
|
||||
connect(EditorManager::instance(), SIGNAL(editorAboutToClose(Core::IEditor*)),
|
||||
this, SLOT(editorAboutToClose(Core::IEditor*)));
|
||||
connect(editorManager, SIGNAL(editorOpened(Core::IEditor*)),
|
||||
connect(EditorManager::instance(), SIGNAL(editorOpened(Core::IEditor*)),
|
||||
this, SLOT(editorOpened(Core::IEditor*)));
|
||||
|
||||
connect(theFakeVimSetting(ConfigUseFakeVim), SIGNAL(valueChanged(QVariant)),
|
||||
@@ -1867,17 +1865,16 @@ void FakeVimPluginPrivate::handleDelayedQuit(bool forced, IEditor *editor)
|
||||
{
|
||||
// This tries to simulate vim behaviour. But the models of vim and
|
||||
// Qt Creator core do not match well...
|
||||
EditorManager *editorManager = ICore::editorManager();
|
||||
if (editorManager->hasSplitter())
|
||||
if (EditorManager::hasSplitter())
|
||||
triggerAction(Core::Constants::REMOVE_CURRENT_SPLIT);
|
||||
else
|
||||
editorManager->closeEditor(editor, !forced);
|
||||
EditorManager::closeEditor(editor, !forced);
|
||||
}
|
||||
|
||||
void FakeVimPluginPrivate::handleDelayedQuitAll(bool forced)
|
||||
{
|
||||
triggerAction(Core::Constants::REMOVE_ALL_SPLITS);
|
||||
ICore::editorManager()->closeAllEditors(!forced);
|
||||
EditorManager::closeAllEditors(!forced);
|
||||
}
|
||||
|
||||
void FakeVimPluginPrivate::moveToMatchingParenthesis(bool *moved, bool *forward,
|
||||
|
||||
@@ -1053,7 +1053,7 @@ void GitPlugin::submitCurrentLog()
|
||||
{
|
||||
// Close the submit editor
|
||||
m_submitActionTriggered = true;
|
||||
Core::ICore::editorManager()->closeEditor();
|
||||
Core::EditorManager::closeEditor();
|
||||
}
|
||||
|
||||
bool GitPlugin::submitEditorAboutToClose()
|
||||
|
||||
@@ -53,8 +53,8 @@ QList<FilterEntry> *categorize(const QString &entry, const QString &candidate,
|
||||
|
||||
} // anynoumous namespace
|
||||
|
||||
FileSystemFilter::FileSystemFilter(EditorManager *editorManager, LocatorWidget *locatorWidget)
|
||||
: m_editorManager(editorManager), m_locatorWidget(locatorWidget), m_includeHidden(true)
|
||||
FileSystemFilter::FileSystemFilter(LocatorWidget *locatorWidget)
|
||||
: m_locatorWidget(locatorWidget), m_includeHidden(true)
|
||||
{
|
||||
setId("Files in file system");
|
||||
setDisplayName(tr("Files in File System"));
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
#include <QByteArray>
|
||||
#include <QFutureInterface>
|
||||
|
||||
namespace Core { class EditorManager; }
|
||||
|
||||
namespace Locator {
|
||||
namespace Internal {
|
||||
|
||||
@@ -50,7 +48,7 @@ class FileSystemFilter : public Locator::ILocatorFilter
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FileSystemFilter(Core::EditorManager *editorManager, LocatorWidget *locatorWidget);
|
||||
explicit FileSystemFilter(LocatorWidget *locatorWidget);
|
||||
QList<Locator::FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry);
|
||||
void accept(Locator::FilterEntry selection) const;
|
||||
QByteArray saveState() const;
|
||||
@@ -59,7 +57,6 @@ public:
|
||||
void refresh(QFutureInterface<void> &) {}
|
||||
|
||||
private:
|
||||
Core::EditorManager *m_editorManager;
|
||||
LocatorWidget *m_locatorWidget;
|
||||
bool m_includeHidden;
|
||||
};
|
||||
|
||||
@@ -122,10 +122,10 @@ bool LocatorPlugin::initialize(const QStringList &, QString *)
|
||||
|
||||
addObject(new LocatorManager(m_locatorWidget));
|
||||
|
||||
m_openDocumentsFilter = new OpenDocumentsFilter(Core::ICore::editorManager());
|
||||
m_openDocumentsFilter = new OpenDocumentsFilter;
|
||||
addObject(m_openDocumentsFilter);
|
||||
|
||||
m_fileSystemFilter = new FileSystemFilter(Core::ICore::editorManager(), m_locatorWidget);
|
||||
m_fileSystemFilter = new FileSystemFilter(m_locatorWidget);
|
||||
addObject(m_fileSystemFilter);
|
||||
|
||||
m_executeFilter = new ExecuteFilter();
|
||||
|
||||
@@ -40,17 +40,16 @@ using namespace Locator;
|
||||
using namespace Locator::Internal;
|
||||
using namespace Utils;
|
||||
|
||||
OpenDocumentsFilter::OpenDocumentsFilter(EditorManager *editorManager) :
|
||||
m_editorManager(editorManager)
|
||||
OpenDocumentsFilter::OpenDocumentsFilter()
|
||||
{
|
||||
setId("Open documents");
|
||||
setDisplayName(tr("Open Documents"));
|
||||
setShortcutString(QString(QLatin1Char('o')));
|
||||
setIncludedByDefault(true);
|
||||
|
||||
connect(m_editorManager, SIGNAL(editorOpened(Core::IEditor*)),
|
||||
connect(EditorManager::instance(), SIGNAL(editorOpened(Core::IEditor*)),
|
||||
this, SLOT(refreshInternally()));
|
||||
connect(m_editorManager, SIGNAL(editorsClosed(QList<Core::IEditor*>)),
|
||||
connect(EditorManager::instance(), SIGNAL(editorsClosed(QList<Core::IEditor*>)),
|
||||
this, SLOT(refreshInternally()));
|
||||
}
|
||||
|
||||
|
||||
@@ -38,10 +38,6 @@
|
||||
#include <QList>
|
||||
#include <QFutureInterface>
|
||||
|
||||
namespace Core {
|
||||
class EditorManager;
|
||||
}
|
||||
|
||||
namespace Locator {
|
||||
namespace Internal {
|
||||
|
||||
@@ -50,7 +46,7 @@ class OpenDocumentsFilter : public Locator::ILocatorFilter
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OpenDocumentsFilter(Core::EditorManager *editorManager);
|
||||
OpenDocumentsFilter();
|
||||
QList<Locator::FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry);
|
||||
void accept(Locator::FilterEntry selection) const;
|
||||
void refresh(QFutureInterface<void> &future);
|
||||
@@ -59,8 +55,6 @@ public slots:
|
||||
void refreshInternally();
|
||||
|
||||
private:
|
||||
Core::EditorManager *m_editorManager;
|
||||
|
||||
QList<Core::DocumentModel::Entry> m_editors;
|
||||
};
|
||||
|
||||
|
||||
@@ -596,7 +596,7 @@ void MercurialPlugin::commitFromEditor()
|
||||
{
|
||||
// Close the submit editor
|
||||
m_submitActionTriggered = true;
|
||||
Core::ICore::editorManager()->closeEditor();
|
||||
Core::EditorManager::closeEditor();
|
||||
}
|
||||
|
||||
bool MercurialPlugin::submitEditorAboutToClose()
|
||||
|
||||
@@ -1087,7 +1087,7 @@ void ProjectExplorerPlugin::closeAllProjects()
|
||||
if (debug)
|
||||
qDebug() << "ProjectExplorerPlugin::closeAllProject";
|
||||
|
||||
if (!Core::ICore::editorManager()->closeAllEditors())
|
||||
if (!Core::EditorManager::closeAllEditors())
|
||||
return; // Action has been cancelled
|
||||
|
||||
d->m_session->closeAllProjects();
|
||||
|
||||
@@ -87,15 +87,13 @@ SessionManager::SessionManager(QObject *parent)
|
||||
connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)),
|
||||
this, SLOT(saveActiveMode(Core::IMode*)));
|
||||
|
||||
EditorManager *em = ICore::editorManager();
|
||||
|
||||
connect(em, SIGNAL(editorCreated(Core::IEditor*,QString)),
|
||||
connect(EditorManager::instance(), SIGNAL(editorCreated(Core::IEditor*,QString)),
|
||||
this, SLOT(configureEditor(Core::IEditor*,QString)));
|
||||
connect(ProjectExplorerPlugin::instance(), SIGNAL(currentProjectChanged(ProjectExplorer::Project*)),
|
||||
this, SLOT(updateWindowTitle()));
|
||||
connect(em, SIGNAL(editorOpened(Core::IEditor*)),
|
||||
connect(EditorManager::instance(), SIGNAL(editorOpened(Core::IEditor*)),
|
||||
this, SLOT(markSessionFileDirty()));
|
||||
connect(em, SIGNAL(editorsClosed(QList<Core::IEditor*>)),
|
||||
connect(EditorManager::instance(), SIGNAL(editorsClosed(QList<Core::IEditor*>)),
|
||||
this, SLOT(markSessionFileDirty()));
|
||||
}
|
||||
|
||||
@@ -339,7 +337,7 @@ bool SessionManager::save()
|
||||
++i;
|
||||
}
|
||||
data.insert(QLatin1String("ProjectDependencies"), QVariant(depMap));
|
||||
data.insert(QLatin1String("EditorSettings"), ICore::editorManager()->saveState().toBase64());
|
||||
data.insert(QLatin1String("EditorSettings"), EditorManager::saveState().toBase64());
|
||||
|
||||
QMap<QString, QVariant>::const_iterator it, end;
|
||||
end = m_values.constEnd();
|
||||
@@ -536,14 +534,14 @@ void SessionManager::updateWindowTitle()
|
||||
{
|
||||
if (isDefaultSession(m_sessionName)) {
|
||||
if (Project *currentProject = ProjectExplorerPlugin::currentProject())
|
||||
ICore::editorManager()->setWindowTitleAddition(currentProject->displayName());
|
||||
EditorManager::setWindowTitleAddition(currentProject->displayName());
|
||||
else
|
||||
ICore::editorManager()->setWindowTitleAddition(QString());
|
||||
EditorManager::setWindowTitleAddition(QString());
|
||||
} else {
|
||||
QString sessionName = m_sessionName;
|
||||
if (sessionName.isEmpty())
|
||||
sessionName = tr("Untitled");
|
||||
ICore::editorManager()->setWindowTitleAddition(sessionName);
|
||||
EditorManager::setWindowTitleAddition(sessionName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -782,8 +780,7 @@ void SessionManager::restoreEditors(const Utils::PersistentSettingsReader &reade
|
||||
{
|
||||
const QVariant &editorsettings = reader.restoreValue(QLatin1String("EditorSettings"));
|
||||
if (editorsettings.isValid()) {
|
||||
ICore::editorManager()->restoreState(
|
||||
QByteArray::fromBase64(editorsettings.toByteArray()));
|
||||
EditorManager::restoreState(QByteArray::fromBase64(editorsettings.toByteArray()));
|
||||
sessionLoadingProgress();
|
||||
}
|
||||
}
|
||||
@@ -841,7 +838,7 @@ bool SessionManager::loadSession(const QString &session)
|
||||
}
|
||||
|
||||
// Clean up
|
||||
if (!ICore::editorManager()->closeAllEditors()) {
|
||||
if (!EditorManager::closeAllEditors()) {
|
||||
m_loadingSession = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -152,12 +152,12 @@ void QmlDesignerPlugin::createDesignModeWidget()
|
||||
|
||||
m_shortCutManager.registerActions(qmlDesignerMainContext, qmlDesignerFormEditorContext, qmlDesignerNavigatorContext);
|
||||
|
||||
connect(Core::ICore::editorManager(),
|
||||
connect(Core::EditorManager::instance(),
|
||||
SIGNAL(currentEditorChanged(Core::IEditor*)),
|
||||
this,
|
||||
SLOT(onCurrentEditorChanged(Core::IEditor*)));
|
||||
|
||||
connect(Core::ICore::editorManager(),
|
||||
connect(Core::EditorManager::instance(),
|
||||
SIGNAL(editorsClosed(QList<Core::IEditor*>)),
|
||||
this,
|
||||
SLOT(onTextEditorsClosed(QList<Core::IEditor*>)));
|
||||
|
||||
@@ -78,28 +78,29 @@ void ShortCutManager::registerActions(const Core::Context &qmlDesignerMainContex
|
||||
SLOT(toggleRightSidebar()));
|
||||
|
||||
// Revert to saved
|
||||
QObject *em = Core::EditorManager::instance();
|
||||
Core::ActionManager::registerAction(&m_revertToSavedAction,Core::Constants::REVERTTOSAVED, qmlDesignerMainContext);
|
||||
connect(&m_revertToSavedAction, SIGNAL(triggered()), Core::ICore::editorManager(), SLOT(revertToSaved()));
|
||||
connect(&m_revertToSavedAction, SIGNAL(triggered()), em, SLOT(revertToSaved()));
|
||||
|
||||
//Save
|
||||
Core::ActionManager::registerAction(&m_saveAction, Core::Constants::SAVE, qmlDesignerMainContext);
|
||||
connect(&m_saveAction, SIGNAL(triggered()), Core::ICore::editorManager(), SLOT(saveDocument()));
|
||||
connect(&m_saveAction, SIGNAL(triggered()), em, SLOT(saveDocument()));
|
||||
|
||||
//Save As
|
||||
Core::ActionManager::registerAction(&m_saveAsAction, Core::Constants::SAVEAS, qmlDesignerMainContext);
|
||||
connect(&m_saveAsAction, SIGNAL(triggered()), Core::ICore::editorManager(), SLOT(saveDocumentAs()));
|
||||
connect(&m_saveAsAction, SIGNAL(triggered()), em, SLOT(saveDocumentAs()));
|
||||
|
||||
//Close Editor
|
||||
Core::ActionManager::registerAction(&m_closeCurrentEditorAction, Core::Constants::CLOSE, qmlDesignerMainContext);
|
||||
connect(&m_closeCurrentEditorAction, SIGNAL(triggered()), Core::ICore::editorManager(), SLOT(closeEditor()));
|
||||
connect(&m_closeCurrentEditorAction, SIGNAL(triggered()), em, SLOT(closeEditor()));
|
||||
|
||||
//Close All
|
||||
Core::ActionManager::registerAction(&m_closeAllEditorsAction, Core::Constants::CLOSEALL, qmlDesignerMainContext);
|
||||
connect(&m_closeAllEditorsAction, SIGNAL(triggered()), Core::ICore::editorManager(), SLOT(closeAllEditors()));
|
||||
connect(&m_closeAllEditorsAction, SIGNAL(triggered()), em, SLOT(closeAllEditors()));
|
||||
|
||||
//Close All Others Action
|
||||
Core::ActionManager::registerAction(&m_closeOtherEditorsAction, Core::Constants::CLOSEOTHERS, qmlDesignerMainContext);
|
||||
connect(&m_closeOtherEditorsAction, SIGNAL(triggered()), Core::ICore::editorManager(), SLOT(closeOtherEditors()));
|
||||
connect(&m_closeOtherEditorsAction, SIGNAL(triggered()), em, SLOT(closeOtherEditors()));
|
||||
|
||||
// Undo / Redo
|
||||
Core::ActionManager::registerAction(&m_undoAction, Core::Constants::UNDO, qmlDesignerMainContext);
|
||||
|
||||
@@ -242,7 +242,7 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e
|
||||
addAutoReleasedObject(new QuickToolBar);
|
||||
addAutoReleasedObject(new Internal::QuickToolBarSettingsPage);
|
||||
|
||||
connect(Core::ICore::editorManager(), SIGNAL(currentEditorChanged(Core::IEditor*)), SLOT(currentEditorChanged(Core::IEditor*)));
|
||||
connect(Core::EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)), SLOT(currentEditorChanged(Core::IEditor*)));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ using namespace Core;
|
||||
BaseHoverHandler::BaseHoverHandler(QObject *parent) : QObject(parent), m_diagnosticTooltip(false)
|
||||
{
|
||||
// Listen for editor opened events in order to connect to tooltip/helpid requests
|
||||
connect(ICore::editorManager(), SIGNAL(editorOpened(Core::IEditor*)),
|
||||
connect(Core::EditorManager::instance(), SIGNAL(editorOpened(Core::IEditor*)),
|
||||
this, SLOT(editorOpened(Core::IEditor*)));
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ using namespace TextEditor::Internal;
|
||||
FindInCurrentFile::FindInCurrentFile()
|
||||
: m_currentDocument(0)
|
||||
{
|
||||
connect(Core::ICore::editorManager(), SIGNAL(currentEditorChanged(Core::IEditor*)),
|
||||
connect(Core::EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)),
|
||||
this, SLOT(handleFileChange(Core::IEditor*)));
|
||||
handleFileChange(Core::EditorManager::currentEditor());
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ TextEditorActionHandler::TextEditorActionHandler(const char *context,
|
||||
m_contextId(context),
|
||||
m_initialized(false)
|
||||
{
|
||||
connect(Core::ICore::editorManager(), SIGNAL(currentEditorChanged(Core::IEditor*)),
|
||||
connect(Core::EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)),
|
||||
this, SLOT(updateCurrentEditor(Core::IEditor*)));
|
||||
}
|
||||
|
||||
|
||||
@@ -311,7 +311,7 @@ void CallgrindToolPrivate::selectFunction(const Function *func)
|
||||
if (QFile::exists(func->file())) {
|
||||
///TODO: custom position support?
|
||||
int line = func->lineNumber();
|
||||
Core::EditorManager::openEditorAt(func->file(), qMax(line, 0));
|
||||
EditorManager::openEditorAt(func->file(), qMax(line, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -493,7 +493,7 @@ CallgrindTool::CallgrindTool(QObject *parent)
|
||||
d = new CallgrindToolPrivate(this);
|
||||
setObjectName(QLatin1String("CallgrindTool"));
|
||||
|
||||
connect(Core::ICore::editorManager(), SIGNAL(editorOpened(Core::IEditor*)),
|
||||
connect(EditorManager::instance(), SIGNAL(editorOpened(Core::IEditor*)),
|
||||
d, SLOT(editorOpened(Core::IEditor*)));
|
||||
}
|
||||
|
||||
@@ -846,7 +846,7 @@ void CallgrindToolPrivate::showParserResults(const ParseData *data)
|
||||
AnalyzerManager::showStatusMessage(msg);
|
||||
}
|
||||
|
||||
void CallgrindToolPrivate::editorOpened(Core::IEditor *editor)
|
||||
void CallgrindToolPrivate::editorOpened(IEditor *editor)
|
||||
{
|
||||
TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor *>(editor);
|
||||
if (!textEditor)
|
||||
|
||||
@@ -206,9 +206,9 @@ public slots:
|
||||
StateListener::StateListener(QObject *parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
connect(Core::ICore::editorManager(), SIGNAL(currentEditorChanged(Core::IEditor*)),
|
||||
connect(Core::EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)),
|
||||
this, SLOT(slotStateChanged()));
|
||||
connect(Core::ICore::editorManager(), SIGNAL(currentDocumentStateChanged()),
|
||||
connect(Core::EditorManager::instance(), SIGNAL(currentDocumentStateChanged()),
|
||||
this, SLOT(slotStateChanged()));
|
||||
connect(Core::ICore::vcsManager(), SIGNAL(repositoryChanged(QString)),
|
||||
this, SLOT(slotStateChanged()));
|
||||
|
||||
Reference in New Issue
Block a user