Commit 2fdb70bd authored by Daniel Teske's avatar Daniel Teske
Browse files

Qt4Project: On folder change just schedule a async parse

On a folder change we need to collect all files which we add to the project
tree due to INSTALL or DEPLOYMENT rules. On a folder change the old
implementation only collected the files in the changed folder, but also
started a updateCodeModels(). If multiple Qt4PriFileNodes would react to
the folderChanged() signal, then a lot of updateCodeModels() would be

This new code does a unnecessary complete iteration of the files starting
from the top level INSTALLS or DEPLOYMENT folders, but optimizes the
updateCodeModels() by going through the more advanced scheduling the
qt4project does for evaluation.

Task-number: QTCREATORBUG-9581
Change-Id: I50345516c56bd33e6e1e1b2e0d7db50635ea1552
Reviewed-by: default avatarTobias Hunger <>
Reviewed-by: default avatarNikolai Kosjar <>
parent d5a975ce
...@@ -720,69 +720,7 @@ void Qt4PriFileNode::watchFolders(const QSet<QString> &folders) ...@@ -720,69 +720,7 @@ void Qt4PriFileNode::watchFolders(const QSet<QString> &folders)
void Qt4PriFileNode::folderChanged(const QString &changedFolder) void Qt4PriFileNode::folderChanged(const QString &changedFolder)
{ {
//qDebug()<<"########## Qt4PriFileNode::folderChanged"; scheduleUpdate();
// So, we need to figure out which files changed.
// Collect all the files
QSet<Utils::FileName> newFiles;
newFiles += recursiveEnumerate(changedFolder);
foreach (const Utils::FileName &file, m_recursiveEnumerateFiles) {
if (!file.isChildOf(Utils::FileName::fromString(changedFolder)))
QSet<Utils::FileName> addedFiles = newFiles;
QSet<Utils::FileName> removedFiles = m_recursiveEnumerateFiles;
if (addedFiles.isEmpty() && removedFiles.isEmpty())
m_recursiveEnumerateFiles = newFiles;
// Apply the differences
// per file type
const QVector<Qt4NodeStaticData::FileTypeData> &fileTypes = qt4NodeStaticData()->fileTypeData;
for (int i = 0; i < fileTypes.size(); ++i) {
FileType type =;
QSet<Utils::FileName> add = filterFilesRecursiveEnumerata(type, addedFiles);
QSet<Utils::FileName> remove = filterFilesRecursiveEnumerata(type, removedFiles);
if (!add.isEmpty() || !remove.isEmpty()) {
// Scream :)
// qDebug()<<"For type"<<<<"\n"
// <<"added files"<<add<<"\n"
// <<"removed files"<<remove;
// Now apply stuff
InternalNode contents;
for (int i = 0; i < fileTypes.size(); ++i) {
FileType type =;
if (!m_files[type].isEmpty()) {
InternalNode *subfolder = new InternalNode;
subfolder->type = type;
subfolder->icon =;
subfolder->fullPath = m_projectDir;
subfolder->typeName =;
subfolder->priority = -i;
subfolder->displayName =;
// create the hierarchy with subdirectories
subfolder->create(m_projectDir, m_files[type], type);
contents.updateSubFolders(this, this);
} }
bool Qt4PriFileNode::deploysFolder(const QString &folder) const bool Qt4PriFileNode::deploysFolder(const QString &folder) const
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