Skip to content
Snippets Groups Projects
Commit 5d75804b authored by dt's avatar dt
Browse files

Refactor the checkbox "Clear system environment" out.

I don't want it in the run configurations.
parent adc7a720
No related branches found
No related tags found
No related merge requests found
......@@ -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();
......
......@@ -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;
};
......
......@@ -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);
......
......@@ -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;
......
......@@ -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();
......
......@@ -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;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment