aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/autotoolsprojectmanager
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@qt.io>2019-08-15 12:20:49 +0200
committerTobias Hunger <tobias.hunger@qt.io>2019-08-16 12:43:30 +0000
commitc89a8a40845aa4b6106586b849c457107768e6ba (patch)
treebd698ac606264b223d03c7564bfc144300a7bc9f /src/plugins/autotoolsprojectmanager
parentd13307b5bf95d81b14701de39c6afd32ac08381e (diff)
AutotoolsProject: Simplify using Project::projectFileIsDirty signal
Change-Id: Idbb81a8d3ddd2f2d81b9060f228331a233fd6ccf Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/autotoolsprojectmanager')
-rw-r--r--src/plugins/autotoolsprojectmanager/autotoolsproject.cpp32
-rw-r--r--src/plugins/autotoolsprojectmanager/autotoolsproject.h11
2 files changed, 10 insertions, 33 deletions
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp b/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp
index f5a675e99b..2bf22d17fb 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 44e0153a0f..44e5d81657 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;