From 6033c31e2327d094cf80f7f2d08b76838e6f69a8 Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 19 Feb 2020 18:38:10 +0100 Subject: [PATCH] ProjectExplorer: Un-export BuildEnvironmentWidget Apparently not needed anymore outside. Change-Id: I9f4f1a65f56a86ba75a37a9b96db71472b3e0af2 Reviewed-by: Christian Stenger --- src/plugins/projectexplorer/CMakeLists.txt | 1 - .../projectexplorer/buildconfiguration.cpp | 53 ++++++++++-- .../buildenvironmentwidget.cpp | 82 ------------------- .../projectexplorer/buildenvironmentwidget.h | 56 ------------- .../projectexplorer/projectexplorer.pro | 2 - .../projectexplorer/projectexplorer.qbs | 1 - src/plugins/qbsprojectmanager/qbsproject.cpp | 2 - 7 files changed, 47 insertions(+), 150 deletions(-) delete mode 100644 src/plugins/projectexplorer/buildenvironmentwidget.cpp delete mode 100644 src/plugins/projectexplorer/buildenvironmentwidget.h diff --git a/src/plugins/projectexplorer/CMakeLists.txt b/src/plugins/projectexplorer/CMakeLists.txt index 60176adceed..9f033bee0da 100644 --- a/src/plugins/projectexplorer/CMakeLists.txt +++ b/src/plugins/projectexplorer/CMakeLists.txt @@ -16,7 +16,6 @@ add_qtc_plugin(ProjectExplorer buildpropertiessettings.h buildpropertiessettingspage.cpp buildpropertiessettingspage.h buildconfiguration.cpp buildconfiguration.h - buildenvironmentwidget.cpp buildenvironmentwidget.h buildinfo.cpp buildinfo.h buildmanager.cpp buildmanager.h buildprogress.cpp buildprogress.h diff --git a/src/plugins/projectexplorer/buildconfiguration.cpp b/src/plugins/projectexplorer/buildconfiguration.cpp index af7359145a7..ad9e980e011 100644 --- a/src/plugins/projectexplorer/buildconfiguration.cpp +++ b/src/plugins/projectexplorer/buildconfiguration.cpp @@ -26,22 +26,22 @@ #include "buildconfiguration.h" #include "buildaspects.h" -#include "buildenvironmentwidget.h" #include "buildinfo.h" #include "buildsteplist.h" #include "buildstepspage.h" #include "buildsystem.h" -#include "namedwidget.h" +#include "environmentwidget.h" #include "kit.h" #include "kitinformation.h" #include "kitmanager.h" -#include "project.h" -#include "projectexplorer.h" +#include "namedwidget.h" #include "projectexplorerconstants.h" +#include "projectexplorer.h" +#include "project.h" #include "projectmacroexpander.h" #include "projecttree.h" -#include "target.h" #include "session.h" +#include "target.h" #include "toolchain.h" #include @@ -54,8 +54,10 @@ #include #include +#include #include #include +#include using namespace Utils; @@ -67,6 +69,45 @@ const char USER_ENVIRONMENT_CHANGES_KEY[] = "ProjectExplorer.BuildConfiguration. namespace ProjectExplorer { namespace Internal { +class BuildEnvironmentWidget : public NamedWidget +{ + Q_DECLARE_TR_FUNCTIONS(ProjectExplorer::BuildEnvironmentWidget) + +public: + explicit BuildEnvironmentWidget(BuildConfiguration *bc) + : NamedWidget(tr("Build Environment")) + { + auto clearBox = new QCheckBox(tr("Clear system environment"), this); + clearBox->setChecked(!bc->useSystemEnvironment()); + + auto envWidget = new EnvironmentWidget(this, EnvironmentWidget::TypeLocal, clearBox); + envWidget->setBaseEnvironment(bc->baseEnvironment()); + envWidget->setBaseEnvironmentText(bc->baseEnvironmentText()); + envWidget->setUserChanges(bc->userEnvironmentChanges()); + + connect(envWidget, &EnvironmentWidget::userChangesChanged, this, [bc, envWidget] { + bc->setUserEnvironmentChanges(envWidget->userChanges()); + }); + + connect(clearBox, &QAbstractButton::toggled, this, [bc, envWidget](bool checked) { + bc->setUseSystemEnvironment(!checked); + envWidget->setBaseEnvironment(bc->baseEnvironment()); + envWidget->setBaseEnvironmentText(bc->baseEnvironmentText()); + }); + + connect(bc, &BuildConfiguration::environmentChanged, this, [bc, envWidget] { + envWidget->setBaseEnvironment(bc->baseEnvironment()); + envWidget->setBaseEnvironmentText(bc->baseEnvironmentText()); + }); + + auto vbox = new QVBoxLayout(this); + vbox->setContentsMargins(0, 0, 0, 0); + vbox->addWidget(clearBox); + vbox->addWidget(envWidget); + } +}; + + class BuildConfigurationPrivate { public: @@ -245,7 +286,7 @@ NamedWidget *BuildConfiguration::createConfigWidget() QList BuildConfiguration::createSubConfigWidgets() { - return {new BuildEnvironmentWidget(this)}; + return {new Internal::BuildEnvironmentWidget(this)}; } BuildSystem *BuildConfiguration::buildSystem() const diff --git a/src/plugins/projectexplorer/buildenvironmentwidget.cpp b/src/plugins/projectexplorer/buildenvironmentwidget.cpp deleted file mode 100644 index 68211385e88..00000000000 --- a/src/plugins/projectexplorer/buildenvironmentwidget.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "buildenvironmentwidget.h" - -#include "buildconfiguration.h" -#include "environmentwidget.h" - -#include - -#include -#include - -namespace ProjectExplorer { - -BuildEnvironmentWidget::BuildEnvironmentWidget(BuildConfiguration *bc) - : NamedWidget(tr("Build Environment")), m_buildConfiguration(bc) -{ - auto vbox = new QVBoxLayout(this); - vbox->setContentsMargins(0, 0, 0, 0); - m_clearSystemEnvironmentCheckBox = new QCheckBox(this); - m_clearSystemEnvironmentCheckBox->setText(tr("Clear system environment")); - - m_buildEnvironmentWidget = new EnvironmentWidget(this, EnvironmentWidget::TypeLocal, - m_clearSystemEnvironmentCheckBox); - vbox->addWidget(m_buildEnvironmentWidget); - - connect(m_buildEnvironmentWidget, &EnvironmentWidget::userChangesChanged, - this, &BuildEnvironmentWidget::environmentModelUserChangesChanged); - connect(m_clearSystemEnvironmentCheckBox, &QAbstractButton::toggled, - this, &BuildEnvironmentWidget::clearSystemEnvironmentCheckBoxClicked); - - connect(m_buildConfiguration, &BuildConfiguration::environmentChanged, - this, &BuildEnvironmentWidget::environmentChanged); - - m_clearSystemEnvironmentCheckBox->setChecked(!m_buildConfiguration->useSystemEnvironment()); - m_buildEnvironmentWidget->setBaseEnvironment(m_buildConfiguration->baseEnvironment()); - m_buildEnvironmentWidget->setBaseEnvironmentText(m_buildConfiguration->baseEnvironmentText()); - m_buildEnvironmentWidget->setUserChanges(m_buildConfiguration->userEnvironmentChanges()); -} - -void BuildEnvironmentWidget::environmentModelUserChangesChanged() -{ - m_buildConfiguration->setUserEnvironmentChanges(m_buildEnvironmentWidget->userChanges()); -} - -void BuildEnvironmentWidget::clearSystemEnvironmentCheckBoxClicked(bool checked) -{ - m_buildConfiguration->setUseSystemEnvironment(!checked); - m_buildEnvironmentWidget->setBaseEnvironment(m_buildConfiguration->baseEnvironment()); - m_buildEnvironmentWidget->setBaseEnvironmentText(m_buildConfiguration->baseEnvironmentText()); -} - -void BuildEnvironmentWidget::environmentChanged() -{ - m_buildEnvironmentWidget->setBaseEnvironment(m_buildConfiguration->baseEnvironment()); - m_buildEnvironmentWidget->setBaseEnvironmentText(m_buildConfiguration->baseEnvironmentText()); -} - -} // ProjectExplorer diff --git a/src/plugins/projectexplorer/buildenvironmentwidget.h b/src/plugins/projectexplorer/buildenvironmentwidget.h deleted file mode 100644 index 7c45bd8f891..00000000000 --- a/src/plugins/projectexplorer/buildenvironmentwidget.h +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#pragma once - -#include - -QT_BEGIN_NAMESPACE -class QCheckBox; -QT_END_NAMESPACE - -namespace ProjectExplorer { - -class EnvironmentWidget; -class BuildConfiguration; - -class PROJECTEXPLORER_EXPORT BuildEnvironmentWidget : public NamedWidget -{ - Q_OBJECT - -public: - explicit BuildEnvironmentWidget(BuildConfiguration *bc); - -private: - void environmentModelUserChangesChanged(); - void clearSystemEnvironmentCheckBoxClicked(bool checked); - void environmentChanged(); - - EnvironmentWidget *m_buildEnvironmentWidget; - QCheckBox *m_clearSystemEnvironmentCheckBox; - BuildConfiguration *m_buildConfiguration; -}; - -} // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/projectexplorer.pro b/src/plugins/projectexplorer/projectexplorer.pro index aa3fc2eb546..341247b735a 100644 --- a/src/plugins/projectexplorer/projectexplorer.pro +++ b/src/plugins/projectexplorer/projectexplorer.pro @@ -105,7 +105,6 @@ HEADERS += projectexplorer.h \ projectexplorersettingspage.h \ baseprojectwizarddialog.h \ miniprojecttargetselector.h \ - buildenvironmentwidget.h \ ldparser.h \ lldparser.h \ linuxiccparser.h \ @@ -258,7 +257,6 @@ SOURCES += projectexplorer.cpp \ projectexplorersettingspage.cpp \ baseprojectwizarddialog.cpp \ miniprojecttargetselector.cpp \ - buildenvironmentwidget.cpp \ ldparser.cpp \ lldparser.cpp \ linuxiccparser.cpp \ diff --git a/src/plugins/projectexplorer/projectexplorer.qbs b/src/plugins/projectexplorer/projectexplorer.qbs index 4b8bb4b8941..8fe4fe522d8 100644 --- a/src/plugins/projectexplorer/projectexplorer.qbs +++ b/src/plugins/projectexplorer/projectexplorer.qbs @@ -33,7 +33,6 @@ Project { "baseprojectwizarddialog.cpp", "baseprojectwizarddialog.h", "buildaspects.cpp", "buildaspects.h", "buildconfiguration.cpp", "buildconfiguration.h", - "buildenvironmentwidget.cpp", "buildenvironmentwidget.h", "buildinfo.cpp", "buildinfo.h", "buildmanager.cpp", "buildmanager.h", "buildprogress.cpp", "buildprogress.h", diff --git a/src/plugins/qbsprojectmanager/qbsproject.cpp b/src/plugins/qbsprojectmanager/qbsproject.cpp index b915107202a..8ce7c8bfb99 100644 --- a/src/plugins/qbsprojectmanager/qbsproject.cpp +++ b/src/plugins/qbsprojectmanager/qbsproject.cpp @@ -49,8 +49,6 @@ #include #include #include -#include -#include #include #include #include