Commit 7b2c2620 authored by Erik Verbruggen's avatar Erik Verbruggen

CppTools: add method to manually set the project part.

Change-Id: Ic3578bd98c2f1aefcaef61f5b993dc9a67ca5a77
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@digia.com>
parent 37e29bd2
......@@ -186,6 +186,20 @@ Document::Ptr SnapshotUpdater::document() const
return m_snapshot.document(m_fileInEditor);
}
ProjectPart::Ptr SnapshotUpdater::currentProjectPart() const
{
QMutexLocker locker(&m_mutex);
return m_projectPart;
}
void SnapshotUpdater::setProjectPart(ProjectPart::Ptr projectPart)
{
QMutexLocker locker(&m_mutex);
m_manuallySetProjectPart = projectPart;
}
void SnapshotUpdater::setUsePrecompiledHeaders(bool usePrecompiledHeaders)
{
QMutexLocker locker(&m_mutex);
......@@ -205,6 +219,11 @@ void SnapshotUpdater::setEditorDefines(const QByteArray &editorDefines)
void SnapshotUpdater::updateProjectPart()
{
if (m_manuallySetProjectPart) {
m_projectPart = m_manuallySetProjectPart;
return;
}
CppModelManager *cmm = dynamic_cast<CppModelManager *>(CppModelManagerInterface::instance());
QList<ProjectPart::Ptr> pParts = cmm->projectPart(m_fileInEditor);
if (pParts.isEmpty()) {
......
......@@ -64,6 +64,9 @@ public:
QStringList frameworkPaths() const
{ return m_frameworkPaths; }
ProjectPart::Ptr currentProjectPart() const;
void setProjectPart(ProjectPart::Ptr projectPart);
void setUsePrecompiledHeaders(bool usePrecompiledHeaders);
void setEditorDefines(const QByteArray &editorDefines);
......@@ -74,7 +77,7 @@ private:
private:
mutable QMutex m_mutex;
QString m_fileInEditor;
ProjectPart::Ptr m_projectPart;
ProjectPart::Ptr m_projectPart, m_manuallySetProjectPart;
QByteArray m_configFile;
bool m_editorDefinesChangedSinceLastUpdate;
QByteArray m_editorDefines;
......
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