forked from qt-creator/qt-creator
Simplify runconfiguration aspect addTo... interface
The parent widget is always given by the layout, no need to pass it as separate parameter. Change-Id: I9e7ed3a89eb63b78a549471d839060131737ff78 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -53,8 +53,8 @@ public:
|
||||
auto clayout = new QFormLayout(this);
|
||||
clayout->addRow(BareMetalCustomRunConfiguration::tr("Executable:"), executableChooser);
|
||||
|
||||
runConfig->extraAspect<ArgumentsAspect>()->addToMainConfigurationWidget(this, clayout);
|
||||
runConfig->extraAspect<WorkingDirectoryAspect>()->addToMainConfigurationWidget(this, clayout);
|
||||
runConfig->extraAspect<ArgumentsAspect>()->addToConfigurationLayout(clayout);
|
||||
runConfig->extraAspect<WorkingDirectoryAspect>()->addToConfigurationLayout(clayout);
|
||||
|
||||
connect(executableChooser, &PathChooser::pathChanged,
|
||||
this, &BareMetalCustomRunConfigWidget::handleLocalExecutableChanged);
|
||||
|
@@ -67,8 +67,8 @@ BareMetalRunConfigurationWidget::BareMetalRunConfigurationWidget(BareMetalRunCon
|
||||
|
||||
//d->genericWidgetsLayout.addRow(tr("Debugger host:"),d->runConfiguration);
|
||||
//d->genericWidgetsLayout.addRow(tr("Debugger port:"),d->runConfiguration);
|
||||
runConfiguration->extraAspect<ArgumentsAspect>()->addToMainConfigurationWidget(this, formLayout);
|
||||
runConfiguration->extraAspect<WorkingDirectoryAspect>()->addToMainConfigurationWidget(this, formLayout);
|
||||
runConfiguration->extraAspect<ArgumentsAspect>()->addToConfigurationLayout(formLayout);
|
||||
runConfiguration->extraAspect<WorkingDirectoryAspect>()->addToConfigurationLayout(formLayout);
|
||||
|
||||
connect(m_runConfiguration, &BareMetalRunConfiguration::targetInformationChanged,
|
||||
this, &BareMetalRunConfigurationWidget::updateTargetInformation);
|
||||
|
@@ -355,7 +355,7 @@ IosRunConfigurationWidget::IosRunConfigurationWidget(IosRunConfiguration *runCon
|
||||
m_deviceTypeLabel = new QLabel(IosRunConfiguration::tr("Device type:"), this);
|
||||
|
||||
auto layout = new QFormLayout(this);
|
||||
runConfiguration->extraAspect<ArgumentsAspect>()->addToMainConfigurationWidget(this, layout);
|
||||
runConfiguration->extraAspect<ArgumentsAspect>()->addToConfigurationLayout(layout);
|
||||
layout->addRow(IosRunConfiguration::tr("Executable:"), m_executableLineEdit);
|
||||
layout->addRow(m_deviceTypeLabel, m_deviceTypeComboBox);
|
||||
|
||||
|
@@ -63,23 +63,23 @@ CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomE
|
||||
auto workingDirectoryAspect = rc->extraAspect<WorkingDirectoryAspect>();
|
||||
auto terminalAspect = rc->extraAspect<TerminalAspect>();
|
||||
if (mode == InstantApply) {
|
||||
argumentsAspect->addToMainConfigurationWidget(this, layout);
|
||||
workingDirectoryAspect->addToMainConfigurationWidget(this, layout);
|
||||
terminalAspect->addToMainConfigurationWidget(this, layout);
|
||||
argumentsAspect->addToConfigurationLayout(layout);
|
||||
workingDirectoryAspect->addToConfigurationLayout(layout);
|
||||
terminalAspect->addToConfigurationLayout(layout);
|
||||
} else {
|
||||
m_temporaryArgumentsAspect = new ArgumentsAspect(rc, QString());
|
||||
m_temporaryArgumentsAspect->copyFrom(argumentsAspect);
|
||||
m_temporaryArgumentsAspect->addToMainConfigurationWidget(this, layout);
|
||||
m_temporaryArgumentsAspect->addToConfigurationLayout(layout);
|
||||
connect(m_temporaryArgumentsAspect, &ArgumentsAspect::argumentsChanged,
|
||||
this, &CustomExecutableConfigurationWidget::validChanged);
|
||||
|
||||
m_temporaryWorkingDirectoryAspect = new WorkingDirectoryAspect(rc, QString());
|
||||
m_temporaryWorkingDirectoryAspect->copyFrom(workingDirectoryAspect);
|
||||
m_temporaryArgumentsAspect->addToMainConfigurationWidget(this, layout);
|
||||
m_temporaryArgumentsAspect->addToConfigurationLayout(layout);
|
||||
|
||||
m_temporaryTerminalAspect = new TerminalAspect(rc, QString());
|
||||
m_temporaryTerminalAspect->copyFrom(terminalAspect);
|
||||
m_temporaryTerminalAspect->addToMainConfigurationWidget(this, layout);
|
||||
m_temporaryTerminalAspect->addToConfigurationLayout(layout);
|
||||
connect(m_temporaryTerminalAspect, &TerminalAspect::useTerminalChanged,
|
||||
this, &CustomExecutableConfigurationWidget::validChanged);
|
||||
}
|
||||
|
@@ -262,21 +262,20 @@ QWidget *RunConfiguration::createConfigurationWidget()
|
||||
|
||||
void RunConfiguration::fillConfigurationLayout(QFormLayout *layout) const
|
||||
{
|
||||
auto widget = layout->parentWidget();
|
||||
if (auto aspect = extraAspect<ExecutableAspect>())
|
||||
aspect->addToMainConfigurationWidget(widget, layout);
|
||||
aspect->addToConfigurationLayout(layout);
|
||||
if (auto aspect = extraAspect<SymbolFileAspect>())
|
||||
aspect->addToMainConfigurationWidget(widget, layout);
|
||||
aspect->addToConfigurationLayout(layout);
|
||||
if (auto aspect = extraAspect<ArgumentsAspect>())
|
||||
aspect->addToMainConfigurationWidget(widget, layout);
|
||||
aspect->addToConfigurationLayout(layout);
|
||||
if (auto aspect = extraAspect<WorkingDirectoryAspect>())
|
||||
aspect->addToMainConfigurationWidget(widget, layout);
|
||||
aspect->addToConfigurationLayout(layout);
|
||||
if (auto aspect = extraAspect<TerminalAspect>())
|
||||
aspect->addToMainConfigurationWidget(widget, layout);
|
||||
aspect->addToConfigurationLayout(layout);
|
||||
if (auto aspect = extraAspect<UseLibraryPathsAspect>())
|
||||
aspect->addToMainConfigurationWidget(widget, layout);
|
||||
aspect->addToConfigurationLayout(layout);
|
||||
if (auto aspect = extraAspect<UseDyldSuffixAspect>())
|
||||
aspect->addToMainConfigurationWidget(widget, layout);
|
||||
aspect->addToConfigurationLayout(layout);
|
||||
}
|
||||
|
||||
void RunConfiguration::updateEnabledState()
|
||||
|
@@ -59,10 +59,10 @@ TerminalAspect::TerminalAspect(RunConfiguration *runConfig, const QString &key,
|
||||
setSettingsKey(key);
|
||||
}
|
||||
|
||||
void TerminalAspect::addToMainConfigurationWidget(QWidget *parent, QFormLayout *layout)
|
||||
void TerminalAspect::addToConfigurationLayout(QFormLayout *layout)
|
||||
{
|
||||
QTC_CHECK(!m_checkBox);
|
||||
m_checkBox = new QCheckBox(tr("Run in terminal"), parent);
|
||||
m_checkBox = new QCheckBox(tr("Run in terminal"), layout->parentWidget());
|
||||
m_checkBox->setChecked(m_useTerminal);
|
||||
layout->addRow(QString(), m_checkBox);
|
||||
connect(m_checkBox.data(), &QAbstractButton::clicked, this, [this] {
|
||||
@@ -130,15 +130,15 @@ WorkingDirectoryAspect::WorkingDirectoryAspect(RunConfiguration *runConfig, cons
|
||||
setSettingsKey(key);
|
||||
}
|
||||
|
||||
void WorkingDirectoryAspect::addToMainConfigurationWidget(QWidget *parent, QFormLayout *layout)
|
||||
void WorkingDirectoryAspect::addToConfigurationLayout(QFormLayout *layout)
|
||||
{
|
||||
QTC_CHECK(!m_chooser);
|
||||
m_resetButton = new QToolButton(parent);
|
||||
m_resetButton = new QToolButton(layout->parentWidget());
|
||||
m_resetButton->setToolTip(tr("Reset to Default"));
|
||||
m_resetButton->setIcon(Utils::Icons::RESET.icon());
|
||||
connect(m_resetButton.data(), &QAbstractButton::clicked, this, &WorkingDirectoryAspect::resetPath);
|
||||
|
||||
m_chooser = new PathChooser(parent);
|
||||
m_chooser = new PathChooser(layout->parentWidget());
|
||||
m_chooser->setHistoryCompleter(settingsKey());
|
||||
m_chooser->setExpectedKind(Utils::PathChooser::Directory);
|
||||
m_chooser->setPromptDialogTitle(tr("Select Working Directory"));
|
||||
@@ -282,10 +282,10 @@ void ArgumentsAspect::toMap(QVariantMap &map) const
|
||||
map.insert(settingsKey(), m_arguments);
|
||||
}
|
||||
|
||||
void ArgumentsAspect::addToMainConfigurationWidget(QWidget *parent, QFormLayout *layout)
|
||||
void ArgumentsAspect::addToConfigurationLayout(QFormLayout *layout)
|
||||
{
|
||||
QTC_CHECK(!m_chooser);
|
||||
m_chooser = new FancyLineEdit(parent);
|
||||
m_chooser = new FancyLineEdit(layout->parentWidget());
|
||||
m_chooser->setHistoryCompleter(settingsKey());
|
||||
m_chooser->setText(m_arguments);
|
||||
|
||||
@@ -369,9 +369,10 @@ void BaseStringAspect::setPlaceHolderText(const QString &placeHolderText)
|
||||
m_lineEditDisplay->setPlaceholderText(placeHolderText);
|
||||
}
|
||||
|
||||
void BaseStringAspect::addToMainConfigurationWidget(QWidget *parent, QFormLayout *layout)
|
||||
void BaseStringAspect::addToConfigurationLayout(QFormLayout *layout)
|
||||
{
|
||||
QTC_CHECK(!m_label);
|
||||
QWidget *parent = layout->parentWidget();
|
||||
m_label = new QLabel(parent);
|
||||
m_label->setTextInteractionFlags(Qt::TextSelectableByMouse);
|
||||
|
||||
@@ -402,7 +403,7 @@ void BaseStringAspect::addToMainConfigurationWidget(QWidget *parent, QFormLayout
|
||||
auto form = new QFormLayout;
|
||||
form->setContentsMargins(0, 0, 0, 0);
|
||||
form->setFormAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
||||
m_checker->addToMainConfigurationWidget(parent, form);
|
||||
m_checker->addToConfigurationLayout(form);
|
||||
hbox->addLayout(form);
|
||||
}
|
||||
layout->addRow(m_label, hbox);
|
||||
@@ -484,11 +485,11 @@ FileName ExecutableAspect::executable() const
|
||||
return m_executable.fileName();
|
||||
}
|
||||
|
||||
void ExecutableAspect::addToMainConfigurationWidget(QWidget *parent, QFormLayout *layout)
|
||||
void ExecutableAspect::addToConfigurationLayout(QFormLayout *layout)
|
||||
{
|
||||
m_executable.addToMainConfigurationWidget(parent, layout);
|
||||
m_executable.addToConfigurationLayout(layout);
|
||||
if (m_alternativeExecutable)
|
||||
m_alternativeExecutable->addToMainConfigurationWidget(parent, layout);
|
||||
m_alternativeExecutable->addToConfigurationLayout(layout);
|
||||
}
|
||||
|
||||
void ExecutableAspect::setLabelText(const QString &labelText)
|
||||
@@ -530,10 +531,10 @@ BaseBoolAspect::BaseBoolAspect(RunConfiguration *runConfig, const QString &setti
|
||||
setSettingsKey(settingsKey);
|
||||
}
|
||||
|
||||
void BaseBoolAspect::addToMainConfigurationWidget(QWidget *parent, QFormLayout *layout)
|
||||
void BaseBoolAspect::addToConfigurationLayout(QFormLayout *layout)
|
||||
{
|
||||
QTC_CHECK(!m_checkBox);
|
||||
m_checkBox = new QCheckBox(m_label, parent);
|
||||
m_checkBox = new QCheckBox(m_label, layout->parentWidget());
|
||||
m_checkBox->setChecked(m_value);
|
||||
layout->addRow(QString(), m_checkBox);
|
||||
connect(m_checkBox.data(), &QAbstractButton::clicked, this, [this] {
|
||||
|
@@ -54,7 +54,7 @@ public:
|
||||
TerminalAspect(RunConfiguration *rc, const QString &settingsKey,
|
||||
bool useTerminal = false);
|
||||
|
||||
void addToMainConfigurationWidget(QWidget *parent, QFormLayout *layout);
|
||||
void addToConfigurationLayout(QFormLayout *layout);
|
||||
|
||||
bool useTerminal() const;
|
||||
void setUseTerminal(bool useTerminal);
|
||||
@@ -84,7 +84,7 @@ public:
|
||||
explicit WorkingDirectoryAspect(RunConfiguration *runConfig,
|
||||
const QString &settingsKey = QString());
|
||||
|
||||
void addToMainConfigurationWidget(QWidget *parent, QFormLayout *layout);
|
||||
void addToConfigurationLayout(QFormLayout *layout);
|
||||
|
||||
Utils::FileName workingDirectory() const;
|
||||
Utils::FileName defaultWorkingDirectory() const;
|
||||
@@ -112,7 +112,7 @@ class PROJECTEXPLORER_EXPORT ArgumentsAspect : public IRunConfigurationAspect
|
||||
public:
|
||||
explicit ArgumentsAspect(RunConfiguration *runConfig, const QString &settingsKey = QString());
|
||||
|
||||
void addToMainConfigurationWidget(QWidget *parent, QFormLayout *layout);
|
||||
void addToConfigurationLayout(QFormLayout *layout);
|
||||
|
||||
QString arguments() const;
|
||||
QString unexpandedArguments() const;
|
||||
@@ -137,7 +137,7 @@ class PROJECTEXPLORER_EXPORT BaseBoolAspect : public IRunConfigurationAspect
|
||||
public:
|
||||
explicit BaseBoolAspect(RunConfiguration *rc, const QString &settingsKey = QString());
|
||||
|
||||
void addToMainConfigurationWidget(QWidget *parent, QFormLayout *layout);
|
||||
void addToConfigurationLayout(QFormLayout *layout);
|
||||
|
||||
bool value() const;
|
||||
void setValue(bool val);
|
||||
@@ -179,7 +179,7 @@ class PROJECTEXPLORER_EXPORT BaseStringAspect : public IRunConfigurationAspect
|
||||
public:
|
||||
explicit BaseStringAspect(RunConfiguration *rc);
|
||||
|
||||
void addToMainConfigurationWidget(QWidget *parent, QFormLayout *layout);
|
||||
void addToConfigurationLayout(QFormLayout *layout);
|
||||
|
||||
QString value() const;
|
||||
void setValue(const QString &val);
|
||||
@@ -229,7 +229,7 @@ public:
|
||||
void setExecutable(const Utils::FileName &executable);
|
||||
|
||||
void makeOverridable(const QString &overridingKey, const QString &useOverridableKey);
|
||||
void addToMainConfigurationWidget(QWidget *parent, QFormLayout *layout);
|
||||
void addToConfigurationLayout(QFormLayout *layout);
|
||||
void setLabelText(const QString &labelText);
|
||||
void setPlaceHolderText(const QString &placeHolderText);
|
||||
void setExecutablePathStyle(Utils::OsType osType);
|
||||
|
@@ -338,8 +338,8 @@ PythonRunConfigurationWidget::PythonRunConfigurationWidget(PythonRunConfiguratio
|
||||
|
||||
fl->addRow(PythonRunConfiguration::tr("Interpreter: "), interpreterChooser);
|
||||
fl->addRow(PythonRunConfiguration::tr("Script: "), scriptLabel);
|
||||
runConfiguration->extraAspect<ArgumentsAspect>()->addToMainConfigurationWidget(this, fl);
|
||||
runConfiguration->extraAspect<TerminalAspect>()->addToMainConfigurationWidget(this, fl);
|
||||
runConfiguration->extraAspect<ArgumentsAspect>()->addToConfigurationLayout(fl);
|
||||
runConfiguration->extraAspect<TerminalAspect>()->addToConfigurationLayout(fl);
|
||||
|
||||
connect(runConfiguration->target(), &Target::applicationTargetsChanged, this, [this, scriptLabel] {
|
||||
scriptLabel->setText(QDir::toNativeSeparators(m_runConfiguration->mainScript()));
|
||||
|
@@ -29,10 +29,6 @@
|
||||
|
||||
#include <projectexplorer/runnables.h>
|
||||
|
||||
#include <utils/environment.h>
|
||||
|
||||
#include <QFormLayout>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace RemoteLinux;
|
||||
|
||||
@@ -65,7 +61,7 @@ Runnable QnxRunConfiguration::runnable() const
|
||||
void QnxRunConfiguration::fillConfigurationLayout(QFormLayout *layout) const
|
||||
{
|
||||
RemoteLinuxRunConfiguration::fillConfigurationLayout(layout);
|
||||
extraAspect<QtLibPathAspect>()->addToMainConfigurationWidget(layout->parentWidget(), layout);
|
||||
extraAspect<QtLibPathAspect>()->addToConfigurationLayout(layout);
|
||||
}
|
||||
|
||||
// QnxRunConfigurationFactory
|
||||
|
@@ -70,8 +70,8 @@ QWidget *WinRtRunConfiguration::createConfigurationWidget()
|
||||
auto widget = new QWidget;
|
||||
auto fl = new QFormLayout(widget);
|
||||
|
||||
extraAspect<ArgumentsAspect>()->addToMainConfigurationWidget(widget, fl);
|
||||
extraAspect<UninstallAfterStopAspect>()->addToMainConfigurationWidget(widget, fl);
|
||||
extraAspect<ArgumentsAspect>()->addToConfigurationLayout(fl);
|
||||
extraAspect<UninstallAfterStopAspect>()->addToConfigurationLayout(fl);
|
||||
|
||||
auto wrapped = wrapWidget(widget);
|
||||
auto detailsWidget = qobject_cast<DetailsWidget *>(wrapped);
|
||||
|
Reference in New Issue
Block a user