Commit 6dd0e79d authored by Eike Ziller's avatar Eike Ziller

Add override to IDocument hierarchy

Change-Id: I6884f59fe0f06e380254c1f8076dd561d9df4ee3
Reviewed-by: default avatarTobias Hunger <tobias.hunger@theqtcompany.com>
parent 277495e8
......@@ -42,13 +42,15 @@ class AndroidManifestDocument : public TextEditor::TextDocument
{
public:
explicit AndroidManifestDocument(AndroidManifestEditorWidget *editorWidget);
bool save(QString *errorString, const QString &fileName = QString(), bool autoSave = false);
bool save(QString *errorString, const QString &fileName = QString(),
bool autoSave = false) override;
QString defaultPath() const;
QString suggestedFileName() const;
QString defaultPath() const override;
QString suggestedFileName() const override;
bool isModified() const override;
bool isSaveAsAllowed() const override;
bool isModified() const;
bool isSaveAsAllowed() const;
private:
AndroidManifestEditorWidget *m_editorWidget;
};
......
......@@ -58,8 +58,8 @@ class JavaDocument : public TextEditor::TextDocument
{
public:
JavaDocument();
QString defaultPath() const;
QString suggestedFileName() const;
QString defaultPath() const override;
QString suggestedFileName() const override;
};
......
......@@ -57,12 +57,12 @@ class AutotoolsProjectFile : public Core::IDocument
public:
AutotoolsProjectFile(AutotoolsProject *project, const QString &fileName);
bool save(QString *errorString, const QString &fileName, bool autoSave);
QString defaultPath() const;
QString suggestedFileName() const;
bool isModified() const;
bool isSaveAsAllowed() const;
bool reload(QString *errorString, ReloadFlag flag, ChangeType type);
bool save(QString *errorString, const QString &fileName, bool autoSave) override;
QString defaultPath() const override;
QString suggestedFileName() const override;
bool isModified() const override;
bool isSaveAsAllowed() const override;
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override;
private:
AutotoolsProject *m_project;
......
......@@ -239,7 +239,7 @@ public:
this, SLOT(provideNewRange(quint64)));
}
bool setContents(const QByteArray &contents)
bool setContents(const QByteArray &contents) override
{
if (!contents.isEmpty())
return false;
......@@ -247,13 +247,13 @@ public:
return true;
}
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override
{
Q_UNUSED(state)
return type == TypeRemoved ? BehaviorSilent : BehaviorAsk;
}
bool save(QString *errorString, const QString &fn, bool autoSave)
bool save(QString *errorString, const QString &fn, bool autoSave) override
{
QTC_ASSERT(!autoSave, return true); // bineditor does not support autosave - it would be a bit expensive
const FileName fileNameToUse = fn.isEmpty() ? filePath() : FileName::fromString(fn);
......@@ -265,7 +265,8 @@ public:
}
}
OpenResult open(QString *errorString, const QString &fileName, const QString &realFileName)
OpenResult open(QString *errorString, const QString &fileName,
const QString &realFileName) override
{
QTC_CHECK(fileName == realFileName); // The bineditor can do no autosaving
return openImpl(errorString, fileName);
......@@ -338,23 +339,26 @@ private slots:
public:
QString defaultPath() const { return QString(); }
QString defaultPath() const override { return QString(); }
QString suggestedFileName() const { return QString(); }
QString suggestedFileName() const override { return QString(); }
bool isModified() const { return isTemporary()/*e.g. memory view*/ ? false
: m_widget->isModified(); }
bool isModified() const override
{
return isTemporary()/*e.g. memory view*/ ? false
: m_widget->isModified();
}
bool isFileReadOnly() const {
bool isFileReadOnly() const override {
const FileName fn = filePath();
if (fn.isEmpty())
return false;
return !fn.toFileInfo().isWritable();
}
bool isSaveAsAllowed() const { return true; }
bool isSaveAsAllowed() const override { return true; }
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) {
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override {
if (flag == FlagIgnore)
return true;
if (type == TypePermissions) {
......
......@@ -240,8 +240,8 @@ class CMakeDocument : public TextDocument
public:
CMakeDocument();
QString defaultPath() const;
QString suggestedFileName() const;
QString defaultPath() const override;
QString suggestedFileName() const override;
};
CMakeDocument::CMakeDocument()
......
......@@ -44,16 +44,16 @@ class CMakeFile : public Core::IDocument
public:
CMakeFile(CMakeProject *parent, const Utils::FileName &fileName);
bool save(QString *errorString, const QString &fileName, bool autoSave);
bool save(QString *errorString, const QString &fileName, bool autoSave) override;
QString defaultPath() const;
QString suggestedFileName() const;
QString defaultPath() const override;
QString suggestedFileName() const override;
bool isModified() const;
bool isSaveAsAllowed() const;
bool isModified() const override;
bool isSaveAsAllowed() const override;
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const;
bool reload(QString *errorString, ReloadFlag flag, ChangeType type);
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override;
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override;
private:
CMakeProject *m_project;
......
......@@ -116,12 +116,12 @@ private:
class RestoredDocument : public IDocument
{
public:
bool save(QString *, const QString &, bool) { return false; }
QString defaultPath() const { return filePath().toFileInfo().absolutePath(); }
QString suggestedFileName() const { return filePath().fileName(); }
bool isModified() const { return false; }
bool isSaveAsAllowed() const { return false; }
bool reload(QString *, ReloadFlag, ChangeType) { return true; }
bool save(QString *, const QString &, bool) override { return false; }
QString defaultPath() const override { return filePath().toFileInfo().absolutePath(); }
QString suggestedFileName() const override { return filePath().fileName(); }
bool isModified() const override { return false; }
bool isSaveAsAllowed() const override { return false; }
bool reload(QString *, ReloadFlag, ChangeType) override { return true; }
};
DocumentModelPrivate::DocumentModelPrivate() :
......
......@@ -86,7 +86,7 @@ public:
};
IDocument(QObject *parent = 0);
virtual ~IDocument();
~IDocument() override;
void setId(Id id);
Id id() const;
......
......@@ -47,7 +47,7 @@ public:
typedef Utils::TextFileFormat::ReadResult ReadResult;
explicit BaseTextDocument(QObject *parent = 0);
virtual ~BaseTextDocument();
~BaseTextDocument() override;
Utils::TextFileFormat format() const;
const QTextCodec *codec() const;
......
......@@ -120,10 +120,6 @@ CppEditorDocument::CppEditorDocument()
// See also onFilePathChanged() for more initialization
}
CppEditorDocument::~CppEditorDocument()
{
}
bool CppEditorDocument::isObjCEnabled() const
{
return m_isObjCEnabled;
......
......@@ -53,10 +53,9 @@ class CppEditorDocument : public TextEditor::TextDocument
public:
explicit CppEditorDocument();
~CppEditorDocument();
bool isObjCEnabled() const;
TextEditor::CompletionAssistProvider *completionAssistProvider() const;
TextEditor::CompletionAssistProvider *completionAssistProvider() const override;
void semanticRehighlight();
CppTools::SemanticInfo recalculateSemanticInfo(); // TODO: Remove me
......@@ -80,7 +79,7 @@ public slots:
void scheduleProcessDocument();
protected:
void applyFontSettings();
void applyFontSettings() override;
private slots:
void invalidateFormatterCache();
......
......@@ -68,16 +68,17 @@ public:
void setIgnoreWhitespace(bool ignore);
bool ignoreWhitespace() const;
bool setContents(const QByteArray &contents);
QString defaultPath() const;
QString suggestedFileName() const Q_DECL_OVERRIDE;
bool setContents(const QByteArray &contents) override;
QString defaultPath() const override;
QString suggestedFileName() const override;
bool isModified() const { return false; }
bool isSaveAsAllowed() const { return true; }
bool save(QString *errorString, const QString &fileName, bool autoSave);
bool isModified() const override { return false; }
bool isSaveAsAllowed() const override { return true; }
bool save(QString *errorString, const QString &fileName, bool autoSave) override;
void reload();
bool reload(QString *errorString, ReloadFlag flag, ChangeType type);
OpenResult open(QString *errorString, const QString &fileName, const QString &realFileName);
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override;
OpenResult open(QString *errorString, const QString &fileName,
const QString &realFileName) override;
QString plainText() const;
......
......@@ -124,16 +124,16 @@ class GenericProjectFile : public Core::IDocument
public:
GenericProjectFile(GenericProject *parent, QString fileName, GenericProject::RefreshOptions options);
bool save(QString *errorString, const QString &fileName, bool autoSave);
bool save(QString *errorString, const QString &fileName, bool autoSave) override;
QString defaultPath() const;
QString suggestedFileName() const;
QString defaultPath() const override;
QString suggestedFileName() const override;
bool isModified() const;
bool isSaveAsAllowed() const;
bool isModified() const override;
bool isSaveAsAllowed() const override;
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const;
bool reload(QString *errorString, ReloadFlag flag, ChangeType type);
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override;
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override;
private:
GenericProject *m_project;
......
......@@ -63,20 +63,21 @@ public:
};
ImageViewerFile();
~ImageViewerFile();
~ImageViewerFile() override;
OpenResult open(QString *errorString, const QString &fileName, const QString &realFileName);
bool save(QString *errorString, const QString &fileName, bool autoSave);
bool setContents(const QByteArray &contents);
OpenResult open(QString *errorString, const QString &fileName,
const QString &realFileName) override;
bool save(QString *errorString, const QString &fileName, bool autoSave) override;
bool setContents(const QByteArray &contents) override;
QString defaultPath() const;
QString suggestedFileName() const;
QString defaultPath() const override;
QString suggestedFileName() const override;
bool isModified() const;
bool isSaveAsAllowed() const;
bool isModified() const override;
bool isSaveAsAllowed() const override;
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const;
bool reload(QString *errorString, ReloadFlag flag, ChangeType type);
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override;
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override;
bool isPaused() const;
void setPaused(bool paused);
......
......@@ -44,9 +44,6 @@ QbsProjectFile::QbsProjectFile(QbsProject *parent, QString fileName) : Core::IDo
setFilePath(Utils::FileName::fromString(fileName));
}
QbsProjectFile::~QbsProjectFile()
{ }
bool QbsProjectFile::save(QString *, const QString &, bool)
{
return false;
......
......@@ -44,19 +44,18 @@ class QbsProjectFile : public Core::IDocument
public:
QbsProjectFile(QbsProject *parent, QString fileName);
~QbsProjectFile();
bool save(QString *errorString, const QString &fileName, bool autoSave);
bool save(QString *errorString, const QString &fileName, bool autoSave) override;
bool isReadOnly() const;
QString defaultPath() const;
QString suggestedFileName() const;
QString defaultPath() const override;
QString suggestedFileName() const override;
bool isModified() const;
bool isSaveAsAllowed() const;
bool isModified() const override;
bool isSaveAsAllowed() const override;
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const;
bool reload(QString *errorString, ReloadFlag flag, ChangeType type);
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override;
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override;
private:
QbsProject *m_project;
......
......@@ -170,12 +170,12 @@ class ProFileDocument : public TextDocument
{
public:
ProFileDocument();
QString defaultPath() const;
QString suggestedFileName() const;
QString defaultPath() const override;
QString suggestedFileName() const override;
// qmake project files doesn't support UTF8-BOM
// If the BOM would be added qmake would fail and QtCreator couldn't parse the project file
bool supportsUtf8Bom() { return false; }
bool supportsUtf8Bom() override { return false; }
};
ProFileDocument::ProFileDocument()
......
......@@ -234,16 +234,16 @@ class QmakePriFile : public Core::IDocument
Q_OBJECT
public:
QmakePriFile(QmakePriFileNode *qmakePriFile);
virtual bool save(QString *errorString, const QString &fileName, bool autoSave);
bool save(QString *errorString, const QString &fileName, bool autoSave) override;
virtual QString defaultPath() const;
virtual QString suggestedFileName() const;
QString defaultPath() const override;
QString suggestedFileName() const override;
virtual bool isModified() const;
virtual bool isSaveAsAllowed() const;
bool isModified() const override;
bool isSaveAsAllowed() const override;
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const;
bool reload(QString *errorString, ReloadFlag flag, ChangeType type);
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override;
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override;
private:
QmakePriFileNode *m_priFile;
......
......@@ -100,16 +100,16 @@ class QmakeProjectFile : public Core::IDocument
public:
QmakeProjectFile(const QString &filePath, QObject *parent = 0);
bool save(QString *errorString, const QString &fileName, bool autoSave);
bool save(QString *errorString, const QString &fileName, bool autoSave) override;
QString defaultPath() const;
QString suggestedFileName() const;
QString defaultPath() const override;
QString suggestedFileName() const override;
bool isModified() const;
bool isSaveAsAllowed() const;
bool isModified() const override;
bool isSaveAsAllowed() const override;
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const;
bool reload(QString *errorString, ReloadFlag flag, ChangeType type);
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override;
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override;
};
/// Watches folders for QmakePriFile nodes
......
......@@ -50,7 +50,7 @@ class QMLJSEDITOR_EXPORT QmlJSEditorDocument : public TextEditor::TextDocument
Q_OBJECT
public:
QmlJSEditorDocument();
~QmlJSEditorDocument();
~QmlJSEditorDocument() override;
const QmlJSTools::SemanticInfo &semanticInfo() const;
bool isSemanticInfoOutdated() const;
......@@ -63,8 +63,8 @@ signals:
void semanticInfoUpdated(const QmlJSTools::SemanticInfo &semanticInfo);
protected:
void applyFontSettings();
void triggerPendingUpdates();
void applyFontSettings() override;
void triggerPendingUpdates() override;
private:
friend class Internal::QmlJSEditorDocumentPrivate; // sending signals
......
......@@ -47,10 +47,6 @@ QmlProjectFile::QmlProjectFile(QmlProject *parent, const Utils::FileName &fileNa
setFilePath(fileName);
}
QmlProjectFile::~QmlProjectFile()
{
}
bool QmlProjectFile::save(QString *, const QString &, bool)
{
return false;
......
......@@ -45,18 +45,17 @@ class QmlProjectFile : public Core::IDocument
public:
QmlProjectFile(QmlProject *parent, const Utils::FileName &fileName);
virtual ~QmlProjectFile();
virtual bool save(QString *errorString, const QString &fileName, bool autoSave);
bool save(QString *errorString, const QString &fileName, bool autoSave) override;
virtual QString defaultPath() const;
virtual QString suggestedFileName() const;
QString defaultPath() const override;
QString suggestedFileName() const override;
virtual bool isModified() const;
virtual bool isSaveAsAllowed() const;
bool isModified() const override;
bool isSaveAsAllowed() const override;
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const;
bool reload(QString *errorString, ReloadFlag flag, ChangeType type);
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override;
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override;
private:
QmlProject *m_project;
......
......@@ -57,17 +57,18 @@ public:
ResourceEditorDocument(QObject *parent = 0);
//IDocument
OpenResult open(QString *errorString, const QString &fileName, const QString &realFileName);
bool save(QString *errorString, const QString &fileName, bool autoSave);
OpenResult open(QString *errorString, const QString &fileName,
const QString &realFileName) override;
bool save(QString *errorString, const QString &fileName, bool autoSave) override;
QString plainText() const;
bool setContents(const QByteArray &contents);
bool shouldAutoSave() const;
bool isModified() const;
bool isSaveAsAllowed() const;
bool reload(QString *errorString, ReloadFlag flag, ChangeType type);
QString defaultPath() const;
QString suggestedFileName() const;
void setFilePath(const Utils::FileName &newName);
bool setContents(const QByteArray &contents) override;
bool shouldAutoSave() const override;
bool isModified() const override;
bool isSaveAsAllowed() const override;
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override;
QString defaultPath() const override;
QString suggestedFileName() const override;
void setFilePath(const Utils::FileName &newName) override;
void setBlockDirtyChanged(bool value);
RelativeResourceModel *model() const;
......
......@@ -113,16 +113,16 @@ class ResourceFileWatcher : public Core::IDocument
Q_OBJECT
public:
ResourceFileWatcher(ResourceTopLevelNode *node);
virtual bool save(QString *errorString, const QString &fileName, bool autoSave);
bool save(QString *errorString, const QString &fileName, bool autoSave) override;
virtual QString defaultPath() const;
virtual QString suggestedFileName() const;
QString defaultPath() const override;
QString suggestedFileName() const override;
virtual bool isModified() const;
virtual bool isSaveAsAllowed() const;
bool isModified() const override;
bool isSaveAsAllowed() const override;
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const;
bool reload(QString *errorString, ReloadFlag flag, ChangeType type);
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override;
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override;
private:
ResourceTopLevelNode *m_node;
};
......
......@@ -46,9 +46,6 @@ TaskFile::TaskFile(QObject *parent) : Core::IDocument(parent)
setId("TaskList.TaskFile");
}
TaskFile::~TaskFile()
{ }
bool TaskFile::save(QString *errorString, const QString &fileName, bool autoSave)
{
Q_UNUSED(errorString)
......
......@@ -42,18 +42,17 @@ class TaskFile : public Core::IDocument
{
public:
TaskFile(QObject *parent);
~TaskFile();
bool save(QString *errorString, const QString &fileName, bool autoSave);
bool save(QString *errorString, const QString &fileName, bool autoSave) override;
QString defaultPath() const;
QString suggestedFileName() const;
QString defaultPath() const override;
QString suggestedFileName() const override;
bool isModified() const;
bool isSaveAsAllowed() const;
bool isModified() const override;
bool isSaveAsAllowed() const override;
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const;
bool reload(QString *errorString, ReloadFlag flag, ChangeType type);
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override;
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override;
bool load(QString *errorString, const QString &fileName);
......
......@@ -66,7 +66,7 @@ class TEXTEDITOR_EXPORT TextDocument : public Core::BaseTextDocument
public:
explicit TextDocument(Core::Id id = Core::Id());
virtual ~TextDocument();
~TextDocument() override;
static QMap<QString, QString> openedTextDocumentContents();
static QMap<QString, QTextCodec *> openedTextDocumentEncodings();
......@@ -101,23 +101,24 @@ public:
void removeMarkFromMarksCache(TextMark *mark);
// IDocument implementation.
bool save(QString *errorString, const QString &fileName, bool autoSave);
bool setContents(const QByteArray &contents);
bool shouldAutoSave() const;
bool isFileReadOnly() const;
bool isModified() const;
bool isSaveAsAllowed() const;
void checkPermissions();
bool reload(QString *errorString, ReloadFlag flag, ChangeType type);
void setFilePath(const Utils::FileName &newName);
QString defaultPath() const;
QString suggestedFileName() const;
bool save(QString *errorString, const QString &fileName, bool autoSave) override;
bool setContents(const QByteArray &contents) override;
bool shouldAutoSave() const override;
bool isFileReadOnly() const override;
bool isModified() const override;
bool isSaveAsAllowed() const override;
void checkPermissions() override;
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override;
void setFilePath(const Utils::FileName &newName) override;
QString defaultPath() const override;
QString suggestedFileName() const override;
void setDefaultPath(const QString &defaultPath);
void setSuggestedFileName(const QString &suggestedFileName);
OpenResult open(QString *errorString, const QString &fileName, const QString &realFileName);
OpenResult open(QString *errorString, const QString &fileName,
const QString &realFileName) override;
virtual bool reload(QString *errorString);
bool setPlainText(const QString &text);
......
......@@ -47,16 +47,17 @@ public:
explicit SubmitEditorFile(const VcsBaseSubmitEditorParameters *parameters,
VcsBaseSubmitEditor *parent = 0);
OpenResult open(QString *errorString, const QString &fileName, const QString &realFileName);
bool setContents(const QByteArray &contents);
QString defaultPath() const { return QString(); }
QString suggestedFileName() const { return QString(); }
OpenResult open(QString *errorString, const QString &fileName,
const QString &realFileName) override;
bool setContents(const QByteArray &contents) override;
QString defaultPath() const override { return QString(); }
QString suggestedFileName() const override { return QString(); }
bool isModified() const { return m_modified; }
bool isSaveAsAllowed() const { return false; }
bool save(QString *errorString, const QString &fileName, bool autoSave);
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const;
bool reload(QString *errorString, ReloadFlag flag, ChangeType type);
bool isModified() const override { return m_modified; }
bool isSaveAsAllowed() const override { return false; }
bool save(QString *errorString, const QString &fileName, bool autoSave) override;
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override;
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override;
void setModified(bool modified = 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