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:
@@ -35,7 +35,6 @@
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QToolButton>
|
||||
#include <QSpinBox>
|
||||
#include <QStyle>
|
||||
@@ -87,19 +86,6 @@ Core::IDocument *DiffEditor::document()
|
||||
return m_file;
|
||||
}
|
||||
|
||||
QString DiffEditor::displayName() const
|
||||
{
|
||||
if (m_displayName.isEmpty())
|
||||
m_displayName = QCoreApplication::translate("DiffEditor", Constants::DIFF_EDITOR_DISPLAY_NAME);
|
||||
return m_displayName;
|
||||
}
|
||||
|
||||
void DiffEditor::setDisplayName(const QString &title)
|
||||
{
|
||||
m_displayName = title;
|
||||
emit changed();
|
||||
}
|
||||
|
||||
Core::Id DiffEditor::id() const
|
||||
{
|
||||
return Constants::DIFF_EDITOR_ID;
|
||||
|
||||
@@ -63,8 +63,6 @@ public:
|
||||
bool createNew(const QString &contents);
|
||||
bool open(QString *errorString, const QString &fileName, const QString &realFileName);
|
||||
Core::IDocument *document();
|
||||
QString displayName() const;
|
||||
void setDisplayName(const QString &title);
|
||||
Core::Id id() const;
|
||||
bool isTemporary() const { return true; }
|
||||
DiffEditorWidget *editorWidget() const { return m_editorWidget; }
|
||||
@@ -86,7 +84,6 @@ private:
|
||||
Internal::DiffEditorFile *m_file;
|
||||
DiffEditorWidget *m_editorWidget;
|
||||
QComboBox *m_entriesComboBox;
|
||||
mutable QString m_displayName;
|
||||
};
|
||||
|
||||
} // namespace DiffEditor
|
||||
|
||||
@@ -28,6 +28,9 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "diffeditorfile.h"
|
||||
#include "diffeditorconstants.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
namespace DiffEditor {
|
||||
namespace Internal {
|
||||
@@ -39,6 +42,7 @@ DiffEditorFile::DiffEditorFile(const QString &mimeType, QObject *parent) :
|
||||
m_mimeType(mimeType),
|
||||
m_modified(false)
|
||||
{
|
||||
setDisplayName(QCoreApplication::translate("DiffEditor", Constants::DIFF_EDITOR_DISPLAY_NAME));
|
||||
}
|
||||
|
||||
void DiffEditorFile::setModified(bool modified)
|
||||
|
||||
@@ -110,6 +110,8 @@ void DiffShowEditorWidget::setDisplaySettings(const DisplaySettings &ds)
|
||||
DiffShowEditor::DiffShowEditor(DiffEditorWidget *editorWidget)
|
||||
: DiffEditor(editorWidget)
|
||||
{
|
||||
document()->setDisplayName(QCoreApplication::translate("DiffShowEditor",
|
||||
Constants::DIFF_SHOW_EDITOR_DISPLAY_NAME));
|
||||
QSplitter *splitter = new Core::MiniSplitter(Qt::Vertical);
|
||||
m_diffShowWidget = new Internal::DiffShowEditorWidget(splitter);
|
||||
m_diffShowWidget->setReadOnly(true);
|
||||
@@ -136,19 +138,6 @@ void DiffShowEditor::setDescription(const QString &description)
|
||||
m_diffShowWidget->setPlainText(description);
|
||||
}
|
||||
|
||||
QString DiffShowEditor::displayName() const
|
||||
{
|
||||
if (m_displayName.isEmpty())
|
||||
m_displayName = QCoreApplication::translate("DiffShowEditor", Constants::DIFF_SHOW_EDITOR_DISPLAY_NAME);
|
||||
return m_displayName;
|
||||
}
|
||||
|
||||
void DiffShowEditor::setDisplayName(const QString &title)
|
||||
{
|
||||
m_displayName = title;
|
||||
emit changed();
|
||||
}
|
||||
|
||||
Core::Id DiffShowEditor::id() const
|
||||
{
|
||||
return Constants::DIFF_SHOW_EDITOR_ID;
|
||||
|
||||
@@ -56,8 +56,6 @@ public:
|
||||
public:
|
||||
void setDescription(const QString &description);
|
||||
// Core::IEditor
|
||||
QString displayName() const;
|
||||
void setDisplayName(const QString &title);
|
||||
Core::Id id() const;
|
||||
|
||||
QWidget *toolBar();
|
||||
@@ -69,7 +67,6 @@ private:
|
||||
void updateEntryToolTip();
|
||||
|
||||
TextEditor::BaseTextEditorWidget *m_diffShowWidget;
|
||||
mutable QString m_displayName;
|
||||
QToolButton *m_toggleDescriptionButton;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user