summaryrefslogtreecommitdiff
path: root/src/plugins/qmlprojectmanager/qmlprojectenvironmentaspect.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2018-02-21 17:01:45 +0100
committerUlf Hermann <ulf.hermann@qt.io>2018-03-07 14:53:17 +0000
commit5179dbbe688e0dc01708432eebe444003c24c439 (patch)
treebef3314e371b86e884d5555365c86201edb53d39 /src/plugins/qmlprojectmanager/qmlprojectenvironmentaspect.cpp
parent6e419d642a2c1e9d6f5cc334bdd58305fd01b3e5 (diff)
downloadqt-creator-5179dbbe688e0dc01708432eebe444003c24c439.tar.gz
QmlProject: Clean up environment selection
On desktop you get "system environment" as default now and "clean environment" as option. "kit environment" doesn't make any sense as that is meant for build configurations. On remote Devices you only get "clean environment" because we cannot query the generic remote device for its default environment. However, as the environment was rather random before and it worked, a clean environment will probably not break it. Change-Id: Iab0ed804a21cf77db9e3413926ff710c91561db0 Task-number: QTCREATORBUG-19887 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io> Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Diffstat (limited to 'src/plugins/qmlprojectmanager/qmlprojectenvironmentaspect.cpp')
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectenvironmentaspect.cpp32
1 files changed, 20 insertions, 12 deletions
diff --git a/src/plugins/qmlprojectmanager/qmlprojectenvironmentaspect.cpp b/src/plugins/qmlprojectmanager/qmlprojectenvironmentaspect.cpp
index 5cc6fe9988..a4721ada4e 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectenvironmentaspect.cpp
+++ b/src/plugins/qmlprojectmanager/qmlprojectenvironmentaspect.cpp
@@ -27,6 +27,7 @@
#include "qmlproject.h"
+#include <projectexplorer/kitinformation.h>
#include <projectexplorer/target.h>
#include <projectexplorer/kit.h>
#include <utils/qtcassert.h>
@@ -39,28 +40,35 @@ namespace QmlProjectManager {
QList<int> QmlProjectEnvironmentAspect::possibleBaseEnvironments() const
{
- return QList<int>() << static_cast<int>(KitEnvironmentBase)
- << static_cast<int>(SystemEnvironmentBase);
+ QList<int> ret;
+ if (ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(runConfiguration()->target()->kit())
+ == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
+ ret << SystemEnvironmentBase;
+ }
+ ret << CleanEnvironmentBase;
+ return ret;
}
QString QmlProjectEnvironmentAspect::baseEnvironmentDisplayName(int base) const
{
- if (base == static_cast<int>(SystemEnvironmentBase))
+ switch (base) {
+ case SystemEnvironmentBase:
return tr("System Environment");
- if (base == static_cast<int>(KitEnvironmentBase))
- return tr("Kit Environment");
- return QString();
+ case CleanEnvironmentBase:
+ return tr("Clean Environment");
+ default:
+ QTC_CHECK(false);
+ return QString();
+ }
}
Utils::Environment QmlProjectEnvironmentAspect::baseEnvironment() const
{
- int base = baseEnvironmentBase();
- Utils::Environment env = Utils::Environment::systemEnvironment();
- if (base == static_cast<int>(KitEnvironmentBase))
- runConfiguration()->target()->kit()->addToEnvironment(env);
+ Utils::Environment env = baseEnvironmentBase() == SystemEnvironmentBase
+ ? Utils::Environment::systemEnvironment()
+ : Utils::Environment();
- QmlProject *project = qobject_cast<QmlProject *>(runConfiguration()->target()->project());
- if (project)
+ if (QmlProject *project = qobject_cast<QmlProject *>(runConfiguration()->target()->project()))
env.modify(project->environment());
return env;