aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVille Nummela <ville.nummela@jolla.com>2019-04-25 11:06:58 +0300
committerVille Nummela <ville.nummela@jolla.com>2019-04-26 05:41:07 +0000
commitecd386c67b3e3c00546df4624b53a5c36e7623ff (patch)
treec2458dcb30ecd90f579aa405d2b2bd497fcef869 /src
parent50715e71b9bf296277ce5408544ac9e41a593b88 (diff)
QmakePM: Only schedule update when files are added/removed
When a file is saved, the directory is also touched. If files are not added or removed, it is not necessary to reparse the project. Change-Id: I718db68362d41ba936629be880f739ad79b8cb6f Fixes: QTCREATORBUG-22361 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp33
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeparsernodes.h1
2 files changed, 24 insertions, 10 deletions
diff --git a/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp b/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp
index 671cd5bfec..7b050a5ed6 100644
--- a/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp
@@ -1623,25 +1623,38 @@ void QmakeProFile::applyEvaluate(QmakeEvalResult *evalResult)
m_wildcardWatcher = std::make_unique<Utils::FileSystemWatcher>();
QObject::connect(
m_wildcardWatcher.get(), &Utils::FileSystemWatcher::directoryChanged,
- [this]() {
- scheduleUpdate();
+ [this](QString path) {
+ QStringList directoryContents = QDir(path).entryList();
+ if (m_wildcardDirectoryContents.value(path) != directoryContents) {
+ m_wildcardDirectoryContents.insert(path, directoryContents);
+ scheduleUpdate();
+ }
});
}
- m_wildcardWatcher->addDirectories(
- Utils::filtered<QStringList>(result->directoriesWithWildcards.toList(),
- [this](const QString &path) {
- return !m_wildcardWatcher->watchesDirectory(path);
- }), Utils::FileSystemWatcher::WatchModifiedDate);
+ const QStringList directoriesToAdd = Utils::filtered<QStringList>(
+ result->directoriesWithWildcards.toList(),
+ [this](const QString &path) {
+ return !m_wildcardWatcher->watchesDirectory(path);
+ });
+ for (QString path : directoriesToAdd)
+ m_wildcardDirectoryContents.insert(path, QDir(path).entryList());
+ m_wildcardWatcher->addDirectories(directoriesToAdd,
+ Utils::FileSystemWatcher::WatchModifiedDate);
}
if (m_wildcardWatcher) {
if (result->directoriesWithWildcards.isEmpty()) {
m_wildcardWatcher.reset();
+ m_wildcardDirectoryContents.clear();
} else {
- m_wildcardWatcher->removeDirectories(
- Utils::filtered<QStringList>(m_wildcardWatcher->directories(),
+ const QStringList directoriesToRemove =
+ Utils::filtered<QStringList>(
+ m_wildcardWatcher->directories(),
[&result](const QString &path) {
return !result->directoriesWithWildcards.contains(path);
- }));
+ });
+ m_wildcardWatcher->removeDirectories(directoriesToRemove);
+ for (QString path : directoriesToRemove)
+ m_wildcardDirectoryContents.remove(path);
}
}
diff --git a/src/plugins/qmakeprojectmanager/qmakeparsernodes.h b/src/plugins/qmakeprojectmanager/qmakeparsernodes.h
index 6f0e13a5c9..68b406fe63 100644
--- a/src/plugins/qmakeprojectmanager/qmakeparsernodes.h
+++ b/src/plugins/qmakeprojectmanager/qmakeparsernodes.h
@@ -370,6 +370,7 @@ private:
InstallsList m_installsList;
std::unique_ptr<Utils::FileSystemWatcher> m_wildcardWatcher;
+ QMap<QString, QStringList> m_wildcardDirectoryContents;
// Async stuff
QFutureWatcher<Internal::QmakeEvalResult *> m_parseFutureWatcher;