Commit f555c936 authored by Daniel Teske's avatar Daniel Teske Committed by Daniel Molkentin

Optimize MiniTargetSelector's various update functions

Should be called less often now.

Change-Id: Id7cd751e2be348c13ecc7dc02bffd0e33ccc297c
Reviewed-by: default avatarDaniel Molkentin <daniel.molkentin@nokia.com>
parent 2342fbb3
......@@ -625,10 +625,10 @@ void MiniProjectTargetSelector::setActiveRunConfiguration(ProjectExplorer::Proje
void MiniProjectTargetSelector::projectAdded(ProjectExplorer::Project *project)
{
connect(project, SIGNAL(addedTarget(ProjectExplorer::Target*)),
this, SLOT(addedTarget(ProjectExplorer::Target*)));
this, SLOT(slotAddedTarget(ProjectExplorer::Target*)));
connect(project, SIGNAL(removedTarget(ProjectExplorer::Target*)),
this, SLOT(removedTarget(ProjectExplorer::Target*)));
this, SLOT(slotRemovedTarget(ProjectExplorer::Target*)));
foreach (Target *t, project->targets())
addedTarget(t);
......@@ -643,10 +643,10 @@ void MiniProjectTargetSelector::projectAdded(ProjectExplorer::Project *project)
void MiniProjectTargetSelector::projectRemoved(ProjectExplorer::Project *project)
{
disconnect(project, SIGNAL(addedTarget(ProjectExplorer::Target*)),
this, SLOT(addedTarget(ProjectExplorer::Target*)));
this, SLOT(slotAddedTarget(ProjectExplorer::Target*)));
disconnect(project, SIGNAL(removedTarget(ProjectExplorer::Target*)),
this, SLOT(removedTarget(ProjectExplorer::Target*)));
this, SLOT(slotRemovedTarget(ProjectExplorer::Target*)));
foreach (Target *t, project->targets())
removedTarget(t);
......@@ -661,19 +661,19 @@ void MiniProjectTargetSelector::projectRemoved(ProjectExplorer::Project *project
void MiniProjectTargetSelector::addedTarget(ProjectExplorer::Target *target)
{
connect(target, SIGNAL(addedBuildConfiguration(ProjectExplorer::BuildConfiguration*)),
this, SLOT(addedBuildConfiguration(ProjectExplorer::BuildConfiguration*)));
this, SLOT(slotAddedBuildConfiguration(ProjectExplorer::BuildConfiguration*)));
connect(target, SIGNAL(removedBuildConfiguration(ProjectExplorer::BuildConfiguration*)),
this, SLOT(removedBuildConfiguration(ProjectExplorer::BuildConfiguration*)));
this, SLOT(slotRemovedBuildConfiguration(ProjectExplorer::BuildConfiguration*)));
connect(target, SIGNAL(addedDeployConfiguration(ProjectExplorer::DeployConfiguration*)),
this, SLOT(addedDeployConfiguration(ProjectExplorer::DeployConfiguration*)));
this, SLOT(slotAddedDeployConfiguration(ProjectExplorer::DeployConfiguration*)));
connect(target, SIGNAL(removedDeployConfiguration(ProjectExplorer::DeployConfiguration*)),
this, SLOT(removedDeployConfiguration(ProjectExplorer::DeployConfiguration*)));
this, SLOT(slotRemovedDeployConfiguration(ProjectExplorer::DeployConfiguration*)));
connect(target, SIGNAL(addedRunConfiguration(ProjectExplorer::RunConfiguration*)),
this, SLOT(addedRunConfiguration(ProjectExplorer::RunConfiguration*)));
this, SLOT(slotAddedRunConfiguration(ProjectExplorer::RunConfiguration*)));
connect(target, SIGNAL(removedRunConfiguration(ProjectExplorer::RunConfiguration*)),
this, SLOT(removedRunConfiguration(ProjectExplorer::RunConfiguration*)));
this, SLOT(slotRemovedRunConfiguration(ProjectExplorer::RunConfiguration*)));
if (target->project() == m_project)
m_listWidgets[TARGET]->addProjectConfiguration(target);
......@@ -684,7 +684,11 @@ void MiniProjectTargetSelector::addedTarget(ProjectExplorer::Target *target)
addedDeployConfiguration(dc);
foreach (RunConfiguration *rc, target->runConfigurations())
addedRunConfiguration(rc);
}
void MiniProjectTargetSelector::slotAddedTarget(ProjectExplorer::Target *target)
{
addedTarget(target);
updateTargetListVisible();
updateBuildListVisible();
updateDeployListVisible();
......@@ -694,19 +698,19 @@ void MiniProjectTargetSelector::addedTarget(ProjectExplorer::Target *target)
void MiniProjectTargetSelector::removedTarget(ProjectExplorer::Target *target)
{
disconnect(target, SIGNAL(addedBuildConfiguration(ProjectExplorer::BuildConfiguration*)),
this, SLOT(addedBuildConfiguration(ProjectExplorer::BuildConfiguration*)));
this, SLOT(slotAddedBuildConfiguration(ProjectExplorer::BuildConfiguration*)));
disconnect(target, SIGNAL(removedBuildConfiguration(ProjectExplorer::BuildConfiguration*)),
this, SLOT(removedBuildConfiguration(ProjectExplorer::BuildConfiguration*)));
this, SLOT(slotRemovedBuildConfiguration(ProjectExplorer::BuildConfiguration*)));
disconnect(target, SIGNAL(addedDeployConfiguration(ProjectExplorer::DeployConfiguration*)),
this, SLOT(addedDeployConfiguration(ProjectExplorer::DeployConfiguration*)));
this, SLOT(slotAddedDeployConfiguration(ProjectExplorer::DeployConfiguration*)));
disconnect(target, SIGNAL(removedDeployConfiguration(ProjectExplorer::DeployConfiguration*)),
this, SLOT(removedDeployConfiguration(ProjectExplorer::DeployConfiguration*)));
this, SLOT(slotRemovedDeployConfiguration(ProjectExplorer::DeployConfiguration*)));
disconnect(target, SIGNAL(addedRunConfiguration(ProjectExplorer::RunConfiguration*)),
this, SLOT(addedRunConfiguration(ProjectExplorer::RunConfiguration*)));
this, SLOT(slotAddedRunConfiguration(ProjectExplorer::RunConfiguration*)));
disconnect(target, SIGNAL(removedRunConfiguration(ProjectExplorer::RunConfiguration*)),
this, SLOT(removedRunConfiguration(ProjectExplorer::RunConfiguration*)));
this, SLOT(slotRemovedRunConfiguration(ProjectExplorer::RunConfiguration*)));
if (target->project() == m_project)
m_listWidgets[TARGET]->removeProjectConfiguration(target);
......@@ -717,6 +721,11 @@ void MiniProjectTargetSelector::removedTarget(ProjectExplorer::Target *target)
removedDeployConfiguration(dc);
foreach (RunConfiguration *rc, target->runConfigurations())
removedRunConfiguration(rc);
}
void MiniProjectTargetSelector::slotRemovedTarget(ProjectExplorer::Target *target)
{
removedTarget(target);
updateTargetListVisible();
updateBuildListVisible();
......@@ -724,7 +733,14 @@ void MiniProjectTargetSelector::removedTarget(ProjectExplorer::Target *target)
updateRunListVisible();
}
void MiniProjectTargetSelector::addedBuildConfiguration(ProjectExplorer::BuildConfiguration *bc)
{
if (bc->target() == m_target)
m_listWidgets[BUILD]->addProjectConfiguration(bc);
}
void MiniProjectTargetSelector::slotAddedBuildConfiguration(ProjectExplorer::BuildConfiguration *bc)
{
if (bc->target() == m_target)
m_listWidgets[BUILD]->addProjectConfiguration(bc);
......@@ -732,6 +748,12 @@ void MiniProjectTargetSelector::addedBuildConfiguration(ProjectExplorer::BuildCo
}
void MiniProjectTargetSelector::removedBuildConfiguration(ProjectExplorer::BuildConfiguration *bc)
{
if (bc->target() == m_target)
m_listWidgets[BUILD]->removeProjectConfiguration(bc);
}
void MiniProjectTargetSelector::slotRemovedBuildConfiguration(ProjectExplorer::BuildConfiguration *bc)
{
if (bc->target() == m_target)
m_listWidgets[BUILD]->removeProjectConfiguration(bc);
......@@ -739,6 +761,12 @@ void MiniProjectTargetSelector::removedBuildConfiguration(ProjectExplorer::Build
}
void MiniProjectTargetSelector::addedDeployConfiguration(ProjectExplorer::DeployConfiguration *dc)
{
if (dc->target() == m_target)
m_listWidgets[DEPLOY]->addProjectConfiguration(dc);
}
void MiniProjectTargetSelector::slotAddedDeployConfiguration(ProjectExplorer::DeployConfiguration *dc)
{
if (dc->target() == m_target)
m_listWidgets[DEPLOY]->addProjectConfiguration(dc);
......@@ -746,6 +774,12 @@ void MiniProjectTargetSelector::addedDeployConfiguration(ProjectExplorer::Deploy
}
void MiniProjectTargetSelector::removedDeployConfiguration(ProjectExplorer::DeployConfiguration *dc)
{
if (dc->target() == m_target)
m_listWidgets[DEPLOY]->removeProjectConfiguration(dc);
}
void MiniProjectTargetSelector::slotRemovedDeployConfiguration(ProjectExplorer::DeployConfiguration *dc)
{
if (dc->target() == m_target)
m_listWidgets[DEPLOY]->removeProjectConfiguration(dc);
......@@ -753,6 +787,12 @@ void MiniProjectTargetSelector::removedDeployConfiguration(ProjectExplorer::Depl
}
void MiniProjectTargetSelector::addedRunConfiguration(ProjectExplorer::RunConfiguration *rc)
{
if (rc->target() == m_target)
m_listWidgets[RUN]->addProjectConfiguration(rc);
}
void MiniProjectTargetSelector::slotAddedRunConfiguration(ProjectExplorer::RunConfiguration *rc)
{
if (rc->target() == m_target)
m_listWidgets[RUN]->addProjectConfiguration(rc);
......@@ -760,6 +800,12 @@ void MiniProjectTargetSelector::addedRunConfiguration(ProjectExplorer::RunConfig
}
void MiniProjectTargetSelector::removedRunConfiguration(ProjectExplorer::RunConfiguration *rc)
{
if (rc->target() == m_target)
m_listWidgets[RUN]->removeProjectConfiguration(rc);
}
void MiniProjectTargetSelector::slotRemovedRunConfiguration(ProjectExplorer::RunConfiguration *rc)
{
if (rc->target() == m_target)
m_listWidgets[RUN]->removeProjectConfiguration(rc);
......
......@@ -62,6 +62,7 @@ public:
void keyPressEvent(QKeyEvent *event);
void keyReleaseEvent(QKeyEvent *event);
void setMaxCount(int maxCount);
private:
int m_maxCount;
};
......@@ -122,14 +123,14 @@ public slots:
private slots:
void projectAdded(ProjectExplorer::Project *project);
void projectRemoved(ProjectExplorer::Project *project);
void addedTarget(ProjectExplorer::Target *target);
void removedTarget(ProjectExplorer::Target *target);
void addedBuildConfiguration(ProjectExplorer::BuildConfiguration* bc);
void removedBuildConfiguration(ProjectExplorer::BuildConfiguration* bc);
void addedDeployConfiguration(ProjectExplorer::DeployConfiguration *dc);
void removedDeployConfiguration(ProjectExplorer::DeployConfiguration *dc);
void addedRunConfiguration(ProjectExplorer::RunConfiguration *rc);
void removedRunConfiguration(ProjectExplorer::RunConfiguration *rc);
void slotAddedTarget(ProjectExplorer::Target *target);
void slotRemovedTarget(ProjectExplorer::Target *target);
void slotAddedBuildConfiguration(ProjectExplorer::BuildConfiguration *bc);
void slotRemovedBuildConfiguration(ProjectExplorer::BuildConfiguration *bc);
void slotAddedDeployConfiguration(ProjectExplorer::DeployConfiguration *dc);
void slotRemovedDeployConfiguration(ProjectExplorer::DeployConfiguration *dc);
void slotAddedRunConfiguration(ProjectExplorer::RunConfiguration *rc);
void slotRemovedRunConfiguration(ProjectExplorer::RunConfiguration *rc);
void changeStartupProject(ProjectExplorer::Project *project);
void activeTargetChanged(ProjectExplorer::Target *target);
......@@ -147,6 +148,15 @@ private slots:
void updateActionAndSummary();
void switchToProjectsMode();
private:
void addedTarget(ProjectExplorer::Target *target);
void removedTarget(ProjectExplorer::Target *target);
void addedBuildConfiguration(ProjectExplorer::BuildConfiguration* bc);
void removedBuildConfiguration(ProjectExplorer::BuildConfiguration* bc);
void addedDeployConfiguration(ProjectExplorer::DeployConfiguration *dc);
void removedDeployConfiguration(ProjectExplorer::DeployConfiguration *dc);
void addedRunConfiguration(ProjectExplorer::RunConfiguration *rc);
void removedRunConfiguration(ProjectExplorer::RunConfiguration *rc);
void updateProjectListVisible();
void updateTargetListVisible();
void updateBuildListVisible();
......
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