QbsPM: Do not delay initial parsing

When a project is opened, delayParsing() is called several times:
* activeTargetChanged -> buildConfigurationChanged
* environmentChanged
* startupProjectChanged -> ... -> buildDirectoryChanged

delayParsing starts a 1s timer for aggregating all the relevant changes
before starting the actual parse.

This makes sense also when the user makes changes (like switching build
configurations fast, or editing the build directory).

When the project is opened initially, there's no reason to wait before
parsing.

Change-Id: I4eb0c7d3419465bc01e8f9febc9ee808684adb6e
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
Orgad Shaneh
2016-03-02 10:20:43 +02:00
committed by Orgad Shaneh
parent 5d6f8547a2
commit 2383a6b452
5 changed files with 13 additions and 0 deletions

View File

@@ -637,6 +637,10 @@ void Project::setProjectLanguage(Core::Id id, bool enabled)
removeProjectLanguage(id);
}
void Project::projectLoaded()
{
}
Core::Context Project::projectContext() const
{
return d->m_projectContext;

View File

@@ -58,6 +58,7 @@ class ProjectPrivate;
class PROJECTEXPLORER_EXPORT Project : public QObject
{
friend class SessionManager; // for setActiveTarget
friend class ProjectExplorerPlugin; // for projectLoaded
Q_OBJECT
public:
@@ -177,6 +178,7 @@ protected:
void addProjectLanguage(Core::Id id);
void removeProjectLanguage(Core::Id id);
void setProjectLanguage(Core::Id id, bool enabled);
virtual void projectLoaded(); // Called when the project is fully loaded.
private:
void changeEnvironment();

View File

@@ -1637,6 +1637,7 @@ ProjectExplorerPlugin::OpenProjectResult ProjectExplorerPlugin::openProject(cons
return result;
dd->addToRecentProjects(fileName, project->displayName());
SessionManager::setStartupProject(project);
project->projectLoaded();
return result;
}

View File

@@ -152,6 +152,11 @@ QbsRootProjectNode *QbsProject::rootProjectNode() const
return static_cast<QbsRootProjectNode *>(Project::rootProjectNode());
}
void QbsProject::projectLoaded()
{
m_parsingDelay.start(0);
}
static void collectFilesForProject(const qbs::ProjectData &project, QSet<QString> &result)
{
result.insert(project.location().filePath());

View File

@@ -135,6 +135,7 @@ private:
void updateApplicationTargets();
void updateDeploymentInfo();
void updateBuildTargetData();
void projectLoaded() override;
static bool ensureWriteableQbsFile(const QString &file);