From 5d75804b931f01f9718b44e0e82e6b51b775fed7 Mon Sep 17 00:00:00 2001 From: dt <qtc-committer@nokia.com> Date: Tue, 26 May 2009 17:21:02 +0200 Subject: [PATCH] Refactor the checkbox "Clear system environment" out. I don't want it in the run configurations. --- .../cmakebuildenvironmentwidget.cpp | 8 +++++--- .../cmakebuildenvironmentwidget.h | 4 ++++ .../projectexplorer/environmenteditmodel.cpp | 15 +-------------- .../projectexplorer/environmenteditmodel.h | 3 --- .../qt4buildenvironmentwidget.cpp | 10 +++++++--- .../qt4projectmanager/qt4buildenvironmentwidget.h | 5 +++++ 6 files changed, 22 insertions(+), 23 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/cmakebuildenvironmentwidget.cpp b/src/plugins/cmakeprojectmanager/cmakebuildenvironmentwidget.cpp index 99526421fbf..2ced7fb57b4 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildenvironmentwidget.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildenvironmentwidget.cpp @@ -44,13 +44,15 @@ CMakeBuildEnvironmentWidget::CMakeBuildEnvironmentWidget(CMakeProject *project) : BuildStepConfigWidget(), m_pro(project) { QVBoxLayout *vbox = new QVBoxLayout(this); - vbox->setMargin(0); + m_clearSystemEnvironmentCheckBox = new QCheckBox(this); + m_clearSystemEnvironmentCheckBox->setText("Clear system environment"); + vbox->addWidget(m_clearSystemEnvironmentCheckBox); m_buildEnvironmentWidget = new ProjectExplorer::EnvironmentWidget(this); vbox->addWidget(m_buildEnvironmentWidget); connect(m_buildEnvironmentWidget, SIGNAL(userChangesUpdated()), this, SLOT(environmentModelUserChangesUpdated())); - connect(m_buildEnvironmentWidget, SIGNAL(clearSystemEnvironmentCheckBoxClicked(bool)), + connect(m_clearSystemEnvironmentCheckBox, SIGNAL(toggled(bool)), this, SLOT(clearSystemEnvironmentCheckBoxClicked(bool))); } @@ -66,7 +68,7 @@ void CMakeBuildEnvironmentWidget::init(const QString &buildConfiguration) m_buildConfiguration = buildConfiguration; - m_buildEnvironmentWidget->setClearSystemEnvironment(!m_pro->useSystemEnvironment(buildConfiguration)); + m_clearSystemEnvironmentCheckBox->setChecked(!m_pro->useSystemEnvironment(buildConfiguration)); m_buildEnvironmentWidget->setBaseEnvironment(m_pro->baseEnvironment(buildConfiguration)); m_buildEnvironmentWidget->setUserChanges(m_pro->userEnvironmentChanges(buildConfiguration)); m_buildEnvironmentWidget->updateButtons(); diff --git a/src/plugins/cmakeprojectmanager/cmakebuildenvironmentwidget.h b/src/plugins/cmakeprojectmanager/cmakebuildenvironmentwidget.h index db59b2c5dfe..9e18affae82 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildenvironmentwidget.h +++ b/src/plugins/cmakeprojectmanager/cmakebuildenvironmentwidget.h @@ -31,6 +31,9 @@ #define QT4BUILDENVIRONMENTWIDGET_H #include <projectexplorer/buildstep.h> +QT_BEGIN_NAMESPACE +class QCheckBox; +QT_END_NAMESPACE namespace ProjectExplorer { class EnvironmentWidget; @@ -56,6 +59,7 @@ private slots: private: ProjectExplorer::EnvironmentWidget *m_buildEnvironmentWidget; + QCheckBox *m_clearSystemEnvironmentCheckBox; CMakeProject *m_pro; QString m_buildConfiguration; }; diff --git a/src/plugins/projectexplorer/environmenteditmodel.cpp b/src/plugins/projectexplorer/environmenteditmodel.cpp index 28ee8eae3fb..08d1cd215d7 100644 --- a/src/plugins/projectexplorer/environmenteditmodel.cpp +++ b/src/plugins/projectexplorer/environmenteditmodel.cpp @@ -432,12 +432,7 @@ EnvironmentWidget::EnvironmentWidget(QWidget *parent) connect(m_model, SIGNAL(userChangesUpdated()), this, SIGNAL(userChangesUpdated())); - QVBoxLayout *verticalLayout = new QVBoxLayout(this); - m_clearSystemEnvironmentCheckBox = new QCheckBox(this); - m_clearSystemEnvironmentCheckBox->setText("Clear system environment"); - verticalLayout->addWidget(m_clearSystemEnvironmentCheckBox); - - QHBoxLayout *horizontalLayout = new QHBoxLayout(); + QHBoxLayout *horizontalLayout = new QHBoxLayout(this); m_environmentTreeView = new QTreeView(this); m_environmentTreeView->setRootIsDecorated(false); m_environmentTreeView->setHeaderHidden(false); @@ -468,7 +463,6 @@ EnvironmentWidget::EnvironmentWidget(QWidget *parent) QSpacerItem *verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); verticalLayout_2->addItem(verticalSpacer); horizontalLayout->addLayout(verticalLayout_2); - verticalLayout->addLayout(horizontalLayout); connect(m_model, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), this, SLOT(updateButtons())); @@ -483,8 +477,6 @@ EnvironmentWidget::EnvironmentWidget(QWidget *parent) this, SLOT(unsetEnvironmentButtonClicked())); connect(m_environmentTreeView->selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)), this, SLOT(environmentCurrentIndexChanged(QModelIndex, QModelIndex))); - connect(m_clearSystemEnvironmentCheckBox, SIGNAL(toggled(bool)), - this, SIGNAL(clearSystemEnvironmentCheckBoxClicked(bool))); } EnvironmentWidget::~EnvironmentWidget() @@ -493,11 +485,6 @@ EnvironmentWidget::~EnvironmentWidget() m_model = 0; } -void EnvironmentWidget::setClearSystemEnvironment(bool b) -{ - m_clearSystemEnvironmentCheckBox->setChecked(b); -} - void EnvironmentWidget::setBaseEnvironment(const ProjectExplorer::Environment &env) { m_model->setBaseEnvironment(env); diff --git a/src/plugins/projectexplorer/environmenteditmodel.h b/src/plugins/projectexplorer/environmenteditmodel.h index def0ca46f31..3d8475bc172 100644 --- a/src/plugins/projectexplorer/environmenteditmodel.h +++ b/src/plugins/projectexplorer/environmenteditmodel.h @@ -97,7 +97,6 @@ public: void setBaseEnvironment(const ProjectExplorer::Environment &env); void setMergedEnvironments(bool b); - void setClearSystemEnvironment(bool b); bool mergedEnvironments(); QList<EnvironmentItem> userChanges() const; @@ -108,7 +107,6 @@ public slots: signals: void userChangesUpdated(); - void clearSystemEnvironmentCheckBoxClicked(bool on); private slots: void editEnvironmentButtonClicked(); @@ -119,7 +117,6 @@ private slots: private: EnvironmentModel *m_model; - QCheckBox *m_clearSystemEnvironmentCheckBox; QTreeView *m_environmentTreeView; QPushButton *m_editButton; QPushButton *m_addButton; diff --git a/src/plugins/qt4projectmanager/qt4buildenvironmentwidget.cpp b/src/plugins/qt4projectmanager/qt4buildenvironmentwidget.cpp index c7b51997255..1c2149a9f56 100644 --- a/src/plugins/qt4projectmanager/qt4buildenvironmentwidget.cpp +++ b/src/plugins/qt4projectmanager/qt4buildenvironmentwidget.cpp @@ -44,13 +44,17 @@ Qt4BuildEnvironmentWidget::Qt4BuildEnvironmentWidget(Qt4Project *project) : BuildStepConfigWidget(), m_pro(project) { QVBoxLayout *vbox = new QVBoxLayout(this); - vbox->setMargin(0); + + m_clearSystemEnvironmentCheckBox = new QCheckBox(this); + m_clearSystemEnvironmentCheckBox->setText("Clear system environment"); + vbox->addWidget(m_clearSystemEnvironmentCheckBox); + m_buildEnvironmentWidget = new ProjectExplorer::EnvironmentWidget(this); vbox->addWidget(m_buildEnvironmentWidget); connect(m_buildEnvironmentWidget, SIGNAL(userChangesUpdated()), this, SLOT(environmentModelUserChangesUpdated())); - connect(m_buildEnvironmentWidget, SIGNAL(clearSystemEnvironmentCheckBoxClicked(bool)), + connect(m_clearSystemEnvironmentCheckBox, SIGNAL(toggled(bool)), this, SLOT(clearSystemEnvironmentCheckBoxClicked(bool))); } @@ -66,7 +70,7 @@ void Qt4BuildEnvironmentWidget::init(const QString &buildConfiguration) m_buildConfiguration = buildConfiguration; - m_buildEnvironmentWidget->setClearSystemEnvironment(!m_pro->useSystemEnvironment(buildConfiguration)); + m_clearSystemEnvironmentCheckBox->setChecked(!m_pro->useSystemEnvironment(buildConfiguration)); m_buildEnvironmentWidget->setBaseEnvironment(m_pro->baseEnvironment(buildConfiguration)); m_buildEnvironmentWidget->setUserChanges(m_pro->userEnvironmentChanges(buildConfiguration)); m_buildEnvironmentWidget->updateButtons(); diff --git a/src/plugins/qt4projectmanager/qt4buildenvironmentwidget.h b/src/plugins/qt4projectmanager/qt4buildenvironmentwidget.h index 6a8396811cf..91f62ea544b 100644 --- a/src/plugins/qt4projectmanager/qt4buildenvironmentwidget.h +++ b/src/plugins/qt4projectmanager/qt4buildenvironmentwidget.h @@ -32,6 +32,10 @@ #include <projectexplorer/buildstep.h> +QT_BEGIN_NAMESPACE +class QCheckBox; +QT_END_NAMESPACE + namespace ProjectExplorer { class EnvironmentWidget; } @@ -57,6 +61,7 @@ private slots: private: ProjectExplorer::EnvironmentWidget *m_buildEnvironmentWidget; + QCheckBox *m_clearSystemEnvironmentCheckBox; Qt4Project *m_pro; QString m_buildConfiguration; }; -- GitLab