Commit 3a8ad685 authored by Tobias Hunger's avatar Tobias Hunger

DeployConfiguration: Make it possible to enable/disable DCs

Allow DCs to be enabled/disabled.

Add infrastructure to target to propagate enabled signals of
BCs, RCs and DCs.

Change-Id: I8ae27a943953228b18e61396a22a2d7a2e4e9694
Reviewed-by: default avatarTobias Hunger <tobias.hunger@nokia.com>
parent 89f3c1c2
......@@ -94,6 +94,16 @@ DeployConfigurationWidget *DeployConfiguration::configurationWidget() const
return 0;
}
bool DeployConfiguration::isEnabled() const
{
return false;
}
QString DeployConfiguration::disabledReason() const
{
return QString();
}
bool DeployConfiguration::fromMap(const QVariantMap &map)
{
if (!ProjectConfiguration::fromMap(map))
......
......@@ -63,8 +63,14 @@ public:
virtual DeployConfigurationWidget *configurationWidget() const;
virtual bool isEnabled() const;
virtual QString disabledReason() const;
Target *target() const;
signals:
void enabledChanged();
protected:
DeployConfiguration(Target *target, const QString &id);
DeployConfiguration(Target *target, DeployConfiguration *source);
......
......@@ -129,6 +129,20 @@ void Target::changeBuildConfigurationEnabled()
emit buildConfigurationEnabledChanged();
}
void Target::changeDeployConfigurationEnabled()
{
DeployConfiguration *dc = qobject_cast<DeployConfiguration *>(sender());
if (dc == activeDeployConfiguration())
emit deployConfigurationEnabledChanged();
}
void Target::changeRunConfigurationEnabled()
{
RunConfiguration *rc = qobject_cast<RunConfiguration *>(sender());
if (rc == activeRunConfiguration())
emit runConfigurationEnabledChanged();
}
Project *Target::project() const
{
return static_cast<Project *>(parent());
......@@ -243,6 +257,8 @@ void Target::addDeployConfiguration(DeployConfiguration *dc)
// add it
d->m_deployConfigurations.push_back(dc);
connect(dc, SIGNAL(enabledChanged()), this, SLOT(changeDeployConfigurationEnabled()));
emit addedDeployConfiguration(dc);
if (!d->m_activeDeployConfiguration)
......@@ -293,6 +309,7 @@ void Target::setActiveDeployConfiguration(DeployConfiguration *dc)
dc != d->m_activeDeployConfiguration)) {
d->m_activeDeployConfiguration = dc;
emit activeDeployConfigurationChanged(d->m_activeDeployConfiguration);
emit deployConfigurationEnabledChanged();
}
}
......@@ -341,6 +358,9 @@ void Target::addRunConfiguration(RunConfiguration* runConfiguration)
runConfiguration->setDisplayName(configurationDisplayName);
d->m_runConfigurations.push_back(runConfiguration);
connect(runConfiguration, SIGNAL(enabledChanged()), this, SLOT(changeRunConfigurationEnabled()));
emit addedRunConfiguration(runConfiguration);
if (!activeRunConfiguration())
......@@ -376,6 +396,7 @@ void Target::setActiveRunConfiguration(RunConfiguration* configuration)
configuration != d->m_activeRunConfiguration)) {
d->m_activeRunConfiguration = configuration;
emit activeRunConfigurationChanged(d->m_activeRunConfiguration);
emit runConfigurationEnabledChanged();
}
}
......
......@@ -112,7 +112,6 @@ public:
virtual QList<ToolChain *> possibleToolChains(BuildConfiguration *) const;
virtual ToolChain *preferredToolChain(BuildConfiguration *) const;
virtual QVariantMap toMap() const;
signals:
......@@ -123,8 +122,6 @@ signals:
// TODO clean up signal names
// might be better to also have aboutToRemove signals
void runConfigurationsEnabledStateChanged();
void removedRunConfiguration(ProjectExplorer::RunConfiguration *);
void addedRunConfiguration(ProjectExplorer::RunConfiguration *);
void activeRunConfigurationChanged(ProjectExplorer::RunConfiguration *);
......@@ -141,9 +138,11 @@ signals:
/// environmentChanged() or if the active build configuration changes
void environmentChanged();
/// convenience signal, emitted if either the active buildconfiguration emits
/// convenience signal, emitted if either the active configuration emits
/// enabledChanged() or if the active build configuration changes
void buildConfigurationEnabledChanged();
void deployConfigurationEnabledChanged();
void runConfigurationEnabledChanged();
protected:
Target(Project *parent, const QString &id);
......@@ -155,6 +154,8 @@ protected:
private slots:
void changeEnvironment();
void changeBuildConfigurationEnabled();
void changeDeployConfigurationEnabled();
void changeRunConfigurationEnabled();
private:
TargetPrivate *d;
......
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