aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2019-07-26 09:23:57 +0200
committerhjk <hjk@qt.io>2019-07-26 12:05:52 +0000
commita6c85993ba324def14c4e306d940df4d0a47da30 (patch)
treec8ea2cb8a3450cfa2788544a5d90e27f96f709ef /src
parentf940aad53cb994bdb39444fddb1f40859380e371 (diff)
ProjectExplorer: Propagate build environment changes more directly
To check this still works I used a CustomRunConfiguration with a executable name $AAA, the tooltip there tries to expand that (and complains that $AAA is not an executable). By inserting a AAA=/bin/ls in the build environment, the tool tip on the run config exectable path chooser changes appropriately, same for changing the AAA value. The connection seems also needed, dropping it destroys that updating. Change-Id: I28965cbd3ce530a83d98808ca7624a6799cd9800 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp2
-rw-r--r--src/plugins/projectexplorer/buildconfiguration.cpp1
-rw-r--r--src/plugins/projectexplorer/localenvironmentaspect.cpp13
-rw-r--r--src/plugins/projectexplorer/localenvironmentaspect.h2
-rw-r--r--src/plugins/projectexplorer/subscription.cpp17
-rw-r--r--src/plugins/projectexplorer/subscription.h7
-rw-r--r--src/plugins/projectexplorer/target.h10
-rw-r--r--src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp4
-rw-r--r--src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp2
9 files changed, 9 insertions, 49 deletions
diff --git a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp
index 50bfeb7b3a..495f5df4ec 100644
--- a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp
@@ -103,7 +103,7 @@ void CMakeRunConfiguration::updateTargetInformation()
BuildTargetInfo bti = buildTargetInfo();
aspect<ExecutableAspect>()->setExecutable(bti.targetFilePath);
aspect<WorkingDirectoryAspect>()->setDefaultWorkingDirectory(bti.workingDirectory);
- aspect<LocalEnvironmentAspect>()->buildEnvironmentHasChanged();
+ aspect<LocalEnvironmentAspect>()->environmentChanged();
auto terminalAspect = aspect<TerminalAspect>();
terminalAspect->setUseTerminalHint(bti.usesTerminal);
diff --git a/src/plugins/projectexplorer/buildconfiguration.cpp b/src/plugins/projectexplorer/buildconfiguration.cpp
index 48493b27ec..a4a7d19734 100644
--- a/src/plugins/projectexplorer/buildconfiguration.cpp
+++ b/src/plugins/projectexplorer/buildconfiguration.cpp
@@ -101,6 +101,7 @@ BuildConfiguration::BuildConfiguration(Target *target, Core::Id id)
connect(this, &BuildConfiguration::environmentChanged, this, [this] {
m_buildDirectoryAspect->setEnvironment(environment());
+ this->target()->buildEnvironmentChanged(this);
});
}
diff --git a/src/plugins/projectexplorer/localenvironmentaspect.cpp b/src/plugins/projectexplorer/localenvironmentaspect.cpp
index 366b938ed4..48eac49492 100644
--- a/src/plugins/projectexplorer/localenvironmentaspect.cpp
+++ b/src/plugins/projectexplorer/localenvironmentaspect.cpp
@@ -30,8 +30,6 @@
#include "kit.h"
#include "target.h"
-#include <utils/qtcassert.h>
-
using namespace Utils;
namespace ProjectExplorer {
@@ -56,15 +54,10 @@ LocalEnvironmentAspect::LocalEnvironmentAspect(Target *target)
return env;
});
- target->subscribeSignal(&BuildConfiguration::environmentChanged,
- this, &LocalEnvironmentAspect::buildEnvironmentHasChanged);
connect(target, &Target::activeBuildConfigurationChanged,
- this, &LocalEnvironmentAspect::buildEnvironmentHasChanged);
-}
-
-void LocalEnvironmentAspect::buildEnvironmentHasChanged()
-{
- emit environmentChanged();
+ this, &EnvironmentAspect::environmentChanged);
+ connect(target, &Target::buildEnvironmentChanged,
+ this, &EnvironmentAspect::environmentChanged);
}
} // namespace ProjectExplorer
diff --git a/src/plugins/projectexplorer/localenvironmentaspect.h b/src/plugins/projectexplorer/localenvironmentaspect.h
index 05653899b2..b1e4d5fd55 100644
--- a/src/plugins/projectexplorer/localenvironmentaspect.h
+++ b/src/plugins/projectexplorer/localenvironmentaspect.h
@@ -35,8 +35,6 @@ class PROJECTEXPLORER_EXPORT LocalEnvironmentAspect : public EnvironmentAspect
public:
explicit LocalEnvironmentAspect(Target *parent);
-
- void buildEnvironmentHasChanged();
};
} // namespace ProjectExplorer
diff --git a/src/plugins/projectexplorer/subscription.cpp b/src/plugins/projectexplorer/subscription.cpp
index 3a84235132..6f713c1e97 100644
--- a/src/plugins/projectexplorer/subscription.cpp
+++ b/src/plugins/projectexplorer/subscription.cpp
@@ -124,22 +124,5 @@ ProjectSubscription::ProjectSubscription(const Subscription::Connector &s, const
ProjectSubscription::~ProjectSubscription() = default;
-TargetSubscription::TargetSubscription(const Subscription::Connector &s, const QObject *r,
- Target *t) :
- Subscription(s, r, t)
-{
- QTC_ASSERT(m_subscriber, return);
-
- subscribe(t);
-
- // Disconnect on removal of a target, to make it save to remove/add a target:
- connect(t->project(), &Project::removedTarget, this,
- [t, this](const Target *reportedTarget) { if (t == reportedTarget) { destroy(); } });
- connect(t, &Target::addedProjectConfiguration, this, &TargetSubscription::subscribe);
- connect(t, &Target::removedProjectConfiguration, this, &TargetSubscription::unsubscribe);
-}
-
-TargetSubscription::~TargetSubscription() = default;
-
} // namespace Internal
} // namespace ProjectExplorer
diff --git a/src/plugins/projectexplorer/subscription.h b/src/plugins/projectexplorer/subscription.h
index 71aa3596f3..6e2b012895 100644
--- a/src/plugins/projectexplorer/subscription.h
+++ b/src/plugins/projectexplorer/subscription.h
@@ -70,12 +70,5 @@ public:
~ProjectSubscription() final;
};
-class PROJECTEXPLORER_EXPORT TargetSubscription : public Subscription
-{
-public:
- TargetSubscription(const Connector &s, const QObject *receiver, Target *t);
- ~TargetSubscription() final;
-};
-
} // namespace Internal
} // namespace ProjectExplorer
diff --git a/src/plugins/projectexplorer/target.h b/src/plugins/projectexplorer/target.h
index f5c7fcabd1..52f84e908b 100644
--- a/src/plugins/projectexplorer/target.h
+++ b/src/plugins/projectexplorer/target.h
@@ -119,15 +119,6 @@ public:
QVariant additionalData(Core::Id id) const;
MakeInstallCommand makeInstallCommand(const QString &installRoot) const;
- template<typename S, typename R, typename T>
- void subscribeSignal(void (S::*sig)(), R*recv, T (R::*sl)()) {
- new Internal::TargetSubscription([sig, recv, sl, this](ProjectConfiguration *pc) {
- if (S* sender = qobject_cast<S*>(pc))
- return connect(sender, sig, recv, sl);
- return QMetaObject::Connection();
- }, recv, this);
- }
-
signals:
void targetEnabled(bool);
void iconChanged();
@@ -150,6 +141,7 @@ signals:
void removedBuildConfiguration(ProjectExplorer::BuildConfiguration *bc);
void addedBuildConfiguration(ProjectExplorer::BuildConfiguration *bc);
void activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration *);
+ void buildEnvironmentChanged(ProjectExplorer::BuildConfiguration *bc);
void removedDeployConfiguration(ProjectExplorer::DeployConfiguration *dc);
void addedDeployConfiguration(ProjectExplorer::DeployConfiguration *dc);
diff --git a/src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp b/src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp
index d4960b3524..258ccedbfa 100644
--- a/src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp
+++ b/src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp
@@ -84,8 +84,8 @@ QbsRunConfiguration::QbsRunConfiguration(Target *target, Core::Id id)
});
}
- connect(project(), &Project::parsingFinished, this,
- [envAspect]() { envAspect->buildEnvironmentHasChanged(); });
+ connect(project(), &Project::parsingFinished,
+ envAspect, &EnvironmentAspect::environmentChanged);
connect(target, &Target::deploymentDataChanged,
this, &QbsRunConfiguration::updateTargetInformation);
diff --git a/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp b/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp
index 8cf53db49b..c055e9bc03 100644
--- a/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp
+++ b/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp
@@ -97,7 +97,7 @@ DesktopQmakeRunConfiguration::DesktopQmakeRunConfiguration(Target *target, Core:
void DesktopQmakeRunConfiguration::updateTargetInformation()
{
setDefaultDisplayName(defaultDisplayName());
- aspect<LocalEnvironmentAspect>()->buildEnvironmentHasChanged();
+ aspect<EnvironmentAspect>()->environmentChanged();
BuildTargetInfo bti = buildTargetInfo();