forked from qt-creator/qt-creator
Change the apppereanve slightly for environment widgets.
This commit is contained in:
@@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
#include <QtGui/QVBoxLayout>
|
#include <QtGui/QVBoxLayout>
|
||||||
#include <QtGui/QHeaderView>
|
#include <QtGui/QHeaderView>
|
||||||
|
#include <QtGui/QToolButton>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
@@ -424,46 +425,36 @@ void EnvironmentModel::setUserChanges(QList<EnvironmentItem> list)
|
|||||||
////
|
////
|
||||||
|
|
||||||
EnvironmentWidget::EnvironmentWidget(QWidget *parent, QWidget *additionalDetailsWidget)
|
EnvironmentWidget::EnvironmentWidget(QWidget *parent, QWidget *additionalDetailsWidget)
|
||||||
: QStackedWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
m_model = new EnvironmentModel();
|
m_model = new EnvironmentModel();
|
||||||
m_model->setMergedEnvironments(true);
|
m_model->setMergedEnvironments(true);
|
||||||
connect(m_model, SIGNAL(userChangesUpdated()),
|
connect(m_model, SIGNAL(userChangesUpdated()),
|
||||||
this, SIGNAL(userChangesUpdated()));
|
this, SIGNAL(userChangesUpdated()));
|
||||||
|
|
||||||
m_summaryPage = new QWidget();
|
QVBoxLayout *vbox = new QVBoxLayout(this);
|
||||||
addWidget(m_summaryPage);
|
|
||||||
QVBoxLayout *vbox = new QVBoxLayout(m_summaryPage);
|
|
||||||
vbox->setContentsMargins(0, -1, 0, -1);
|
|
||||||
|
|
||||||
QPushButton *detailsButton = new QPushButton(this);
|
|
||||||
detailsButton->setText(tr("Show Details"));
|
|
||||||
QHBoxLayout *hdetailsButtonLayout = new QHBoxLayout();
|
|
||||||
hdetailsButtonLayout->setMargin(0);
|
|
||||||
hdetailsButtonLayout->addWidget(detailsButton);
|
|
||||||
hdetailsButtonLayout->addStretch(10);
|
|
||||||
connect(detailsButton, SIGNAL(clicked()),
|
|
||||||
this, SLOT(switchToDetails()));
|
|
||||||
vbox->addLayout(hdetailsButtonLayout);
|
|
||||||
|
|
||||||
m_summaryText = new QLabel(this);
|
m_summaryText = new QLabel(this);
|
||||||
m_summaryText->setText("");
|
m_summaryText->setText("");
|
||||||
vbox->addWidget(m_summaryText);
|
|
||||||
|
|
||||||
m_detailsPage = new QWidget();
|
QToolButton *detailsButton = new QToolButton(this);
|
||||||
//addWidget(m_detailsPage);
|
detailsButton->setText(tr("Details"));
|
||||||
QVBoxLayout *vbox2 = new QVBoxLayout(m_detailsPage);
|
|
||||||
vbox2->setContentsMargins(0, -1, 0, -1);
|
connect(detailsButton, SIGNAL(clicked()),
|
||||||
|
this, SLOT(switchToDetails()));
|
||||||
|
|
||||||
QPushButton *summaryButton = new QPushButton(this);
|
|
||||||
summaryButton->setText(tr("Hide Details"));
|
|
||||||
QHBoxLayout *hbox = new QHBoxLayout();
|
QHBoxLayout *hbox = new QHBoxLayout();
|
||||||
|
hbox->addWidget(m_summaryText);
|
||||||
|
hbox->addWidget(detailsButton);
|
||||||
hbox->setMargin(0);
|
hbox->setMargin(0);
|
||||||
hbox->addWidget(summaryButton);
|
|
||||||
hbox->addStretch(10);
|
vbox->addLayout(hbox);
|
||||||
connect(summaryButton, SIGNAL(clicked()),
|
|
||||||
this, SLOT(switchToSummary()));
|
m_details = new QWidget(this);
|
||||||
vbox2->addLayout(hbox);
|
m_details->setVisible(false);
|
||||||
|
|
||||||
|
QVBoxLayout *vbox2 = new QVBoxLayout(m_details);
|
||||||
|
vbox2->setMargin(0);
|
||||||
|
|
||||||
if (additionalDetailsWidget)
|
if (additionalDetailsWidget)
|
||||||
vbox2->addWidget(additionalDetailsWidget);
|
vbox2->addWidget(additionalDetailsWidget);
|
||||||
@@ -478,31 +469,33 @@ EnvironmentWidget::EnvironmentWidget(QWidget *parent, QWidget *additionalDetails
|
|||||||
m_environmentTreeView->setMinimumHeight(400);
|
m_environmentTreeView->setMinimumHeight(400);
|
||||||
horizontalLayout->addWidget(m_environmentTreeView);
|
horizontalLayout->addWidget(m_environmentTreeView);
|
||||||
|
|
||||||
QVBoxLayout *verticalLayout_2 = new QVBoxLayout();
|
QVBoxLayout *buttonLayout = new QVBoxLayout();
|
||||||
|
|
||||||
m_editButton = new QPushButton(this);
|
m_editButton = new QPushButton(this);
|
||||||
m_editButton->setText(tr("&Edit"));
|
m_editButton->setText(tr("&Edit"));
|
||||||
verticalLayout_2->addWidget(m_editButton);
|
buttonLayout->addWidget(m_editButton);
|
||||||
|
|
||||||
m_addButton = new QPushButton(this);
|
m_addButton = new QPushButton(this);
|
||||||
m_addButton->setText(tr("&Add"));
|
m_addButton->setText(tr("&Add"));
|
||||||
verticalLayout_2->addWidget(m_addButton);
|
buttonLayout->addWidget(m_addButton);
|
||||||
|
|
||||||
m_removeButton = new QPushButton(this);
|
m_removeButton = new QPushButton(this);
|
||||||
m_removeButton->setEnabled(false);
|
m_removeButton->setEnabled(false);
|
||||||
m_removeButton->setText(tr("&Reset"));
|
m_removeButton->setText(tr("&Reset"));
|
||||||
verticalLayout_2->addWidget(m_removeButton);
|
buttonLayout->addWidget(m_removeButton);
|
||||||
|
|
||||||
m_unsetButton = new QPushButton(this);
|
m_unsetButton = new QPushButton(this);
|
||||||
m_unsetButton->setEnabled(false);
|
m_unsetButton->setEnabled(false);
|
||||||
m_unsetButton->setText(tr("&Unset"));
|
m_unsetButton->setText(tr("&Unset"));
|
||||||
verticalLayout_2->addWidget(m_unsetButton);
|
buttonLayout->addWidget(m_unsetButton);
|
||||||
|
|
||||||
QSpacerItem *verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
QSpacerItem *verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||||
verticalLayout_2->addItem(verticalSpacer);
|
buttonLayout->addItem(verticalSpacer);
|
||||||
horizontalLayout->addLayout(verticalLayout_2);
|
horizontalLayout->addLayout(buttonLayout);
|
||||||
vbox2->addLayout(horizontalLayout);
|
vbox2->addLayout(horizontalLayout);
|
||||||
|
|
||||||
|
vbox->addWidget(m_details);
|
||||||
|
|
||||||
connect(m_model, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)),
|
connect(m_model, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)),
|
||||||
this, SLOT(updateButtons()));
|
this, SLOT(updateButtons()));
|
||||||
|
|
||||||
@@ -520,26 +513,13 @@ EnvironmentWidget::EnvironmentWidget(QWidget *parent, QWidget *additionalDetails
|
|||||||
|
|
||||||
EnvironmentWidget::~EnvironmentWidget()
|
EnvironmentWidget::~EnvironmentWidget()
|
||||||
{
|
{
|
||||||
delete m_summaryPage;
|
|
||||||
delete m_detailsPage;
|
|
||||||
delete m_model;
|
delete m_model;
|
||||||
m_model = 0;
|
m_model = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnvironmentWidget::switchToDetails()
|
void EnvironmentWidget::switchToDetails()
|
||||||
{
|
{
|
||||||
addWidget(m_detailsPage);
|
m_details->setVisible(!m_details->isVisible());
|
||||||
setCurrentWidget(m_detailsPage);
|
|
||||||
removeWidget(m_summaryPage);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void EnvironmentWidget::switchToSummary()
|
|
||||||
{
|
|
||||||
updateSummaryText();
|
|
||||||
addWidget(m_summaryPage);
|
|
||||||
setCurrentWidget(m_summaryPage);
|
|
||||||
removeWidget(m_detailsPage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnvironmentWidget::setBaseEnvironment(const ProjectExplorer::Environment &env)
|
void EnvironmentWidget::setBaseEnvironment(const ProjectExplorer::Environment &env)
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ private:
|
|||||||
bool m_mergedEnvironments;
|
bool m_mergedEnvironments;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT EnvironmentWidget : public QStackedWidget
|
class PROJECTEXPLORER_EXPORT EnvironmentWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
@@ -122,9 +122,8 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
void updateSummaryText();
|
void updateSummaryText();
|
||||||
EnvironmentModel *m_model;
|
EnvironmentModel *m_model;
|
||||||
QWidget*m_summaryPage;
|
|
||||||
QWidget *m_detailsPage;
|
|
||||||
QLabel *m_summaryText;
|
QLabel *m_summaryText;
|
||||||
|
QWidget *m_details;
|
||||||
QTreeView *m_environmentTreeView;
|
QTreeView *m_environmentTreeView;
|
||||||
QPushButton *m_editButton;
|
QPushButton *m_editButton;
|
||||||
QPushButton *m_addButton;
|
QPushButton *m_addButton;
|
||||||
|
|||||||
Reference in New Issue
Block a user