forked from qt-creator/qt-creator
EditorManager: Make placeholder text API 'module-private'
Since locator is actually part of coreplugin, and it is the only one supported to set this currently. Change-Id: I7f310a29f6d157f3a494fa774216772e48853dc4 Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
This commit is contained in:
@@ -510,6 +510,11 @@ void EditorManagerPrivate::init()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EditorManagerPrivate *EditorManagerPrivate::instance()
|
||||||
|
{
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
EditorArea *EditorManagerPrivate::mainEditorArea()
|
EditorArea *EditorManagerPrivate::mainEditorArea()
|
||||||
{
|
{
|
||||||
return d->m_editorAreas.at(0);
|
return d->m_editorAreas.at(0);
|
||||||
@@ -1467,6 +1472,19 @@ void EditorManagerPrivate::makeCurrentEditorWritable()
|
|||||||
makeFileWritable(doc);
|
makeFileWritable(doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EditorManagerPrivate::setPlaceholderText(const QString &text)
|
||||||
|
{
|
||||||
|
if (d->m_placeholderText == text)
|
||||||
|
return;
|
||||||
|
d->m_placeholderText = text;
|
||||||
|
emit d->placeholderTextChanged(d->m_placeholderText);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString EditorManagerPrivate::placeholderText()
|
||||||
|
{
|
||||||
|
return d->m_placeholderText;
|
||||||
|
}
|
||||||
|
|
||||||
void EditorManagerPrivate::vcsOpenCurrentEditor()
|
void EditorManagerPrivate::vcsOpenCurrentEditor()
|
||||||
{
|
{
|
||||||
IDocument *document = EditorManager::currentDocument();
|
IDocument *document = EditorManager::currentDocument();
|
||||||
@@ -1987,19 +2005,6 @@ void EditorManager::addNativeDirAndOpenWithActions(QMenu *contextMenu, DocumentM
|
|||||||
DocumentManager::populateOpenWithMenu(openWith, entry->fileName());
|
DocumentManager::populateOpenWithMenu(openWith, entry->fileName());
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorManager::setPlaceholderText(const QString &text)
|
|
||||||
{
|
|
||||||
if (d->m_placeholderText == text)
|
|
||||||
return;
|
|
||||||
d->m_placeholderText = text;
|
|
||||||
emit m_instance->placeholderTextChanged(d->m_placeholderText);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString EditorManager::placeholderText()
|
|
||||||
{
|
|
||||||
return d->m_placeholderText;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EditorManager::saveDocument()
|
void EditorManager::saveDocument()
|
||||||
{
|
{
|
||||||
EditorManagerPrivate::saveDocument(currentDocument());
|
EditorManagerPrivate::saveDocument(currentDocument());
|
||||||
|
@@ -173,9 +173,6 @@ public:
|
|||||||
IEditor *editor = 0);
|
IEditor *editor = 0);
|
||||||
static void addNativeDirAndOpenWithActions(QMenu *contextMenu, DocumentModel::Entry *entry);
|
static void addNativeDirAndOpenWithActions(QMenu *contextMenu, DocumentModel::Entry *entry);
|
||||||
|
|
||||||
static void setPlaceholderText(const QString &text);
|
|
||||||
static QString placeholderText();
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void currentEditorChanged(Core::IEditor *editor);
|
void currentEditorChanged(Core::IEditor *editor);
|
||||||
void currentDocumentStateChanged();
|
void currentDocumentStateChanged();
|
||||||
@@ -184,7 +181,6 @@ signals:
|
|||||||
void editorAboutToClose(Core::IEditor *editor);
|
void editorAboutToClose(Core::IEditor *editor);
|
||||||
void editorsClosed(QList<Core::IEditor *> editors);
|
void editorsClosed(QList<Core::IEditor *> editors);
|
||||||
void findOnFileSystemRequest(const QString &path);
|
void findOnFileSystemRequest(const QString &path);
|
||||||
void placeholderTextChanged(const QString &text);
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
static void saveDocument();
|
static void saveDocument();
|
||||||
|
@@ -68,6 +68,8 @@ class EditorManagerPrivate : public QObject
|
|||||||
friend class Core::EditorManager;
|
friend class Core::EditorManager;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
static EditorManagerPrivate *instance();
|
||||||
|
|
||||||
static EditorArea *mainEditorArea();
|
static EditorArea *mainEditorArea();
|
||||||
static EditorView *currentEditorView();
|
static EditorView *currentEditorView();
|
||||||
static void setCurrentEditor(IEditor *editor, bool ignoreNavigationHistory = false);
|
static void setCurrentEditor(IEditor *editor, bool ignoreNavigationHistory = false);
|
||||||
@@ -121,6 +123,9 @@ public:
|
|||||||
static void vcsOpenCurrentEditor();
|
static void vcsOpenCurrentEditor();
|
||||||
static void makeCurrentEditorWritable();
|
static void makeCurrentEditorWritable();
|
||||||
|
|
||||||
|
static void setPlaceholderText(const QString &text);
|
||||||
|
static QString placeholderText();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
static bool saveDocument(Core::IDocument *document);
|
static bool saveDocument(Core::IDocument *document);
|
||||||
static bool saveDocumentAs(Core::IDocument *document);
|
static bool saveDocumentAs(Core::IDocument *document);
|
||||||
@@ -132,6 +137,9 @@ public slots:
|
|||||||
void handleDocumentStateChange();
|
void handleDocumentStateChange();
|
||||||
static void editorAreaDestroyed(QObject *area);
|
static void editorAreaDestroyed(QObject *area);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void placeholderTextChanged(const QString &text);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
static void gotoNextDocHistory();
|
static void gotoNextDocHistory();
|
||||||
static void gotoPreviousDocHistory();
|
static void gotoPreviousDocHistory();
|
||||||
|
@@ -126,9 +126,9 @@ EditorView::EditorView(SplitterOrView *parentSplitterOrView, QWidget *parent) :
|
|||||||
auto emptyLayout = new QGridLayout(empty);
|
auto emptyLayout = new QGridLayout(empty);
|
||||||
empty->setLayout(emptyLayout);
|
empty->setLayout(emptyLayout);
|
||||||
m_emptyViewLabel = new QLabel;
|
m_emptyViewLabel = new QLabel;
|
||||||
connect(EditorManager::instance(), &EditorManager::placeholderTextChanged,
|
connect(EditorManagerPrivate::instance(), &EditorManagerPrivate::placeholderTextChanged,
|
||||||
m_emptyViewLabel, &QLabel::setText);
|
m_emptyViewLabel, &QLabel::setText);
|
||||||
m_emptyViewLabel->setText(EditorManager::placeholderText());
|
m_emptyViewLabel->setText(EditorManagerPrivate::placeholderText());
|
||||||
emptyLayout->addWidget(m_emptyViewLabel);
|
emptyLayout->addWidget(m_emptyViewLabel);
|
||||||
m_container->addWidget(empty);
|
m_container->addWidget(empty);
|
||||||
m_widgetEditorMap.insert(empty, 0);
|
m_widgetEditorMap.insert(empty, 0);
|
||||||
|
@@ -45,6 +45,7 @@
|
|||||||
#include <coreplugin/actionmanager/actionmanager.h>
|
#include <coreplugin/actionmanager/actionmanager.h>
|
||||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
|
#include <coreplugin/editormanager/editormanager_p.h>
|
||||||
#include <coreplugin/progressmanager/progressmanager.h>
|
#include <coreplugin/progressmanager/progressmanager.h>
|
||||||
#include <coreplugin/progressmanager/futureprogress.h>
|
#include <coreplugin/progressmanager/futureprogress.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
@@ -227,7 +228,7 @@ void Locator::updateEditorManagerPlaceholderText()
|
|||||||
methods = tr("<div style=\"margin-left: 1em\">- type <code>%1<space><pattern></code>"
|
methods = tr("<div style=\"margin-left: 1em\">- type <code>%1<space><pattern></code>"
|
||||||
" to jump to a function definition</div>").arg(methodsFilter->shortcutString());
|
" to jump to a function definition</div>").arg(methodsFilter->shortcutString());
|
||||||
|
|
||||||
EditorManager::setPlaceholderText(placeholderText.arg(classes, methods));
|
EditorManagerPrivate::setPlaceholderText(placeholderText.arg(classes, methods));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Locator::saveSettings()
|
void Locator::saveSettings()
|
||||||
|
Reference in New Issue
Block a user