Commit a97dcb53 authored by dt's avatar dt

Tweaks to the project page.

parent 1936535c
......@@ -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;
}
......@@ -18,6 +18,7 @@ class QTCREATOR_UTILS_EXPORT DetailsButton
Q_OBJECT
public:
DetailsButton(QWidget *parent=0);
bool isToggled();
public slots:
void onClicked();
private:
......
......@@ -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 \
......
......@@ -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
{
......
......@@ -56,7 +56,6 @@ public:
private slots:
void environmentModelUserChangesUpdated();
void clearSystemEnvironmentCheckBoxClicked(bool checked);
void layoutFixup();
private:
ProjectExplorer::EnvironmentWidget *m_buildEnvironmentWidget;
......
......@@ -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();
......
......@@ -37,6 +37,7 @@
#include <QtGui/QPushButton>
#include <QtGui/QLabel>
#include <QtGui/QGroupBox>
#include <QtGui/QSpacerItem>
namespace ProjectExplorer {
......@@ -56,6 +57,7 @@ public:
private:
QList<QWidget *> m_widgets;
QList<QLabel *> m_labels;
QList<QSpacerItem *> m_spacerItems;
};
class BuildSettingsPanelFactory : public IPanelFactory
......
......@@ -134,20 +134,6 @@ bool BuildStep::immutable() const
return false;
}
void BuildConfigWidget::fixupLayout(QWidget *widget)
{
QWidget *parent = widget;
QStack<QWidget *> widgets;
while((parent = parent->parentWidget()) && parent && parent->layout()) {
widgets.push(parent);
parent->layout()->update();
}
while(!widgets.isEmpty()) {
widgets.pop()->layout()->activate();
}
}
IBuildStepFactory::IBuildStepFactory()
{
......
......@@ -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
......
......@@ -34,13 +34,13 @@
#include <coreplugin/coreconstants.h>
#include <extensionsystem/pluginmanager.h>
#include <utils/qtcassert.h>
#include <utils/detailsbutton.h>
#include <QtGui/QLabel>
#include <QtGui/QPushButton>
#include <QtGui/QMenu>
#include <QtGui/QVBoxLayout>
#include <QtGui/QHBoxLayout>
#include <QtGui/QToolButton>
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<BuildStep *> &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<QAbstractButton *>(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<BuildStepConfigWidget *>(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);
......
......@@ -31,6 +31,7 @@
#define BUILDSTEPSPAGE_H
#include "buildstep.h"
#include <utils/detailswidget.h>
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;
......
......@@ -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;
......
......@@ -31,9 +31,10 @@
#define CUSTOMEXECUTABLERUNCONFIGURATION_H
#include "applicationrunconfiguration.h"
#include <utils/detailswidget.h>
#include <QtGui/QWidget>
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
......
......@@ -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);
}
//
......
......@@ -31,6 +31,7 @@
#define DEPENDENCIESDIALOG_H
#include "iprojectproperties.h"
#include <utils/detailswidget.h>
#include <QtCore/QSize>
#include <QtGui/QWidget>
......@@ -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
......
......@@ -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()
......
......@@ -35,6 +35,7 @@
#include <QtCore/QString>
#include <QtCore/QAbstractItemModel>
#include <QtGui/QWidget>
#include <utils/detailswidget.h>
QT_BEGIN_NAMESPACE
class QCheckBox;
......@@ -106,14 +107,8 @@ public:
QList<EnvironmentItem> userChanges() const;
void setUserChanges(QList<EnvironmentItem> 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;
......
......@@ -99,6 +99,7 @@ PanelsWidget::~PanelsWidget()