forked from qt-creator/qt-creator
UiCodeModelSupport: Notify if content changes
Needed for ClangCodeModel. If the content changes, we want to send it immediately to the codemodelbackend process. Change-Id: Iedf16930b494ccb5e91f1bc435db026067d98613 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com> Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
This commit is contained in:
@@ -53,6 +53,11 @@ void AbstractEditorSupport::updateDocument()
|
||||
m_modelmanager->updateSourceFiles(QSet<QString>() << fileName());
|
||||
}
|
||||
|
||||
void AbstractEditorSupport::notifyAboutUpdatedContents() const
|
||||
{
|
||||
m_modelmanager->emitAbstractEditorSupportContentsUpdated(fileName(), contents());
|
||||
}
|
||||
|
||||
QString AbstractEditorSupport::licenseTemplate(const QString &file, const QString &className)
|
||||
{
|
||||
return Internal::CppFileSettings::licenseTemplate(file, className);
|
||||
|
||||
@@ -51,6 +51,7 @@ public:
|
||||
virtual QString fileName() const = 0;
|
||||
|
||||
void updateDocument();
|
||||
void notifyAboutUpdatedContents() const;
|
||||
unsigned revision() const { return m_revision; }
|
||||
|
||||
static QString licenseTemplate(const QString &file = QString(), const QString &className = QString());
|
||||
|
||||
@@ -958,6 +958,17 @@ void CppModelManager::emitDocumentUpdated(Document::Ptr doc)
|
||||
emit documentUpdated(doc);
|
||||
}
|
||||
|
||||
void CppModelManager::emitAbstractEditorSupportContentsUpdated(const QString &filePath,
|
||||
const QByteArray &contents)
|
||||
{
|
||||
emit abstractEditorSupportContentsUpdated(filePath, contents);
|
||||
}
|
||||
|
||||
void CppModelManager::emitAbstractEditorSupportRemoved(const QString &filePath)
|
||||
{
|
||||
emit abstractEditorSupportRemoved(filePath);
|
||||
}
|
||||
|
||||
void CppModelManager::onProjectAdded(ProjectExplorer::Project *)
|
||||
{
|
||||
QMutexLocker locker(&d->m_projectMutex);
|
||||
|
||||
@@ -111,6 +111,9 @@ public:
|
||||
bool replaceDocument(Document::Ptr newDoc);
|
||||
|
||||
void emitDocumentUpdated(CPlusPlus::Document::Ptr doc);
|
||||
void emitAbstractEditorSupportContentsUpdated(const QString &filePath,
|
||||
const QByteArray &contents);
|
||||
void emitAbstractEditorSupportRemoved(const QString &filePath);
|
||||
|
||||
bool isCppEditor(Core::IEditor *editor) const;
|
||||
|
||||
@@ -173,6 +176,9 @@ signals:
|
||||
|
||||
void gcFinished(); // Needed for tests.
|
||||
|
||||
void abstractEditorSupportContentsUpdated(const QString &filePath, const QByteArray &contents);
|
||||
void abstractEditorSupportRemoved(const QString &filePath);
|
||||
|
||||
public slots:
|
||||
void updateModifiedSourceFiles();
|
||||
void GC();
|
||||
|
||||
Reference in New Issue
Block a user