forked from qt-creator/qt-creator
EditorManager: Use static pattern, adjust surrounding code
Change-Id: I3255a0150cd9a730336456c5a9f986eb74fefbff Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
@@ -579,8 +579,7 @@ void BookmarkManager::documentPrevNext(bool next)
|
||||
nextLine = markLine;
|
||||
}
|
||||
|
||||
Core::EditorManager *em = Core::EditorManager::instance();
|
||||
em->addCurrentPositionToNavigationHistory();
|
||||
EditorManager::addCurrentPositionToNavigationHistory();
|
||||
if (next) {
|
||||
if (nextLine == -1)
|
||||
editor->gotoLine(firstLine);
|
||||
|
||||
@@ -1350,7 +1350,7 @@ void ClearCasePlugin::describe(const QString &source, const QString &changeNr)
|
||||
void ClearCasePlugin::checkInSelected()
|
||||
{
|
||||
m_submitActionTriggered = true;
|
||||
Core::EditorManager::instance()->closeEditor();
|
||||
Core::EditorManager::closeEditor();
|
||||
}
|
||||
|
||||
QString ClearCasePlugin::runCleartoolSync(const QString &workingDir,
|
||||
|
||||
@@ -267,7 +267,7 @@ int ReadOnlyFilesDialog::exec()
|
||||
}
|
||||
break;
|
||||
case RO_SaveAs:
|
||||
if (!EditorManager::instance()->saveDocumentAs(d->document)) {
|
||||
if (!EditorManager::saveDocumentAs(d->document)) {
|
||||
failedToMakeWritable << buttengroup.fileName;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -646,7 +646,7 @@ static QList<IDocument *> saveModifiedFilesHelper(const QList<IDocument *> &docu
|
||||
}
|
||||
}
|
||||
foreach (IDocument *document, documentsToSave) {
|
||||
if (!EditorManager::instance()->saveDocument(document)) {
|
||||
if (!EditorManager::saveDocument(document)) {
|
||||
if (cancelled)
|
||||
*cancelled = true;
|
||||
notSaved.append(document);
|
||||
@@ -823,7 +823,7 @@ void DocumentManager::checkForReload()
|
||||
|
||||
d->m_blockActivated = true;
|
||||
|
||||
IDocument::ReloadSetting defaultBehavior = EditorManager::instance()->reloadSetting();
|
||||
IDocument::ReloadSetting defaultBehavior = EditorManager::reloadSetting();
|
||||
Utils::ReloadPromptAnswer previousAnswer = Utils::ReloadCurrent;
|
||||
|
||||
QList<IDocument *> documentsToClose;
|
||||
@@ -1340,7 +1340,7 @@ void DocumentManager::executeOpenWithMenuAction(QAction *action)
|
||||
if (entry.editorFactory->id() == openEditor->id())
|
||||
editorsOpenForFile.removeAll(openEditor);
|
||||
}
|
||||
if (!EditorManager::instance()->closeEditors(editorsOpenForFile)) // don't open if cancel was pressed
|
||||
if (!EditorManager::closeEditors(editorsOpenForFile)) // don't open if cancel was pressed
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,6 @@ EditMode::EditMode() :
|
||||
m_splitter(new MiniSplitter),
|
||||
m_rightSplitWidgetLayout(new QVBoxLayout)
|
||||
{
|
||||
m_editorManager = EditorManager::instance();
|
||||
setObjectName(QLatin1String("EditMode"));
|
||||
setDisplayName(tr("Edit"));
|
||||
setIcon(QIcon(QLatin1String(":/fancyactionbar/images/mode_Edit.png")));
|
||||
@@ -84,7 +83,7 @@ EditMode::EditMode() :
|
||||
|
||||
connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)),
|
||||
this, SLOT(grabEditorManager(Core::IMode*)));
|
||||
m_splitter->setFocusProxy(m_editorManager);
|
||||
m_splitter->setFocusProxy(EditorManager::instance());
|
||||
|
||||
setWidget(m_splitter);
|
||||
setContext(Context(Constants::C_EDIT_MODE,
|
||||
@@ -95,7 +94,7 @@ EditMode::EditMode() :
|
||||
EditMode::~EditMode()
|
||||
{
|
||||
// Make sure the editor manager does not get deleted
|
||||
m_editorManager->setParent(0);
|
||||
EditorManager::instance()->setParent(0);
|
||||
delete m_splitter;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,6 @@ private slots:
|
||||
void grabEditorManager(Core::IMode *mode);
|
||||
|
||||
private:
|
||||
EditorManager *m_editorManager;
|
||||
QSplitter *m_splitter;
|
||||
QVBoxLayout *m_rightSplitWidgetLayout;
|
||||
};
|
||||
|
||||
@@ -96,31 +96,15 @@ namespace Internal {
|
||||
class EditorClosingCoreListener : public ICoreListener
|
||||
{
|
||||
public:
|
||||
EditorClosingCoreListener(EditorManager *em);
|
||||
bool editorAboutToClose(IEditor *editor);
|
||||
bool coreAboutToClose();
|
||||
|
||||
private:
|
||||
EditorManager *m_em;
|
||||
bool editorAboutToClose(IEditor *) { return true; }
|
||||
bool coreAboutToClose()
|
||||
{
|
||||
// Do not ask for files to save.
|
||||
// MainWindow::closeEvent has already done that.
|
||||
return EditorManager::closeAllEditors(false);
|
||||
}
|
||||
};
|
||||
|
||||
EditorClosingCoreListener::EditorClosingCoreListener(EditorManager *em)
|
||||
: m_em(em)
|
||||
{
|
||||
}
|
||||
|
||||
bool EditorClosingCoreListener::editorAboutToClose(IEditor *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EditorClosingCoreListener::coreAboutToClose()
|
||||
{
|
||||
// Do not ask for files to save.
|
||||
// MainWindow::closeEvent has already done that.
|
||||
return m_em->closeAllEditors(false);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Core
|
||||
|
||||
@@ -269,7 +253,7 @@ EditorManagerPrivate::~EditorManagerPrivate()
|
||||
static EditorManager *m_instance = 0;
|
||||
static EditorManagerPrivate *d;
|
||||
|
||||
EditorManager *EditorManager::instance() { return m_instance; }
|
||||
QWidget *EditorManager::instance() { return m_instance; }
|
||||
|
||||
EditorManager::EditorManager(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
@@ -477,7 +461,7 @@ EditorManager::~EditorManager()
|
||||
|
||||
void EditorManager::init()
|
||||
{
|
||||
d->m_coreListener = new EditorClosingCoreListener(this);
|
||||
d->m_coreListener = new EditorClosingCoreListener();
|
||||
ExtensionSystem::PluginManager::addObject(d->m_coreListener);
|
||||
|
||||
d->m_openEditorsFactory = new OpenEditorsViewFactory();
|
||||
@@ -489,7 +473,7 @@ void EditorManager::init()
|
||||
VariableManager::registerVariable(kCurrentDocumentYPos,
|
||||
tr("Y-coordinate of the current editor's upper left corner, relative to screen."));
|
||||
connect(VariableManager::instance(), SIGNAL(variableUpdateRequested(QByteArray)),
|
||||
this, SLOT(updateVariable(QByteArray)));
|
||||
m_instance, SLOT(updateVariable(QByteArray)));
|
||||
}
|
||||
|
||||
void EditorManager::updateAutoSave()
|
||||
@@ -530,7 +514,7 @@ void EditorManager::handleContextChange(const QList<Core::IContext *> &context)
|
||||
// the locator line edit) first activates the window and sets focus to its focus widget.
|
||||
// Only afterwards the focus is shifted to the widget that received the click.
|
||||
d->m_scheduledCurrentEditor = editor;
|
||||
QTimer::singleShot(0, this, SLOT(setCurrentEditorFromContextChange()));
|
||||
QTimer::singleShot(0, m_instance, SLOT(setCurrentEditorFromContextChange()));
|
||||
} else {
|
||||
updateActions();
|
||||
}
|
||||
@@ -555,7 +539,7 @@ void EditorManager::setCurrentEditor(IEditor *editor, bool ignoreNavigationHisto
|
||||
}
|
||||
updateActions();
|
||||
updateWindowTitle();
|
||||
emit currentEditorChanged(editor);
|
||||
emit m_instance->currentEditorChanged(editor);
|
||||
}
|
||||
|
||||
|
||||
@@ -578,7 +562,7 @@ void EditorManager::setCurrentView(Internal::EditorView *view)
|
||||
}
|
||||
}
|
||||
|
||||
Internal::EditorView *EditorManager::currentEditorView() const
|
||||
Internal::EditorView *EditorManager::currentEditorView()
|
||||
{
|
||||
EditorView *view = d->m_currentView;
|
||||
if (!view) {
|
||||
@@ -656,12 +640,12 @@ void EditorManager::emptyView(Core::Internal::EditorView *view)
|
||||
view->removeEditor(editor);
|
||||
continue; // don't close the editor
|
||||
}
|
||||
emit editorAboutToClose(editor);
|
||||
emit m_instance->editorAboutToClose(editor);
|
||||
removeEditor(editor);
|
||||
view->removeEditor(editor);
|
||||
}
|
||||
if (!editors.isEmpty()) {
|
||||
emit editorsClosed(editors);
|
||||
emit m_instance->editorsClosed(editors);
|
||||
foreach (IEditor *editor, editors) {
|
||||
delete editor;
|
||||
}
|
||||
@@ -1078,7 +1062,7 @@ bool EditorManager::closeEditors(const QList<IEditor*> &editorsToClose, bool ask
|
||||
|
||||
// remove the editors
|
||||
foreach (IEditor *editor, acceptedEditors) {
|
||||
emit editorAboutToClose(editor);
|
||||
emit m_instance->editorAboutToClose(editor);
|
||||
if (!editor->document()->filePath().isEmpty()
|
||||
&& !editor->document()->isTemporary()) {
|
||||
QByteArray state = editor->saveState();
|
||||
@@ -1127,7 +1111,7 @@ bool EditorManager::closeEditors(const QList<IEditor*> &editorsToClose, bool ask
|
||||
}
|
||||
}
|
||||
|
||||
emit editorsClosed(acceptedEditors.toList());
|
||||
emit m_instance->editorsClosed(acceptedEditors.toList());
|
||||
|
||||
foreach (IEditor *editor, acceptedEditors) {
|
||||
delete editor;
|
||||
@@ -1141,7 +1125,7 @@ bool EditorManager::closeEditors(const QList<IEditor*> &editorsToClose, bool ask
|
||||
}
|
||||
|
||||
if (!currentEditor()) {
|
||||
emit currentEditorChanged(0);
|
||||
emit m_instance->currentEditorChanged(0);
|
||||
updateActions();
|
||||
updateWindowTitle();
|
||||
}
|
||||
@@ -1149,7 +1133,7 @@ bool EditorManager::closeEditors(const QList<IEditor*> &editorsToClose, bool ask
|
||||
return !closingFailed;
|
||||
}
|
||||
|
||||
Core::IEditor *EditorManager::pickUnusedEditor(EditorView **foundView) const
|
||||
Core::IEditor *EditorManager::pickUnusedEditor(EditorView **foundView)
|
||||
{
|
||||
foreach (IEditor *editor,
|
||||
d->m_documentModel->editorsForDocuments(d->m_documentModel->openedDocuments())) {
|
||||
@@ -1413,13 +1397,13 @@ void EditorManager::addEditor(IEditor *editor)
|
||||
if (!isTemporary)
|
||||
DocumentManager::addToRecentFiles(editor->document()->filePath(), editor->id());
|
||||
}
|
||||
emit editorOpened(editor);
|
||||
emit m_instance->editorOpened(editor);
|
||||
}
|
||||
|
||||
// Run the OpenWithDialog and return the editor id
|
||||
// selected by the user.
|
||||
Core::Id EditorManager::getOpenWithEditorId(const QString &fileName,
|
||||
bool *isExternalEditor) const
|
||||
bool *isExternalEditor)
|
||||
{
|
||||
// Collect editors that can open the file
|
||||
MimeType mt = ICore::mimeDatabase()->findByFile(fileName);
|
||||
@@ -1619,7 +1603,7 @@ bool EditorManager::openExternalEditor(const QString &fileName, const Core::Id &
|
||||
return ok;
|
||||
}
|
||||
|
||||
QStringList EditorManager::getOpenFileNames() const
|
||||
QStringList EditorManager::getOpenFileNames()
|
||||
{
|
||||
QString selectedFilter;
|
||||
const QString &fileFilters = ICore::mimeDatabase()->allFiltersString(&selectedFilter);
|
||||
@@ -1945,12 +1929,12 @@ void EditorManager::updateMakeWritableWarning()
|
||||
InfoBarEntry info(Id(kMakeWritableWarning),
|
||||
tr("<b>Warning:</b> This file was not opened in %1 yet.")
|
||||
.arg(versionControl->displayName()));
|
||||
info.setCustomButtonInfo(tr("Open"), this, SLOT(vcsOpenCurrentEditor()));
|
||||
info.setCustomButtonInfo(tr("Open"), m_instance, SLOT(vcsOpenCurrentEditor()));
|
||||
document->infoBar()->addInfo(info);
|
||||
} else {
|
||||
InfoBarEntry info(Id(kMakeWritableWarning),
|
||||
tr("<b>Warning:</b> You are changing a read-only file."));
|
||||
info.setCustomButtonInfo(tr("Make Writable"), this, SLOT(makeCurrentEditorWritable()));
|
||||
info.setCustomButtonInfo(tr("Make Writable"), m_instance, SLOT(makeCurrentEditorWritable()));
|
||||
document->infoBar()->addInfo(info);
|
||||
}
|
||||
} else {
|
||||
@@ -1984,10 +1968,10 @@ void EditorManager::updateActions()
|
||||
|
||||
if (curDocument) {
|
||||
if (HostOsInfo::isMacHost())
|
||||
window()->setWindowModified(curDocument->isModified());
|
||||
m_instance->window()->setWindowModified(curDocument->isModified());
|
||||
updateMakeWritableWarning();
|
||||
} else /* curEditor */ if (HostOsInfo::isMacHost()) {
|
||||
window()->setWindowModified(false);
|
||||
m_instance->window()->setWindowModified(false);
|
||||
}
|
||||
|
||||
foreach (SplitterOrView *root, d->m_root)
|
||||
@@ -2031,7 +2015,7 @@ void EditorManager::setCloseSplitEnabled(SplitterOrView *splitterOrView, bool en
|
||||
}
|
||||
}
|
||||
|
||||
bool EditorManager::hasSplitter() const
|
||||
bool EditorManager::hasSplitter()
|
||||
{
|
||||
EditorView *view = currentEditorView();
|
||||
QTC_ASSERT(view, return false);
|
||||
@@ -2040,7 +2024,7 @@ bool EditorManager::hasSplitter() const
|
||||
return root->isSplitter();
|
||||
}
|
||||
|
||||
QList<IEditor*> EditorManager::visibleEditors() const
|
||||
QList<IEditor*> EditorManager::visibleEditors()
|
||||
{
|
||||
QList<IEditor *> editors;
|
||||
foreach (SplitterOrView *root, d->m_root) {
|
||||
@@ -2098,12 +2082,12 @@ void EditorManager::goForwardInNavigationHistory()
|
||||
updateActions();
|
||||
}
|
||||
|
||||
OpenEditorsWindow *EditorManager::windowPopup() const
|
||||
OpenEditorsWindow *EditorManager::windowPopup()
|
||||
{
|
||||
return d->m_windowPopup;
|
||||
}
|
||||
|
||||
void EditorManager::showPopupOrSelectDocument() const
|
||||
void EditorManager::showPopupOrSelectDocument()
|
||||
{
|
||||
if (QApplication::keyboardModifiers() == Qt::NoModifier) {
|
||||
windowPopup()->selectAndHide();
|
||||
@@ -2134,7 +2118,7 @@ void EditorManager::showPopupOrSelectDocument() const
|
||||
}
|
||||
|
||||
// Save state of all non-teporary editors.
|
||||
QByteArray EditorManager::saveState() const
|
||||
QByteArray EditorManager::saveState()
|
||||
{
|
||||
QByteArray bytes;
|
||||
QDataStream stream(&bytes, QIODevice::WriteOnly);
|
||||
@@ -2323,7 +2307,7 @@ void EditorManager::setReloadSetting(IDocument::ReloadSetting behavior)
|
||||
d->m_reloadSetting = behavior;
|
||||
}
|
||||
|
||||
IDocument::ReloadSetting EditorManager::reloadSetting() const
|
||||
IDocument::ReloadSetting EditorManager::reloadSetting()
|
||||
{
|
||||
return d->m_reloadSetting;
|
||||
}
|
||||
@@ -2334,7 +2318,7 @@ void EditorManager::setAutoSaveEnabled(bool enabled)
|
||||
updateAutoSave();
|
||||
}
|
||||
|
||||
bool EditorManager::autoSaveEnabled() const
|
||||
bool EditorManager::autoSaveEnabled()
|
||||
{
|
||||
return d->m_autoSaveEnabled;
|
||||
}
|
||||
@@ -2345,12 +2329,12 @@ void EditorManager::setAutoSaveInterval(int interval)
|
||||
updateAutoSave();
|
||||
}
|
||||
|
||||
int EditorManager::autoSaveInterval() const
|
||||
int EditorManager::autoSaveInterval()
|
||||
{
|
||||
return d->m_autoSaveInterval;
|
||||
}
|
||||
|
||||
QTextCodec *EditorManager::defaultTextCodec() const
|
||||
QTextCodec *EditorManager::defaultTextCodec()
|
||||
{
|
||||
QSettings *settings = Core::ICore::settings();
|
||||
if (QTextCodec *candidate = QTextCodec::codecForName(
|
||||
@@ -2368,7 +2352,7 @@ Core::IEditor *EditorManager::duplicateEditor(Core::IEditor *editor)
|
||||
|
||||
IEditor *duplicate = editor->duplicate(0);
|
||||
duplicate->restoreState(editor->saveState());
|
||||
emit editorCreated(duplicate, duplicate->document()->filePath());
|
||||
emit m_instance->editorCreated(duplicate, duplicate->document()->filePath());
|
||||
addEditor(duplicate);
|
||||
return duplicate;
|
||||
}
|
||||
@@ -2502,7 +2486,7 @@ void EditorManager::setWindowTitleAddition(const QString &addition)
|
||||
updateWindowTitle();
|
||||
}
|
||||
|
||||
QString EditorManager::windowTitleAddition() const
|
||||
QString EditorManager::windowTitleAddition()
|
||||
{
|
||||
return d->m_titleAddition;
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ public:
|
||||
typedef QList<IEditorFactory *> EditorFactoryList;
|
||||
typedef QList<IExternalEditor *> ExternalEditorList;
|
||||
|
||||
static EditorManager *instance();
|
||||
static QWidget *instance();
|
||||
|
||||
static EditorToolBar *createToolBar(QWidget *parent = 0);
|
||||
|
||||
@@ -119,74 +119,74 @@ public:
|
||||
|
||||
static bool openExternalEditor(const QString &fileName, const Id &editorId);
|
||||
|
||||
QStringList getOpenFileNames() const;
|
||||
Id getOpenWithEditorId(const QString &fileName, bool *isExternalEditor = 0) const;
|
||||
static QStringList getOpenFileNames();
|
||||
static Id getOpenWithEditorId(const QString &fileName, bool *isExternalEditor = 0);
|
||||
|
||||
static IDocument *currentDocument();
|
||||
static IEditor *currentEditor();
|
||||
QList<IEditor *> visibleEditors() const;
|
||||
static QList<IEditor *> visibleEditors();
|
||||
|
||||
static void activateEditor(IEditor *editor, OpenEditorFlags flags = 0);
|
||||
void activateEditorForEntry(DocumentModel::Entry *entry, OpenEditorFlags flags = 0);
|
||||
IEditor *activateEditorForDocument(IDocument *document, OpenEditorFlags flags = 0);
|
||||
IEditor *activateEditorForDocument(Internal::EditorView *view, IDocument *document, OpenEditorFlags flags = 0);
|
||||
static void activateEditorForEntry(DocumentModel::Entry *entry, OpenEditorFlags flags = 0);
|
||||
static IEditor *activateEditorForDocument(IDocument *document, OpenEditorFlags flags = 0);
|
||||
static IEditor *activateEditorForDocument(Internal::EditorView *view, IDocument *document, OpenEditorFlags flags = 0);
|
||||
|
||||
static DocumentModel *documentModel();
|
||||
static bool closeDocuments(const QList<IDocument *> &documents, bool askAboutModifiedEditors = true);
|
||||
void closeEditor(DocumentModel::Entry *entry);
|
||||
void closeOtherEditors(IDocument *document);
|
||||
static void closeEditor(DocumentModel::Entry *entry);
|
||||
static void closeOtherEditors(IDocument *document);
|
||||
|
||||
void addCurrentPositionToNavigationHistory(IEditor *editor = 0, const QByteArray &saveState = QByteArray());
|
||||
void cutForwardNavigationHistory();
|
||||
static void addCurrentPositionToNavigationHistory(IEditor *editor = 0, const QByteArray &saveState = QByteArray());
|
||||
static void cutForwardNavigationHistory();
|
||||
|
||||
bool saveEditor(IEditor *editor);
|
||||
static bool saveEditor(IEditor *editor);
|
||||
|
||||
bool closeEditors(const QList<IEditor *> &editorsToClose, bool askAboutModifiedEditors = true);
|
||||
void closeEditor(IEditor *editor, bool askAboutModifiedEditors = true);
|
||||
static bool closeEditors(const QList<IEditor *> &editorsToClose, bool askAboutModifiedEditors = true);
|
||||
static void closeEditor(IEditor *editor, bool askAboutModifiedEditors = true);
|
||||
|
||||
MakeWritableResult makeFileWritable(IDocument *document);
|
||||
static MakeWritableResult makeFileWritable(IDocument *document);
|
||||
|
||||
QByteArray saveState() const;
|
||||
bool restoreState(const QByteArray &state);
|
||||
bool hasSplitter() const;
|
||||
static QByteArray saveState();
|
||||
static bool restoreState(const QByteArray &state);
|
||||
static bool hasSplitter();
|
||||
|
||||
void saveSettings();
|
||||
void readSettings();
|
||||
static void saveSettings();
|
||||
static void readSettings();
|
||||
|
||||
Internal::OpenEditorsWindow *windowPopup() const;
|
||||
void showPopupOrSelectDocument() const;
|
||||
static Internal::OpenEditorsWindow *windowPopup();
|
||||
static void showPopupOrSelectDocument();
|
||||
|
||||
void showEditorStatusBar(const QString &id,
|
||||
static void showEditorStatusBar(const QString &id,
|
||||
const QString &infoText,
|
||||
const QString &buttonText = QString(),
|
||||
QObject *object = 0, const char *member = 0);
|
||||
|
||||
void hideEditorStatusBar(const QString &id);
|
||||
static void hideEditorStatusBar(const QString &id);
|
||||
|
||||
static EditorFactoryList editorFactories(const MimeType &mimeType, bool bestMatchOnly = true);
|
||||
static ExternalEditorList externalEditors(const MimeType &mimeType, bool bestMatchOnly = true);
|
||||
|
||||
void setReloadSetting(IDocument::ReloadSetting behavior);
|
||||
IDocument::ReloadSetting reloadSetting() const;
|
||||
static void setReloadSetting(IDocument::ReloadSetting behavior);
|
||||
static IDocument::ReloadSetting reloadSetting();
|
||||
|
||||
void setAutoSaveEnabled(bool enabled);
|
||||
bool autoSaveEnabled() const;
|
||||
void setAutoSaveInterval(int interval);
|
||||
int autoSaveInterval() const;
|
||||
static void setAutoSaveEnabled(bool enabled);
|
||||
static bool autoSaveEnabled();
|
||||
static void setAutoSaveInterval(int interval);
|
||||
static int autoSaveInterval();
|
||||
static bool isAutoSaveFile(const QString &fileName);
|
||||
|
||||
QTextCodec *defaultTextCodec() const;
|
||||
static QTextCodec *defaultTextCodec();
|
||||
|
||||
static qint64 maxTextFileSize();
|
||||
|
||||
void setWindowTitleAddition(const QString &addition);
|
||||
QString windowTitleAddition() const;
|
||||
static void setWindowTitleAddition(const QString &addition);
|
||||
static QString windowTitleAddition();
|
||||
|
||||
static void setWindowTitleVcsTopic(const QString &topic);
|
||||
static QString windowTitleVcsTopic();
|
||||
|
||||
void addSaveAndCloseEditorActions(QMenu *contextMenu, DocumentModel::Entry *entry);
|
||||
void addNativeDirActions(QMenu *contextMenu, DocumentModel::Entry *entry);
|
||||
static void addSaveAndCloseEditorActions(QMenu *contextMenu, DocumentModel::Entry *entry);
|
||||
static void addNativeDirActions(QMenu *contextMenu, DocumentModel::Entry *entry);
|
||||
|
||||
signals:
|
||||
void currentEditorChanged(Core::IEditor *editor);
|
||||
@@ -197,88 +197,88 @@ signals:
|
||||
void editorsClosed(QList<Core::IEditor *> editors);
|
||||
|
||||
public slots:
|
||||
bool closeAllEditors(bool askAboutModifiedEditors = true);
|
||||
static bool closeAllEditors(bool askAboutModifiedEditors = true);
|
||||
|
||||
bool saveDocument(Core::IDocument *documentParam = 0);
|
||||
bool saveDocumentAs(Core::IDocument *documentParam = 0);
|
||||
void revertToSaved();
|
||||
void revertToSaved(IDocument *document);
|
||||
void closeEditor();
|
||||
void closeOtherEditors();
|
||||
void doEscapeKeyFocusMoveMagic();
|
||||
static bool saveDocument(Core::IDocument *documentParam = 0);
|
||||
static bool saveDocumentAs(Core::IDocument *documentParam = 0);
|
||||
static void revertToSaved();
|
||||
static void revertToSaved(IDocument *document);
|
||||
static void closeEditor();
|
||||
static void closeOtherEditors();
|
||||
static void doEscapeKeyFocusMoveMagic();
|
||||
|
||||
private slots:
|
||||
void gotoNextDocHistory();
|
||||
void gotoPreviousDocHistory();
|
||||
void handleContextChange(const QList<Core::IContext *> &context);
|
||||
void updateActions();
|
||||
void makeCurrentEditorWritable();
|
||||
void vcsOpenCurrentEditor();
|
||||
void updateWindowTitle();
|
||||
static void gotoNextDocHistory();
|
||||
static void gotoPreviousDocHistory();
|
||||
static void handleContextChange(const QList<Core::IContext *> &context);
|
||||
static void updateActions();
|
||||
static void makeCurrentEditorWritable();
|
||||
static void vcsOpenCurrentEditor();
|
||||
static void updateWindowTitle();
|
||||
void handleDocumentStateChange();
|
||||
void updateVariable(const QByteArray &variable);
|
||||
void autoSave();
|
||||
static void updateVariable(const QByteArray &variable);
|
||||
static void autoSave();
|
||||
|
||||
void saveDocumentFromContextMenu();
|
||||
void saveDocumentAsFromContextMenu();
|
||||
void revertToSavedFromContextMenu();
|
||||
static void saveDocumentFromContextMenu();
|
||||
static void saveDocumentAsFromContextMenu();
|
||||
static void revertToSavedFromContextMenu();
|
||||
|
||||
void closeEditorFromContextMenu();
|
||||
void closeOtherEditorsFromContextMenu();
|
||||
static void closeEditorFromContextMenu();
|
||||
static void closeOtherEditorsFromContextMenu();
|
||||
|
||||
void showInGraphicalShell();
|
||||
void openTerminal();
|
||||
static void showInGraphicalShell();
|
||||
static void openTerminal();
|
||||
|
||||
void rootDestroyed(QObject *root);
|
||||
void setCurrentEditorFromContextChange();
|
||||
static void rootDestroyed(QObject *root);
|
||||
static void setCurrentEditorFromContextChange();
|
||||
|
||||
void gotoNextSplit();
|
||||
static void gotoNextSplit();
|
||||
|
||||
public slots:
|
||||
void goBackInNavigationHistory();
|
||||
void goForwardInNavigationHistory();
|
||||
void split(Qt::Orientation orientation);
|
||||
void split();
|
||||
void splitSideBySide();
|
||||
void splitNewWindow();
|
||||
void removeCurrentSplit();
|
||||
void removeAllSplits();
|
||||
void gotoOtherSplit();
|
||||
static void goBackInNavigationHistory();
|
||||
static void goForwardInNavigationHistory();
|
||||
static void split(Qt::Orientation orientation);
|
||||
static void split();
|
||||
static void splitSideBySide();
|
||||
static void splitNewWindow();
|
||||
static void removeCurrentSplit();
|
||||
static void removeAllSplits();
|
||||
static void gotoOtherSplit();
|
||||
|
||||
private:
|
||||
explicit EditorManager(QWidget *parent);
|
||||
virtual ~EditorManager();
|
||||
void init();
|
||||
~EditorManager();
|
||||
static void init();
|
||||
|
||||
static IEditor *createEditor(const Id &id = Id(), const QString &fileName = QString());
|
||||
void addEditor(IEditor *editor);
|
||||
void removeEditor(IEditor *editor);
|
||||
static void addEditor(IEditor *editor);
|
||||
static void removeEditor(IEditor *editor);
|
||||
|
||||
void restoreEditorState(IEditor *editor);
|
||||
static void restoreEditorState(IEditor *editor);
|
||||
|
||||
IEditor *placeEditor(Internal::EditorView *view, IEditor *editor);
|
||||
IEditor *duplicateEditor(IEditor *editor);
|
||||
IEditor *activateEditor(Internal::EditorView *view, IEditor *editor, OpenEditorFlags flags = 0);
|
||||
void activateEditorForEntry(Internal::EditorView *view, DocumentModel::Entry *entry, OpenEditorFlags flags = 0);
|
||||
void activateView(Internal::EditorView *view);
|
||||
IEditor *openEditor(Internal::EditorView *view, const QString &fileName,
|
||||
static IEditor *placeEditor(Internal::EditorView *view, IEditor *editor);
|
||||
static IEditor *duplicateEditor(IEditor *editor);
|
||||
static IEditor *activateEditor(Internal::EditorView *view, IEditor *editor, OpenEditorFlags flags = 0);
|
||||
static void activateEditorForEntry(Internal::EditorView *view, DocumentModel::Entry *entry, OpenEditorFlags flags = 0);
|
||||
static void activateView(Internal::EditorView *view);
|
||||
static IEditor *openEditor(Internal::EditorView *view, const QString &fileName,
|
||||
const Id &id = Id(), OpenEditorFlags flags = 0, bool *newEditor = 0);
|
||||
|
||||
void setCurrentEditor(IEditor *editor, bool ignoreNavigationHistory = false);
|
||||
void setCurrentView(Internal::EditorView *view);
|
||||
Internal::EditorView *currentEditorView() const;
|
||||
static void setCurrentEditor(IEditor *editor, bool ignoreNavigationHistory = false);
|
||||
static void setCurrentView(Internal::EditorView *view);
|
||||
static Internal::EditorView *currentEditorView();
|
||||
static Internal::EditorView *viewForEditor(IEditor *editor);
|
||||
static Internal::SplitterOrView *findRoot(const Internal::EditorView *view, int *rootIndex = 0);
|
||||
|
||||
void closeView(Internal::EditorView *view);
|
||||
void emptyView(Internal::EditorView *view);
|
||||
static void closeView(Internal::EditorView *view);
|
||||
static void emptyView(Internal::EditorView *view);
|
||||
static void splitNewWindow(Internal::EditorView *view);
|
||||
IEditor *pickUnusedEditor(Internal::EditorView **foundView = 0) const;
|
||||
void addDocumentToRecentFiles(IDocument *document);
|
||||
void updateAutoSave();
|
||||
void setCloseSplitEnabled(Internal::SplitterOrView *splitterOrView, bool enable);
|
||||
void updateMakeWritableWarning();
|
||||
void setupSaveActions(IDocument *document, QAction *saveAction, QAction *saveAsAction, QAction *revertToSavedAction);
|
||||
static IEditor *pickUnusedEditor(Internal::EditorView **foundView = 0);
|
||||
static void addDocumentToRecentFiles(IDocument *document);
|
||||
static void updateAutoSave();
|
||||
static void setCloseSplitEnabled(Internal::SplitterOrView *splitterOrView, bool enable);
|
||||
static void updateMakeWritableWarning();
|
||||
static void setupSaveActions(IDocument *document, QAction *saveAction, QAction *saveAsAction, QAction *revertToSavedAction);
|
||||
|
||||
friend class Core::Internal::MainWindow;
|
||||
friend class Core::Internal::SplitterOrView;
|
||||
|
||||
@@ -303,36 +303,33 @@ IEditor *EditorView::currentEditor() const
|
||||
|
||||
void EditorView::listSelectionActivated(int index)
|
||||
{
|
||||
EditorManager::instance()->activateEditorForEntry(
|
||||
EditorManager::activateEditorForEntry(
|
||||
this, EditorManager::documentModel()->documentAtRow(index));
|
||||
}
|
||||
|
||||
void EditorView::splitHorizontally()
|
||||
{
|
||||
EditorManager *editorManager = EditorManager::instance();
|
||||
if (m_parentSplitterOrView)
|
||||
m_parentSplitterOrView->split(Qt::Vertical);
|
||||
editorManager->updateActions();
|
||||
EditorManager::updateActions();
|
||||
}
|
||||
|
||||
void EditorView::splitVertically()
|
||||
{
|
||||
EditorManager *editorManager = EditorManager::instance();
|
||||
if (m_parentSplitterOrView)
|
||||
m_parentSplitterOrView->split(Qt::Horizontal);
|
||||
editorManager->updateActions();
|
||||
EditorManager::updateActions();
|
||||
}
|
||||
|
||||
void EditorView::splitNewWindow()
|
||||
{
|
||||
EditorManager::instance()->splitNewWindow(this);
|
||||
EditorManager::splitNewWindow(this);
|
||||
}
|
||||
|
||||
void EditorView::closeSplit()
|
||||
{
|
||||
EditorManager *editorManager = EditorManager::instance();
|
||||
editorManager->closeView(this);
|
||||
editorManager->updateActions();
|
||||
EditorManager::closeView(this);
|
||||
EditorManager::updateActions();
|
||||
}
|
||||
|
||||
void EditorView::setParentSplitterOrView(SplitterOrView *splitterOrView)
|
||||
@@ -539,7 +536,7 @@ SplitterOrView::~SplitterOrView()
|
||||
delete m_layout;
|
||||
m_layout = 0;
|
||||
if (m_view)
|
||||
EditorManager::instance()->emptyView(m_view);
|
||||
EditorManager::emptyView(m_view);
|
||||
delete m_view;
|
||||
m_view = 0;
|
||||
delete m_splitter;
|
||||
@@ -641,7 +638,7 @@ void SplitterOrView::split(Qt::Orientation orientation)
|
||||
void SplitterOrView::unsplitAll()
|
||||
{
|
||||
QTC_ASSERT(m_splitter, return);
|
||||
EditorView *currentView = EditorManager::instance()->currentEditorView();
|
||||
EditorView *currentView = EditorManager::currentEditorView();
|
||||
if (currentView) {
|
||||
currentView->parentSplitterOrView()->takeView();
|
||||
currentView->setParentSplitterOrView(this);
|
||||
|
||||
@@ -192,13 +192,13 @@ void OpenEditorsWidget::handleClicked(const QModelIndex &index)
|
||||
void OpenEditorsWidget::activateEditor(const QModelIndex &index)
|
||||
{
|
||||
selectionModel()->select(index, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
|
||||
EditorManager::instance()->activateEditorForEntry(
|
||||
EditorManager::activateEditorForEntry(
|
||||
EditorManager::documentModel()->documentAtRow(m_model->mapToSource(index).row()));
|
||||
}
|
||||
|
||||
void OpenEditorsWidget::closeEditor(const QModelIndex &index)
|
||||
{
|
||||
EditorManager::instance()->closeEditor(
|
||||
EditorManager::closeEditor(
|
||||
EditorManager::documentModel()->documentAtRow(m_model->mapToSource(index).row()));
|
||||
// work around selection changes
|
||||
updateCurrentItem(EditorManager::currentEditor());
|
||||
@@ -210,9 +210,9 @@ void OpenEditorsWidget::contextMenuRequested(QPoint pos)
|
||||
QModelIndex editorIndex = indexAt(pos);
|
||||
DocumentModel::Entry *entry = EditorManager::documentModel()->documentAtRow(
|
||||
m_model->mapToSource(editorIndex).row());
|
||||
EditorManager::instance()->addSaveAndCloseEditorActions(&contextMenu, entry);
|
||||
EditorManager::addSaveAndCloseEditorActions(&contextMenu, entry);
|
||||
contextMenu.addSeparator();
|
||||
EditorManager::instance()->addNativeDirActions(&contextMenu, entry);
|
||||
EditorManager::addNativeDirActions(&contextMenu, entry);
|
||||
contextMenu.exec(mapToGlobal(pos));
|
||||
}
|
||||
|
||||
|
||||
@@ -225,7 +225,7 @@ void OpenEditorsWindow::selectEditor(QTreeWidgetItem *item)
|
||||
return;
|
||||
if (IDocument *document = item->data(0, Qt::UserRole).value<IDocument*>()) {
|
||||
EditorView *view = item->data(0, Qt::UserRole+1).value<EditorView*>();
|
||||
EditorManager::instance()->activateEditorForDocument(view, document);
|
||||
EditorManager::activateEditorForDocument(view, document);
|
||||
} else {
|
||||
if (!EditorManager::openEditor(
|
||||
item->toolTip(0), item->data(0, Qt::UserRole+2).value<Core::Id>())) {
|
||||
|
||||
@@ -238,7 +238,7 @@ void EditorToolBar::closeEditor()
|
||||
return;
|
||||
|
||||
if (d->m_isStandalone)
|
||||
EditorManager::instance()->closeEditor(current);
|
||||
EditorManager::closeEditor(current);
|
||||
emit closeClicked();
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@ void EditorToolBar::setToolbarCreationFlags(ToolbarCreationFlags flags)
|
||||
{
|
||||
d->m_isStandalone = flags & FlagsStandalone;
|
||||
if (d->m_isStandalone) {
|
||||
EditorManager *em = EditorManager::instance();
|
||||
QWidget *em = EditorManager::instance();
|
||||
connect(em, SIGNAL(currentEditorChanged(Core::IEditor*)), SLOT(updateEditorListSelection(Core::IEditor*)));
|
||||
|
||||
disconnect(d->m_editorList, SIGNAL(activated(int)), this, SIGNAL(listSelectionActivated(int)));
|
||||
@@ -309,8 +309,7 @@ void EditorToolBar::updateEditorListSelection(IEditor *newSelection)
|
||||
|
||||
void EditorToolBar::changeActiveEditor(int row)
|
||||
{
|
||||
EditorManager *em = EditorManager::instance();
|
||||
em->activateEditorForEntry(d->m_editorsListModel->documentAtRow(row));
|
||||
EditorManager::activateEditorForEntry(d->m_editorsListModel->documentAtRow(row));
|
||||
}
|
||||
|
||||
void EditorToolBar::listContextMenu(QPoint pos)
|
||||
@@ -323,9 +322,9 @@ void EditorToolBar::listContextMenu(QPoint pos)
|
||||
QMenu menu;
|
||||
QAction *copyPath = menu.addAction(tr("Copy Full Path to Clipboard"));
|
||||
menu.addSeparator();
|
||||
EditorManager::instance()->addSaveAndCloseEditorActions(&menu, entry);
|
||||
EditorManager::addSaveAndCloseEditorActions(&menu, entry);
|
||||
menu.addSeparator();
|
||||
EditorManager::instance()->addNativeDirActions(&menu, entry);
|
||||
EditorManager::addNativeDirActions(&menu, entry);
|
||||
QAction *result = menu.exec(d->m_editorList->mapToGlobal(pos));
|
||||
if (result == copyPath)
|
||||
QApplication::clipboard()->setText(QDir::toNativeSeparators(fileName));
|
||||
@@ -334,7 +333,7 @@ void EditorToolBar::listContextMenu(QPoint pos)
|
||||
void EditorToolBar::makeEditorWritable()
|
||||
{
|
||||
if (IDocument *current = EditorManager::currentDocument())
|
||||
EditorManager::instance()->makeFileWritable(current);
|
||||
EditorManager::makeFileWritable(current);
|
||||
}
|
||||
|
||||
void EditorToolBar::setCanGoBack(bool canGoBack)
|
||||
|
||||
@@ -110,7 +110,7 @@ QWidget *GeneralSettings::createPage(QWidget *parent)
|
||||
fillLanguageBox();
|
||||
|
||||
m_page->colorButton->setColor(StyleHelper::requestedBaseColor());
|
||||
m_page->reloadBehavior->setCurrentIndex(EditorManager::instance()->reloadSetting());
|
||||
m_page->reloadBehavior->setCurrentIndex(EditorManager::reloadSetting());
|
||||
if (HostOsInfo::isAnyUnixHost()) {
|
||||
QSettings *settings = Core::ICore::settings();
|
||||
const QStringList availableTerminals = ConsoleProcess::availableTerminalEmulators();
|
||||
@@ -135,8 +135,8 @@ QWidget *GeneralSettings::createPage(QWidget *parent)
|
||||
m_page->helpExternalFileBrowserButton->hide();
|
||||
}
|
||||
|
||||
m_page->autoSaveCheckBox->setChecked(EditorManager::instance()->autoSaveEnabled());
|
||||
m_page->autoSaveInterval->setValue(EditorManager::instance()->autoSaveInterval());
|
||||
m_page->autoSaveCheckBox->setChecked(EditorManager::autoSaveEnabled());
|
||||
m_page->autoSaveInterval->setValue(EditorManager::autoSaveInterval());
|
||||
m_page->resetWarningsButton->setEnabled(Core::InfoBar::anyGloballySuppressed());
|
||||
|
||||
connect(m_page->resetColorButton, SIGNAL(clicked()),
|
||||
@@ -179,7 +179,7 @@ void GeneralSettings::apply()
|
||||
setLanguage(m_page->languageBox->itemData(currentIndex, Qt::UserRole).toString());
|
||||
// Apply the new base color if accepted
|
||||
StyleHelper::setBaseColor(m_page->colorButton->color());
|
||||
EditorManager::instance()->setReloadSetting(IDocument::ReloadSetting(m_page->reloadBehavior->currentIndex()));
|
||||
EditorManager::setReloadSetting(IDocument::ReloadSetting(m_page->reloadBehavior->currentIndex()));
|
||||
if (HostOsInfo::isAnyUnixHost()) {
|
||||
ConsoleProcess::setTerminalEmulator(Core::ICore::settings(),
|
||||
m_page->terminalComboBox->lineEdit()->text());
|
||||
@@ -188,8 +188,8 @@ void GeneralSettings::apply()
|
||||
m_page->externalFileBrowserEdit->text());
|
||||
}
|
||||
}
|
||||
EditorManager::instance()->setAutoSaveEnabled(m_page->autoSaveCheckBox->isChecked());
|
||||
EditorManager::instance()->setAutoSaveInterval(m_page->autoSaveInterval->value());
|
||||
EditorManager::setAutoSaveEnabled(m_page->autoSaveCheckBox->isChecked());
|
||||
EditorManager::setAutoSaveInterval(m_page->autoSaveInterval->value());
|
||||
}
|
||||
|
||||
void GeneralSettings::finish()
|
||||
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
TextDocument::TextDocument(QObject *parent) :
|
||||
IDocument(parent), d(new Internal::TextDocumentPrivate)
|
||||
{
|
||||
setCodec(Core::EditorManager::instance()->defaultTextCodec());
|
||||
setCodec(Core::EditorManager::defaultTextCodec());
|
||||
}
|
||||
|
||||
TextDocument::~TextDocument()
|
||||
|
||||
@@ -115,7 +115,7 @@ TestCase::TestCase(const QByteArray &input)
|
||||
|
||||
TestCase::~TestCase()
|
||||
{
|
||||
EditorManager::instance()->closeEditor(editor, false);
|
||||
EditorManager::closeEditor(editor, false);
|
||||
QCoreApplication::processEvents(); // process any pending events
|
||||
|
||||
// Remove the test file from the code-model
|
||||
|
||||
@@ -171,9 +171,8 @@ void CppOutlineWidget::updateTextCursor(const QModelIndex &proxyIndex)
|
||||
if (debug)
|
||||
qDebug() << "CppOutline - moving cursor to" << symbol->line() << symbol->column() - 1;
|
||||
|
||||
Core::EditorManager *editorManager = Core::EditorManager::instance();
|
||||
editorManager->cutForwardNavigationHistory();
|
||||
editorManager->addCurrentPositionToNavigationHistory();
|
||||
Core::EditorManager::cutForwardNavigationHistory();
|
||||
Core::EditorManager::addCurrentPositionToNavigationHistory();
|
||||
|
||||
// line has to be 1 based, column 0 based!
|
||||
m_editor->gotoLine(symbol->line(), symbol->column() - 1);
|
||||
|
||||
@@ -264,7 +264,7 @@ TestCase::~TestCase()
|
||||
if (testFile->editor)
|
||||
editorsToClose << testFile->editor;
|
||||
}
|
||||
EditorManager::instance()->closeEditors(editorsToClose, false);
|
||||
EditorManager::closeEditors(editorsToClose, false);
|
||||
QCoreApplication::processEvents(); // process any pending events
|
||||
|
||||
// Remove the test files from the code-model
|
||||
|
||||
@@ -165,7 +165,7 @@ void CppTypeHierarchyWidget::perform()
|
||||
{
|
||||
showNoTypeHierarchyLabel();
|
||||
|
||||
CPPEditor *editor = qobject_cast<CPPEditor *>(Core::EditorManager::instance()->currentEditor());
|
||||
CPPEditor *editor = qobject_cast<CPPEditor *>(Core::EditorManager::currentEditor());
|
||||
if (!editor)
|
||||
return;
|
||||
|
||||
|
||||
@@ -299,9 +299,8 @@ void TestActionsTestCase::moveWordCamelCaseToToken(TranslationUnit *translationU
|
||||
|
||||
void TestActionsTestCase::undoAllChangesAndCloseAllEditors()
|
||||
{
|
||||
EditorManager *em = EditorManager::instance();
|
||||
undoChangesInAllEditorWidgets();
|
||||
em->closeAllEditors(/*askAboutModifiedEditors =*/ false);
|
||||
EditorManager::closeAllEditors(/*askAboutModifiedEditors =*/ false);
|
||||
QApplication::processEvents();
|
||||
QCOMPARE(EditorManager::documentModel()->openedDocuments().size(), 0);
|
||||
}
|
||||
@@ -332,10 +331,8 @@ public:
|
||||
|
||||
void FollowSymbolUnderCursorTokenAction::run(CPPEditorWidget *editorWidget)
|
||||
{
|
||||
EditorManager *em = EditorManager::instance();
|
||||
|
||||
// Follow link
|
||||
IEditor *editorBefore = em->currentEditor();
|
||||
IEditor *editorBefore = EditorManager::currentEditor();
|
||||
const int originalLine = editorBefore->currentLine();
|
||||
const int originalColumn = editorBefore->currentColumn();
|
||||
editorWidget->openLinkUnderCursor();
|
||||
@@ -343,9 +340,9 @@ void FollowSymbolUnderCursorTokenAction::run(CPPEditorWidget *editorWidget)
|
||||
QApplication::processEvents();
|
||||
|
||||
// Go back
|
||||
IEditor *editorAfter = em->currentEditor();
|
||||
IEditor *editorAfter = EditorManager::currentEditor();
|
||||
if (editorAfter != editorBefore)
|
||||
em->goBackInNavigationHistory();
|
||||
EditorManager::goBackInNavigationHistory();
|
||||
else
|
||||
editorBefore->gotoLine(originalLine, originalColumn);
|
||||
QApplication::processEvents();
|
||||
@@ -360,19 +357,17 @@ public:
|
||||
|
||||
void SwitchDeclarationDefinitionTokenAction::run(CPPEditorWidget *)
|
||||
{
|
||||
EditorManager *em = EditorManager::instance();
|
||||
|
||||
// Switch Declaration/Definition
|
||||
IEditor *editorBefore = em->currentEditor();
|
||||
IEditor *editorBefore = EditorManager::currentEditor();
|
||||
const int originalLine = editorBefore->currentLine();
|
||||
const int originalColumn = editorBefore->currentColumn();
|
||||
CppEditor::Internal::CppEditorPlugin::instance()->switchDeclarationDefinition();
|
||||
QApplication::processEvents();
|
||||
|
||||
// Go back
|
||||
IEditor *editorAfter = em->currentEditor();
|
||||
IEditor *editorAfter = EditorManager::currentEditor();
|
||||
if (editorAfter != editorBefore)
|
||||
em->goBackInNavigationHistory();
|
||||
EditorManager::goBackInNavigationHistory();
|
||||
else
|
||||
editorBefore->gotoLine(originalLine, originalColumn);
|
||||
QApplication::processEvents();
|
||||
@@ -500,17 +495,15 @@ public:
|
||||
|
||||
void SwitchHeaderSourceFileAction::run(CPPEditorWidget *)
|
||||
{
|
||||
EditorManager *em = EditorManager::instance();
|
||||
|
||||
// Switch Header/Source
|
||||
IEditor *editorBefore = em->currentEditor();
|
||||
IEditor *editorBefore = EditorManager::currentEditor();
|
||||
CppTools::Internal::CppToolsPlugin::instance()->switchHeaderSource();
|
||||
QApplication::processEvents();
|
||||
|
||||
// Go back
|
||||
IEditor *editorAfter = em->currentEditor();
|
||||
IEditor *editorAfter = EditorManager::currentEditor();
|
||||
if (editorAfter != editorBefore)
|
||||
em->goBackInNavigationHistory();
|
||||
EditorManager::goBackInNavigationHistory();
|
||||
QApplication::processEvents();
|
||||
}
|
||||
|
||||
|
||||
@@ -251,7 +251,7 @@ TestCase::~TestCase()
|
||||
if (testFile->editor)
|
||||
editorsToClose << testFile->editor;
|
||||
}
|
||||
EditorManager::instance()->closeEditors(editorsToClose, false);
|
||||
EditorManager::closeEditors(editorsToClose, false);
|
||||
QCoreApplication::processEvents(); // process any pending events
|
||||
|
||||
// Remove the test files from the code-model
|
||||
@@ -308,7 +308,7 @@ void TestCase::run(bool expectedFail)
|
||||
QCoreApplication::processEvents();
|
||||
|
||||
// Compare
|
||||
IEditor *currentEditor = EditorManager::instance()->currentEditor();
|
||||
IEditor *currentEditor = EditorManager::currentEditor();
|
||||
BaseTextEditor *currentTextEditor = dynamic_cast<BaseTextEditor*>(currentEditor);
|
||||
QVERIFY(currentTextEditor);
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ public:
|
||||
|
||||
~CompletionTestCase()
|
||||
{
|
||||
EditorManager::instance()->closeEditors(QList<IEditor*>() << editor,
|
||||
EditorManager::closeEditors(QList<IEditor*>() << editor,
|
||||
/*askAboutModifiedEditors=*/ false);
|
||||
cmm->GC();
|
||||
QVERIFY(cmm->snapshot().isEmpty());
|
||||
|
||||
@@ -205,9 +205,8 @@ QString CppFileSettings::licenseTemplate(const QString &fileName, const QString
|
||||
return QString();
|
||||
}
|
||||
|
||||
QTextCodec *codec = Core::EditorManager::instance()->defaultTextCodec();
|
||||
QTextStream licenseStream(&file);
|
||||
licenseStream.setCodec(codec);
|
||||
licenseStream.setCodec(Core::EditorManager::defaultTextCodec());
|
||||
licenseStream.setAutoDetectUnicode(true);
|
||||
QString license = licenseStream.readAll();
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ static QString getSource(const QString &fileName,
|
||||
QString fileContents;
|
||||
Utils::TextFileFormat format;
|
||||
QString error;
|
||||
QTextCodec *defaultCodec = Core::EditorManager::instance()->defaultTextCodec();
|
||||
QTextCodec *defaultCodec = Core::EditorManager::defaultTextCodec();
|
||||
Utils::TextFileFormat::ReadResult result = Utils::TextFileFormat::readFile(
|
||||
fileName, defaultCodec, &fileContents, &format, &error);
|
||||
if (result != Utils::TextFileFormat::ReadSuccess)
|
||||
|
||||
@@ -125,7 +125,7 @@ private:
|
||||
|
||||
virtual void doAfterLocatorRun()
|
||||
{
|
||||
EditorManager::instance()->closeEditor(m_editor, /*askAboutModifiedEditors=*/ false);
|
||||
EditorManager::closeEditor(m_editor, /*askAboutModifiedEditors=*/ false);
|
||||
QCoreApplication::processEvents();
|
||||
QVERIFY(EditorManager::documentModel()->openedDocuments().isEmpty());
|
||||
m_modelManager->GC();
|
||||
|
||||
@@ -712,12 +712,11 @@ void CppToolsPlugin::test_modelmanager_gc_if_last_cppeditor_closed()
|
||||
MyTestDataDir testDataDirectory(QLatin1String("testdata_guiproject1"));
|
||||
const QString file = testDataDirectory.file(QLatin1String("main.cpp"));
|
||||
|
||||
Core::EditorManager *em = Core::EditorManager::instance();
|
||||
CppModelManager *mm = CppModelManager::instance();
|
||||
|
||||
// Open a file in the editor
|
||||
QCOMPARE(Core::EditorManager::documentModel()->openedDocuments().size(), 0);
|
||||
Core::IEditor *editor = em->openEditor(file);
|
||||
Core::IEditor *editor = Core::EditorManager::openEditor(file);
|
||||
QVERIFY(editor);
|
||||
QCOMPARE(Core::EditorManager::documentModel()->openedDocuments().size(), 1);
|
||||
QVERIFY(mm->isCppEditor(editor));
|
||||
@@ -727,7 +726,7 @@ void CppToolsPlugin::test_modelmanager_gc_if_last_cppeditor_closed()
|
||||
QVERIFY(mm->snapshot().contains(file));
|
||||
|
||||
// Close file/editor
|
||||
em->closeEditor(editor, /*askAboutModifiedEditors=*/ false);
|
||||
Core::EditorManager::closeEditor(editor, /*askAboutModifiedEditors=*/ false);
|
||||
helper.waitForFinishedGc();
|
||||
|
||||
// Check: File is removed from the snapshpt
|
||||
@@ -743,12 +742,11 @@ void CppToolsPlugin::test_modelmanager_dont_gc_opened_files()
|
||||
MyTestDataDir testDataDirectory(QLatin1String("testdata_guiproject1"));
|
||||
const QString file = testDataDirectory.file(QLatin1String("main.cpp"));
|
||||
|
||||
Core::EditorManager *em = Core::EditorManager::instance();
|
||||
CppModelManager *mm = CppModelManager::instance();
|
||||
|
||||
// Open a file in the editor
|
||||
QCOMPARE(Core::EditorManager::documentModel()->openedDocuments().size(), 0);
|
||||
Core::IEditor *editor = em->openEditor(file);
|
||||
Core::IEditor *editor = Core::EditorManager::openEditor(file);
|
||||
QVERIFY(editor);
|
||||
QCOMPARE(Core::EditorManager::documentModel()->openedDocuments().size(), 1);
|
||||
QVERIFY(mm->isCppEditor(editor));
|
||||
@@ -765,7 +763,7 @@ void CppToolsPlugin::test_modelmanager_dont_gc_opened_files()
|
||||
QVERIFY(mm->snapshot().contains(file));
|
||||
|
||||
// Close editor
|
||||
em->closeEditors(QList<Core::IEditor*>() << editor);
|
||||
Core::EditorManager::closeEditors(QList<Core::IEditor*>() << editor);
|
||||
helper.waitForFinishedGc();
|
||||
QVERIFY(mm->snapshot().isEmpty());
|
||||
}
|
||||
|
||||
@@ -171,9 +171,8 @@ void CppPreprocessor::getFileContents(const QString &absoluteFilePath,
|
||||
|
||||
QFile file(absoluteFilePath);
|
||||
if (file.open(QFile::ReadOnly | QFile::Text)) {
|
||||
QTextCodec *defaultCodec = Core::EditorManager::instance()->defaultTextCodec();
|
||||
QTextStream stream(&file);
|
||||
stream.setCodec(defaultCodec);
|
||||
stream.setCodec(Core::EditorManager::defaultTextCodec());
|
||||
if (contents)
|
||||
*contents = stream.readAll();
|
||||
if (revision)
|
||||
|
||||
@@ -305,7 +305,7 @@ void CppEditorSupport::startHighlighting()
|
||||
|
||||
// Start highlighting only if the editor is or would be visible
|
||||
// (in case another mode is active) in the edit mode.
|
||||
if (!Core::EditorManager::instance()->visibleEditors().contains(m_textEditor))
|
||||
if (!Core::EditorManager::visibleEditors().contains(m_textEditor))
|
||||
return;
|
||||
|
||||
if (m_highlightingSupport->requiresSemanticInfo()) {
|
||||
|
||||
@@ -1216,7 +1216,7 @@ bool CvsPlugin::describe(const QString &repositoryPath,
|
||||
void CvsPlugin::submitCurrentLog()
|
||||
{
|
||||
m_submitActionTriggered = true;
|
||||
EditorManager::instance()->closeEditor(EditorManager::currentEditor());
|
||||
EditorManager::closeEditor(EditorManager::currentEditor());
|
||||
}
|
||||
|
||||
// Run CVS. At this point, file arguments must be relative to
|
||||
|
||||
@@ -1359,7 +1359,7 @@ void DebuggerToolTipManager::debugModeEntered()
|
||||
m_debugModeActive = true;
|
||||
QWidget *topLevel = ICore::mainWindow()->topLevelWidget();
|
||||
topLevel->installEventFilter(this);
|
||||
EditorManager *em = EditorManager::instance();
|
||||
QObject *em = EditorManager::instance();
|
||||
connect(em, SIGNAL(currentEditorChanged(Core::IEditor*)),
|
||||
this, SLOT(slotUpdateVisibleToolTips()));
|
||||
connect(em, SIGNAL(editorOpened(Core::IEditor*)),
|
||||
|
||||
@@ -124,8 +124,7 @@ DisassemblerAgentPrivate::DisassemblerAgentPrivate()
|
||||
|
||||
DisassemblerAgentPrivate::~DisassemblerAgentPrivate()
|
||||
{
|
||||
if (editor)
|
||||
EditorManager::instance()->closeEditor(editor);
|
||||
EditorManager::closeEditor(editor);
|
||||
editor = 0;
|
||||
delete locationMark;
|
||||
qDeleteAll(breakpointMarks);
|
||||
|
||||
@@ -139,7 +139,7 @@ static void openImageViewer(const QImage &image)
|
||||
fileName = temporaryFile.fileName();
|
||||
temporaryFile.close();
|
||||
}
|
||||
if (Core::IEditor *e = Core::EditorManager::instance()->openEditor(fileName))
|
||||
if (Core::IEditor *e = Core::EditorManager::openEditor(fileName))
|
||||
e->document()->setProperty(Debugger::Constants::OPENED_BY_DEBUGGER, QVariant(true));
|
||||
}
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ void MemoryAgent::closeEditors()
|
||||
foreach (QPointer<IEditor> editor, m_editors)
|
||||
if (editor)
|
||||
editors.append(editor.data());
|
||||
EditorManager::instance()->closeEditors(editors);
|
||||
EditorManager::closeEditors(editors);
|
||||
m_editors.clear();
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ void MemoryAgent::updateContents()
|
||||
|
||||
bool MemoryAgent::hasVisibleEditor() const
|
||||
{
|
||||
QList<IEditor *> visible = EditorManager::instance()->visibleEditors();
|
||||
QList<IEditor *> visible = EditorManager::visibleEditors();
|
||||
foreach (QPointer<IEditor> editor, m_editors)
|
||||
if (visible.contains(editor.data()))
|
||||
return true;
|
||||
|
||||
@@ -342,7 +342,7 @@ QmlEngine::~QmlEngine()
|
||||
if (textEditPtr)
|
||||
editorsToClose << textEditPtr.data();
|
||||
}
|
||||
Core::EditorManager::instance()->closeEditors(editorsToClose);
|
||||
Core::EditorManager::closeEditors(editorsToClose);
|
||||
}
|
||||
|
||||
void QmlEngine::notifyInferiorSetupOk()
|
||||
@@ -539,7 +539,7 @@ void QmlEngine::gotoLocation(const Location &location)
|
||||
//Check if there are open documents with the same title
|
||||
foreach (Core::IDocument *document, Core::EditorManager::documentModel()->openedDocuments()) {
|
||||
if (document->displayName() == titlePattern) {
|
||||
Core::EditorManager::instance()->activateEditorForDocument(document);
|
||||
Core::EditorManager::activateEditorForDocument(document);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -438,7 +438,6 @@ void QmlInspectorAdapter::setActiveEngineClient(BaseEngineDebugClient *client)
|
||||
|
||||
void QmlInspectorAdapter::initializePreviews()
|
||||
{
|
||||
Core::EditorManager *em = Core::EditorManager::instance();
|
||||
QmlJS::ModelManagerInterface *modelManager
|
||||
= QmlJS::ModelManagerInterface::instance();
|
||||
if (modelManager) {
|
||||
@@ -446,6 +445,7 @@ void QmlInspectorAdapter::initializePreviews()
|
||||
|
||||
if (!m_listeningToEditorManager) {
|
||||
m_listeningToEditorManager = true;
|
||||
QObject *em = Core::EditorManager::instance();
|
||||
connect(em, SIGNAL(editorAboutToClose(Core::IEditor*)),
|
||||
this, SLOT(removePreviewForEditor(Core::IEditor*)));
|
||||
connect(em, SIGNAL(editorOpened(Core::IEditor*)),
|
||||
|
||||
@@ -76,8 +76,7 @@ SourceAgentPrivate::SourceAgentPrivate()
|
||||
|
||||
SourceAgentPrivate::~SourceAgentPrivate()
|
||||
{
|
||||
if (editor)
|
||||
EditorManager::instance()->closeEditor(editor);
|
||||
EditorManager::closeEditor(editor);
|
||||
editor = 0;
|
||||
delete locationMark;
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ public:
|
||||
private:
|
||||
void cleanup()
|
||||
{
|
||||
EditorManager::instance()->closeAllEditors(/*askAboutModifiedEditors =*/ false);
|
||||
EditorManager::closeAllEditors(/*askAboutModifiedEditors =*/ false);
|
||||
QVERIFY(EditorManager::documentModel()->openedDocuments().isEmpty());
|
||||
|
||||
m_modelManager->GC();
|
||||
|
||||
@@ -280,7 +280,7 @@ void FakeVimPlugin::setup(TestData *data)
|
||||
|
||||
void FakeVimPlugin::cleanup()
|
||||
{
|
||||
Core::EditorManager::instance()->closeAllEditors(false);
|
||||
Core::EditorManager::closeAllEditors(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1356,7 +1356,7 @@ void FakeVimPluginPrivate::moveSomewhere(DistFunction f, int count)
|
||||
IEditor *bestEditor = 0;
|
||||
int repeat = count;
|
||||
|
||||
QList<IEditor *> editors = EditorManager::instance()->visibleEditors();
|
||||
QList<IEditor *> editors = EditorManager::visibleEditors();
|
||||
while (repeat < 0 || repeat-- > 0) {
|
||||
editors.removeOne(currentEditor);
|
||||
int bestValue = -1;
|
||||
@@ -1389,7 +1389,7 @@ void FakeVimPluginPrivate::moveSomewhere(DistFunction f, int count)
|
||||
void FakeVimPluginPrivate::keepOnlyWindow()
|
||||
{
|
||||
IEditor *currentEditor = EditorManager::currentEditor();
|
||||
QList<IEditor *> editors = EditorManager::instance()->visibleEditors();
|
||||
QList<IEditor *> editors = EditorManager::visibleEditors();
|
||||
editors.removeOne(currentEditor);
|
||||
|
||||
foreach (IEditor *editor, editors) {
|
||||
@@ -1988,7 +1988,7 @@ void FakeVimPluginPrivate::changeSelection(const QList<QTextEdit::ExtraSelection
|
||||
|
||||
void FakeVimPluginPrivate::highlightMatches(const QString &needle)
|
||||
{
|
||||
foreach (IEditor *editor, EditorManager::instance()->visibleEditors()) {
|
||||
foreach (IEditor *editor, EditorManager::visibleEditors()) {
|
||||
QWidget *w = editor->widget();
|
||||
Find::IFindSupport *find = Aggregation::query<Find::IFindSupport>(w);
|
||||
if (find != 0)
|
||||
@@ -2011,7 +2011,7 @@ void FakeVimPluginPrivate::switchToFile(int n)
|
||||
n = n % size;
|
||||
if (n < 0)
|
||||
n += size;
|
||||
EditorManager::instance()->activateEditorForEntry(EditorManager::documentModel()->documents().at(n));
|
||||
EditorManager::activateEditorForEntry(EditorManager::documentModel()->documents().at(n));
|
||||
}
|
||||
|
||||
ExCommandMap &FakeVimExCommandsPage::exCommandMap()
|
||||
|
||||
@@ -179,7 +179,7 @@ void GitSubmitEditor::updateFileModel()
|
||||
} else {
|
||||
VcsBase::VcsBaseOutputWindow::instance()->appendError(errorMessage);
|
||||
m_forceClose = true;
|
||||
Core::EditorManager::instance()->closeEditor(this);
|
||||
Core::EditorManager::closeEditor(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,8 +60,7 @@ static const quint8 RESET = 5;
|
||||
FindMacroHandler::FindMacroHandler():
|
||||
IMacroHandler()
|
||||
{
|
||||
const Core::EditorManager *editorManager = Core::EditorManager::instance();
|
||||
connect(editorManager, SIGNAL(currentEditorChanged(Core::IEditor*)),
|
||||
connect(Core::EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)),
|
||||
this, SLOT(changeEditor(Core::IEditor*)));
|
||||
}
|
||||
|
||||
|
||||
@@ -290,7 +290,7 @@ void MacroManager::startMacro()
|
||||
QString executeShortcut = Core::ActionManager::command(Constants::EXECUTE_LAST_MACRO)->defaultKeySequence().toString();
|
||||
QString help = tr("Macro mode. Type \"%1\" to stop recording and \"%2\" to play it")
|
||||
.arg(endShortcut).arg(executeShortcut);
|
||||
Core::EditorManager::instance()->showEditorStatusBar(
|
||||
Core::EditorManager::showEditorStatusBar(
|
||||
QLatin1String(Constants::M_STATUS_BUFFER),
|
||||
help,
|
||||
tr("Stop Recording Macro"), this, SLOT(endMacro()));
|
||||
@@ -298,7 +298,7 @@ void MacroManager::startMacro()
|
||||
|
||||
void MacroManager::endMacro()
|
||||
{
|
||||
Core::EditorManager::instance()->hideEditorStatusBar(QLatin1String(Constants::M_STATUS_BUFFER));
|
||||
Core::EditorManager::hideEditorStatusBar(QLatin1String(Constants::M_STATUS_BUFFER));
|
||||
|
||||
Core::ActionManager::command(Constants::START_MACRO)->action()->setEnabled(true);
|
||||
Core::ActionManager::command(Constants::END_MACRO)->action()->setEnabled(false);
|
||||
|
||||
@@ -61,7 +61,7 @@ static quint8 COUNT = 5;
|
||||
TextEditorMacroHandler::TextEditorMacroHandler():
|
||||
IMacroHandler()
|
||||
{
|
||||
const Core::EditorManager *editorManager = Core::EditorManager::instance();
|
||||
const QObject *editorManager = Core::EditorManager::instance();
|
||||
connect(editorManager, SIGNAL(currentEditorChanged(Core::IEditor*)),
|
||||
this, SLOT(changeEditor(Core::IEditor*)));
|
||||
connect(editorManager, SIGNAL(editorAboutToClose(Core::IEditor*)),
|
||||
|
||||
@@ -1294,7 +1294,7 @@ void PerforcePlugin::describe(const QString & source, const QString &n)
|
||||
void PerforcePlugin::submitCurrentLog()
|
||||
{
|
||||
m_submitActionTriggered = true;
|
||||
Core::EditorManager::instance()->closeEditor(Core::EditorManager::currentEditor());
|
||||
Core::EditorManager::closeEditor(Core::EditorManager::currentEditor());
|
||||
}
|
||||
|
||||
void PerforcePlugin::cleanCommitMessageFile()
|
||||
|
||||
@@ -67,7 +67,7 @@ struct EditorConfigurationPrivate
|
||||
, m_storageSettings(TextEditorSettings::instance()->storageSettings())
|
||||
, m_behaviorSettings(TextEditorSettings::instance()->behaviorSettings())
|
||||
, m_extraEncodingSettings(TextEditorSettings::instance()->extraEncodingSettings())
|
||||
, m_textCodec(Core::EditorManager::instance()->defaultTextCodec())
|
||||
, m_textCodec(Core::EditorManager::defaultTextCodec())
|
||||
{
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ void EditorConfiguration::cloneGlobalSettings()
|
||||
setStorageSettings(textEditorSettings->storageSettings());
|
||||
setBehaviorSettings(textEditorSettings->behaviorSettings());
|
||||
setExtraEncodingSettings(textEditorSettings->extraEncodingSettings());
|
||||
d->m_textCodec = Core::EditorManager::instance()->defaultTextCodec();
|
||||
d->m_textCodec = Core::EditorManager::defaultTextCodec();
|
||||
}
|
||||
|
||||
QTextCodec *EditorConfiguration::textCodec() const
|
||||
@@ -208,7 +208,7 @@ void EditorConfiguration::fromMap(const QVariantMap &map)
|
||||
const QByteArray &codecName = map.value(kCodec, d->m_textCodec->name()).toByteArray();
|
||||
d->m_textCodec = QTextCodec::codecForName(codecName);
|
||||
if (!d->m_textCodec)
|
||||
d->m_textCodec = Core::EditorManager::instance()->defaultTextCodec();
|
||||
d->m_textCodec = Core::EditorManager::defaultTextCodec();
|
||||
|
||||
const int codeStyleCount = map.value(kCodeStyleCount, 0).toInt();
|
||||
for (int i = 0; i < codeStyleCount; ++i) {
|
||||
|
||||
@@ -692,9 +692,8 @@ void QmlJSTextEditorWidget::jumpToOutlineElement(int /*index*/)
|
||||
if (!location.isValid())
|
||||
return;
|
||||
|
||||
Core::EditorManager *editorManager = Core::EditorManager::instance();
|
||||
editorManager->cutForwardNavigationHistory();
|
||||
editorManager->addCurrentPositionToNavigationHistory();
|
||||
Core::EditorManager::cutForwardNavigationHistory();
|
||||
Core::EditorManager::addCurrentPositionToNavigationHistory();
|
||||
|
||||
QTextCursor cursor = textCursor();
|
||||
cursor.setPosition(location.offset);
|
||||
|
||||
@@ -217,9 +217,8 @@ void QmlJSOutlineWidget::updateTextCursor(const QModelIndex &index)
|
||||
if (location.offset >= textLength)
|
||||
return;
|
||||
|
||||
Core::EditorManager *editorManager = Core::EditorManager::instance();
|
||||
editorManager->cutForwardNavigationHistory();
|
||||
editorManager->addCurrentPositionToNavigationHistory();
|
||||
Core::EditorManager::cutForwardNavigationHistory();
|
||||
Core::EditorManager::addCurrentPositionToNavigationHistory();
|
||||
|
||||
QTextCursor textCursor = m_editor->textCursor();
|
||||
m_blockCursorSync = true;
|
||||
|
||||
@@ -363,7 +363,7 @@ void QmlProfilerTool::gotoSourceLocation(const QString &fileUrl, int lineNumber,
|
||||
TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor*>(editor);
|
||||
|
||||
if (textEditor) {
|
||||
EditorManager::instance()->addCurrentPositionToNavigationHistory();
|
||||
EditorManager::addCurrentPositionToNavigationHistory();
|
||||
// textEditor counts columns starting with 0, but the ASTs store the
|
||||
// location starting with 1, therefore the -1 in the call to gotoLine
|
||||
textEditor->gotoLine(lineNumber, columnNumber - 1);
|
||||
|
||||
@@ -90,8 +90,7 @@ QString QmlProjectRunConfiguration::disabledReason() const
|
||||
void QmlProjectRunConfiguration::ctor()
|
||||
{
|
||||
// reset default settings in constructor
|
||||
EditorManager *em = Core::EditorManager::instance();
|
||||
connect(em, SIGNAL(currentEditorChanged(Core::IEditor*)),
|
||||
connect(Core::EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)),
|
||||
this, SLOT(changeCurrentFile(Core::IEditor*)));
|
||||
|
||||
connect(target(), SIGNAL(kitChanged()),
|
||||
|
||||
@@ -78,7 +78,7 @@ BarDescriptorDocument::BarDescriptorDocument(BarDescriptorEditorWidget *editorWi
|
||||
if (QTextCodec *defaultUTF8 = QTextCodec::codecForName("UTF-8"))
|
||||
setCodec(defaultUTF8);
|
||||
else
|
||||
setCodec(Core::EditorManager::instance()->defaultTextCodec());
|
||||
setCodec(Core::EditorManager::defaultTextCodec());
|
||||
}
|
||||
|
||||
BarDescriptorDocument::~BarDescriptorDocument()
|
||||
|
||||
@@ -1074,7 +1074,7 @@ void SubversionPlugin::slotDescribe()
|
||||
void SubversionPlugin::submitCurrentLog()
|
||||
{
|
||||
m_submitActionTriggered = true;
|
||||
Core::EditorManager::instance()->closeEditors(QList<Core::IEditor*>()
|
||||
Core::EditorManager::closeEditors(QList<Core::IEditor*>()
|
||||
<< Core::EditorManager::currentEditor());
|
||||
}
|
||||
|
||||
|
||||
@@ -521,7 +521,7 @@ void BaseTextEditorWidget::selectEncoding()
|
||||
break; }
|
||||
case CodecSelector::Save:
|
||||
doc->setCodec(codecSelector.selectedCodec());
|
||||
Core::EditorManager::instance()->saveEditor(editor());
|
||||
Core::EditorManager::saveEditor(editor());
|
||||
updateTextCodecLabel();
|
||||
break;
|
||||
case CodecSelector::Cancel:
|
||||
@@ -4004,7 +4004,7 @@ void BaseTextEditorWidget::slotCursorPositionChanged()
|
||||
<< "indent:" << BaseTextDocumentLayout::userData(textCursor().block())->foldingIndent();
|
||||
#endif
|
||||
if (!d->m_contentsChanged && d->m_lastCursorChangeWasInteresting) {
|
||||
Core::EditorManager::instance()->addCurrentPositionToNavigationHistory(editor(), d->m_tempNavigationState);
|
||||
Core::EditorManager::addCurrentPositionToNavigationHistory(editor(), d->m_tempNavigationState);
|
||||
d->m_lastCursorChangeWasInteresting = false;
|
||||
} else if (d->m_contentsChanged) {
|
||||
saveCurrentCursorPositionForNavigation();
|
||||
@@ -4170,11 +4170,11 @@ void BaseTextEditorWidget::mouseMoveEvent(QMouseEvent *e)
|
||||
static bool handleForwardBackwardMouseButtons(QMouseEvent *e)
|
||||
{
|
||||
if (e->button() == Qt::XButton1) {
|
||||
Core::EditorManager::instance()->goBackInNavigationHistory();
|
||||
Core::EditorManager::goBackInNavigationHistory();
|
||||
return true;
|
||||
}
|
||||
if (e->button() == Qt::XButton2) {
|
||||
Core::EditorManager::instance()->goForwardInNavigationHistory();
|
||||
Core::EditorManager::goForwardInNavigationHistory();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -4224,7 +4224,7 @@ void BaseTextEditorWidget::mouseReleaseEvent(QMouseEvent *e)
|
||||
&& e->button() == Qt::LeftButton
|
||||
) {
|
||||
|
||||
Core::EditorManager::instance()->addCurrentPositionToNavigationHistory();
|
||||
Core::EditorManager::addCurrentPositionToNavigationHistory();
|
||||
bool inNextSplit = ((e->modifiers() & Qt::AltModifier) && !alwaysOpenLinksInNextSplit())
|
||||
|| (alwaysOpenLinksInNextSplit() && !(e->modifiers() & Qt::AltModifier));
|
||||
if (openLink(findLinkAt(cursorForPosition(e->pos())), inNextSplit)) {
|
||||
@@ -4815,11 +4815,10 @@ bool BaseTextEditorWidget::openLink(const Link &link, bool inNextSplit)
|
||||
if (!link.hasValidTarget())
|
||||
return false;
|
||||
|
||||
Core::EditorManager *editorManager = Core::EditorManager::instance();
|
||||
if (inNextSplit) {
|
||||
editorManager->gotoOtherSplit();
|
||||
Core::EditorManager::gotoOtherSplit();
|
||||
} else if (baseTextDocument()->filePath() == link.targetFileName) {
|
||||
editorManager->addCurrentPositionToNavigationHistory();
|
||||
Core::EditorManager::addCurrentPositionToNavigationHistory();
|
||||
gotoLine(link.targetLine, link.targetColumn);
|
||||
setFocus();
|
||||
return true;
|
||||
|
||||
@@ -44,8 +44,7 @@ using namespace TextEditor::Internal;
|
||||
BaseTextMarkRegistry::BaseTextMarkRegistry(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
Core::EditorManager *em = Core::EditorManager::instance();
|
||||
connect(em, SIGNAL(editorOpened(Core::IEditor*)),
|
||||
connect(Core::EditorManager::instance(), SIGNAL(editorOpened(Core::IEditor*)),
|
||||
SLOT(editorOpened(Core::IEditor*)));
|
||||
|
||||
Core::DocumentManager *dm = Core::DocumentManager::instance();
|
||||
|
||||
@@ -222,8 +222,7 @@ void BehaviorSettingsPage::settingsToUI()
|
||||
d->m_page->behaviorWidget->setAssignedStorageSettings(d->m_storageSettings);
|
||||
d->m_page->behaviorWidget->setAssignedBehaviorSettings(d->m_behaviorSettings);
|
||||
d->m_page->behaviorWidget->setAssignedExtraEncodingSettings(d->m_extraEncodingSettings);
|
||||
d->m_page->behaviorWidget->setAssignedCodec(
|
||||
Core::EditorManager::instance()->defaultTextCodec());
|
||||
d->m_page->behaviorWidget->setAssignedCodec(Core::EditorManager::defaultTextCodec());
|
||||
}
|
||||
|
||||
void BehaviorSettingsPage::finish()
|
||||
|
||||
@@ -67,7 +67,7 @@ Utils::FileIterator *FindInCurrentFile::files(const QStringList &nameFilters,
|
||||
QMap<QString, QTextCodec *> openEditorEncodings = ITextEditor::openedTextDocumentEncodings();
|
||||
QTextCodec *codec = openEditorEncodings.value(fileName);
|
||||
if (!codec)
|
||||
codec = Core::EditorManager::instance()->defaultTextCodec();
|
||||
codec = Core::EditorManager::defaultTextCodec();
|
||||
return new Utils::FileIterator(QStringList() << fileName, QList<QTextCodec *>() << codec);
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ Utils::FileIterator *FindInFiles::files(const QStringList &nameFilters,
|
||||
{
|
||||
return new Utils::SubDirFileIterator(QStringList() << additionalParameters.toString(),
|
||||
nameFilters,
|
||||
Core::EditorManager::instance()->defaultTextCodec());
|
||||
Core::EditorManager::defaultTextCodec());
|
||||
}
|
||||
|
||||
QVariant FindInFiles::additionalParameters() const
|
||||
|
||||
@@ -43,9 +43,9 @@ using namespace TextEditor::Internal;
|
||||
|
||||
FindInOpenFiles::FindInOpenFiles()
|
||||
{
|
||||
connect(Core::ICore::instance()->editorManager(), SIGNAL(editorOpened(Core::IEditor*)),
|
||||
connect(Core::EditorManager::instance(), SIGNAL(editorOpened(Core::IEditor*)),
|
||||
this, SLOT(updateEnabledState()));
|
||||
connect(Core::ICore::instance()->editorManager(), SIGNAL(editorsClosed(QList<Core::IEditor*>)),
|
||||
connect(Core::EditorManager::instance(), SIGNAL(editorsClosed(QList<Core::IEditor*>)),
|
||||
this, SLOT(updateEnabledState()));
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ Utils::FileIterator *FindInOpenFiles::files(const QStringList &nameFilters,
|
||||
fileNames.append(fileName);
|
||||
QTextCodec *codec = openEditorEncodings.value(fileName);
|
||||
if (!codec)
|
||||
codec = Core::EditorManager::instance()->defaultTextCodec();
|
||||
codec = Core::EditorManager::defaultTextCodec();
|
||||
codecs.append(codec);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,8 +91,7 @@ void LineNumberFilter::accept(FilterEntry selection) const
|
||||
{
|
||||
ITextEditor *editor = currentTextEditor();
|
||||
if (editor) {
|
||||
Core::EditorManager *editorManager = Core::EditorManager::instance();
|
||||
editorManager->addCurrentPositionToNavigationHistory();
|
||||
EditorManager::addCurrentPositionToNavigationHistory();
|
||||
LineColumn data = selection.internalData.value<LineColumn>();
|
||||
if (data.first < 1) { // jump to column in same line
|
||||
int currLine, currColumn;
|
||||
@@ -100,7 +99,7 @@ void LineNumberFilter::accept(FilterEntry selection) const
|
||||
data.first = currLine;
|
||||
}
|
||||
editor->gotoLine(data.first, data.second);
|
||||
Core::EditorManager::activateEditor(editor);
|
||||
EditorManager::activateEditor(editor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -71,8 +71,7 @@ OutlineWidgetStack::OutlineWidgetStack(OutlineFactory *factory) :
|
||||
m_filterMenu = new QMenu(m_filterButton);
|
||||
m_filterButton->setMenu(m_filterMenu);
|
||||
|
||||
Core::EditorManager *editorManager = Core::EditorManager::instance();
|
||||
connect(editorManager, SIGNAL(currentEditorChanged(Core::IEditor*)),
|
||||
connect(Core::EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)),
|
||||
this, SLOT(updateCurrentEditor(Core::IEditor*)));
|
||||
updateCurrentEditor(Core::EditorManager::currentEditor());
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ bool RefactoringChanges::createFile(const QString &fileName, const QString &cont
|
||||
|
||||
// Write the file to disk:
|
||||
Utils::TextFileFormat format;
|
||||
format.codec = Core::EditorManager::instance()->defaultTextCodec();
|
||||
format.codec = Core::EditorManager::defaultTextCodec();
|
||||
QString error;
|
||||
bool saveOk = format.writeFile(fileName, document->toPlainText(), &error);
|
||||
delete document;
|
||||
@@ -207,7 +207,7 @@ QTextDocument *RefactoringFile::mutableDocument() const
|
||||
QString fileContents;
|
||||
if (!m_fileName.isEmpty()) {
|
||||
QString error;
|
||||
QTextCodec *defaultCodec = Core::EditorManager::instance()->defaultTextCodec();
|
||||
QTextCodec *defaultCodec = Core::EditorManager::defaultTextCodec();
|
||||
Utils::TextFileFormat::ReadResult result = Utils::TextFileFormat::readFile(
|
||||
m_fileName, defaultCodec,
|
||||
&fileContents, &m_textFileFormat,
|
||||
|
||||
@@ -160,10 +160,8 @@ void TodoItemsProvider::setupStartupProjectBinding()
|
||||
|
||||
void TodoItemsProvider::setupCurrentEditorBinding()
|
||||
{
|
||||
Core::EditorManager *editorManager = Core::EditorManager::instance();
|
||||
|
||||
m_currentEditor = Core::EditorManager::currentEditor();
|
||||
connect(editorManager, SIGNAL(currentEditorChanged(Core::IEditor*)),
|
||||
connect(Core::EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)),
|
||||
SLOT(currentEditorChanged(Core::IEditor*)));
|
||||
}
|
||||
|
||||
|
||||
@@ -878,8 +878,7 @@ void VcsBaseEditorWidget::slotJumpToEntry(int index)
|
||||
int currentLine, currentColumn;
|
||||
convertPosition(position(), ¤tLine, ¤tColumn);
|
||||
if (lineNumber != currentLine) {
|
||||
Core::EditorManager *editorManager = Core::EditorManager::instance();
|
||||
editorManager->addCurrentPositionToNavigationHistory();
|
||||
Core::EditorManager::addCurrentPositionToNavigationHistory();
|
||||
gotoLine(lineNumber, 0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user