forked from qt-creator/qt-creator
QmakeProjectManager: Code cosmetics
Qt 5 connects, remove no-op function, add a few 'overload', use a few 'auto', put common code with ugly cast in function, ... Change-Id: I242aea07356bf535ba9ae11235de4a2a2c1f1d04 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -89,8 +89,7 @@ DesktopQmakeRunConfiguration::DesktopQmakeRunConfiguration(Target *parent, Core:
|
|||||||
addExtraAspect(new TerminalAspect(this, QStringLiteral("Qt4ProjectManager.Qt4RunConfiguration.UseTerminal")));
|
addExtraAspect(new TerminalAspect(this, QStringLiteral("Qt4ProjectManager.Qt4RunConfiguration.UseTerminal")));
|
||||||
addExtraAspect(new WorkingDirectoryAspect(this,
|
addExtraAspect(new WorkingDirectoryAspect(this,
|
||||||
QStringLiteral("Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory")));
|
QStringLiteral("Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory")));
|
||||||
|
QmakeProject *project = qmakeProject();
|
||||||
QmakeProject *project = static_cast<QmakeProject *>(parent->project());
|
|
||||||
m_parseSuccess = project->validParse(m_proFilePath);
|
m_parseSuccess = project->validParse(m_proFilePath);
|
||||||
m_parseInProgress = project->parseInProgress(m_proFilePath);
|
m_parseInProgress = project->parseInProgress(m_proFilePath);
|
||||||
|
|
||||||
@@ -120,7 +119,7 @@ QString DesktopQmakeRunConfiguration::disabledReason() const
|
|||||||
.arg(m_proFilePath.fileName());
|
.arg(m_proFilePath.fileName());
|
||||||
|
|
||||||
if (!m_parseSuccess)
|
if (!m_parseSuccess)
|
||||||
return static_cast<QmakeProject *>(target()->project())->disabledReasonForRunConfiguration(m_proFilePath);
|
return qmakeProject()->disabledReasonForRunConfiguration(m_proFilePath);
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,13 +137,11 @@ void DesktopQmakeRunConfiguration::proFileUpdated(QmakeProFileNode *pro, bool su
|
|||||||
if (!parseInProgress) {
|
if (!parseInProgress) {
|
||||||
emit effectiveTargetInformationChanged();
|
emit effectiveTargetInformationChanged();
|
||||||
setDefaultDisplayName(defaultDisplayName());
|
setDefaultDisplayName(defaultDisplayName());
|
||||||
LocalEnvironmentAspect *aspect = extraAspect<LocalEnvironmentAspect>();
|
extraAspect<LocalEnvironmentAspect>()->buildEnvironmentHasChanged();
|
||||||
QTC_ASSERT(aspect, return);
|
|
||||||
aspect->buildEnvironmentHasChanged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TerminalAspect *terminalAspect = extraAspect<TerminalAspect>();
|
auto terminalAspect = extraAspect<TerminalAspect>();
|
||||||
if (terminalAspect && !terminalAspect->isUserSet()) {
|
if (!terminalAspect->isUserSet()) {
|
||||||
terminalAspect->setUseTerminal(pro->variableValue(ConfigVar).contains(QLatin1String("console"))
|
terminalAspect->setUseTerminal(pro->variableValue(ConfigVar).contains(QLatin1String("console"))
|
||||||
&& !pro->variableValue(QtVar).contains(QLatin1String("testlib")));
|
&& !pro->variableValue(QtVar).contains(QLatin1String("testlib")));
|
||||||
}
|
}
|
||||||
@@ -154,16 +151,14 @@ void DesktopQmakeRunConfiguration::proFileEvaluated()
|
|||||||
{
|
{
|
||||||
// We depend on all .pro files for the LD_LIBRARY_PATH so we emit a signal for all .pro files
|
// We depend on all .pro files for the LD_LIBRARY_PATH so we emit a signal for all .pro files
|
||||||
// This can be optimized by checking whether LD_LIBRARY_PATH changed
|
// This can be optimized by checking whether LD_LIBRARY_PATH changed
|
||||||
LocalEnvironmentAspect *aspect = extraAspect<LocalEnvironmentAspect>();
|
return extraAspect<LocalEnvironmentAspect>()->buildEnvironmentHasChanged();
|
||||||
QTC_ASSERT(aspect, return);
|
|
||||||
aspect->buildEnvironmentHasChanged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DesktopQmakeRunConfiguration::ctor()
|
void DesktopQmakeRunConfiguration::ctor()
|
||||||
{
|
{
|
||||||
setDefaultDisplayName(defaultDisplayName());
|
setDefaultDisplayName(defaultDisplayName());
|
||||||
|
|
||||||
QmakeProject *project = static_cast<QmakeProject *>(target()->project());
|
QmakeProject *project = qmakeProject();
|
||||||
connect(project, &QmakeProject::proFileUpdated,
|
connect(project, &QmakeProject::proFileUpdated,
|
||||||
this, &DesktopQmakeRunConfiguration::proFileUpdated);
|
this, &DesktopQmakeRunConfiguration::proFileUpdated);
|
||||||
connect(project, &QmakeProject::proFilesEvaluated,
|
connect(project, &QmakeProject::proFilesEvaluated,
|
||||||
@@ -174,14 +169,13 @@ void DesktopQmakeRunConfiguration::ctor()
|
|||||||
/// DesktopQmakeRunConfigurationWidget
|
/// DesktopQmakeRunConfigurationWidget
|
||||||
/////
|
/////
|
||||||
|
|
||||||
DesktopQmakeRunConfigurationWidget::DesktopQmakeRunConfigurationWidget(DesktopQmakeRunConfiguration *qmakeRunConfiguration, QWidget *parent)
|
DesktopQmakeRunConfigurationWidget::DesktopQmakeRunConfigurationWidget(DesktopQmakeRunConfiguration *qmakeRunConfiguration)
|
||||||
: QWidget(parent),
|
: m_qmakeRunConfiguration(qmakeRunConfiguration)
|
||||||
m_qmakeRunConfiguration(qmakeRunConfiguration)
|
|
||||||
{
|
{
|
||||||
QVBoxLayout *vboxTopLayout = new QVBoxLayout(this);
|
auto vboxTopLayout = new QVBoxLayout(this);
|
||||||
vboxTopLayout->setMargin(0);
|
vboxTopLayout->setMargin(0);
|
||||||
|
|
||||||
QHBoxLayout *hl = new QHBoxLayout();
|
auto hl = new QHBoxLayout();
|
||||||
hl->addStretch();
|
hl->addStretch();
|
||||||
m_disabledIcon = new QLabel(this);
|
m_disabledIcon = new QLabel(this);
|
||||||
m_disabledIcon->setPixmap(Core::Icons::WARNING.pixmap());
|
m_disabledIcon->setPixmap(Core::Icons::WARNING.pixmap());
|
||||||
@@ -192,12 +186,12 @@ DesktopQmakeRunConfigurationWidget::DesktopQmakeRunConfigurationWidget(DesktopQm
|
|||||||
hl->addStretch();
|
hl->addStretch();
|
||||||
vboxTopLayout->addLayout(hl);
|
vboxTopLayout->addLayout(hl);
|
||||||
|
|
||||||
m_detailsContainer = new DetailsWidget(this);
|
auto detailsContainer = new DetailsWidget(this);
|
||||||
m_detailsContainer->setState(DetailsWidget::NoSummary);
|
detailsContainer->setState(DetailsWidget::NoSummary);
|
||||||
vboxTopLayout->addWidget(m_detailsContainer);
|
vboxTopLayout->addWidget(detailsContainer);
|
||||||
QWidget *detailsWidget = new QWidget(m_detailsContainer);
|
auto detailsWidget = new QWidget(detailsContainer);
|
||||||
m_detailsContainer->setWidget(detailsWidget);
|
detailsContainer->setWidget(detailsWidget);
|
||||||
QFormLayout *toplayout = new QFormLayout(detailsWidget);
|
auto toplayout = new QFormLayout(detailsWidget);
|
||||||
toplayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
toplayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
||||||
toplayout->setMargin(0);
|
toplayout->setMargin(0);
|
||||||
|
|
||||||
@@ -213,7 +207,7 @@ DesktopQmakeRunConfigurationWidget::DesktopQmakeRunConfigurationWidget(DesktopQm
|
|||||||
m_useQvfbCheck->setToolTip(tr("Check this option to run the application on a Qt Virtual Framebuffer."));
|
m_useQvfbCheck->setToolTip(tr("Check this option to run the application on a Qt Virtual Framebuffer."));
|
||||||
m_useQvfbCheck->setChecked(m_qmakeRunConfiguration->runMode() == ApplicationLauncher::Console);
|
m_useQvfbCheck->setChecked(m_qmakeRunConfiguration->runMode() == ApplicationLauncher::Console);
|
||||||
m_useQvfbCheck->setVisible(false);
|
m_useQvfbCheck->setVisible(false);
|
||||||
QHBoxLayout *innerBox = new QHBoxLayout();
|
auto innerBox = new QHBoxLayout();
|
||||||
innerBox->addWidget(m_useQvfbCheck);
|
innerBox->addWidget(m_useQvfbCheck);
|
||||||
innerBox->addStretch();
|
innerBox->addStretch();
|
||||||
toplayout->addRow(QString(), innerBox);
|
toplayout->addRow(QString(), innerBox);
|
||||||
@@ -222,8 +216,8 @@ DesktopQmakeRunConfigurationWidget::DesktopQmakeRunConfigurationWidget(DesktopQm
|
|||||||
m_usingDyldImageSuffix = new QCheckBox(tr("Use debug version of frameworks (DYLD_IMAGE_SUFFIX=_debug)"), this);
|
m_usingDyldImageSuffix = new QCheckBox(tr("Use debug version of frameworks (DYLD_IMAGE_SUFFIX=_debug)"), this);
|
||||||
m_usingDyldImageSuffix->setChecked(m_qmakeRunConfiguration->isUsingDyldImageSuffix());
|
m_usingDyldImageSuffix->setChecked(m_qmakeRunConfiguration->isUsingDyldImageSuffix());
|
||||||
toplayout->addRow(QString(), m_usingDyldImageSuffix);
|
toplayout->addRow(QString(), m_usingDyldImageSuffix);
|
||||||
connect(m_usingDyldImageSuffix, SIGNAL(toggled(bool)),
|
connect(m_usingDyldImageSuffix, &QAbstractButton::toggled,
|
||||||
this, SLOT(usingDyldImageSuffixToggled(bool)));
|
this, &DesktopQmakeRunConfigurationWidget::usingDyldImageSuffixToggled);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString librarySeachPathLabel;
|
QString librarySeachPathLabel;
|
||||||
@@ -249,26 +243,19 @@ DesktopQmakeRunConfigurationWidget::DesktopQmakeRunConfigurationWidget(DesktopQm
|
|||||||
runConfigurationEnabledChange();
|
runConfigurationEnabledChange();
|
||||||
effectiveTargetInformationChanged();
|
effectiveTargetInformationChanged();
|
||||||
|
|
||||||
connect(m_useQvfbCheck, SIGNAL(toggled(bool)),
|
connect(qmakeRunConfiguration, &DesktopQmakeRunConfiguration::usingDyldImageSuffixChanged,
|
||||||
this, SLOT(qvfbToggled(bool)));
|
this, &DesktopQmakeRunConfigurationWidget::usingDyldImageSuffixChanged);
|
||||||
|
|
||||||
connect(qmakeRunConfiguration, SIGNAL(usingDyldImageSuffixChanged(bool)),
|
|
||||||
this, SLOT(usingDyldImageSuffixChanged(bool)));
|
|
||||||
connect(qmakeRunConfiguration, &DesktopQmakeRunConfiguration::usingLibrarySearchPathChanged,
|
connect(qmakeRunConfiguration, &DesktopQmakeRunConfiguration::usingLibrarySearchPathChanged,
|
||||||
this, &DesktopQmakeRunConfigurationWidget::usingLibrarySearchPathChanged);
|
this, &DesktopQmakeRunConfigurationWidget::usingLibrarySearchPathChanged);
|
||||||
connect(qmakeRunConfiguration, SIGNAL(effectiveTargetInformationChanged()),
|
connect(qmakeRunConfiguration, &DesktopQmakeRunConfiguration::effectiveTargetInformationChanged,
|
||||||
this, SLOT(effectiveTargetInformationChanged()), Qt::QueuedConnection);
|
this, &DesktopQmakeRunConfigurationWidget::effectiveTargetInformationChanged, Qt::QueuedConnection);
|
||||||
|
|
||||||
connect(qmakeRunConfiguration, SIGNAL(enabledChanged()),
|
connect(qmakeRunConfiguration, &RunConfiguration::enabledChanged,
|
||||||
this, SLOT(runConfigurationEnabledChange()));
|
this, &DesktopQmakeRunConfigurationWidget::runConfigurationEnabledChange);
|
||||||
|
|
||||||
Core::VariableChooser::addSupportForChildWidgets(this, m_qmakeRunConfiguration->macroExpander());
|
Core::VariableChooser::addSupportForChildWidgets(this, m_qmakeRunConfiguration->macroExpander());
|
||||||
}
|
}
|
||||||
|
|
||||||
DesktopQmakeRunConfigurationWidget::~DesktopQmakeRunConfigurationWidget()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void DesktopQmakeRunConfigurationWidget::runConfigurationEnabledChange()
|
void DesktopQmakeRunConfigurationWidget::runConfigurationEnabledChange()
|
||||||
{
|
{
|
||||||
bool enabled = m_qmakeRunConfiguration->isEnabled();
|
bool enabled = m_qmakeRunConfiguration->isEnabled();
|
||||||
@@ -277,13 +264,6 @@ void DesktopQmakeRunConfigurationWidget::runConfigurationEnabledChange()
|
|||||||
m_disabledReason->setText(m_qmakeRunConfiguration->disabledReason());
|
m_disabledReason->setText(m_qmakeRunConfiguration->disabledReason());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DesktopQmakeRunConfigurationWidget::qvfbToggled(bool on)
|
|
||||||
{
|
|
||||||
Q_UNUSED(on);
|
|
||||||
m_ignoreChange = true;
|
|
||||||
m_ignoreChange = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DesktopQmakeRunConfigurationWidget::usingDyldImageSuffixToggled(bool state)
|
void DesktopQmakeRunConfigurationWidget::usingDyldImageSuffixToggled(bool state)
|
||||||
{
|
{
|
||||||
m_ignoreChange = true;
|
m_ignoreChange = true;
|
||||||
@@ -323,7 +303,7 @@ void DesktopQmakeRunConfigurationWidget::effectiveTargetInformationChanged()
|
|||||||
|
|
||||||
QWidget *DesktopQmakeRunConfiguration::createConfigurationWidget()
|
QWidget *DesktopQmakeRunConfiguration::createConfigurationWidget()
|
||||||
{
|
{
|
||||||
return new DesktopQmakeRunConfigurationWidget(this, 0);
|
return new DesktopQmakeRunConfigurationWidget(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap DesktopQmakeRunConfiguration::toMap() const
|
QVariantMap DesktopQmakeRunConfiguration::toMap() const
|
||||||
@@ -343,16 +323,15 @@ bool DesktopQmakeRunConfiguration::fromMap(const QVariantMap &map)
|
|||||||
m_isUsingDyldImageSuffix = map.value(QLatin1String(USE_DYLD_IMAGE_SUFFIX_KEY), false).toBool();
|
m_isUsingDyldImageSuffix = map.value(QLatin1String(USE_DYLD_IMAGE_SUFFIX_KEY), false).toBool();
|
||||||
m_isUsingLibrarySearchPath = map.value(QLatin1String(USE_LIBRARY_SEARCH_PATH), true).toBool();
|
m_isUsingLibrarySearchPath = map.value(QLatin1String(USE_LIBRARY_SEARCH_PATH), true).toBool();
|
||||||
|
|
||||||
m_parseSuccess = static_cast<QmakeProject *>(target()->project())->validParse(m_proFilePath);
|
m_parseSuccess = qmakeProject()->validParse(m_proFilePath);
|
||||||
m_parseInProgress = static_cast<QmakeProject *>(target()->project())->parseInProgress(m_proFilePath);
|
m_parseInProgress = qmakeProject()->parseInProgress(m_proFilePath);
|
||||||
|
|
||||||
return LocalApplicationRunConfiguration::fromMap(map);
|
return LocalApplicationRunConfiguration::fromMap(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DesktopQmakeRunConfiguration::executable() const
|
QString DesktopQmakeRunConfiguration::executable() const
|
||||||
{
|
{
|
||||||
QmakeProject *pro = static_cast<QmakeProject *>(target()->project());
|
const QmakeProFileNode *node = qmakeProject()->rootProjectNode()->findProFileFor(m_proFilePath);
|
||||||
const QmakeProFileNode *node = pro->rootProjectNode()->findProFileFor(m_proFilePath);
|
|
||||||
return extractWorkingDirAndExecutable(node).second;
|
return extractWorkingDirAndExecutable(node).second;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -371,9 +350,7 @@ void DesktopQmakeRunConfiguration::setUsingDyldImageSuffix(bool state)
|
|||||||
m_isUsingDyldImageSuffix = state;
|
m_isUsingDyldImageSuffix = state;
|
||||||
emit usingDyldImageSuffixChanged(state);
|
emit usingDyldImageSuffixChanged(state);
|
||||||
|
|
||||||
LocalEnvironmentAspect *aspect = extraAspect<LocalEnvironmentAspect>();
|
return extraAspect<LocalEnvironmentAspect>()->environmentChanged();
|
||||||
QTC_ASSERT(aspect, return);
|
|
||||||
aspect->environmentChanged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DesktopQmakeRunConfiguration::isUsingLibrarySearchPath() const
|
bool DesktopQmakeRunConfiguration::isUsingLibrarySearchPath() const
|
||||||
@@ -386,9 +363,7 @@ void DesktopQmakeRunConfiguration::setUsingLibrarySearchPath(bool state)
|
|||||||
m_isUsingLibrarySearchPath = state;
|
m_isUsingLibrarySearchPath = state;
|
||||||
emit usingLibrarySearchPathChanged(state);
|
emit usingLibrarySearchPathChanged(state);
|
||||||
|
|
||||||
LocalEnvironmentAspect *aspect = extraAspect<LocalEnvironmentAspect>();
|
return extraAspect<LocalEnvironmentAspect>()->environmentChanged();
|
||||||
QTC_ASSERT(aspect, return);
|
|
||||||
aspect->environmentChanged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DesktopQmakeRunConfiguration::workingDirectory() const
|
QString DesktopQmakeRunConfiguration::workingDirectory() const
|
||||||
@@ -398,8 +373,7 @@ QString DesktopQmakeRunConfiguration::workingDirectory() const
|
|||||||
|
|
||||||
QString DesktopQmakeRunConfiguration::baseWorkingDirectory() const
|
QString DesktopQmakeRunConfiguration::baseWorkingDirectory() const
|
||||||
{
|
{
|
||||||
QmakeProject *pro = static_cast<QmakeProject *>(target()->project());
|
const QmakeProFileNode *node = qmakeProject()->rootProjectNode()->findProFileFor(m_proFilePath);
|
||||||
const QmakeProFileNode *node = pro->rootProjectNode()->findProFileFor(m_proFilePath);
|
|
||||||
return extractWorkingDirAndExecutable(node).first;
|
return extractWorkingDirAndExecutable(node).first;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -416,7 +390,7 @@ void DesktopQmakeRunConfiguration::addToBaseEnvironment(Environment &env) const
|
|||||||
// The user could be linking to a library found via a -L/some/dir switch
|
// The user could be linking to a library found via a -L/some/dir switch
|
||||||
// to find those libraries while actually running we explicitly prepend those
|
// to find those libraries while actually running we explicitly prepend those
|
||||||
// dirs to the library search path
|
// dirs to the library search path
|
||||||
const QmakeProFileNode *node = static_cast<QmakeProject *>(target()->project())->rootProjectNode()->findProFileFor(m_proFilePath);
|
const QmakeProFileNode *node = qmakeProject()->rootProjectNode()->findProFileFor(m_proFilePath);
|
||||||
if (m_isUsingLibrarySearchPath && node) {
|
if (m_isUsingLibrarySearchPath && node) {
|
||||||
const QStringList libDirectories = node->variableValue(LibDirectoriesVar);
|
const QStringList libDirectories = node->variableValue(LibDirectoriesVar);
|
||||||
if (!libDirectories.isEmpty()) {
|
if (!libDirectories.isEmpty()) {
|
||||||
@@ -441,10 +415,14 @@ Utils::FileName DesktopQmakeRunConfiguration::proFilePath() const
|
|||||||
return m_proFilePath;
|
return m_proFilePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QmakeProject *DesktopQmakeRunConfiguration::qmakeProject() const
|
||||||
|
{
|
||||||
|
return static_cast<QmakeProject *>(target()->project());
|
||||||
|
}
|
||||||
|
|
||||||
QString DesktopQmakeRunConfiguration::defaultDisplayName()
|
QString DesktopQmakeRunConfiguration::defaultDisplayName()
|
||||||
{
|
{
|
||||||
auto project = static_cast<QmakeProject *>(target()->project());
|
const QmakeProFileNode *root = qmakeProject()->rootProjectNode();
|
||||||
const QmakeProFileNode *root = project->rootProjectNode();
|
|
||||||
if (root) {
|
if (root) {
|
||||||
const QmakeProFileNode *node = root->findProFileFor(m_proFilePath);
|
const QmakeProFileNode *node = root->findProFileFor(m_proFilePath);
|
||||||
if (node) // should always be found
|
if (node) // should always be found
|
||||||
@@ -512,10 +490,9 @@ QPair<QString, QString> DesktopQmakeRunConfiguration::extractWorkingDirAndExecut
|
|||||||
|
|
||||||
DesktopQmakeRunConfigurationFactory::DesktopQmakeRunConfigurationFactory(QObject *parent) :
|
DesktopQmakeRunConfigurationFactory::DesktopQmakeRunConfigurationFactory(QObject *parent) :
|
||||||
QmakeRunConfigurationFactory(parent)
|
QmakeRunConfigurationFactory(parent)
|
||||||
{ setObjectName(QLatin1String("DesktopQmakeRunConfigurationFactory")); }
|
{
|
||||||
|
setObjectName(QLatin1String("DesktopQmakeRunConfigurationFactory"));
|
||||||
DesktopQmakeRunConfigurationFactory::~DesktopQmakeRunConfigurationFactory()
|
}
|
||||||
{ }
|
|
||||||
|
|
||||||
bool DesktopQmakeRunConfigurationFactory::canCreate(Target *parent, Core::Id id) const
|
bool DesktopQmakeRunConfigurationFactory::canCreate(Target *parent, Core::Id id) const
|
||||||
{
|
{
|
||||||
@@ -527,8 +504,7 @@ bool DesktopQmakeRunConfigurationFactory::canCreate(Target *parent, Core::Id id)
|
|||||||
|
|
||||||
RunConfiguration *DesktopQmakeRunConfigurationFactory::doCreate(Target *parent, Core::Id id)
|
RunConfiguration *DesktopQmakeRunConfigurationFactory::doCreate(Target *parent, Core::Id id)
|
||||||
{
|
{
|
||||||
DesktopQmakeRunConfiguration *rc = new DesktopQmakeRunConfiguration(parent, id);
|
return new DesktopQmakeRunConfiguration(parent, id);
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DesktopQmakeRunConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
|
bool DesktopQmakeRunConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
|
||||||
@@ -587,8 +563,8 @@ QList<RunConfiguration *> DesktopQmakeRunConfigurationFactory::runConfigurations
|
|||||||
{
|
{
|
||||||
QList<RunConfiguration *> result;
|
QList<RunConfiguration *> result;
|
||||||
foreach (RunConfiguration *rc, t->runConfigurations())
|
foreach (RunConfiguration *rc, t->runConfigurations())
|
||||||
if (DesktopQmakeRunConfiguration *qt4c = qobject_cast<DesktopQmakeRunConfiguration *>(rc))
|
if (DesktopQmakeRunConfiguration *qmakeRc = qobject_cast<DesktopQmakeRunConfiguration *>(rc))
|
||||||
if (qt4c->proFilePath() == n->filePath())
|
if (qmakeRc->proFilePath() == n->filePath())
|
||||||
result << rc;
|
result << rc;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@@ -37,25 +37,18 @@
|
|||||||
|
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
|
|
||||||
#include <QStringList>
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QCheckBox;
|
class QCheckBox;
|
||||||
|
class QLabel;
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
class QRadioButton;
|
|
||||||
class QComboBox;
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Utils {
|
|
||||||
class PathChooser;
|
|
||||||
class DetailsWidget;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace QmakeProjectManager {
|
namespace QmakeProjectManager {
|
||||||
|
|
||||||
class QmakeProFileNode;
|
class QmakeProFileNode;
|
||||||
|
class QmakeProject;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
class DesktopQmakeRunConfigurationFactory;
|
class DesktopQmakeRunConfigurationFactory;
|
||||||
@@ -113,6 +106,7 @@ private:
|
|||||||
QPair<QString, QString> extractWorkingDirAndExecutable(const QmakeProFileNode *node) const;
|
QPair<QString, QString> extractWorkingDirAndExecutable(const QmakeProFileNode *node) const;
|
||||||
QString baseWorkingDirectory() const;
|
QString baseWorkingDirectory() const;
|
||||||
QString defaultDisplayName();
|
QString defaultDisplayName();
|
||||||
|
QmakeProject *qmakeProject() const;
|
||||||
|
|
||||||
void ctor();
|
void ctor();
|
||||||
|
|
||||||
@@ -131,14 +125,11 @@ class DesktopQmakeRunConfigurationWidget : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DesktopQmakeRunConfigurationWidget(DesktopQmakeRunConfiguration *qmakeRunConfiguration, QWidget *parent);
|
explicit DesktopQmakeRunConfigurationWidget(DesktopQmakeRunConfiguration *qmakeRunConfiguration);
|
||||||
~DesktopQmakeRunConfigurationWidget();
|
|
||||||
|
|
||||||
private slots:
|
private:
|
||||||
void runConfigurationEnabledChange();
|
void runConfigurationEnabledChange();
|
||||||
|
|
||||||
void effectiveTargetInformationChanged();
|
void effectiveTargetInformationChanged();
|
||||||
void qvfbToggled(bool);
|
|
||||||
void usingDyldImageSuffixToggled(bool);
|
void usingDyldImageSuffixToggled(bool);
|
||||||
void usingDyldImageSuffixChanged(bool);
|
void usingDyldImageSuffixChanged(bool);
|
||||||
void usingLibrarySearchPathToggled(bool state);
|
void usingLibrarySearchPathToggled(bool state);
|
||||||
@@ -154,7 +145,6 @@ private:
|
|||||||
QCheckBox *m_usingDyldImageSuffix = nullptr;
|
QCheckBox *m_usingDyldImageSuffix = nullptr;
|
||||||
QCheckBox *m_usingLibrarySearchPath = nullptr;
|
QCheckBox *m_usingLibrarySearchPath = nullptr;
|
||||||
QLineEdit *m_qmlDebugPort = nullptr;
|
QLineEdit *m_qmlDebugPort = nullptr;
|
||||||
Utils::DetailsWidget *m_detailsContainer = nullptr;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DesktopQmakeRunConfigurationFactory : public QmakeRunConfigurationFactory
|
class DesktopQmakeRunConfigurationFactory : public QmakeRunConfigurationFactory
|
||||||
@@ -163,25 +153,25 @@ class DesktopQmakeRunConfigurationFactory : public QmakeRunConfigurationFactory
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DesktopQmakeRunConfigurationFactory(QObject *parent = 0);
|
explicit DesktopQmakeRunConfigurationFactory(QObject *parent = 0);
|
||||||
~DesktopQmakeRunConfigurationFactory();
|
|
||||||
|
|
||||||
bool canCreate(ProjectExplorer::Target *parent, Core::Id id) const;
|
bool canCreate(ProjectExplorer::Target *parent, Core::Id id) const override;
|
||||||
bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
|
bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const override;
|
||||||
bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const;
|
bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const override;
|
||||||
ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source);
|
ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent,
|
||||||
|
ProjectExplorer::RunConfiguration *source) override;
|
||||||
|
|
||||||
QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent, CreationMode mode) const;
|
QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent, CreationMode mode) const override;
|
||||||
QString displayNameForId(Core::Id id) const;
|
QString displayNameForId(Core::Id id) const override;
|
||||||
|
|
||||||
QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t,
|
QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t,
|
||||||
const ProjectExplorer::Node *n);
|
const ProjectExplorer::Node *n) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool canHandle(ProjectExplorer::Target *t) const;
|
bool canHandle(ProjectExplorer::Target *t) const override;
|
||||||
|
|
||||||
ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, Core::Id id);
|
ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, Core::Id id) override;
|
||||||
ProjectExplorer::RunConfiguration *doRestore(ProjectExplorer::Target *parent,
|
ProjectExplorer::RunConfiguration *doRestore(ProjectExplorer::Target *parent,
|
||||||
const QVariantMap &map);
|
const QVariantMap &map) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -33,10 +33,9 @@
|
|||||||
|
|
||||||
#include <coreplugin/variablechooser.h>
|
#include <coreplugin/variablechooser.h>
|
||||||
#include <projectexplorer/environmentaspect.h>
|
#include <projectexplorer/environmentaspect.h>
|
||||||
#include <projectexplorer/runconfigurationaspects.h>
|
|
||||||
#include <projectexplorer/target.h>
|
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/runconfigurationaspects.h>
|
#include <projectexplorer/runconfigurationaspects.h>
|
||||||
|
#include <projectexplorer/target.h>
|
||||||
#include <utils/detailswidget.h>
|
#include <utils/detailswidget.h>
|
||||||
#include <utils/pathchooser.h>
|
#include <utils/pathchooser.h>
|
||||||
|
|
||||||
@@ -48,26 +47,24 @@
|
|||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
namespace QtSupport {
|
namespace QtSupport {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomExecutableRunConfiguration *rc, ApplyMode mode)
|
CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomExecutableRunConfiguration *rc, ApplyMode mode)
|
||||||
: m_ignoreChange(false),
|
: m_runConfiguration(rc)
|
||||||
m_runConfiguration(rc),
|
|
||||||
m_temporaryArgumentsAspect(0),
|
|
||||||
m_temporaryTerminalAspect(0)
|
|
||||||
{
|
{
|
||||||
QFormLayout *layout = new QFormLayout;
|
auto layout = new QFormLayout;
|
||||||
layout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
layout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
||||||
layout->setMargin(0);
|
layout->setMargin(0);
|
||||||
|
|
||||||
m_executableChooser = new Utils::PathChooser(this);
|
m_executableChooser = new PathChooser(this);
|
||||||
m_executableChooser->setHistoryCompleter(QLatin1String("Qt.CustomExecutable.History"));
|
m_executableChooser->setHistoryCompleter(QLatin1String("Qt.CustomExecutable.History"));
|
||||||
m_executableChooser->setExpectedKind(Utils::PathChooser::Command);
|
m_executableChooser->setExpectedKind(PathChooser::Command);
|
||||||
layout->addRow(tr("Executable:"), m_executableChooser);
|
layout->addRow(tr("Executable:"), m_executableChooser);
|
||||||
|
|
||||||
ArgumentsAspect *argumentsAspect = rc->extraAspect<ArgumentsAspect>();
|
auto argumentsAspect = rc->extraAspect<ArgumentsAspect>();
|
||||||
if (mode == InstantApply) {
|
if (mode == InstantApply) {
|
||||||
argumentsAspect->addToMainConfigurationWidget(this, layout);
|
argumentsAspect->addToMainConfigurationWidget(this, layout);
|
||||||
} else {
|
} else {
|
||||||
@@ -77,14 +74,14 @@ CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomE
|
|||||||
this, &CustomExecutableConfigurationWidget::validChanged);
|
this, &CustomExecutableConfigurationWidget::validChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_workingDirectory = new Utils::PathChooser(this);
|
m_workingDirectory = new PathChooser(this);
|
||||||
m_workingDirectory->setHistoryCompleter(QLatin1String("Qt.WorkingDir.History"));
|
m_workingDirectory->setHistoryCompleter(QLatin1String("Qt.WorkingDir.History"));
|
||||||
m_workingDirectory->setExpectedKind(Utils::PathChooser::Directory);
|
m_workingDirectory->setExpectedKind(PathChooser::Directory);
|
||||||
m_workingDirectory->setBaseFileName(rc->target()->project()->projectDirectory());
|
m_workingDirectory->setBaseFileName(rc->target()->project()->projectDirectory());
|
||||||
|
|
||||||
layout->addRow(tr("Working directory:"), m_workingDirectory);
|
layout->addRow(tr("Working directory:"), m_workingDirectory);
|
||||||
|
|
||||||
TerminalAspect *terminalAspect = rc->extraAspect<TerminalAspect>();
|
auto terminalAspect = rc->extraAspect<TerminalAspect>();
|
||||||
if (mode == InstantApply) {
|
if (mode == InstantApply) {
|
||||||
terminalAspect->addToMainConfigurationWidget(this, layout);
|
terminalAspect->addToMainConfigurationWidget(this, layout);
|
||||||
} else {
|
} else {
|
||||||
@@ -94,42 +91,43 @@ CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomE
|
|||||||
this, &CustomExecutableConfigurationWidget::validChanged);
|
this, &CustomExecutableConfigurationWidget::validChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVBoxLayout *vbox = new QVBoxLayout(this);
|
auto vbox = new QVBoxLayout(this);
|
||||||
vbox->setMargin(0);
|
vbox->setMargin(0);
|
||||||
|
|
||||||
m_detailsContainer = new Utils::DetailsWidget(this);
|
m_detailsContainer = new DetailsWidget(this);
|
||||||
m_detailsContainer->setState(Utils::DetailsWidget::NoSummary);
|
m_detailsContainer->setState(DetailsWidget::NoSummary);
|
||||||
vbox->addWidget(m_detailsContainer);
|
vbox->addWidget(m_detailsContainer);
|
||||||
|
|
||||||
QWidget *detailsWidget = new QWidget(m_detailsContainer);
|
auto detailsWidget = new QWidget(m_detailsContainer);
|
||||||
m_detailsContainer->setWidget(detailsWidget);
|
m_detailsContainer->setWidget(detailsWidget);
|
||||||
detailsWidget->setLayout(layout);
|
detailsWidget->setLayout(layout);
|
||||||
|
|
||||||
changed();
|
changed();
|
||||||
|
|
||||||
if (mode == InstantApply) {
|
if (mode == InstantApply) {
|
||||||
connect(m_executableChooser, SIGNAL(rawPathChanged(QString)),
|
connect(m_executableChooser, &PathChooser::rawPathChanged,
|
||||||
this, SLOT(executableEdited()));
|
this, &CustomExecutableConfigurationWidget::executableEdited);
|
||||||
connect(m_workingDirectory, SIGNAL(rawPathChanged(QString)),
|
connect(m_workingDirectory, &PathChooser::rawPathChanged,
|
||||||
this, SLOT(workingDirectoryEdited()));
|
this, &CustomExecutableConfigurationWidget::workingDirectoryEdited);
|
||||||
} else {
|
} else {
|
||||||
connect(m_executableChooser, SIGNAL(rawPathChanged(QString)),
|
connect(m_executableChooser, &PathChooser::rawPathChanged,
|
||||||
this, SIGNAL(validChanged()));
|
this, &CustomExecutableConfigurationWidget::validChanged);
|
||||||
connect(m_workingDirectory, SIGNAL(rawPathChanged(QString)),
|
connect(m_workingDirectory, &PathChooser::rawPathChanged,
|
||||||
this, SIGNAL(validChanged()));
|
this, &CustomExecutableConfigurationWidget::validChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorer::EnvironmentAspect *aspect = rc->extraAspect<ProjectExplorer::EnvironmentAspect>();
|
auto enviromentAspect = rc->extraAspect<EnvironmentAspect>();
|
||||||
if (aspect) {
|
connect(enviromentAspect, &EnvironmentAspect::environmentChanged,
|
||||||
connect(aspect, SIGNAL(environmentChanged()), this, SLOT(environmentWasChanged()));
|
this, &CustomExecutableConfigurationWidget::environmentWasChanged);
|
||||||
environmentWasChanged();
|
environmentWasChanged();
|
||||||
}
|
|
||||||
|
|
||||||
// If we are in mode InstantApply, we keep us in sync with the rc
|
// If we are in InstantApply mode, we keep us in sync with the rc
|
||||||
// otherwise we ignore changes to the rc and override them on apply,
|
// otherwise we ignore changes to the rc and override them on apply,
|
||||||
// or keep them on cancel
|
// or keep them on cancel
|
||||||
if (mode == InstantApply)
|
if (mode == InstantApply) {
|
||||||
connect(m_runConfiguration, SIGNAL(changed()), this, SLOT(changed()));
|
connect(m_runConfiguration, &CustomExecutableRunConfiguration::changed,
|
||||||
|
this, &CustomExecutableConfigurationWidget::changed);
|
||||||
|
}
|
||||||
|
|
||||||
Core::VariableChooser::addSupportForChildWidgets(this, m_runConfiguration->macroExpander());
|
Core::VariableChooser::addSupportForChildWidgets(this, m_runConfiguration->macroExpander());
|
||||||
}
|
}
|
||||||
@@ -142,8 +140,7 @@ CustomExecutableConfigurationWidget::~CustomExecutableConfigurationWidget()
|
|||||||
|
|
||||||
void CustomExecutableConfigurationWidget::environmentWasChanged()
|
void CustomExecutableConfigurationWidget::environmentWasChanged()
|
||||||
{
|
{
|
||||||
ProjectExplorer::EnvironmentAspect *aspect
|
auto aspect = m_runConfiguration->extraAspect<EnvironmentAspect>();
|
||||||
= m_runConfiguration->extraAspect<ProjectExplorer::EnvironmentAspect>();
|
|
||||||
QTC_ASSERT(aspect, return);
|
QTC_ASSERT(aspect, return);
|
||||||
m_workingDirectory->setEnvironment(aspect->environment());
|
m_workingDirectory->setEnvironment(aspect->environment());
|
||||||
m_executableChooser->setEnvironment(aspect->environment());
|
m_executableChooser->setEnvironment(aspect->environment());
|
||||||
|
@@ -66,26 +66,24 @@ public:
|
|||||||
~CustomExecutableConfigurationWidget();
|
~CustomExecutableConfigurationWidget();
|
||||||
|
|
||||||
void apply(); // only used for DelayedApply
|
void apply(); // only used for DelayedApply
|
||||||
|
|
||||||
bool isValid() const;
|
bool isValid() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void validChanged();
|
void validChanged();
|
||||||
|
|
||||||
private slots:
|
private:
|
||||||
void changed();
|
void changed();
|
||||||
|
|
||||||
void executableEdited();
|
void executableEdited();
|
||||||
void workingDirectoryEdited();
|
void workingDirectoryEdited();
|
||||||
void environmentWasChanged();
|
void environmentWasChanged();
|
||||||
|
|
||||||
private:
|
bool m_ignoreChange = false;
|
||||||
bool m_ignoreChange;
|
CustomExecutableRunConfiguration *m_runConfiguration = 0;
|
||||||
CustomExecutableRunConfiguration *m_runConfiguration;
|
ProjectExplorer::ArgumentsAspect *m_temporaryArgumentsAspect = 0;
|
||||||
ProjectExplorer::ArgumentsAspect *m_temporaryArgumentsAspect;
|
ProjectExplorer::TerminalAspect *m_temporaryTerminalAspect = 0;
|
||||||
ProjectExplorer::TerminalAspect *m_temporaryTerminalAspect;
|
Utils::PathChooser *m_executableChooser = 0;
|
||||||
Utils::PathChooser *m_executableChooser;
|
Utils::PathChooser *m_workingDirectory = 0;
|
||||||
Utils::PathChooser *m_workingDirectory;
|
Utils::DetailsWidget *m_detailsContainer = 0;
|
||||||
Utils::DetailsWidget *m_detailsContainer;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
Reference in New Issue
Block a user