Commit daad8e23 authored by hjk's avatar hjk Committed by Eike Ziller
Browse files

Editors: Provide a base implementation for duplicate{,Supported}



Helps avoiding trivial re-implementations.

Change-Id: Iaa2e6b92503a2b9553432568c2047c28899c7ea6
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent 8e50dc18
......@@ -73,17 +73,6 @@ Core::Id AndroidManifestEditor::id() const
return Constants::ANDROID_MANIFEST_EDITOR_ID;
}
bool AndroidManifestEditor::duplicateSupported() const
{
return false;
}
Core::IEditor *AndroidManifestEditor::duplicate(QWidget *parent)
{
Q_UNUSED(parent);
return 0;
}
bool AndroidManifestEditor::isTemporary() const
{
return false;
......
......@@ -46,15 +46,13 @@ class AndroidManifestEditorWidget;
class AndroidManifestEditor : public TextEditor::BaseTextEditor
{
Q_OBJECT
public:
explicit AndroidManifestEditor(AndroidManifestEditorWidget *editorWidget);
Core::Id id() const;
bool duplicateSupported() const;
Core::IEditor *duplicate(QWidget *parent);
bool isTemporary() const;
private slots:
void changeEditorPage(QAction *action);
......
......@@ -364,9 +364,6 @@ public:
QString displayName() const { return m_displayName; }
void setDisplayName(const QString &title) { m_displayName = title; emit changed(); }
bool duplicateSupported() const { return false; }
IEditor *duplicate(QWidget * /* parent */) { return 0; }
QByteArray saveState() const { return QByteArray(); } // not supported
bool restoreState(const QByteArray & /* state */) { return false; } // not supported
......
......@@ -54,8 +54,8 @@ public:
virtual QString displayName() const = 0;
virtual void setDisplayName(const QString &title) = 0;
virtual bool duplicateSupported() const = 0;
virtual IEditor *duplicate(QWidget *parent) = 0;
virtual bool duplicateSupported() const { return false; }
virtual IEditor *duplicate(QWidget */*parent*/) { return 0; }
virtual QByteArray saveState() const = 0;
virtual bool restoreState(const QByteArray &state) = 0;
......
......@@ -215,16 +215,6 @@ void FormWindowEditor::setDisplayName(const QString &title)
emit changed();
}
bool FormWindowEditor::duplicateSupported() const
{
return false;
}
Core::IEditor *FormWindowEditor::duplicate(QWidget *)
{
return 0;
}
QByteArray FormWindowEditor::saveState() const
{
return d->m_textEditor.saveState();
......
......@@ -74,9 +74,6 @@ public:
virtual QString displayName() const;
virtual void setDisplayName(const QString &title);
virtual bool duplicateSupported() const;
virtual IEditor *duplicate(QWidget *parent);
virtual QByteArray saveState() const;
virtual bool restoreState(const QByteArray &state);
......
......@@ -98,17 +98,6 @@ void DiffEditorEditable::setDisplayName(const QString &title)
emit changed();
}
bool DiffEditorEditable::duplicateSupported() const
{
return false;
}
Core::IEditor *DiffEditorEditable::duplicate(QWidget *parent)
{
Q_UNUSED(parent)
return 0;
}
Core::Id DiffEditorEditable::id() const
{
return Constants::DIFF_EDITOR_ID;
......
......@@ -65,8 +65,6 @@ public:
Core::IDocument *document();
QString displayName() const;
void setDisplayName(const QString &title);
bool duplicateSupported() const;
Core::IEditor *duplicate(QWidget *parent);
Core::Id id() const;
bool isTemporary() const { return true; }
DiffEditorWidget *editorWidget() const { return m_editorWidget; }
......
......@@ -101,11 +101,9 @@ class DiffViewEditorEditable : public BaseTextEditor
Q_OBJECT
public:
DiffViewEditorEditable(BaseTextEditorWidget *editorWidget) : BaseTextEditor(editorWidget) {}
virtual Core::Id id() const { return "DiffViewEditor"; }
virtual bool duplicateSupported() const { return false; }
virtual IEditor *duplicate(QWidget *parent) { Q_UNUSED(parent) return 0; }
virtual bool isTemporary() const { return false; }
Core::Id id() const { return "DiffViewEditor"; }
bool isTemporary() const { return false; }
};
......
......@@ -163,17 +163,6 @@ void ImageViewer::setDisplayName(const QString &title)
emit changed();
}
bool ImageViewer::duplicateSupported() const
{
return false;
}
Core::IEditor *ImageViewer::duplicate(QWidget *parent)
{
Q_UNUSED(parent);
return 0;
}
QByteArray ImageViewer::saveState() const
{
return QByteArray();
......
......@@ -61,9 +61,6 @@ public:
QString displayName() const;
void setDisplayName(const QString &title);
bool duplicateSupported() const;
IEditor *duplicate(QWidget *parent);
QByteArray saveState() const;
bool restoreState(const QByteArray &state);
......
......@@ -118,17 +118,6 @@ void BarDescriptorEditor::setDisplayName(const QString &title)
emit changed();
}
bool BarDescriptorEditor::duplicateSupported() const
{
return false;
}
Core::IEditor *BarDescriptorEditor::duplicate(QWidget *parent)
{
Q_UNUSED(parent);
return 0;
}
QByteArray BarDescriptorEditor::saveState() const
{
return QByteArray(); // Not supported
......
......@@ -70,9 +70,6 @@ public:
QString displayName() const;
void setDisplayName(const QString &title);
bool duplicateSupported() const;
Core::IEditor *duplicate(QWidget *parent);
QByteArray saveState() const;
bool restoreState(const QByteArray &state);
......
......@@ -83,8 +83,6 @@ public:
// IEditor
bool createNew(const QString &contents);
bool open(QString *errorString, const QString &fileName, const QString &realFileName);
bool duplicateSupported() const { return false; }
Core::IEditor *duplicate(QWidget *) { return 0; }
Core::IDocument *document() { return m_resourceDocument; }
Core::Id id() const;
QString displayName() const { return m_displayName; }
......
......@@ -145,8 +145,6 @@ class VcsBaseEditor : public TextEditor::BaseTextEditor
public:
VcsBaseEditor(VcsBaseEditorWidget *, const VcsBaseEditorParameters *type);
bool duplicateSupported() const { return false; }
Core::IEditor *duplicate(QWidget * /*parent*/) { return 0; }
Core::Id id() const { return m_id; }
bool isTemporary() const { return m_temporary; }
......
......@@ -400,16 +400,6 @@ void VcsBaseSubmitEditor::setCheckScriptWorkingDirectory(const QString &s)
d->m_checkScriptWorkingDirectory = s;
}
bool VcsBaseSubmitEditor::duplicateSupported() const
{
return false;
}
Core::IEditor *VcsBaseSubmitEditor::duplicate(QWidget * /*parent*/)
{
return 0;
}
Core::Id VcsBaseSubmitEditor::id() const
{
return d->m_parameters->id;
......
......@@ -116,8 +116,6 @@ public:
Core::IDocument *document();
QString displayName() const;
void setDisplayName(const QString &title);
bool duplicateSupported() const;
Core::IEditor *duplicate(QWidget *parent);
Core::Id id() const;
bool isTemporary() const { return true; }
......
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