forked from qt-creator/qt-creator
Move displayName from IEditor to IDocument
The display name is not editor instance specific, but belongs to the document. Change-Id: I3c936f04a86e10e6ca30063d85036d85b4b5880e Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
@@ -335,7 +335,7 @@ void BaseTextEditorWidgetPrivate::print(QPrinter *printer)
|
||||
{
|
||||
QTextDocument *doc = q->document();
|
||||
|
||||
QString title = q->displayName();
|
||||
QString title = m_document->displayName();
|
||||
if (title.isEmpty())
|
||||
printer->setDocName(title);
|
||||
|
||||
@@ -499,7 +499,7 @@ BaseTextEditor *BaseTextEditorWidget::editor() const
|
||||
connect(this, SIGNAL(textChanged()),
|
||||
d->m_editor, SIGNAL(contentsChanged()));
|
||||
connect(this, SIGNAL(changed()),
|
||||
d->m_editor, SIGNAL(changed()));
|
||||
d->m_editor->document(), SIGNAL(changed()));
|
||||
}
|
||||
return d->m_editor;
|
||||
}
|
||||
@@ -557,7 +557,7 @@ void BaseTextEditorWidget::updateCannotDecodeInfo()
|
||||
if (d->m_document->hasDecodingError()) {
|
||||
Core::InfoBarEntry info(Core::Id(Constants::SELECT_ENCODING),
|
||||
tr("<b>Error:</b> Could not decode \"%1\" with \"%2\"-encoding. Editing not possible.")
|
||||
.arg(displayName()).arg(QString::fromLatin1(d->m_document->codec()->name())));
|
||||
.arg(d->m_document->displayName()).arg(QString::fromLatin1(d->m_document->codec()->name())));
|
||||
info.setCustomButtonInfo(tr("Select Encoding"), this, SLOT(selectEncoding()));
|
||||
d->m_document->infoBar()->addInfo(info);
|
||||
} else {
|
||||
@@ -2153,7 +2153,6 @@ void BaseTextEditorWidget::duplicateFrom(BaseTextEditorWidget *widget)
|
||||
{
|
||||
if (this == widget)
|
||||
return;
|
||||
setDisplayName(widget->displayName());
|
||||
d->m_revisionsVisible = widget->d->m_revisionsVisible;
|
||||
if (d->m_document == widget->d->m_document)
|
||||
return;
|
||||
@@ -2161,17 +2160,6 @@ void BaseTextEditorWidget::duplicateFrom(BaseTextEditorWidget *widget)
|
||||
d->m_document = widget->d->m_document;
|
||||
}
|
||||
|
||||
QString BaseTextEditorWidget::displayName() const
|
||||
{
|
||||
return d->m_displayName;
|
||||
}
|
||||
|
||||
void BaseTextEditorWidget::setDisplayName(const QString &title)
|
||||
{
|
||||
d->m_displayName = title;
|
||||
emit changed();
|
||||
}
|
||||
|
||||
QSharedPointer<BaseTextDocument> BaseTextEditorWidget::baseTextDocument() const
|
||||
{
|
||||
return d->m_document;
|
||||
@@ -2584,8 +2572,6 @@ void BaseTextEditorWidgetPrivate::setupDocumentSignals(const QSharedPointer<Base
|
||||
QObject::connect(doc, SIGNAL(modificationChanged(bool)), q, SIGNAL(changed()));
|
||||
QObject::connect(doc, SIGNAL(contentsChange(int,int,int)), q,
|
||||
SLOT(editorContentsChange(int,int,int)), Qt::DirectConnection);
|
||||
QObject::connect(document.data(), SIGNAL(changed()), q, SIGNAL(changed()));
|
||||
QObject::connect(document.data(), SIGNAL(titleChanged(QString)), q, SLOT(setDisplayName(QString)));
|
||||
QObject::connect(document.data(), SIGNAL(aboutToReload()), q, SLOT(documentAboutToBeReloaded()));
|
||||
QObject::connect(document.data(), SIGNAL(reloadFinished(bool)), q, SLOT(documentReloadFinished(bool)));
|
||||
q->slotUpdateExtraAreaWidth();
|
||||
|
||||
Reference in New Issue
Block a user