Commit d2682828 authored by dt's avatar dt
Browse files

Fixes: On session restore, start less indexers.

Details:  This should improve performance a bit. Instead of starting on indexer per .pro file, schedule and compress updates of ui files. And don't update if we have a full project code model update scheduled anyway. Which helps the startup case.
parent e7cd1e23
......@@ -845,7 +845,7 @@ void Qt4ProFileNode::updateUiFiles()
}
addFileNodes(toAdd, this);
}
modelManager->updateSourceFiles(toUpdate);
m_project->addUiFilesToCodeModel(toUpdate);
}
ProFileReader *Qt4PriFileNode::createProFileReader() const
......
......@@ -255,6 +255,10 @@ Qt4Project::Qt4Project(Qt4Manager *manager, const QString& fileName) :
m_updateCodeModelTimer.setSingleShot(true);
m_updateCodeModelTimer.setInterval(20);
connect(&m_updateCodeModelTimer, SIGNAL(timeout()), this, SLOT(updateCodeModel()));
m_addUiFilesTimer.setSingleShot(true);
m_addUiFilesTimer.setInterval(20);
connect(&m_addUiFilesTimer, SIGNAL(timeout()), this, SLOT(addUiFiles()));
}
Qt4Project::~Qt4Project()
......@@ -370,6 +374,27 @@ namespace {
};
}
void Qt4Project::addUiFilesToCodeModel(const QStringList &files)
{
// if we already have a full updateCodeModel() scheduled
// then we don't need to this seperately
// since that one will add also all the ui files
if (m_updateCodeModelTimer.isActive())
return;
m_addUiFilesTimer.start();
m_uiFilesToAdd << files;
}
void Qt4Project::addUiFiles()
{
if (m_updateCodeModelTimer.isActive())
return;
CppTools::CppModelManagerInterface *modelManager =
ExtensionSystem::PluginManager::instance()->getObject<CppTools::CppModelManagerInterface>();
modelManager->updateSourceFiles(m_uiFilesToAdd);
m_uiFilesToAdd.clear();
}
void Qt4Project::scheduleUpdateCodeModel()
{
m_updateCodeModelTimer.start();
......
......@@ -182,6 +182,9 @@ public:
void notifyChanged(const QString &name);
// called by qt4ProjectNode to add ui_*.h files to the codemodel
void addUiFilesToCodeModel(const QStringList &files);
public slots:
void update();
void proFileParseError(const QString &errorMessage);
......@@ -200,6 +203,7 @@ private slots:
const Qt4ProjectManager::Internal::Qt4ProjectType oldType,
const Qt4ProjectManager::Internal::Qt4ProjectType newType);
void proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode *node);
void addUiFiles();
protected:
virtual void restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader &settingsReader);
......@@ -232,6 +236,8 @@ private:
Internal::Qt4ProjectFiles *m_projectFiles;
QTimer m_updateCodeModelTimer;
QTimer m_addUiFilesTimer;
QStringList m_uiFilesToAdd;
Internal::GCCPreprocessor m_preproc;
friend class Qt4ProjectFile;
......
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