Commit 22aef3b6 authored by hjk's avatar hjk

VcsBase: Remove remaining BaseTextEditor::editor() usage

Change-Id: I5414319b30f29dfd2d321f6ca99554df8202e6d8
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
parent 747b34c3
......@@ -288,7 +288,7 @@ void GitEditorWidget::applyDiffChunk(const VcsBase::DiffChunk& chunk, bool rever
void GitEditorWidget::init()
{
VcsBase::VcsBaseEditorWidget::init();
Core::Id editorId = editor()->document()->id();
Core::Id editorId = textDocument()->id();
if (editorId == Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID)
textDocument()->setSyntaxHighlighter(new GitSubmitHighlighter);
else if (editorId == Git::Constants::GIT_REBASE_EDITOR_ID)
......@@ -310,7 +310,7 @@ void GitEditorWidget::addDiffActions(QMenu *menu, const VcsBase::DiffChunk &chun
bool GitEditorWidget::open(QString *errorString, const QString &fileName, const QString &realFileName)
{
Core::Id editorId = editor()->document()->id();
Core::Id editorId = textDocument()->id();
if (editorId == Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID
|| editorId == Git::Constants::GIT_REBASE_EDITOR_ID) {
QFileInfo fi(fileName);
......@@ -378,8 +378,8 @@ QString GitEditorWidget::revisionSubject(const QTextBlock &inBlock) const
bool GitEditorWidget::supportChangeLinks() const
{
return VcsBaseEditorWidget::supportChangeLinks()
|| (editor()->document()->id() == Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID)
|| (editor()->document()->id() == Git::Constants::GIT_REBASE_EDITOR_ID);
|| (textDocument()->id() == Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID)
|| (textDocument()->id() == Git::Constants::GIT_REBASE_EDITOR_ID);
}
QString GitEditorWidget::fileNameForLine(int line) const
......
......@@ -156,6 +156,17 @@ VcsBaseEditor::VcsBaseEditor(const VcsBaseEditorParameters *type)
setContext(Core::Context(type->context, TextEditor::Constants::C_TEXTEDITOR));
}
void VcsBaseEditor::finalizeInitialization()
{
auto widget = qobject_cast<VcsBaseEditorWidget *>(editorWidget());
QTC_ASSERT(widget, return);
// Pass on signals.
connect(widget, &VcsBaseEditorWidget::describeRequested,
this, &VcsBaseEditor::describeRequested);
connect(widget, &VcsBaseEditorWidget::annotateRevisionRequested,
this, &VcsBaseEditor::annotateRevisionRequested);
}
// ----------- VcsBaseEditorPrivate
namespace Internal {
......@@ -687,13 +698,6 @@ void VcsBaseEditorWidget::setDescribeSlot(QObject *describeReceiver, const char
void VcsBaseEditorWidget::finalizeInitialization()
{
BaseTextEditor *editor = this->editor();
// Pass on signals.
connect(this, SIGNAL(describeRequested(QString,QString)),
editor, SIGNAL(describeRequested(QString,QString)));
connect(this, SIGNAL(annotateRevisionRequested(QString,QString,QString,int)),
editor, SIGNAL(annotateRevisionRequested(QString,QString,QString,int)));
if (d->m_describeReceiver)
connect(this, SIGNAL(describeRequested(QString,QString)), d->m_describeReceiver, d->m_describeSlot);
......@@ -738,10 +742,8 @@ VcsBaseEditorWidget::~VcsBaseEditorWidget()
void VcsBaseEditorWidget::setForceReadOnly(bool b)
{
VcsBaseEditor *eda = qobject_cast<VcsBaseEditor *>(editor());
QTC_ASSERT(eda != 0, return);
setReadOnly(b);
eda->document()->setTemporary(b);
textDocument()->setTemporary(b);
}
QString VcsBaseEditorWidget::source() const
......
......@@ -132,6 +132,7 @@ public:
static Core::IEditor* locateEditorByTag(const QString &tag);
static QString editorTag(EditorContentType t, const QString &workingDirectory, const QStringList &files,
const QString &revision = QString());
void finalizeInitialization();
signals:
void describeRequested(const QString &source, const QString &change);
void annotateRevisionRequested(const QString &workingDirectory, const QString &file,
......
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