From a97dcb53d167e9ea1deb564a3b5fa6265b0eb1ab Mon Sep 17 00:00:00 2001 From: dt Date: Thu, 1 Oct 2009 14:24:44 +0200 Subject: Tweaks to the project page. --- src/libs/utils/detailsbutton.cpp | 10 +- src/libs/utils/detailsbutton.h | 1 + src/libs/utils/utils.pro | 6 +- .../cmakebuildenvironmentwidget.cpp | 6 - .../cmakebuildenvironmentwidget.h | 1 - .../buildsettingspropertiespage.cpp | 6 + .../projectexplorer/buildsettingspropertiespage.h | 2 + src/plugins/projectexplorer/buildstep.cpp | 14 -- src/plugins/projectexplorer/buildstep.h | 3 - src/plugins/projectexplorer/buildstepspage.cpp | 66 ++--- src/plugins/projectexplorer/buildstepspage.h | 4 +- .../customexecutablerunconfiguration.cpp | 28 +-- .../customexecutablerunconfiguration.h | 8 +- src/plugins/projectexplorer/dependenciespanel.cpp | 28 +-- src/plugins/projectexplorer/dependenciespanel.h | 5 +- .../projectexplorer/environmenteditmodel.cpp | 47 +--- src/plugins/projectexplorer/environmenteditmodel.h | 10 +- src/plugins/projectexplorer/projectwindow.cpp | 13 + src/plugins/projectexplorer/projectwindow.h | 2 + .../qt4buildenvironmentwidget.cpp | 8 - .../qt4projectmanager/qt4buildenvironmentwidget.h | 1 - .../qt4projectmanager/qt4projectconfigwidget.cpp | 45 +--- .../qt4projectmanager/qt4projectconfigwidget.h | 3 +- .../qt4projectmanager/qt4projectconfigwidget.ui | 273 +++++++++------------ .../qt4projectmanager/qt4runconfiguration.cpp | 38 +-- .../qt4projectmanager/qt4runconfiguration.h | 4 +- 26 files changed, 217 insertions(+), 415 deletions(-) (limited to 'src') diff --git a/src/libs/utils/detailsbutton.cpp b/src/libs/utils/detailsbutton.cpp index c19123e845..b9d0982212 100644 --- a/src/libs/utils/detailsbutton.cpp +++ b/src/libs/utils/detailsbutton.cpp @@ -24,9 +24,9 @@ DetailsButton::DetailsButton(QWidget *parent) void DetailsButton::onClicked() { m_checked = !m_checked; - if (m_checked) { - setText(tr("Hide Details")); - } else { - setText(tr("Show Details")); - } +} + +bool DetailsButton::isToggled() +{ + return m_checked; } diff --git a/src/libs/utils/detailsbutton.h b/src/libs/utils/detailsbutton.h index c5f287a10d..ce38cea4f3 100644 --- a/src/libs/utils/detailsbutton.h +++ b/src/libs/utils/detailsbutton.h @@ -18,6 +18,7 @@ class QTCREATOR_UTILS_EXPORT DetailsButton Q_OBJECT public: DetailsButton(QWidget *parent=0); + bool isToggled(); public slots: void onClicked(); private: diff --git a/src/libs/utils/utils.pro b/src/libs/utils/utils.pro index b135ca94c1..74939e2f06 100644 --- a/src/libs/utils/utils.pro +++ b/src/libs/utils/utils.pro @@ -34,7 +34,8 @@ SOURCES += reloadpromptutils.cpp \ stylehelper.cpp \ welcomemodetreewidget.cpp \ fancymainwindow.cpp \ - detailsbutton.cpp + detailsbutton.cpp \ + detailswidget.cpp win32 { SOURCES += abstractprocess_win.cpp \ consoleprocess_win.cpp \ @@ -76,7 +77,8 @@ HEADERS += utils_global.h \ stylehelper.h \ welcomemodetreewidget.h \ fancymainwindow.h \ - detailsbutton.h + detailsbutton.h \ + detailswidget.h FORMS += filewizardpage.ui \ projectintropage.ui \ newclasswidget.ui \ diff --git a/src/plugins/cmakeprojectmanager/cmakebuildenvironmentwidget.cpp b/src/plugins/cmakeprojectmanager/cmakebuildenvironmentwidget.cpp index 5960f19a3b..ecae63b841 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildenvironmentwidget.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildenvironmentwidget.cpp @@ -53,16 +53,10 @@ CMakeBuildEnvironmentWidget::CMakeBuildEnvironmentWidget(CMakeProject *project) connect(m_buildEnvironmentWidget, SIGNAL(userChangesUpdated()), this, SLOT(environmentModelUserChangesUpdated())); - connect(m_buildEnvironmentWidget, SIGNAL(detailsVisibleChanged(bool)), - this, SLOT(layoutFixup())); connect(m_clearSystemEnvironmentCheckBox, SIGNAL(toggled(bool)), this, SLOT(clearSystemEnvironmentCheckBoxClicked(bool))); } -void CMakeBuildEnvironmentWidget::layoutFixup() -{ - fixupLayout(m_buildEnvironmentWidget->detailsWidget()); -} QString CMakeBuildEnvironmentWidget::displayName() const { diff --git a/src/plugins/cmakeprojectmanager/cmakebuildenvironmentwidget.h b/src/plugins/cmakeprojectmanager/cmakebuildenvironmentwidget.h index 358fc1dd2f..e059783849 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildenvironmentwidget.h +++ b/src/plugins/cmakeprojectmanager/cmakebuildenvironmentwidget.h @@ -56,7 +56,6 @@ public: private slots: void environmentModelUserChangesUpdated(); void clearSystemEnvironmentCheckBoxClicked(bool checked); - void layoutFixup(); private: ProjectExplorer::EnvironmentWidget *m_buildEnvironmentWidget; diff --git a/src/plugins/projectexplorer/buildsettingspropertiespage.cpp b/src/plugins/projectexplorer/buildsettingspropertiespage.cpp index 1fe4d3eee6..b6fe770d54 100644 --- a/src/plugins/projectexplorer/buildsettingspropertiespage.cpp +++ b/src/plugins/projectexplorer/buildsettingspropertiespage.cpp @@ -96,6 +96,8 @@ BuildSettingsSubWidgets::~BuildSettingsSubWidgets() void BuildSettingsSubWidgets::addWidget(const QString &name, QWidget *widget) { + QSpacerItem *item = new QSpacerItem(1, 10, QSizePolicy::Fixed, QSizePolicy::Fixed); + QLabel *label = new QLabel(this); label->setText(name); QFont f = label->font(); @@ -103,6 +105,7 @@ void BuildSettingsSubWidgets::addWidget(const QString &name, QWidget *widget) f.setPointSizeF(f.pointSizeF() *1.2); label->setFont(f); + layout()->addItem(item); layout()->addWidget(label); layout()->addWidget(widget); @@ -112,6 +115,9 @@ void BuildSettingsSubWidgets::addWidget(const QString &name, QWidget *widget) void BuildSettingsSubWidgets::clear() { + foreach(QSpacerItem *item, m_spacerItems) + layout()->removeItem(item); + qDeleteAll(m_spacerItems); qDeleteAll(m_widgets); qDeleteAll(m_labels); m_widgets.clear(); diff --git a/src/plugins/projectexplorer/buildsettingspropertiespage.h b/src/plugins/projectexplorer/buildsettingspropertiespage.h index bb83c0c6ec..f80b6b7326 100644 --- a/src/plugins/projectexplorer/buildsettingspropertiespage.h +++ b/src/plugins/projectexplorer/buildsettingspropertiespage.h @@ -37,6 +37,7 @@ #include #include #include +#include namespace ProjectExplorer { @@ -56,6 +57,7 @@ public: private: QList m_widgets; QList m_labels; + QList m_spacerItems; }; class BuildSettingsPanelFactory : public IPanelFactory diff --git a/src/plugins/projectexplorer/buildstep.cpp b/src/plugins/projectexplorer/buildstep.cpp index 847e9578f1..51d6e83161 100644 --- a/src/plugins/projectexplorer/buildstep.cpp +++ b/src/plugins/projectexplorer/buildstep.cpp @@ -134,20 +134,6 @@ bool BuildStep::immutable() const return false; } -void BuildConfigWidget::fixupLayout(QWidget *widget) -{ - QWidget *parent = widget; - QStack widgets; - while((parent = parent->parentWidget()) && parent && parent->layout()) { - widgets.push(parent); - parent->layout()->update(); - } - - while(!widgets.isEmpty()) { - widgets.pop()->layout()->activate(); - } -} - IBuildStepFactory::IBuildStepFactory() { diff --git a/src/plugins/projectexplorer/buildstep.h b/src/plugins/projectexplorer/buildstep.h index 9f113967a1..336e844282 100644 --- a/src/plugins/projectexplorer/buildstep.h +++ b/src/plugins/projectexplorer/buildstep.h @@ -169,9 +169,6 @@ public: :QWidget(0) {} - // This function iterates all parents and relayouts - // This is a hack to work around flickering - void fixupLayout(QWidget *widget); virtual QString displayName() const = 0; // This is called to set up the config widget before showing it diff --git a/src/plugins/projectexplorer/buildstepspage.cpp b/src/plugins/projectexplorer/buildstepspage.cpp index 5c33b9b5f7..e909d290ff 100644 --- a/src/plugins/projectexplorer/buildstepspage.cpp +++ b/src/plugins/projectexplorer/buildstepspage.cpp @@ -34,13 +34,13 @@ #include #include #include -#include #include #include #include #include #include +#include using namespace ProjectExplorer; using namespace ProjectExplorer::Internal; @@ -51,7 +51,7 @@ BuildStepsPage::BuildStepsPage(Project *project, bool clean) : m_clean(clean) { m_vbox = new QVBoxLayout(this); - m_vbox->setContentsMargins(20, 0, 0, 0); + m_vbox->setContentsMargins(0, 0, 0, 0); const QList &steps = m_clean ? m_pro->cleanSteps() : m_pro->buildSteps(); foreach (BuildStep *bs, steps) { addBuildStepWidget(-1, bs); @@ -92,36 +92,19 @@ BuildStepsPage::BuildStepsPage(Project *project, bool clean) : BuildStepsPage::~BuildStepsPage() { foreach(BuildStepsWidgetStruct s, m_buildSteps) { - delete s.detailsLabel; - delete s.upButton; - delete s.downButton; - delete s.detailsButton; - delete s.hbox; delete s.widget; + delete s.detailsWidget; } m_buildSteps.clear(); } -void BuildStepsPage::toggleDetails() -{ - QAbstractButton *button = qobject_cast(sender()); - if (button) { - foreach(const BuildStepsWidgetStruct &s, m_buildSteps) { - if (s.detailsButton == button) { - s.widget->setVisible(!s.widget->isVisible()); - fixupLayout(s.widget); - } - } - } -} - void BuildStepsPage::updateSummary() { BuildStepConfigWidget *widget = qobject_cast(sender()); if (widget) foreach(const BuildStepsWidgetStruct &s, m_buildSteps) if (s.widget == widget) - s.detailsLabel->setText(widget->summaryText()); + s.detailsWidget->setSummaryText(widget->summaryText()); } QString BuildStepsPage::displayName() const @@ -136,7 +119,7 @@ void BuildStepsPage::init(const QString &buildConfiguration) // make sure widget is updated foreach(BuildStepsWidgetStruct s, m_buildSteps) { s.widget->init(m_configuration); - s.detailsLabel->setText(s.widget->summaryText()); + s.detailsWidget->setSummaryText(s.widget->summaryText()); } } @@ -174,8 +157,10 @@ void BuildStepsPage::addBuildStepWidget(int pos, BuildStep *step) // create everything BuildStepsWidgetStruct s; s.widget = step->createConfigWidget(); - s.detailsLabel = new QLabel(this); - s.detailsLabel->setText(s.widget->summaryText()); + s.detailsWidget = new Utils::DetailsWidget(this); + s.detailsWidget->setSummaryText(s.widget->summaryText()); + s.detailsWidget->setWidget(s.widget); + s.upButton = new QToolButton(this); s.upButton->setArrowType(Qt::UpArrow); s.downButton = new QToolButton(this); @@ -184,14 +169,14 @@ void BuildStepsPage::addBuildStepWidget(int pos, BuildStep *step) s.upButton->setIconSize(QSize(10, 10)); s.downButton->setIconSize(QSize(10, 10)); #endif - s.detailsButton = new Utils::DetailsButton(this); - // layout - s.hbox = new QHBoxLayout(); - s.hbox->addWidget(s.detailsLabel); + QWidget *toolWidget = new QWidget(s.detailsWidget); + toolWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + s.hbox = new QHBoxLayout(toolWidget); + s.hbox->setMargin(0); s.hbox->addWidget(s.upButton); s.hbox->addWidget(s.downButton); - s.hbox->addWidget(s.detailsButton); + s.detailsWidget->setToolWidget(toolWidget); if (pos == -1) m_buildSteps.append(s); @@ -199,17 +184,10 @@ void BuildStepsPage::addBuildStepWidget(int pos, BuildStep *step) m_buildSteps.insert(pos, s); if (pos == -1) { - m_vbox->addLayout(s.hbox); - m_vbox->addWidget(s.widget); + m_vbox->addWidget(s.detailsWidget); } else { - m_vbox->insertLayout(pos *2, s.hbox); - m_vbox->insertWidget(pos *2 + 1, s.widget); + m_vbox->insertWidget(pos, s.detailsWidget); } - s.widget->hide(); - - // connect - connect(s.detailsButton, SIGNAL(clicked()), - this, SLOT(toggleDetails())); connect(s.widget, SIGNAL(updateSummary()), this, SLOT(updateSummary())); @@ -231,7 +209,7 @@ void BuildStepsPage::addBuildStep() addBuildStepWidget(pos, newStep); const BuildStepsWidgetStruct s = m_buildSteps.at(pos); s.widget->init(m_configuration); - s.detailsLabel->setText(s.widget->summaryText()); + s.detailsWidget->setSummaryText(s.widget->summaryText()); } updateBuildStepButtonsState(); } @@ -260,12 +238,8 @@ void BuildStepsPage::removeBuildStep() return; BuildStepsWidgetStruct s = m_buildSteps.at(pos); - delete s.detailsLabel; - delete s.upButton; - delete s.downButton; - delete s.detailsButton; - delete s.hbox; delete s.widget; + delete s.detailsWidget; m_buildSteps.removeAt(pos); m_clean ? m_pro->removeCleanStep(pos) : m_pro->removeBuildStep(pos); } @@ -316,9 +290,7 @@ void BuildStepsPage::stepMoveUp(int pos) { m_clean ? m_pro->moveCleanStepUp(pos) : m_pro->moveBuildStepUp(pos); - m_buildSteps.at(pos).hbox->setParent(0); - m_vbox->insertLayout((pos - 1) * 2, m_buildSteps.at(pos).hbox); - m_vbox->insertWidget((pos - 1) * 2 + 1, m_buildSteps.at(pos).widget); + m_vbox->insertWidget(pos - 1, m_buildSteps.at(pos).detailsWidget); BuildStepsWidgetStruct tmp = m_buildSteps.at(pos -1); m_buildSteps[pos -1] = m_buildSteps.at(pos); diff --git a/src/plugins/projectexplorer/buildstepspage.h b/src/plugins/projectexplorer/buildstepspage.h index 31c4b149a0..2bd25b0c25 100644 --- a/src/plugins/projectexplorer/buildstepspage.h +++ b/src/plugins/projectexplorer/buildstepspage.h @@ -31,6 +31,7 @@ #define BUILDSTEPSPAGE_H #include "buildstep.h" +#include QT_BEGIN_NAMESPACE class QTreeWidgetItem; @@ -55,8 +56,7 @@ namespace Ui { struct BuildStepsWidgetStruct { BuildStepConfigWidget *widget; - QLabel *detailsLabel; - QAbstractButton *detailsButton; + Utils::DetailsWidget *detailsWidget; QToolButton *upButton; QToolButton *downButton; QHBoxLayout *hbox; diff --git a/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp b/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp index 16d737f2ff..55b27d0a86 100644 --- a/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp +++ b/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp @@ -94,23 +94,14 @@ CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomE layout->addRow(QString(), m_useTerminalCheck); QVBoxLayout *vbox = new QVBoxLayout(this); - vbox->setContentsMargins(0, -1, 0, -1); + vbox->setMargin(0); - m_summaryLabel = new QLabel(this); + m_detailsContainer = new Utils::DetailsWidget(this); + vbox->addWidget(m_detailsContainer); - m_detailsButton = new Utils::DetailsButton(this); - connect(m_detailsButton, SIGNAL(clicked()), - this, SLOT(toggleDetails())); - - QHBoxLayout *hbox = new QHBoxLayout(); - hbox->addWidget(m_summaryLabel); - hbox->addWidget(m_detailsButton); - vbox->addLayout(hbox); - - m_detailsWidget = new QWidget(this); - m_detailsWidget->setLayout(layout); - vbox->addWidget(m_detailsWidget); - m_detailsWidget->setVisible(false); + QWidget *detailsWidget = new QWidget(m_detailsContainer); + m_detailsContainer->setWidget(detailsWidget); + detailsWidget->setLayout(layout); QLabel *environmentLabel = new QLabel(this); environmentLabel->setText(tr("Run Environment")); @@ -165,11 +156,6 @@ CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomE this, SLOT(userEnvironmentChangesChanged())); } -void CustomExecutableConfigurationWidget::toggleDetails() -{ - m_detailsWidget->setVisible(!m_detailsWidget->isVisible()); -} - void CustomExecutableConfigurationWidget::userChangesUpdated() { m_runConfiguration->setUserEnvironmentChanges(m_environmentWidget->userChanges()); @@ -242,7 +228,7 @@ void CustomExecutableConfigurationWidget::changed() arg(executable, ProjectExplorer::Environment::joinArgumentList(m_runConfiguration->commandLineArguments())); - m_summaryLabel->setText(text); + m_detailsContainer->setSummaryText(text); // We triggered the change, don't update us if (m_ignoreChange) return; diff --git a/src/plugins/projectexplorer/customexecutablerunconfiguration.h b/src/plugins/projectexplorer/customexecutablerunconfiguration.h index 3c47b219da..8a7d4d1b49 100644 --- a/src/plugins/projectexplorer/customexecutablerunconfiguration.h +++ b/src/plugins/projectexplorer/customexecutablerunconfiguration.h @@ -31,9 +31,10 @@ #define CUSTOMEXECUTABLERUNCONFIGURATION_H #include "applicationrunconfiguration.h" - +#include #include + QT_BEGIN_NAMESPACE class QCheckBox; class QLineEdit; @@ -166,7 +167,6 @@ private slots: void baseEnvironmentChanged(); void userEnvironmentChangesChanged(); void baseEnvironmentComboBoxChanged(int index); - void toggleDetails(); private: bool m_ignoreChange; CustomExecutableRunConfiguration *m_runConfiguration; @@ -177,9 +177,7 @@ private: QCheckBox *m_useTerminalCheck; ProjectExplorer::EnvironmentWidget *m_environmentWidget; QComboBox *m_baseEnvironmentComboBox; - QWidget *m_detailsWidget; - QLabel *m_summaryLabel; - QAbstractButton *m_detailsButton; + Utils::DetailsWidget *m_detailsContainer; }; } // namespace Internal diff --git a/src/plugins/projectexplorer/dependenciespanel.cpp b/src/plugins/projectexplorer/dependenciespanel.cpp index f7e2078b9b..32c5fe8532 100644 --- a/src/plugins/projectexplorer/dependenciespanel.cpp +++ b/src/plugins/projectexplorer/dependenciespanel.cpp @@ -227,29 +227,18 @@ DependenciesWidget::DependenciesWidget(SessionManager *session, { QVBoxLayout *vbox = new QVBoxLayout(this); vbox->setContentsMargins(0, 0, 0, 0); + m_detailsContainer = new Utils::DetailsWidget(this); + vbox->addWidget(m_detailsContainer); - QHBoxLayout *hbox = new QHBoxLayout(); - m_titleLabel = new QLabel(this); - m_titleLabel->setText("Dummy Text"); - hbox->addWidget(m_titleLabel); - - QAbstractButton *detailsButton = new Utils::DetailsButton(this); - connect(detailsButton, SIGNAL(clicked()), - this, SLOT(toggleDetails())); - - hbox->addWidget(detailsButton); - vbox->addLayout(hbox); - - m_detailsWidget = new QWidget(this); - QHBoxLayout *layout = new QHBoxLayout(m_detailsWidget); + QWidget *detailsWidget = new QWidget(m_detailsContainer); + m_detailsContainer->setWidget(detailsWidget); + QHBoxLayout *layout = new QHBoxLayout(detailsWidget); layout->setContentsMargins(0, -1, 0, -1); DependenciesView *treeView = new DependenciesView(this); treeView->setModel(m_model); treeView->setHeaderHidden(true); layout->addWidget(treeView); layout->addSpacerItem(new QSpacerItem(0, 0 , QSizePolicy::Expanding, QSizePolicy::Fixed)); - vbox->addWidget(m_detailsWidget); - m_detailsWidget->setVisible(false); updateDetails(); @@ -264,11 +253,6 @@ DependenciesWidget::DependenciesWidget(SessionManager *session, this, SLOT(updateDetails())); } -void DependenciesWidget::toggleDetails() -{ - m_detailsWidget->setVisible(!m_detailsWidget->isVisible()); -} - void DependenciesWidget::updateDetails() { QStringList dependsOn; @@ -286,7 +270,7 @@ void DependenciesWidget::updateDetails() } else { text = tr("%1 depends on: %2.").arg(m_project->name(), dependsOn.join(QLatin1String(", "))); } - m_titleLabel->setText(text); + m_detailsContainer->setSummaryText(text); } // diff --git a/src/plugins/projectexplorer/dependenciespanel.h b/src/plugins/projectexplorer/dependenciespanel.h index 0b183cb238..8e017a178b 100644 --- a/src/plugins/projectexplorer/dependenciespanel.h +++ b/src/plugins/projectexplorer/dependenciespanel.h @@ -31,6 +31,7 @@ #define DEPENDENCIESDIALOG_H #include "iprojectproperties.h" +#include #include #include @@ -119,15 +120,13 @@ public: DependenciesWidget(SessionManager *session, Project *project, QWidget *parent = 0); private slots: - void toggleDetails(); void updateDetails(); private: SessionManager *m_session; Project *m_project; DependenciesModel *m_model; - QWidget *m_detailsWidget; - QLabel *m_titleLabel; + Utils::DetailsWidget *m_detailsContainer; }; } // namespace Internal diff --git a/src/plugins/projectexplorer/environmenteditmodel.cpp b/src/plugins/projectexplorer/environmenteditmodel.cpp index 7ca0af8315..c77c1f0de6 100644 --- a/src/plugins/projectexplorer/environmenteditmodel.cpp +++ b/src/plugins/projectexplorer/environmenteditmodel.cpp @@ -444,25 +444,13 @@ EnvironmentWidget::EnvironmentWidget(QWidget *parent, QWidget *additionalDetails QVBoxLayout *vbox = new QVBoxLayout(this); vbox->setContentsMargins(20, 0, 0, 0); - m_summaryText = new QLabel(this); - m_summaryText->setText(""); + m_detailsContainer = new Utils::DetailsWidget(this); - QAbstractButton *detailsButton = new Utils::DetailsButton(this); + QWidget *details = new QWidget(m_detailsContainer); + m_detailsContainer->setWidget(details); + details->setVisible(false); - connect(detailsButton, SIGNAL(clicked()), - this, SLOT(toggleDetails())); - - QHBoxLayout *hbox = new QHBoxLayout(); - hbox->addWidget(m_summaryText); - hbox->addWidget(detailsButton); - hbox->setMargin(0); - - vbox->addLayout(hbox); - - m_details = new QWidget(this); - m_details->setVisible(false); - - QVBoxLayout *vbox2 = new QVBoxLayout(m_details); + QVBoxLayout *vbox2 = new QVBoxLayout(details); vbox2->setMargin(0); if (additionalDetailsWidget) @@ -503,7 +491,7 @@ EnvironmentWidget::EnvironmentWidget(QWidget *parent, QWidget *additionalDetails horizontalLayout->addLayout(buttonLayout); vbox2->addLayout(horizontalLayout); - vbox->addWidget(m_details); + vbox->addWidget(m_detailsContainer); connect(m_model, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), this, SLOT(updateButtons())); @@ -528,27 +516,6 @@ EnvironmentWidget::~EnvironmentWidget() m_model = 0; } -bool EnvironmentWidget::detailsVisible() const -{ - return m_details->isVisible(); -} - -void EnvironmentWidget::setDetailsVisible(bool b) -{ - m_details->setVisible(b); -} - -void EnvironmentWidget::toggleDetails() -{ - m_details->setVisible(!m_details->isVisible()); - emit detailsVisibleChanged(m_details->isVisible()); -} - -QWidget *EnvironmentWidget::detailsWidget() const -{ - return m_details; -} - void EnvironmentWidget::setBaseEnvironment(const ProjectExplorer::Environment &env) { m_model->setBaseEnvironment(env); @@ -591,7 +558,7 @@ void EnvironmentWidget::updateSummaryText() } if (text.isEmpty()) text = tr("Summary: No changes to Environment"); - m_summaryText->setText(text); + m_detailsContainer->setSummaryText(text); } void EnvironmentWidget::updateButtons() diff --git a/src/plugins/projectexplorer/environmenteditmodel.h b/src/plugins/projectexplorer/environmenteditmodel.h index d6572340b7..1df7aacb9a 100644 --- a/src/plugins/projectexplorer/environmenteditmodel.h +++ b/src/plugins/projectexplorer/environmenteditmodel.h @@ -35,6 +35,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE class QCheckBox; @@ -106,14 +107,8 @@ public: QList userChanges() const; void setUserChanges(QList list); - bool detailsVisible() const; - void setDetailsVisible(bool b); - - QWidget *detailsWidget() const; - public slots: void updateButtons(); - void toggleDetails(); signals: void userChangesUpdated(); @@ -129,8 +124,7 @@ private slots: private: EnvironmentModel *m_model; - QLabel *m_summaryText; - QWidget *m_details; + Utils::DetailsWidget *m_detailsContainer; QTreeView *m_environmentTreeView; QPushButton *m_editButton; QPushButton *m_addButton; diff --git a/src/plugins/projectexplorer/projectwindow.cpp b/src/plugins/projectexplorer/projectwindow.cpp index 633e75c0a5..1ee0522584 100644 --- a/src/plugins/projectexplorer/projectwindow.cpp +++ b/src/plugins/projectexplorer/projectwindow.cpp @@ -99,6 +99,7 @@ PanelsWidget::~PanelsWidget() void PanelsWidget::addWidget(QWidget *widget) { Panel p; + p.spacer = 0; p.nameLabel = 0; p.panelWidget = widget; @@ -109,7 +110,10 @@ void PanelsWidget::addWidget(QWidget *widget) void PanelsWidget::addWidget(const QString &name, QWidget *widget) { + + Panel p; + p.spacer = new QSpacerItem(1, 10, QSizePolicy::Fixed, QSizePolicy::Fixed); p.nameLabel = new QLabel(this); p.nameLabel->setText(name); QFont f = p.nameLabel->font(); @@ -119,6 +123,7 @@ void PanelsWidget::addWidget(const QString &name, QWidget *widget) p.panelWidget = widget; + m_layout->insertSpacerItem(m_layout->count() - 1, p.spacer); m_layout->insertWidget(m_layout->count() - 1, p.nameLabel); QHBoxLayout *hboxLayout = new QHBoxLayout(); hboxLayout->setContentsMargins(20, 0, 0, 0); @@ -131,6 +136,10 @@ void PanelsWidget::addWidget(const QString &name, QWidget *widget) void PanelsWidget::clear() { foreach(Panel p, m_panels) { + if (p.spacer) { + m_layout->removeItem(p.spacer); + delete p.spacer; + } delete p.nameLabel; delete p.panelWidget; delete p.marginLayout; @@ -143,6 +152,10 @@ void PanelsWidget::removeWidget(QWidget *widget) for(int i=0; iremoveItem(p.spacer); + delete p.spacer; + } if (p.marginLayout) p.marginLayout->removeWidget(p.panelWidget); else diff --git a/src/plugins/projectexplorer/projectwindow.h b/src/plugins/projectexplorer/projectwindow.h index 952a0ebdf0..a29da6b19d 100644 --- a/src/plugins/projectexplorer/projectwindow.h +++ b/src/plugins/projectexplorer/projectwindow.h @@ -47,6 +47,7 @@ class QTabWidget; class QHBoxLayout; class QComboBox; class QMenu; +class QSpacerItem; QT_END_NAMESPACE namespace ProjectExplorer { @@ -75,6 +76,7 @@ private: struct Panel { + QSpacerItem *spacer; QLabel *nameLabel; QWidget *panelWidget; QHBoxLayout *marginLayout; diff --git a/src/plugins/qt4projectmanager/qt4buildenvironmentwidget.cpp b/src/plugins/qt4projectmanager/qt4buildenvironmentwidget.cpp index 2d1b9fca33..2edd8cfeb7 100644 --- a/src/plugins/qt4projectmanager/qt4buildenvironmentwidget.cpp +++ b/src/plugins/qt4projectmanager/qt4buildenvironmentwidget.cpp @@ -56,18 +56,10 @@ Qt4BuildEnvironmentWidget::Qt4BuildEnvironmentWidget(Qt4Project *project) connect(m_buildEnvironmentWidget, SIGNAL(userChangesUpdated()), this, SLOT(environmentModelUserChangesUpdated())); - connect(m_buildEnvironmentWidget, SIGNAL(detailsVisibleChanged(bool)), - this, SLOT(layoutFixup())); - connect(m_clearSystemEnvironmentCheckBox, SIGNAL(toggled(bool)), this, SLOT(clearSystemEnvironmentCheckBoxClicked(bool))); } -void Qt4BuildEnvironmentWidget::layoutFixup() -{ - fixupLayout(m_buildEnvironmentWidget->detailsWidget()); -} - QString Qt4BuildEnvironmentWidget::displayName() const { return tr("Build Environment"); diff --git a/src/plugins/qt4projectmanager/qt4buildenvironmentwidget.h b/src/plugins/qt4projectmanager/qt4buildenvironmentwidget.h index 11c3725c3c..c6c9d259e0 100644 --- a/src/plugins/qt4projectmanager/qt4buildenvironmentwidget.h +++ b/src/plugins/qt4projectmanager/qt4buildenvironmentwidget.h @@ -58,7 +58,6 @@ public: private slots: void environmentModelUserChangesUpdated(); void clearSystemEnvironmentCheckBoxClicked(bool checked); - void layoutFixup(); private: ProjectExplorer::EnvironmentWidget *m_buildEnvironmentWidget; diff --git a/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp b/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp index 200a74f476..25e66aa189 100644 --- a/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp +++ b/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp @@ -36,7 +36,6 @@ #include "qt4projectmanager.h" #include "ui_qt4projectconfigwidget.h" -#include #include #include #include @@ -56,41 +55,23 @@ Qt4ProjectConfigWidget::Qt4ProjectConfigWidget(Qt4Project *project) : BuildConfigWidget(), m_pro(project) { + QVBoxLayout *vbox = new QVBoxLayout(this); + vbox->setMargin(0); + m_detailsContainer = new Utils::DetailsWidget(this); + vbox->addWidget(m_detailsContainer); + QWidget *details = new QWidget(m_detailsContainer); + m_detailsContainer->setWidget(details); m_ui = new Ui::Qt4ProjectConfigWidget(); - m_ui->setupUi(this); + m_ui->setupUi(details); + - // fix the layout m_browseButton = m_ui->shadowBuildDirEdit->buttonAtIndex(0); -#ifdef Q_OS_WIN - m_browseButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); -#endif - m_ui->gridLayout->addWidget(m_browseButton, 4, 2); - int minimumHeight = qMax(m_ui->qtVersionComboBox->sizeHint().height(), m_ui->manageQtVersionPushButtons->sizeHint().height()); - Qt::Alignment labelAlignment = Qt::Alignment(style()->styleHint(QStyle::SH_FormLayoutLabelAlignment)); - for (int i = 0; i < m_ui->gridLayout->rowCount(); ++i) { - m_ui->gridLayout->setRowMinimumHeight(i, minimumHeight); - QLayoutItem *item = m_ui->gridLayout->itemAtPosition(i, 0); - if (item) - item->setAlignment(labelAlignment); - } + // TODO refix the layout m_ui->shadowBuildDirEdit->setPromptDialogTitle(tr("Shadow Build Directory")); m_ui->shadowBuildDirEdit->setExpectedKind(Core::Utils::PathChooser::Directory); m_ui->invalidQtWarningLabel->setVisible(false); - m_ui->detailsWidget->setVisible(false); - m_ui->titleLabel->setText(""); - - QAbstractButton *detailsButton = new Utils::DetailsButton(this); - QHBoxLayout *layout = new QHBoxLayout; - layout->setMargin(0); - layout->setSpacing(0); - layout->addWidget(detailsButton); - m_ui->detailsButtonWidget->setLayout(layout); - - connect(detailsButton, SIGNAL(clicked()), - this, SLOT(toggleDetails())); - connect(m_ui->nameLineEdit, SIGNAL(textEdited(QString)), this, SLOT(changeConfigName(QString))); @@ -128,12 +109,6 @@ Qt4ProjectConfigWidget::~Qt4ProjectConfigWidget() delete m_ui; } -void Qt4ProjectConfigWidget::toggleDetails() -{ - m_ui->detailsWidget->setVisible(!m_ui->detailsWidget->isVisible()); - fixupLayout(m_ui->detailsWidget); -} - void Qt4ProjectConfigWidget::updateDetails() { ProjectExplorer::BuildConfiguration *bc = m_pro->buildConfiguration(m_buildConfiguration); @@ -147,7 +122,7 @@ void Qt4ProjectConfigWidget::updateDetails() versionString = tr("No Qt Version set"); } // Qt Version, Build Directory and Toolchain - m_ui->titleLabel->setText(tr("using Qt version: %1
" + m_detailsContainer->setSummaryText(tr("using Qt version: %1
" "with tool chain %2
" "building in %3") .arg(versionString, diff --git a/src/plugins/qt4projectmanager/qt4projectconfigwidget.h b/src/plugins/qt4projectmanager/qt4projectconfigwidget.h index 026827cf4f..5590c29fd6 100644 --- a/src/plugins/qt4projectmanager/qt4projectconfigwidget.h +++ b/src/plugins/qt4projectmanager/qt4projectconfigwidget.h @@ -32,6 +32,7 @@ #include #include +#include namespace Qt4ProjectManager { @@ -63,7 +64,6 @@ private slots: void qtVersionComboBoxCurrentIndexChanged(const QString &); void manageQtVersions(); void selectToolChain(int index); - void toggleDetails(); void updateDetails(); private: @@ -74,6 +74,7 @@ private: QAbstractButton *m_browseButton; Qt4Project *m_pro; QString m_buildConfiguration; + Utils::DetailsWidget *m_detailsContainer; }; } // namespace Internal diff --git a/src/plugins/qt4projectmanager/qt4projectconfigwidget.ui b/src/plugins/qt4projectmanager/qt4projectconfigwidget.ui index 785e8d6327..48501e8ec9 100644 --- a/src/plugins/qt4projectmanager/qt4projectconfigwidget.ui +++ b/src/plugins/qt4projectmanager/qt4projectconfigwidget.ui @@ -6,180 +6,133 @@ 0 0 - 557 - 237 + 455 + 201 - - - 0 - - - 20 - - - 0 - - - 0 - - - 0 - - - - - - - Multi -Line -placeholder + + + + + + 100 + 0 + + + + + + + + + 0 + 0 + + + + Qt Version: + + + + + + + 4 + + + + + + 0 + 0 + - - + + - + 0 0 + + This Qt-Version is invalid. + + + + + + + Manage + - - - - - 0 - - - - - Configuration Name: - - - - - - - - 100 - 0 - - - - - - - - - 0 - 0 - - - - Qt Version: - - - - - - - 4 - - - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - This Qt-Version is invalid. - - - - - - - - - Manage - - - - - - - Tool Chain: - - - - - - - - - - Shadow Build: - - - - - - - - - - - - - - - 0 - 0 - - - - Build Directory: - - - - - - - - 0 - 0 - - - - - - - - <a href="import">Import existing build</a> - - - Qt::RichText - - - - + + + + Shadow Build: + + + + + + + + + + + + + + + 0 + 0 + + + + Build Directory: + + + + + + + + 0 + 0 + + + + + + + + <a href="import">Import existing build</a> + + + Qt::RichText + + + + + + + Configuration Name: + + + + + + + + + + Tool Chain: + diff --git a/src/plugins/qt4projectmanager/qt4runconfiguration.cpp b/src/plugins/qt4projectmanager/qt4runconfiguration.cpp index cd5e80664c..f6ee0a72e4 100644 --- a/src/plugins/qt4projectmanager/qt4runconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt4runconfiguration.cpp @@ -42,7 +42,6 @@ #include #include #include -#include #include #include @@ -120,7 +119,14 @@ Qt4RunConfigurationWidget::Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4Run m_usingDyldImageSuffix(0), m_isShown(false) { - QFormLayout *toplayout = new QFormLayout(); + QVBoxLayout *vboxTopLayout = new QVBoxLayout(this); + vboxTopLayout->setMargin(0); + + m_detailsContainer = new Utils::DetailsWidget(this); + vboxTopLayout->addWidget(m_detailsContainer); + QWidget *detailsWidget = new QWidget(m_detailsContainer); + m_detailsContainer->setWidget(detailsWidget); + QFormLayout *toplayout = new QFormLayout(detailsWidget); toplayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); toplayout->setMargin(0); @@ -164,27 +170,6 @@ Qt4RunConfigurationWidget::Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4Run this, SLOT(usingDyldImageSuffixToggled(bool))); #endif - m_detailsWidget = new QWidget(this); - m_detailsWidget->setVisible(false); - QVBoxLayout *vboxTopLayout = new QVBoxLayout(this); - vboxTopLayout->setMargin(0); - m_summaryLabel = new QLabel(this); - m_summaryLabel->setText("This is a summary"); - QAbstractButton *detailsButton = new Utils::DetailsButton(this); - - connect(detailsButton, SIGNAL(clicked()), - this, SLOT(toggleDetails())); - - QHBoxLayout *detailsLayout = new QHBoxLayout(); - detailsLayout->setMargin(0); - detailsLayout->addWidget(m_summaryLabel); - detailsLayout->addWidget(detailsButton); - - vboxTopLayout->addLayout(detailsLayout); - - vboxTopLayout->addWidget(m_detailsWidget); - m_detailsWidget->setLayout(toplayout); - QLabel *environmentLabel = new QLabel(this); environmentLabel->setText(tr("Run Environment")); QFont f = environmentLabel->font(); @@ -252,11 +237,6 @@ Qt4RunConfigurationWidget::Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4Run this, SLOT(baseEnvironmentChanged())); } -void Qt4RunConfigurationWidget::toggleDetails() -{ - m_detailsWidget->setVisible(!m_detailsWidget->isVisible()); -} - void Qt4RunConfigurationWidget::updateSummary() { const QString &filename = QFileInfo(m_qt4RunConfiguration->executable()).fileName(); @@ -265,7 +245,7 @@ void Qt4RunConfigurationWidget::updateSummary() filename, arguments, m_qt4RunConfiguration->runMode() == LocalApplicationRunConfiguration::Console ? tr("(in terminal)") : ""); - m_summaryLabel->setText(text); + m_detailsContainer->setSummaryText(text); } void Qt4RunConfigurationWidget::baseEnvironmentComboBoxChanged(int index) diff --git a/src/plugins/qt4projectmanager/qt4runconfiguration.h b/src/plugins/qt4projectmanager/qt4runconfiguration.h index 63853a17ae..d0dc4ab205 100644 --- a/src/plugins/qt4projectmanager/qt4runconfiguration.h +++ b/src/plugins/qt4projectmanager/qt4runconfiguration.h @@ -31,6 +31,7 @@ #define QT4RUNCONFIGURATION_H #include +#include #include #include #include @@ -181,8 +182,7 @@ private: QCheckBox *m_usingDyldImageSuffix; QComboBox *m_baseEnvironmentComboBox; - QWidget *m_detailsWidget; - QLabel *m_summaryLabel; + Utils::DetailsWidget *m_detailsContainer; ProjectExplorer::EnvironmentWidget *m_environmentWidget; bool m_isShown; -- cgit v1.2.1