Commit 5182f2ff authored by Ulf Hermann's avatar Ulf Hermann

Core: Add methods to retrieve contents from IDocument

This is very helpful for dynamic extra compiler support (e.g. uic,
flex, ...).

Change-Id: I5a49b0b39a0f1fbc7834701d60a68ef441172969
Reviewed-by: default avatarEike Ziller <eike.ziller@theqtcompany.com>
parent fc485e6b
...@@ -150,6 +150,15 @@ IDocument::OpenResult IDocument::open(QString *errorString, const QString &fileN ...@@ -150,6 +150,15 @@ IDocument::OpenResult IDocument::open(QString *errorString, const QString &fileN
return OpenResult::CannotHandle; return OpenResult::CannotHandle;
} }
/*!
* Returns the current contents of the document. The base implementation returns an empty
* QByteArray.
*/
QByteArray IDocument::contents() const
{
return QByteArray();
}
/*! /*!
Used for example by EditorManager::openEditorWithContents() to set the contents Used for example by EditorManager::openEditorWithContents() to set the contents
of this document. of this document.
......
...@@ -95,6 +95,8 @@ public: ...@@ -95,6 +95,8 @@ public:
virtual OpenResult open(QString *errorString, const QString &fileName, const QString &realFileName); virtual OpenResult open(QString *errorString, const QString &fileName, const QString &realFileName);
virtual bool save(QString *errorString, const QString &fileName = QString(), bool autoSave = false) = 0; virtual bool save(QString *errorString, const QString &fileName = QString(), bool autoSave = false) = 0;
virtual QByteArray contents() const;
virtual bool setContents(const QByteArray &contents); virtual bool setContents(const QByteArray &contents);
const Utils::FileName &filePath() const; const Utils::FileName &filePath() const;
...@@ -133,7 +135,12 @@ public: ...@@ -133,7 +135,12 @@ public:
InfoBar *infoBar(); InfoBar *infoBar();
signals: signals:
// For meta data changes: file name, modified state, ...
void changed(); void changed();
// For changes in the contents of the document
void contentsChanged();
void mimeTypeChanged(); void mimeTypeChanged();
void aboutToReload(); void aboutToReload();
......
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