From 2a030ac95a5f1791e6d1f5c604c75a99779b9b58 Mon Sep 17 00:00:00 2001 From: Daniel Teske Date: Thu, 4 Jul 2013 18:23:28 +0200 Subject: [PATCH] EnvironmentAspect: Fix various aspects broken in the refactoring Switching the base environment needs to update the environment. Fetching remote environment didn't work. Task-number: QTCREATORBUG-9734 Change-Id: I4dd0052b364c5c3cfea17d8169de8a235d37b891 Reviewed-by: Christian Kandeler Reviewed-by: Eike Ziller --- .../projectexplorer/environmentaspectwidget.cpp | 11 +++++++++++ src/plugins/projectexplorer/environmentaspectwidget.h | 1 + .../projectexplorer/localenvironmentaspect.cpp | 4 +--- .../remotelinux/remotelinuxenvironmentaspect.cpp | 5 +---- .../remotelinux/remotelinuxenvironmentaspect.h | 3 --- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/plugins/projectexplorer/environmentaspectwidget.cpp b/src/plugins/projectexplorer/environmentaspectwidget.cpp index 4836af78512..79ff5d61273 100644 --- a/src/plugins/projectexplorer/environmentaspectwidget.cpp +++ b/src/plugins/projectexplorer/environmentaspectwidget.cpp @@ -97,6 +97,8 @@ EnvironmentAspectWidget::EnvironmentAspectWidget(EnvironmentAspect *aspect, QWid connect(m_aspect, SIGNAL(baseEnvironmentChanged()), this, SLOT(changeBaseEnvironment())); connect(m_aspect, SIGNAL(userEnvironmentChangesChanged(QList)), this, SLOT(changeUserChanges(QList))); + connect(m_aspect, SIGNAL(environmentChanged()), + this, SLOT(environmentChanged())); } QString EnvironmentAspectWidget::displayName() const @@ -118,6 +120,7 @@ void EnvironmentAspectWidget::baseEnvironmentSelected(int idx) { m_ignoreChange = true; m_aspect->setBaseEnvironmentBase(m_baseEnvironmentComboBox->itemData(idx).toInt()); + m_environmentWidget->setBaseEnvironment(m_aspect->baseEnvironment()); m_ignoreChange = false; } @@ -132,6 +135,7 @@ void EnvironmentAspectWidget::changeBaseEnvironment() m_baseEnvironmentComboBox->setCurrentIndex(i); } m_environmentWidget->setBaseEnvironmentText(m_aspect->baseEnvironmentDisplayName(base)); + m_environmentWidget->setBaseEnvironment(m_aspect->baseEnvironment()); } void EnvironmentAspectWidget::userChangesEdited() @@ -148,4 +152,11 @@ void EnvironmentAspectWidget::changeUserChanges(QList ch m_environmentWidget->setUserChanges(changes); } +void EnvironmentAspectWidget::environmentChanged() +{ + if (m_ignoreChange) + return; + m_environmentWidget->setBaseEnvironment(m_aspect->baseEnvironment()); +} + } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/environmentaspectwidget.h b/src/plugins/projectexplorer/environmentaspectwidget.h index 2093eac8a78..465b802640a 100644 --- a/src/plugins/projectexplorer/environmentaspectwidget.h +++ b/src/plugins/projectexplorer/environmentaspectwidget.h @@ -67,6 +67,7 @@ private slots: void changeBaseEnvironment(); void userChangesEdited(); void changeUserChanges(QList changes); + void environmentChanged(); private: EnvironmentAspect *m_aspect; diff --git a/src/plugins/projectexplorer/localenvironmentaspect.cpp b/src/plugins/projectexplorer/localenvironmentaspect.cpp index 8e84bc3b470..1ec0d7f4895 100644 --- a/src/plugins/projectexplorer/localenvironmentaspect.cpp +++ b/src/plugins/projectexplorer/localenvironmentaspect.cpp @@ -84,10 +84,8 @@ Utils::Environment LocalEnvironmentAspect::baseEnvironment() const void LocalEnvironmentAspect::buildEnvironmentHasChanged() { - if (baseEnvironmentBase() == static_cast(BuildEnvironmentBase)) { - emit baseEnvironmentChanged(); + if (baseEnvironmentBase() == static_cast(BuildEnvironmentBase)) emit environmentChanged(); - } } LocalEnvironmentAspect::LocalEnvironmentAspect(RunConfiguration *rc) : diff --git a/src/plugins/remotelinux/remotelinuxenvironmentaspect.cpp b/src/plugins/remotelinux/remotelinuxenvironmentaspect.cpp index 22b9ca97910..70b3da48845 100644 --- a/src/plugins/remotelinux/remotelinuxenvironmentaspect.cpp +++ b/src/plugins/remotelinux/remotelinuxenvironmentaspect.cpp @@ -87,11 +87,8 @@ void RemoteLinuxEnvironmentAspect::setRemoteEnvironment(const Utils::Environment { if (env != m_remoteEnvironment) { m_remoteEnvironment = env; - emit remoteEnvironmentChanged(); - if (baseEnvironmentBase() == static_cast(RemoteBaseEnvironment)) { - emit baseEnvironmentChanged(); + if (baseEnvironmentBase() == static_cast(RemoteBaseEnvironment)) emit environmentChanged(); - } } } diff --git a/src/plugins/remotelinux/remotelinuxenvironmentaspect.h b/src/plugins/remotelinux/remotelinuxenvironmentaspect.h index 44313727314..c1770343600 100644 --- a/src/plugins/remotelinux/remotelinuxenvironmentaspect.h +++ b/src/plugins/remotelinux/remotelinuxenvironmentaspect.h @@ -60,9 +60,6 @@ public: QString userEnvironmentChangesAsString() const; -signals: - void remoteEnvironmentChanged(); - private: enum BaseEnvironmentBase { CleanBaseEnvironment = 0,