Commit 93c832a6 authored by Tobias Hunger's avatar Tobias Hunger

Project: Get rid of *EnabledChanged signals on Project and Target

Change-Id: I87529e4eed73fedf34a1482c99129ecc3a5c0e98
Reviewed-by: Tim Jenssen's avatarTim Jenssen <tim.jenssen@qt.io>
parent f119eec4
......@@ -223,13 +223,6 @@ QString Project::makeUnique(const QString &preferredName, const QStringList &use
return tryName;
}
void Project::changeBuildConfigurationEnabled()
{
auto t = qobject_cast<Target *>(sender());
if (t == activeTarget())
emit buildConfigurationEnabledChanged();
}
void Project::addTarget(Target *t)
{
QTC_ASSERT(t && !d->m_targets.contains(t), return);
......@@ -240,8 +233,6 @@ void Project::addTarget(Target *t)
// add it
d->m_targets.push_back(t);
connect(t, &Target::buildConfigurationEnabledChanged,
this, &Project::changeBuildConfigurationEnabled);
connect(t, &Target::addedProjectConfiguration, this, &Project::addedProjectConfiguration);
connect(t, &Target::aboutToRemoveProjectConfiguration, this, &Project::aboutToRemoveProjectConfiguration);
connect(t, &Target::removedProjectConfiguration, this, &Project::removedProjectConfiguration);
......@@ -297,7 +288,6 @@ void Project::setActiveTarget(Target *target)
d->m_activeTarget = target;
emit activeProjectConfigurationChanged(d->m_activeTarget);
emit activeTargetChanged(d->m_activeTarget);
emit buildConfigurationEnabledChanged();
}
}
......
......@@ -207,8 +207,6 @@ signals:
void removedTarget(ProjectExplorer::Target *target);
void addedTarget(ProjectExplorer::Target *target);
void buildConfigurationEnabledChanged();
void settingsLoaded();
void aboutToSaveSettings();
......@@ -242,8 +240,6 @@ protected:
virtual void projectLoaded(); // Called when the project is fully loaded.
private:
void changeBuildConfigurationEnabled();
void setActiveTarget(Target *target);
ProjectPrivate *d;
......
......@@ -2624,17 +2624,17 @@ void ProjectExplorerPluginPrivate::projectAdded(Project *pro)
if (m_projectsMode)
m_projectsMode->setEnabled(true);
// more specific action en and disabling ?
connect(pro, &Project::buildConfigurationEnabledChanged,
this, &ProjectExplorerPluginPrivate::updateActions);
pro->subscribeSignal(&BuildConfiguration::enabledChanged, this, [this]() {
if (static_cast<BuildConfiguration *>(sender())->isActive())
updateActions();
});
}
void ProjectExplorerPluginPrivate::projectRemoved(Project *pro)
{
Q_UNUSED(pro);
if (m_projectsMode)
m_projectsMode->setEnabled(SessionManager::hasProjects());
// more specific action en and disabling ?
disconnect(pro, &Project::buildConfigurationEnabledChanged,
this, &ProjectExplorerPluginPrivate::updateActions);
}
void ProjectExplorerPluginPrivate::projectDisplayNameChanged(Project *pro)
......
......@@ -153,27 +153,6 @@ Target::~Target()
delete d;
}
void Target::changeBuildConfigurationEnabled()
{
auto bc = qobject_cast<BuildConfiguration *>(sender());
if (bc == activeBuildConfiguration())
emit buildConfigurationEnabledChanged();
}
void Target::changeDeployConfigurationEnabled()
{
auto dc = qobject_cast<DeployConfiguration *>(sender());
if (dc == activeDeployConfiguration())
emit deployConfigurationEnabledChanged();
}
void Target::changeRunConfigurationEnabled()
{
auto rc = qobject_cast<RunConfiguration *>(sender());
if (rc == activeRunConfiguration())
emit runConfigurationEnabledChanged();
}
void Target::handleKitUpdates(Kit *k)
{
if (k != d->m_kit)
......@@ -232,9 +211,6 @@ void Target::addBuildConfiguration(BuildConfiguration *bc)
emit addedProjectConfiguration(bc);
emit addedBuildConfiguration(bc);
connect(bc, &BuildConfiguration::enabledChanged,
this, &Target::changeBuildConfigurationEnabled);
if (!activeBuildConfiguration())
setActiveBuildConfiguration(bc);
}
......@@ -285,7 +261,6 @@ void Target::setActiveBuildConfiguration(BuildConfiguration *bc)
d->m_activeBuildConfiguration = bc;
emit activeProjectConfigurationChanged(d->m_activeBuildConfiguration);
emit activeBuildConfigurationChanged(d->m_activeBuildConfiguration);
emit buildConfigurationEnabledChanged();
}
}
......@@ -306,9 +281,6 @@ void Target::addDeployConfiguration(DeployConfiguration *dc)
// add it
d->m_deployConfigurations.push_back(dc);
connect(dc, &DeployConfiguration::enabledChanged,
this, &Target::changeDeployConfigurationEnabled);
emit addedProjectConfiguration(dc);
emit addedDeployConfiguration(dc);
......@@ -362,7 +334,6 @@ void Target::setActiveDeployConfiguration(DeployConfiguration *dc)
d->m_activeDeployConfiguration = dc;
emit activeProjectConfigurationChanged(d->m_activeDeployConfiguration);
emit activeDeployConfigurationChanged(d->m_activeDeployConfiguration);
emit deployConfigurationEnabledChanged();
}
updateDeviceState();
}
......@@ -420,9 +391,6 @@ void Target::addRunConfiguration(RunConfiguration *rc)
d->m_runConfigurations.push_back(rc);
connect(rc, &RunConfiguration::enabledChanged,
this, &Target::changeRunConfigurationEnabled);
emit addedProjectConfiguration(rc);
emit addedRunConfiguration(rc);
......@@ -463,7 +431,6 @@ void Target::setActiveRunConfiguration(RunConfiguration *rc)
d->m_activeRunConfiguration = rc;
emit activeProjectConfigurationChanged(d->m_activeRunConfiguration);
emit activeRunConfigurationChanged(d->m_activeRunConfiguration);
emit runConfigurationEnabledChanged();
}
updateDeviceState();
}
......
......@@ -160,12 +160,6 @@ signals:
void addedDeployConfiguration(ProjectExplorer::DeployConfiguration *dc);
void activeDeployConfigurationChanged(ProjectExplorer::DeployConfiguration *dc);
/// convenience signal, emitted if either the active configuration emits
/// enabledChanged() or if the active build configuration changes
void buildConfigurationEnabledChanged();
void deployConfigurationEnabledChanged();
void runConfigurationEnabledChanged();
void deploymentDataChanged();
void applicationTargetsChanged();
......@@ -177,7 +171,6 @@ private:
void updateDeviceState();
void changeBuildConfigurationEnabled();
void changeDeployConfigurationEnabled();
void changeRunConfigurationEnabled();
void handleKitUpdates(ProjectExplorer::Kit *k);
......
......@@ -98,7 +98,7 @@ QmakeProjectConfigWidget::QmakeProjectConfigWidget(QmakeBuildConfiguration *bc)
this, &QmakeProjectConfigWidget::shadowBuildEdited);
QmakeProject *project = static_cast<QmakeProject *>(bc->target()->project());
project->subscribeSignal(&BuildConfiguration::environmentChanged, this, [this]() {
project->subscribeSignal(&BuildConfiguration::environmentChanged, this, [this, bc]() {
if (static_cast<BuildConfiguration *>(sender())->isActive())
environmentChanged();
});
......
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