CompilationDatabase: Simplify based on Project::projectFileIsDirty signal

Change-Id: Icfcbae73f611d967a7cc2db7c249f6f7190f5926
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Tobias Hunger
2019-08-15 12:23:35 +02:00
parent f187ddd590
commit abebbdc9f7
2 changed files with 9 additions and 8 deletions

View File

@@ -407,17 +407,19 @@ CompilationDatabaseProject::CompilationDatabaseProject(const Utils::FilePath &pr
m_kit.reset(KitManager::defaultKit()->clone());
addTargetForKit(m_kit.get());
connect(this, &CompilationDatabaseProject::rootProjectDirectoryChanged,
m_parseDelay, QOverload<>::of(&QTimer::start));
connect(this,
&CompilationDatabaseProject::rootProjectDirectoryChanged,
m_parseDelay,
QOverload<>::of(&QTimer::start));
m_fileSystemWatcher.addFile(projectFile.toString(), Utils::FileSystemWatcher::WatchModifiedDate);
m_fileSystemWatcher.addFile(projectFile.toString() + Constants::COMPILATIONDATABASEPROJECT_FILES_SUFFIX,
Utils::FileSystemWatcher::WatchModifiedDate);
connect(&m_fileSystemWatcher, &Utils::FileSystemWatcher::fileChanged,
m_parseDelay, QOverload<>::of(&QTimer::start));
setExtraProjectFiles(
{projectFile.stringAppended(Constants::COMPILATIONDATABASEPROJECT_FILES_SUFFIX)});
connect(m_parseDelay, &QTimer::timeout, this, &CompilationDatabaseProject::reparseProject);
m_parseDelay->setSingleShot(true);
m_parseDelay->setInterval(1000);
connect(this, &Project::projectFileIsDirty, this, &CompilationDatabaseProject::reparseProject);
}
Utils::FilePath CompilationDatabaseProject::rootPathFromSettings() const

View File

@@ -69,7 +69,6 @@ private:
QFutureWatcher<void> m_parserWatcher;
std::unique_ptr<CppTools::CppProjectUpdater> m_cppCodeModelUpdater;
std::unique_ptr<ProjectExplorer::Kit> m_kit;
Utils::FileSystemWatcher m_fileSystemWatcher;
MimeBinaryCache m_mimeBinaryCache;
QTimer * const m_parseDelay;
CompilationDbParser *m_parser = nullptr;