diff options
-rw-r--r-- | src/plugins/autotoolsprojectmanager/autotoolsproject.cpp | 32 | ||||
-rw-r--r-- | src/plugins/autotoolsprojectmanager/autotoolsproject.h | 11 |
2 files changed, 10 insertions, 33 deletions
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp b/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp index f5a675e99b2..2bf22d17fb9 100644 --- a/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp +++ b/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp @@ -67,16 +67,17 @@ using namespace AutotoolsProjectManager; using namespace AutotoolsProjectManager::Internal; using namespace ProjectExplorer; -AutotoolsProject::AutotoolsProject(const Utils::FilePath &fileName) : - Project(Constants::MAKEFILE_MIMETYPE, fileName), - m_fileWatcher(new Utils::FileSystemWatcher(this)), - m_cppCodeModelUpdater(new CppTools::CppProjectUpdater) +AutotoolsProject::AutotoolsProject(const Utils::FilePath &fileName) + : Project(Constants::MAKEFILE_MIMETYPE, fileName) + , m_cppCodeModelUpdater(new CppTools::CppProjectUpdater) { setId(Constants::AUTOTOOLS_PROJECT_ID); setProjectLanguages(Core::Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID)); setDisplayName(projectDirectory().fileName()); setHasMakeInstallEquivalent(true); + + connect(this, &AutotoolsProject::projectFileIsDirty, this, &AutotoolsProject::loadProjectTree); } AutotoolsProject::~AutotoolsProject() @@ -100,9 +101,6 @@ Project::RestoreResult AutotoolsProject::fromMap(const QVariantMap &map, QString if (result != RestoreResult::Ok) return result; - connect(m_fileWatcher, &Utils::FileSystemWatcher::fileChanged, - this, &AutotoolsProject::onFileChanged); - // Load the project tree structure. loadProjectTree(); @@ -165,12 +163,9 @@ void AutotoolsProject::makefileParsingFinished() if (m_makefileParserThread->hasError()) qWarning("Parsing of makefile contained errors."); - // Remove file watches for the current project state. - // The file watches will be added again after the parsing. - m_fileWatcher->removeFiles(m_watchedFiles); - m_files.clear(); - m_watchedFiles.clear(); + + QVector<Utils::FilePath> filesToWatch; // Apply sources to m_files, which are returned at AutotoolsProject::files() const QFileInfo fileInfo = projectFilePath().toFileInfo(); @@ -187,8 +182,7 @@ void AutotoolsProject::makefileParsingFinished() m_files.append(absMakefile); - m_fileWatcher->addFile(absMakefile, Utils::FileSystemWatcher::WatchAllChanges); - m_watchedFiles.append(absMakefile); + filesToWatch.append(Utils::FilePath::fromString(absMakefile)); } // Add configure.ac file to project and watch for changes. @@ -198,8 +192,7 @@ void AutotoolsProject::makefileParsingFinished() const QString absConfigureAc = dir.absoluteFilePath(configureAc); m_files.append(absConfigureAc); - m_fileWatcher->addFile(absConfigureAc, Utils::FileSystemWatcher::WatchAllChanges); - m_watchedFiles.append(absConfigureAc); + filesToWatch.append(Utils::FilePath::fromString(absConfigureAc)); } auto newRoot = std::make_unique<ProjectNode>(projectDirectory()); @@ -209,6 +202,7 @@ void AutotoolsProject::makefileParsingFinished() FileNode::fileTypeForFileName(path))); } setRootProjectNode(std::move(newRoot)); + setExtraProjectFiles(filesToWatch); updateCppCodeModel(); @@ -216,12 +210,6 @@ void AutotoolsProject::makefileParsingFinished() m_makefileParserThread = nullptr; } -void AutotoolsProject::onFileChanged(const QString &file) -{ - Q_UNUSED(file) - loadProjectTree(); -} - static QStringList filterIncludes(const QString &absSrc, const QString &absBuild, const QStringList &in) { diff --git a/src/plugins/autotoolsprojectmanager/autotoolsproject.h b/src/plugins/autotoolsprojectmanager/autotoolsproject.h index 44e0153a0fe..44e5d816572 100644 --- a/src/plugins/autotoolsprojectmanager/autotoolsproject.h +++ b/src/plugins/autotoolsprojectmanager/autotoolsproject.h @@ -80,13 +80,6 @@ private: void makefileParsingFinished(); /** - * Is invoked, if a file of the project tree has been changed by the user. - * If a Makefile.am or a configure.ac file has been changed, the project - * configuration must be updated. - */ - void onFileChanged(const QString &file); - - /** * This function is in charge of the code completion. */ void updateCppCodeModel(); @@ -94,10 +87,6 @@ private: /// Return value for AutotoolsProject::files() QStringList m_files; - /// Watches project files for changes. - Utils::FileSystemWatcher *m_fileWatcher; - QStringList m_watchedFiles; - /// Responsible for parsing the makefiles asynchronously in a thread MakefileParserThread *m_makefileParserThread = nullptr; |