Commit 45d2fd07 authored by con's avatar con
Browse files

Make the show/hide environment details buttons stay at same place.

parent 2afea9dd
......@@ -43,19 +43,13 @@ 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");
m_clearSystemEnvironmentCheckBox->setVisible(false);
vbox->addWidget(m_clearSystemEnvironmentCheckBox);
m_buildEnvironmentWidget = new ProjectExplorer::EnvironmentWidget(this);
m_buildEnvironmentWidget = new ProjectExplorer::EnvironmentWidget(this, m_clearSystemEnvironmentCheckBox);
vbox->addWidget(m_buildEnvironmentWidget);
connect(m_buildEnvironmentWidget, SIGNAL(switchedToDetails()),
m_clearSystemEnvironmentCheckBox, SLOT(show()));
connect(m_buildEnvironmentWidget, SIGNAL(switchedToSummary()),
m_clearSystemEnvironmentCheckBox, SLOT(hide()));
connect(m_buildEnvironmentWidget, SIGNAL(userChangesUpdated()),
this, SLOT(environmentModelUserChangesUpdated()));
connect(m_clearSystemEnvironmentCheckBox, SIGNAL(toggled(bool)),
......
......@@ -272,25 +272,21 @@ CMakeRunConfigurationWidget::CMakeRunConfigurationWidget(CMakeRunConfiguration *
environmentLabel->setFont(f);
vbx->addWidget(environmentLabel);
QFormLayout *formlayout = new QFormLayout();
QWidget *baseEnvironmentWidget = new QWidget;
QHBoxLayout *baseEnvironmentLayout = new QHBoxLayout(baseEnvironmentWidget);
baseEnvironmentLayout->setMargin(0);
QLabel *label = new QLabel(tr("Base environment for this runconfiguration:"), this);
baseEnvironmentLayout->addWidget(label);
m_baseEnvironmentComboBox = new QComboBox(this);
m_baseEnvironmentComboBox->addItems(QStringList()
<< tr("Clean Environment")
<< tr("System Environment")
<< tr("Build Environment"));
formlayout->addRow(label, m_baseEnvironmentComboBox);
vbx->addLayout(formlayout);
label->setVisible(false);
m_baseEnvironmentComboBox->setVisible(false);
m_baseEnvironmentComboBox->setCurrentIndex(m_cmakeRunConfiguration->baseEnvironmentBase());
connect(m_baseEnvironmentComboBox, SIGNAL(currentIndexChanged(int)),
this, SLOT(baseEnvironmentComboBoxChanged(int)));
baseEnvironmentLayout->addWidget(m_baseEnvironmentComboBox);
baseEnvironmentLayout->addStretch(10);
connect(m_workingDirectoryEdit, SIGNAL(changed(QString)),
this, SLOT(setWorkingDirectory()));
......@@ -298,20 +294,10 @@ CMakeRunConfigurationWidget::CMakeRunConfigurationWidget(CMakeRunConfiguration *
connect(resetButton, SIGNAL(clicked()),
this, SLOT(resetWorkingDirectory()));
m_environmentWidget = new ProjectExplorer::EnvironmentWidget(this);
m_environmentWidget = new ProjectExplorer::EnvironmentWidget(this, baseEnvironmentWidget);
m_environmentWidget->setBaseEnvironment(m_cmakeRunConfiguration->baseEnvironment());
m_environmentWidget->setUserChanges(m_cmakeRunConfiguration->userEnvironmentChanges());
connect(m_environmentWidget, SIGNAL(switchedToSummary()),
m_baseEnvironmentComboBox, SLOT(hide()));
connect(m_environmentWidget, SIGNAL(switchedToDetails()),
m_baseEnvironmentComboBox, SLOT(show()));
connect(m_environmentWidget, SIGNAL(switchedToSummary()),
label, SLOT(hide()));
connect(m_environmentWidget, SIGNAL(switchedToDetails()),
label, SLOT(show()));
vbx->addWidget(m_environmentWidget);
connect(m_environmentWidget, SIGNAL(userChangesUpdated()),
......
......@@ -90,6 +90,7 @@ CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomE
layout->addRow(QString(), m_useTerminalCheck);
QVBoxLayout *vbox = new QVBoxLayout(this);
vbox->setContentsMargins(0, -1, 0, -1);
vbox->addLayout(layout);
QLabel *environmentLabel = new QLabel(this);
......@@ -100,41 +101,27 @@ CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomE
environmentLabel->setFont(f);
vbox->addWidget(environmentLabel);
QFormLayout *formlayout = new QFormLayout();
QWidget *baseEnvironmentWidget = new QWidget;
QHBoxLayout *baseEnvironmentLayout = new QHBoxLayout(baseEnvironmentWidget);
baseEnvironmentLayout->setMargin(0);
QLabel *label = new QLabel(tr("Base environment for this runconfiguration:"), this);
baseEnvironmentLayout->addWidget(label);
m_baseEnvironmentComboBox = new QComboBox(this);
m_baseEnvironmentComboBox->addItems(QStringList()
<< tr("Clean Environment")
<< tr("System Environment")
<< tr("Build Environment"));
formlayout->addRow(label, m_baseEnvironmentComboBox);
vbox->addLayout(formlayout);
label->setVisible(false);
m_baseEnvironmentComboBox->setVisible(false);
m_baseEnvironmentComboBox->setCurrentIndex(rc->baseEnvironmentBase());
connect(m_baseEnvironmentComboBox, SIGNAL(currentIndexChanged(int)),
this, SLOT(baseEnvironmentComboBoxChanged(int)));
baseEnvironmentLayout->addWidget(m_baseEnvironmentComboBox);
baseEnvironmentLayout->addStretch(10);
m_environmentWidget = new EnvironmentWidget(this);
m_environmentWidget = new EnvironmentWidget(this, baseEnvironmentWidget);
m_environmentWidget->setBaseEnvironment(rc->baseEnvironment());
m_environmentWidget->setUserChanges(rc->userEnvironmentChanges());
vbox->addWidget(m_environmentWidget);
connect(m_environmentWidget, SIGNAL(switchedToSummary()),
m_baseEnvironmentComboBox, SLOT(hide()));
connect(m_environmentWidget, SIGNAL(switchedToDetails()),
m_baseEnvironmentComboBox, SLOT(show()));
connect(m_environmentWidget, SIGNAL(switchedToSummary()),
label, SLOT(hide()));
connect(m_environmentWidget, SIGNAL(switchedToDetails()),
label, SLOT(show()));
changed();
connect(m_userName, SIGNAL(textEdited(QString)),
......
......@@ -423,7 +423,7 @@ void EnvironmentModel::setUserChanges(QList<EnvironmentItem> list)
// EnvironmentWidget::EnvironmentWidget
////
EnvironmentWidget::EnvironmentWidget(QWidget *parent)
EnvironmentWidget::EnvironmentWidget(QWidget *parent, QWidget *additionalDetailsWidget)
: QStackedWidget(parent)
{
m_model = new EnvironmentModel();
......@@ -435,26 +435,41 @@ EnvironmentWidget::EnvironmentWidget(QWidget *parent)
addWidget(m_summaryPage);
QVBoxLayout *vbox = new QVBoxLayout(m_summaryPage);
vbox->setContentsMargins(0, -1, 0, -1);
m_summaryText = new QLabel(this);
m_summaryText->setText("");
vbox->addWidget(m_summaryText);
QPushButton *detailsButton = new QPushButton(this);
detailsButton->setText(tr("Show Details"));
QHBoxLayout *hdetailsButtonLayout = new QHBoxLayout();
hdetailsButtonLayout->setMargin(0);
hdetailsButtonLayout->addWidget(detailsButton);
hdetailsButtonLayout->addSpacerItem(new QSpacerItem(0,0, QSizePolicy::Expanding, QSizePolicy::Fixed));
vbox->addLayout(hdetailsButtonLayout);
hdetailsButtonLayout->addStretch(10);
connect(detailsButton, SIGNAL(clicked()),
this, SLOT(switchToDetails()));
vbox->addLayout(hdetailsButtonLayout);
m_summaryText = new QLabel(this);
m_summaryText->setText("");
vbox->addWidget(m_summaryText);
m_detailsPage = new QWidget();
//addWidget(m_detailsPage);
QVBoxLayout *vbox2 = new QVBoxLayout(m_detailsPage);
vbox2->setContentsMargins(0, -1, 0, -1);
QPushButton *summaryButton = new QPushButton(this);
summaryButton->setText(tr("Hide Details"));
QHBoxLayout *hbox = new QHBoxLayout();
hbox->setMargin(0);
hbox->addWidget(summaryButton);
hbox->addStretch(10);
connect(summaryButton, SIGNAL(clicked()),
this, SLOT(switchToSummary()));
vbox2->addLayout(hbox);
if (additionalDetailsWidget)
vbox2->addWidget(additionalDetailsWidget);
QHBoxLayout *horizontalLayout = new QHBoxLayout();
horizontalLayout->setMargin(0);
m_environmentTreeView = new QTreeView(this);
m_environmentTreeView->setRootIsDecorated(false);
m_environmentTreeView->setHeaderHidden(false);
......@@ -488,17 +503,6 @@ EnvironmentWidget::EnvironmentWidget(QWidget *parent)
horizontalLayout->addLayout(verticalLayout_2);
vbox2->addLayout(horizontalLayout);
QHBoxLayout *hbox = new QHBoxLayout();
QPushButton *summaryButton = new QPushButton(this);
summaryButton->setText(tr("Hide Details"));
hbox->addWidget(summaryButton);
connect(summaryButton, SIGNAL(clicked()),
this, SLOT(switchToSummary()));
hbox->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Fixed));
vbox2->addLayout(hbox);
connect(m_model, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)),
this, SLOT(updateButtons()));
......@@ -527,7 +531,6 @@ void EnvironmentWidget::switchToDetails()
addWidget(m_detailsPage);
setCurrentWidget(m_detailsPage);
removeWidget(m_summaryPage);
emit switchedToDetails();
}
......@@ -537,7 +540,6 @@ void EnvironmentWidget::switchToSummary()
addWidget(m_summaryPage);
setCurrentWidget(m_summaryPage);
removeWidget(m_detailsPage);
emit switchedToSummary();
}
void EnvironmentWidget::setBaseEnvironment(const ProjectExplorer::Environment &env)
......@@ -579,7 +581,7 @@ void EnvironmentWidget::updateSummaryText()
text.append(tr("Set <b>%1</b> to <b>%2</b>").arg(item.name, item.value));
}
if (text.isEmpty())
text = tr("No changes to Environment");
text = tr("Summary: No changes to Environment");
m_summaryText->setText(text);
}
......
......@@ -93,7 +93,7 @@ class PROJECTEXPLORER_EXPORT EnvironmentWidget : public QStackedWidget
{
Q_OBJECT
public:
EnvironmentWidget(QWidget *parent);
EnvironmentWidget(QWidget *parent, QWidget *additionalDetailsWidget = 0);
~EnvironmentWidget();
void setBaseEnvironment(const ProjectExplorer::Environment &env);
......@@ -111,8 +111,6 @@ public slots:
signals:
void userChangesUpdated();
void switchedToDetails();
void switchedToSummary();
private slots:
void editEnvironmentButtonClicked();
......
......@@ -47,21 +47,13 @@ Qt4BuildEnvironmentWidget::Qt4BuildEnvironmentWidget(Qt4Project *project)
m_clearSystemEnvironmentCheckBox = new QCheckBox(this);
m_clearSystemEnvironmentCheckBox->setText("Clear system environment");
vbox->addWidget(m_clearSystemEnvironmentCheckBox);
m_clearSystemEnvironmentCheckBox->setVisible(false);
m_buildEnvironmentWidget = new ProjectExplorer::EnvironmentWidget(this);
m_buildEnvironmentWidget = new ProjectExplorer::EnvironmentWidget(this, m_clearSystemEnvironmentCheckBox);
vbox->addWidget(m_buildEnvironmentWidget);
connect(m_buildEnvironmentWidget, SIGNAL(userChangesUpdated()),
this, SLOT(environmentModelUserChangesUpdated()));
connect(m_buildEnvironmentWidget, SIGNAL(switchedToDetails()),
m_clearSystemEnvironmentCheckBox, SLOT(show()));
connect(m_buildEnvironmentWidget, SIGNAL(switchedToSummary()),
m_clearSystemEnvironmentCheckBox, SLOT(hide()));
connect(m_clearSystemEnvironmentCheckBox, SIGNAL(toggled(bool)),
this, SLOT(clearSystemEnvironmentCheckBoxClicked(bool)));
}
......
......@@ -172,40 +172,28 @@ Qt4RunConfigurationWidget::Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4Run
environmentLabel->setFont(f);
vbox->addWidget(environmentLabel);
QFormLayout *formlayout = new QFormLayout();
QWidget *baseEnvironmentWidget = new QWidget;
QHBoxLayout *baseEnvironmentLayout = new QHBoxLayout(baseEnvironmentWidget);
baseEnvironmentLayout->setMargin(0);
QLabel *label = new QLabel(tr("Base environment for this runconfiguration:"), this);
baseEnvironmentLayout->addWidget(label);
m_baseEnvironmentComboBox = new QComboBox(this);
m_baseEnvironmentComboBox->addItems(QStringList()
<< tr("Clean Environment")
<< tr("System Environment")
<< tr("Build Environment"));
formlayout->addRow(label, m_baseEnvironmentComboBox);
vbox->addLayout(formlayout);
label->setVisible(false);
m_baseEnvironmentComboBox->setVisible(false);
m_baseEnvironmentComboBox->setCurrentIndex(qt4RunConfiguration->baseEnvironmentBase());
connect(m_baseEnvironmentComboBox, SIGNAL(currentIndexChanged(int)),
this, SLOT(baseEnvironmentComboBoxChanged(int)));
baseEnvironmentLayout->addWidget(m_baseEnvironmentComboBox);
baseEnvironmentLayout->addStretch(10);
m_environmentWidget = new ProjectExplorer::EnvironmentWidget(this);
m_environmentWidget = new ProjectExplorer::EnvironmentWidget(this, baseEnvironmentWidget);
m_environmentWidget->setBaseEnvironment(m_qt4RunConfiguration->baseEnvironment());
m_environmentWidget->setUserChanges(m_qt4RunConfiguration->userEnvironmentChanges());
m_environmentWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
vbox->addWidget(m_environmentWidget);
connect(m_environmentWidget, SIGNAL(switchedToSummary()),
m_baseEnvironmentComboBox, SLOT(hide()));
connect(m_environmentWidget, SIGNAL(switchedToDetails()),
m_baseEnvironmentComboBox, SLOT(show()));
connect(m_environmentWidget, SIGNAL(switchedToSummary()),
label, SLOT(hide()));
connect(m_environmentWidget, SIGNAL(switchedToDetails()),
label, SLOT(show()));
connect(m_workingDirectoryEdit, SIGNAL(changed(QString)),
this, SLOT(setWorkingDirectory()));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment