Commit fbcff211 authored by Eike Ziller's avatar Eike Ziller

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: default avatarDavid Schulz <david.schulz@theqtcompany.com>
parent 77f584b9
......@@ -510,6 +510,11 @@ void EditorManagerPrivate::init()
});
}
EditorManagerPrivate *EditorManagerPrivate::instance()
{
return d;
}
EditorArea *EditorManagerPrivate::mainEditorArea()
{
return d->m_editorAreas.at(0);
......@@ -1467,6 +1472,19 @@ void EditorManagerPrivate::makeCurrentEditorWritable()
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()
{
IDocument *document = EditorManager::currentDocument();
......@@ -1987,19 +2005,6 @@ void EditorManager::addNativeDirAndOpenWithActions(QMenu *contextMenu, DocumentM
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()
{
EditorManagerPrivate::saveDocument(currentDocument());
......
......@@ -173,9 +173,6 @@ public:
IEditor *editor = 0);
static void addNativeDirAndOpenWithActions(QMenu *contextMenu, DocumentModel::Entry *entry);
static void setPlaceholderText(const QString &text);
static QString placeholderText();
signals:
void currentEditorChanged(Core::IEditor *editor);
void currentDocumentStateChanged();
......@@ -184,7 +181,6 @@ signals:
void editorAboutToClose(Core::IEditor *editor);
void editorsClosed(QList<Core::IEditor *> editors);
void findOnFileSystemRequest(const QString &path);
void placeholderTextChanged(const QString &text);
public slots:
static void saveDocument();
......
......@@ -68,6 +68,8 @@ class EditorManagerPrivate : public QObject
friend class Core::EditorManager;
public:
static EditorManagerPrivate *instance();
static EditorArea *mainEditorArea();
static EditorView *currentEditorView();
static void setCurrentEditor(IEditor *editor, bool ignoreNavigationHistory = false);
......@@ -121,6 +123,9 @@ public:
static void vcsOpenCurrentEditor();
static void makeCurrentEditorWritable();
static void setPlaceholderText(const QString &text);
static QString placeholderText();
public slots:
static bool saveDocument(Core::IDocument *document);
static bool saveDocumentAs(Core::IDocument *document);
......@@ -132,6 +137,9 @@ public slots:
void handleDocumentStateChange();
static void editorAreaDestroyed(QObject *area);
signals:
void placeholderTextChanged(const QString &text);
private slots:
static void gotoNextDocHistory();
static void gotoPreviousDocHistory();
......
......@@ -126,9 +126,9 @@ EditorView::EditorView(SplitterOrView *parentSplitterOrView, QWidget *parent) :
auto emptyLayout = new QGridLayout(empty);
empty->setLayout(emptyLayout);
m_emptyViewLabel = new QLabel;
connect(EditorManager::instance(), &EditorManager::placeholderTextChanged,
connect(EditorManagerPrivate::instance(), &EditorManagerPrivate::placeholderTextChanged,
m_emptyViewLabel, &QLabel::setText);
m_emptyViewLabel->setText(EditorManager::placeholderText());
m_emptyViewLabel->setText(EditorManagerPrivate::placeholderText());
emptyLayout->addWidget(m_emptyViewLabel);
m_container->addWidget(empty);
m_widgetEditorMap.insert(empty, 0);
......
......@@ -45,6 +45,7 @@
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/editormanager/editormanager_p.h>
#include <coreplugin/progressmanager/progressmanager.h>
#include <coreplugin/progressmanager/futureprogress.h>
#include <extensionsystem/pluginmanager.h>
......@@ -227,7 +228,7 @@ void Locator::updateEditorManagerPlaceholderText()
methods = tr("<div style=\"margin-left: 1em\">- type <code>%1&lt;space&gt;&lt;pattern&gt;</code>"
" 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()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment