diff --git a/src/plugins/cmakeprojectmanager/cmakebuildenvironmentwidget.cpp b/src/plugins/cmakeprojectmanager/cmakebuildenvironmentwidget.cpp index f01d3d386dfc77d37383b71643b02da1080f77a6..a0295f6cbd59df8a5d459ad698b04d016f86bb9a 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildenvironmentwidget.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildenvironmentwidget.cpp @@ -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)), diff --git a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp index 6ed151b7f6b5928378edee835c2dcb29509582aa..3bab6ebb88c7811b60f7a570a6f425fce2437abb 100644 --- a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp +++ b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp @@ -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()), diff --git a/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp b/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp index 5ff7d25e45a0c19f58e3b47aa025159f2f6cf7dc..1ff5cbeca27f5bb58a1f72e9057fa09141f44e6c 100644 --- a/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp +++ b/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp @@ -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)), diff --git a/src/plugins/projectexplorer/environmenteditmodel.cpp b/src/plugins/projectexplorer/environmenteditmodel.cpp index 6c5bd75752353b29eb1cd2c42a03186877de7a51..4ceaef6d069b4f2e4901bccbb8962d4e5f2cc086 100644 --- a/src/plugins/projectexplorer/environmenteditmodel.cpp +++ b/src/plugins/projectexplorer/environmenteditmodel.cpp @@ -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); } diff --git a/src/plugins/projectexplorer/environmenteditmodel.h b/src/plugins/projectexplorer/environmenteditmodel.h index 1123aca632193b8f1286a152726cacd3568fcfee..121c26acc91ad295ea405e1c03c7d7fa476f1b46 100644 --- a/src/plugins/projectexplorer/environmenteditmodel.h +++ b/src/plugins/projectexplorer/environmenteditmodel.h @@ -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(); diff --git a/src/plugins/qt4projectmanager/qt4buildenvironmentwidget.cpp b/src/plugins/qt4projectmanager/qt4buildenvironmentwidget.cpp index e7a86cfd66a35496af162a1780b246cdce389349..b684ebedc25129864096900064dd3c63c7ec5a3d 100644 --- a/src/plugins/qt4projectmanager/qt4buildenvironmentwidget.cpp +++ b/src/plugins/qt4projectmanager/qt4buildenvironmentwidget.cpp @@ -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))); } diff --git a/src/plugins/qt4projectmanager/qt4runconfiguration.cpp b/src/plugins/qt4projectmanager/qt4runconfiguration.cpp index fdc6c2a326c68e77ad240054f0bc5ca25dbd015d..06aee2bd5b33fe3dfb26d1913800121d2b62aa35 100644 --- a/src/plugins/qt4projectmanager/qt4runconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt4runconfiguration.cpp @@ -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()));