Commit 25534864 authored by con's avatar con
Browse files

Remove the summary part from the most commonly used project configuration pages.

Reviewed-by: dt
parent 61d52820
......@@ -58,6 +58,7 @@ DetailsWidget::DetailsWidget(QWidget *parent) :
m_summaryLabel(new QLabel(this)),
m_toolWidget(0),
m_widget(0),
m_state(Collapsed),
m_hovered(false)
{
m_summaryLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
......@@ -69,11 +70,9 @@ DetailsWidget::DetailsWidget(QWidget *parent) :
m_grid->addWidget(m_summaryLabel, 0, 1);
m_grid->addWidget(m_detailsButton, 0, 2);
m_detailsButton->setEnabled(false);
m_summaryLabel->setEnabled(true);
connect(m_detailsButton, SIGNAL(toggled(bool)),
this, SLOT(setExpanded(bool)));
updateControls();
}
DetailsWidget::~DetailsWidget()
......@@ -90,7 +89,7 @@ void DetailsWidget::paintEvent(QPaintEvent *paintEvent)
QPoint topLeft(m_summaryLabel->geometry().left(), contentsRect().top());
const QRect paintArea(topLeft, contentsRect().bottomRight());
if (!isExpanded()) {
if (m_state != Expanded) {
if (m_collapsedPixmap.isNull() ||
m_collapsedPixmap.size() != size())
m_collapsedPixmap = cacheBackground(paintArea.size(), false);
......@@ -125,23 +124,32 @@ QString DetailsWidget::summaryText() const
return m_summaryLabel->text();
}
bool DetailsWidget::isExpanded() const
DetailsWidget::State DetailsWidget::state() const
{
if (!m_widget)
return false;
return m_widget->isVisible();
return m_state;
}
void DetailsWidget::setExpanded(bool expand)
void DetailsWidget::setState(State state)
{
if (!m_widget || isExpanded() == expand)
if (state == m_state)
return;
m_state = state;
updateControls();
}
m_summaryLabel->setEnabled(!expand);
m_widget->setVisible(expand);
m_detailsButton->setChecked(expand);
void DetailsWidget::setExpanded(bool expanded)
{
setState(expanded ? Expanded : Collapsed);
}
emit expanded(expand);
void DetailsWidget::updateControls()
{
if (m_widget)
m_widget->setVisible(m_state == Expanded || m_state == NoSummary);
m_detailsButton->setChecked(m_state == Expanded && m_widget);
m_summaryLabel->setEnabled(m_state == Collapsed && m_widget);
m_detailsButton->setVisible(m_state != NoSummary);
m_summaryLabel->setVisible(m_state != NoSummary);
}
QWidget *DetailsWidget::widget() const
......@@ -154,23 +162,18 @@ void DetailsWidget::setWidget(QWidget *widget)
if (m_widget == widget)
return;
const bool wasExpanded(isExpanded());
if (m_widget)
if (m_widget) {
m_grid->removeWidget(m_widget);
delete m_widget;
}
m_widget = widget;
if (m_widget) {
m_widget->setVisible(wasExpanded);
m_widget->setContentsMargins(MARGIN, MARGIN, MARGIN, MARGIN);
m_grid->addWidget(m_widget, 1, 1, 1, 2);
m_detailsButton->setEnabled(true);
m_detailsButton->setChecked(wasExpanded);
} else {
m_detailsButton->setEnabled(false);
m_detailsButton->setChecked(false);
}
updateControls();
}
void DetailsWidget::setToolWidget(QWidget *widget)
......
......@@ -47,16 +47,24 @@ class QTCREATOR_UTILS_EXPORT DetailsWidget : public QWidget
{
Q_OBJECT
Q_PROPERTY(QString summaryText READ summaryText WRITE setSummaryText DESIGNABLE true)
Q_PROPERTY(bool expanded READ isExpanded WRITE setExpanded DESIGNABLE true)
Q_PROPERTY(State state READ state WRITE setState)
public:
enum State {
Expanded,
Collapsed,
NoSummary
};
DetailsWidget(QWidget *parent = 0);
~DetailsWidget();
void setSummaryText(const QString &text);
QString summaryText() const;
bool isExpanded() const;
void setState(State state);
State state() const;
void setWidget(QWidget *widget);
QWidget *widget() const;
......@@ -64,18 +72,16 @@ public:
void setToolWidget(QWidget *widget);
QWidget *toolWidget() const;
public slots:
private slots:
void setExpanded(bool);
signals:
void expanded(bool);
protected:
void paintEvent(QPaintEvent *paintEvent);
void enterEvent(QEvent *event);
void leaveEvent(QEvent *event);
private:
void updateControls();
QPixmap cacheBackground(const QSize &size, bool expanded);
void changeHoverState(bool hovered);
......@@ -88,6 +94,7 @@ private:
QPixmap m_collapsedPixmap;
QPixmap m_expandedPixmap;
State m_state;
bool m_hovered;
};
}
......
......@@ -320,6 +320,7 @@ CMakeRunConfigurationWidget::CMakeRunConfigurationWidget(CMakeRunConfiguration *
fl->addRow(tr("Working Directory:"), boxlayout);
m_detailsContainer = new Utils::DetailsWidget(this);
m_detailsContainer->setState(Utils::DetailsWidget::NoSummary);
QWidget *m_details = new QWidget(m_detailsContainer);
m_detailsContainer->setWidget(m_details);
......@@ -360,8 +361,6 @@ CMakeRunConfigurationWidget::CMakeRunConfigurationWidget(CMakeRunConfiguration *
vbx->addWidget(m_environmentWidget);
updateSummary();
connect(m_workingDirectoryEdit, SIGNAL(changed(QString)),
this, SLOT(setWorkingDirectory()));
......@@ -435,18 +434,8 @@ void CMakeRunConfigurationWidget::userEnvironmentChangesChanged()
void CMakeRunConfigurationWidget::setArguments(const QString &args)
{
m_cmakeRunConfiguration->setArguments(args);
updateSummary();
}
void CMakeRunConfigurationWidget::updateSummary()
{
QString text = tr("Running executable: <b>%1</b> %2")
.arg(QFileInfo(m_cmakeRunConfiguration->executable()).fileName(),
ProjectExplorer::Environment::joinArgumentList(m_cmakeRunConfiguration->commandLineArguments()));
m_detailsContainer->setSummaryText(text);
}
// Factory
CMakeRunConfigurationFactory::CMakeRunConfigurationFactory(QObject *parent) :
ProjectExplorer::IRunConfigurationFactory(parent)
......
......@@ -135,7 +135,6 @@ private slots:
private:
void ctor();
void updateSummary();
bool m_ignoreChange;
CMakeRunConfiguration *m_cmakeRunConfiguration;
Utils::PathChooser *m_workingDirectoryEdit;
......
......@@ -213,7 +213,7 @@ void BuildStepsPage::addBuildStep()
addBuildStepWidget(pos, newStep);
const BuildStepsWidgetStruct s = m_buildSteps.at(pos);
s.detailsWidget->setExpanded(true);
s.detailsWidget->setState(Utils::DetailsWidget::Expanded);
}
m_noStepsLabel->setVisible(false);
......
......@@ -110,6 +110,7 @@ CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomE
vbox->setMargin(0);
m_detailsContainer = new Utils::DetailsWidget(this);
m_detailsContainer->setState(Utils::DetailsWidget::NoSummary);
vbox->addWidget(m_detailsContainer);
QWidget *detailsWidget = new QWidget(m_detailsContainer);
......@@ -246,7 +247,6 @@ void CustomExecutableConfigurationWidget::changed()
arg(executable,
ProjectExplorer::Environment::joinArgumentList(m_runConfiguration->commandLineArguments()));
m_detailsContainer->setSummaryText(text);
// We triggered the change, don't update us
if (m_ignoreChange)
return;
......
......@@ -239,6 +239,7 @@ DependenciesWidget::DependenciesWidget(SessionManager *session,
QVBoxLayout *vbox = new QVBoxLayout(this);
vbox->setContentsMargins(0, 0, 0, 0);
m_detailsContainer = new Utils::DetailsWidget(this);
m_detailsContainer->setState(Utils::DetailsWidget::NoSummary);
vbox->addWidget(m_detailsContainer);
QWidget *detailsWidget = new QWidget(m_detailsContainer);
......@@ -250,38 +251,6 @@ DependenciesWidget::DependenciesWidget(SessionManager *session,
treeView->setHeaderHidden(true);
layout->addWidget(treeView);
layout->addSpacerItem(new QSpacerItem(0, 0 , QSizePolicy::Expanding, QSizePolicy::Fixed));
updateDetails();
connect(session, SIGNAL(dependencyChanged(ProjectExplorer::Project*,ProjectExplorer::Project*)),
this, SLOT(updateDetails()));
connect(session, SIGNAL(projectRemoved(ProjectExplorer::Project*)),
this, SLOT(updateDetails()));
connect(session, SIGNAL(projectAdded(ProjectExplorer::Project*)),
this, SLOT(updateDetails()));
connect(session, SIGNAL(sessionLoaded()),
this, SLOT(updateDetails()));
}
void DependenciesWidget::updateDetails()
{
QStringList dependsOn;
foreach(Project *other, m_session->projects()) {
if (m_session->hasDependency(m_project, other)) {
dependsOn.append(other->displayName());
}
}
QString text;
if (dependsOn.isEmpty()) {
text = tr("%1 has no dependencies.").arg(m_project->displayName());
} else if (dependsOn.count() == 1) {
text =tr("%1 depends on %2.").arg(m_project->displayName(), dependsOn.first());
} else {
text = tr("%1 depends on: %2.").arg(m_project->displayName(), dependsOn.join(QLatin1String(", ")));
}
m_detailsContainer->setSummaryText(text);
}
//
......
......@@ -123,9 +123,6 @@ class DependenciesWidget : public QWidget
public:
DependenciesWidget(SessionManager *session, Project *project,
QWidget *parent = 0);
private slots:
void updateDetails();
private:
SessionManager *m_session;
Project *m_project;
......
......@@ -76,6 +76,7 @@ S60DeviceRunConfigurationWidget::S60DeviceRunConfigurationWidget(
m_deviceInfoLabel(new QLabel),
m_infoTimeOutTimer(0)
{
m_detailsWidget->setState(Utils::DetailsWidget::NoSummary);
updateTargetInformation();
QVBoxLayout *mainBoxLayout = new QVBoxLayout();
mainBoxLayout->setMargin(0);
......@@ -172,7 +173,6 @@ S60DeviceRunConfigurationWidget::S60DeviceRunConfigurationWidget(
connect(customSignature, SIGNAL(toggled(bool)), this, SLOT(customSignatureToggled(bool)));
connect(signaturePath, SIGNAL(changed(QString)), this, SLOT(signaturePathChanged(QString)));
connect(keyPath, SIGNAL(changed(QString)), this, SLOT(keyPathChanged(QString)));
updateSummary();
}
void S60DeviceRunConfigurationWidget::updateSerialDevices()
......@@ -201,7 +201,6 @@ void S60DeviceRunConfigurationWidget::updateSerialDevices()
if (newPortName != previousRunConfigurationPortName)
m_runConfiguration->setSerialPortName(newPortName);
}
updateSummary();
}
CommunicationDevice S60DeviceRunConfigurationWidget::device(int i) const
......@@ -248,45 +247,28 @@ void S60DeviceRunConfigurationWidget::setSerialPort(int index)
m_runConfiguration->setCommunicationType(d.type);
m_deviceInfoButton->setEnabled(index >= 0);
clearDeviceInfo();
updateSummary();
}
void S60DeviceRunConfigurationWidget::selfSignToggled(bool toggle)
{
if (toggle)
m_runConfiguration->setSigningMode(S60DeviceRunConfiguration::SignSelf);
updateSummary();
}
void S60DeviceRunConfigurationWidget::customSignatureToggled(bool toggle)
{
if (toggle)
m_runConfiguration->setSigningMode(S60DeviceRunConfiguration::SignCustom);
updateSummary();
}
void S60DeviceRunConfigurationWidget::signaturePathChanged(const QString &path)
{
m_runConfiguration->setCustomSignaturePath(path);
updateSummary();
}
void S60DeviceRunConfigurationWidget::keyPathChanged(const QString &path)
{
m_runConfiguration->setCustomKeyPath(path);
updateSummary();
}
void S60DeviceRunConfigurationWidget::updateSummary()
{
//: Summary text of S60 device run configuration
const QString device = m_serialPortsCombo->currentIndex() != -1 ?
m_serialPortsCombo->currentText() :
tr("<No Device>");
const QString signature = m_runConfiguration->signingMode() == S60DeviceRunConfiguration::SignCustom ?
tr("(custom certificate)") :
tr("(self-signed certificate)");
m_detailsWidget->setSummaryText(tr("Summary: Run on '%1' %2").arg(device, signature));
}
void S60DeviceRunConfigurationWidget::clearDeviceInfo()
......
......@@ -75,7 +75,6 @@ private slots:
void customSignatureToggled(bool toggle);
void signaturePathChanged(const QString &path);
void keyPathChanged(const QString &path);
void updateSummary();
void updateDeviceInfo();
void clearDeviceInfo();
void slotLauncherStateChanged(int);
......
......@@ -205,6 +205,7 @@ S60EmulatorRunConfigurationWidget::S60EmulatorRunConfigurationWidget(S60Emulator
m_nameLineEdit(new QLineEdit(m_runConfiguration->displayName())),
m_executableLabel(new QLabel(m_runConfiguration->executable()))
{
m_detailsWidget->setState(Utils::DetailsWidget::NoSummary);
QVBoxLayout *mainBoxLayout = new QVBoxLayout();
mainBoxLayout->setMargin(0);
setLayout(mainBoxLayout);
......@@ -227,7 +228,6 @@ S60EmulatorRunConfigurationWidget::S60EmulatorRunConfigurationWidget(S60Emulator
this, SLOT(displayNameEdited(QString)));
connect(m_runConfiguration, SIGNAL(targetInformationChanged()),
this, SLOT(updateTargetInformation()));
updateSummary();
}
void S60EmulatorRunConfigurationWidget::displayNameEdited(const QString &text)
......@@ -240,11 +240,6 @@ void S60EmulatorRunConfigurationWidget::updateTargetInformation()
m_executableLabel->setText(m_runConfiguration->executable());
}
void S60EmulatorRunConfigurationWidget::updateSummary()
{
m_detailsWidget->setSummaryText(tr("Summary: Run %1 in emulator").arg(m_runConfiguration->executable()));
}
// ======== S60EmulatorRunConfigurationFactory
S60EmulatorRunConfigurationFactory::S60EmulatorRunConfigurationFactory(QObject *parent)
......
......@@ -100,7 +100,6 @@ public:
private slots:
void displayNameEdited(const QString &text);
void updateTargetInformation();
void updateSummary();
private:
S60EmulatorRunConfiguration *m_runConfiguration;
......
......@@ -62,6 +62,7 @@ Qt4ProjectConfigWidget::Qt4ProjectConfigWidget(Qt4Project *project)
QVBoxLayout *vbox = new QVBoxLayout(this);
vbox->setMargin(0);
m_detailsContainer = new Utils::DetailsWidget(this);
m_detailsContainer->setState(Utils::DetailsWidget::NoSummary);
vbox->addWidget(m_detailsContainer);
QWidget *details = new QWidget(m_detailsContainer);
m_detailsContainer->setWidget(details);
......@@ -124,24 +125,6 @@ void Qt4ProjectConfigWidget::updateDetails()
} else {
versionString = tr("No Qt Version set");
}
if (!version->isValid()) {
// Not a valid qt version
m_detailsContainer->setSummaryText(
tr("using <font color=\"#ff0000\">invalid</font> Qt Version: <b>%1</b><br>"
"%2")
.arg(versionString,
version->invalidReason()));
} else {
// Qt Version, Build Directory and Toolchain
m_detailsContainer->setSummaryText(
tr("using Qt version: <b>%1</b><br>"
"with tool chain <b>%2</b><br>"
"building in <b>%3</b>")
.arg(versionString,
ProjectExplorer::ToolChain::toolChainName(m_buildConfiguration->toolChainType()),
QDir::toNativeSeparators(m_buildConfiguration->buildDirectory())));
}
}
void Qt4ProjectConfigWidget::manageQtVersions()
......
......@@ -178,6 +178,7 @@ Qt4RunConfigurationWidget::Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4Run
vboxTopLayout->setMargin(0);
m_detailsContainer = new Utils::DetailsWidget(this);
m_detailsContainer->setState(Utils::DetailsWidget::NoSummary);
vboxTopLayout->addWidget(m_detailsContainer);
QWidget *detailsWidget = new QWidget(m_detailsContainer);
m_detailsContainer->setWidget(detailsWidget);
......@@ -193,6 +194,11 @@ Qt4RunConfigurationWidget::Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4Run
m_executableLabel = new QLabel(m_qt4RunConfiguration->executable());
toplayout->addRow(tr("Executable:"), m_executableLabel);
QLabel *argumentsLabel = new QLabel(tr("Arguments:"));
m_argumentsLineEdit = new QLineEdit(ProjectExplorer::Environment::joinArgumentList(qt4RunConfiguration->commandLineArguments()));
argumentsLabel->setBuddy(m_argumentsLineEdit);
toplayout->addRow(argumentsLabel, m_argumentsLineEdit);
m_workingDirectoryEdit = new Utils::PathChooser();
m_workingDirectoryEdit->setPath(m_qt4RunConfiguration->workingDirectory());
m_workingDirectoryEdit->setExpectedKind(Utils::PathChooser::Directory);
......@@ -208,11 +214,6 @@ Qt4RunConfigurationWidget::Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4Run
boxlayout->addWidget(resetButton);
toplayout->addRow(tr("Working Directory:"), boxlayout);
QLabel *argumentsLabel = new QLabel(tr("Arguments:"));
m_argumentsLineEdit = new QLineEdit(ProjectExplorer::Environment::joinArgumentList(qt4RunConfiguration->commandLineArguments()));
argumentsLabel->setBuddy(m_argumentsLineEdit);
toplayout->addRow(argumentsLabel, m_argumentsLineEdit);
m_useTerminalCheck = new QCheckBox(tr("Run in Terminal"));
m_useTerminalCheck->setChecked(m_qt4RunConfiguration->runMode() == ProjectExplorer::LocalApplicationRunConfiguration::Console);
toplayout->addRow(QString(), m_useTerminalCheck);
......@@ -293,17 +294,6 @@ Qt4RunConfigurationWidget::Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4Run
this, SLOT(baseEnvironmentChanged()));
}
void Qt4RunConfigurationWidget::updateSummary()
{
const QString &filename = QFileInfo(m_qt4RunConfiguration->executable()).fileName();
const QString &arguments = ProjectExplorer::Environment::joinArgumentList(m_qt4RunConfiguration->commandLineArguments());
const bool terminal = m_qt4RunConfiguration->runMode() == LocalApplicationRunConfiguration::Console;
const QString text = terminal ?
tr("Running executable: <b>%1</b> %2 (in terminal)").arg(filename, arguments) :
tr("Running executable: <b>%1</b> %2").arg(filename, arguments);
m_detailsContainer->setSummaryText(text);
}
void Qt4RunConfigurationWidget::baseEnvironmentSelected(int index)
{
m_ignoreChange = true;
......@@ -391,7 +381,6 @@ void Qt4RunConfigurationWidget::workingDirectoryChanged(const QString &workingDi
void Qt4RunConfigurationWidget::commandLineArgumentsChanged(const QString &args)
{
updateSummary();
if (m_ignoreChange)
return;
m_argumentsLineEdit->setText(args);
......@@ -405,7 +394,6 @@ void Qt4RunConfigurationWidget::displayNameChanged(const QString &name)
void Qt4RunConfigurationWidget::runModeChanged(LocalApplicationRunConfiguration::RunMode runMode)
{
updateSummary();
if (!m_ignoreChange)
m_useTerminalCheck->setChecked(runMode == LocalApplicationRunConfiguration::Console);
}
......@@ -418,7 +406,6 @@ void Qt4RunConfigurationWidget::usingDyldImageSuffixChanged(bool state)
void Qt4RunConfigurationWidget::effectiveTargetInformationChanged()
{
updateSummary();
if (m_isShown) {
m_executableLabel->setText(QDir::toNativeSeparators(m_qt4RunConfiguration->executable()));
m_ignoreChange = true;
......
......@@ -182,7 +182,6 @@ private slots:
void baseEnvironmentSelected(int index);
private:
void updateSummary();
Qt4RunConfiguration *m_qt4RunConfiguration;
bool m_ignoreChange;
QLabel *m_executableLabel;
......
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