forked from qt-creator/qt-creator
QMake: Use new ExecutableAspect
Change-Id: I87af8de1a6bec216ebafaa6d7832e00facc9601a Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -39,7 +39,6 @@
|
|||||||
#include <qtsupport/qtsupportconstants.h>
|
#include <qtsupport/qtsupportconstants.h>
|
||||||
|
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
#include <utils/hostosinfo.h>
|
|
||||||
#include <utils/pathchooser.h>
|
#include <utils/pathchooser.h>
|
||||||
#include <utils/persistentsettings.h>
|
#include <utils/persistentsettings.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
@@ -51,8 +50,6 @@
|
|||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QFormLayout>
|
#include <QFormLayout>
|
||||||
#include <QLabel>
|
|
||||||
#include <QLineEdit>
|
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
@@ -72,6 +69,7 @@ const char USE_LIBRARY_SEARCH_PATH[] = "QmakeProjectManager.QmakeRunConfiguratio
|
|||||||
DesktopQmakeRunConfiguration::DesktopQmakeRunConfiguration(Target *target)
|
DesktopQmakeRunConfiguration::DesktopQmakeRunConfiguration(Target *target)
|
||||||
: RunConfiguration(target, QMAKE_RC_PREFIX)
|
: RunConfiguration(target, QMAKE_RC_PREFIX)
|
||||||
{
|
{
|
||||||
|
addExtraAspect(new ExecutableAspect(this));
|
||||||
addExtraAspect(new LocalEnvironmentAspect(this, [](RunConfiguration *rc, Environment &env) {
|
addExtraAspect(new LocalEnvironmentAspect(this, [](RunConfiguration *rc, Environment &env) {
|
||||||
static_cast<DesktopQmakeRunConfiguration *>(rc)->addToBaseEnvironment(env);
|
static_cast<DesktopQmakeRunConfiguration *>(rc)->addToBaseEnvironment(env);
|
||||||
}));
|
}));
|
||||||
@@ -104,6 +102,8 @@ void DesktopQmakeRunConfiguration::updateTargetInformation()
|
|||||||
if (!terminalAspect->isUserSet())
|
if (!terminalAspect->isUserSet())
|
||||||
terminalAspect->setUseTerminal(bti.usesTerminal);
|
terminalAspect->setUseTerminal(bti.usesTerminal);
|
||||||
|
|
||||||
|
extraAspect<ExecutableAspect>()->setExecutable(bti.targetFilePath);
|
||||||
|
|
||||||
emit effectiveTargetInformationChanged();
|
emit effectiveTargetInformationChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,10 +118,7 @@ DesktopQmakeRunConfigurationWidget::DesktopQmakeRunConfigurationWidget(DesktopQm
|
|||||||
toplayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
toplayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
||||||
toplayout->setMargin(0);
|
toplayout->setMargin(0);
|
||||||
|
|
||||||
m_executableLineLabel = new QLabel(this);
|
m_qmakeRunConfiguration->extraAspect<ExecutableAspect>()->addToMainConfigurationWidget(this, toplayout);
|
||||||
m_executableLineLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
|
|
||||||
toplayout->addRow(tr("Executable:"), m_executableLineLabel);
|
|
||||||
|
|
||||||
m_qmakeRunConfiguration->extraAspect<ArgumentsAspect>()->addToMainConfigurationWidget(this, toplayout);
|
m_qmakeRunConfiguration->extraAspect<ArgumentsAspect>()->addToMainConfigurationWidget(this, toplayout);
|
||||||
m_qmakeRunConfiguration->extraAspect<WorkingDirectoryAspect>()->addToMainConfigurationWidget(this, toplayout);
|
m_qmakeRunConfiguration->extraAspect<WorkingDirectoryAspect>()->addToMainConfigurationWidget(this, toplayout);
|
||||||
m_qmakeRunConfiguration->extraAspect<TerminalAspect>()->addToMainConfigurationWidget(this, toplayout);
|
m_qmakeRunConfiguration->extraAspect<TerminalAspect>()->addToMainConfigurationWidget(this, toplayout);
|
||||||
@@ -158,11 +155,8 @@ DesktopQmakeRunConfigurationWidget::DesktopQmakeRunConfigurationWidget(DesktopQm
|
|||||||
this, &DesktopQmakeRunConfigurationWidget::usingDyldImageSuffixChanged);
|
this, &DesktopQmakeRunConfigurationWidget::usingDyldImageSuffixChanged);
|
||||||
connect(qmakeRunConfiguration, &DesktopQmakeRunConfiguration::usingLibrarySearchPathChanged,
|
connect(qmakeRunConfiguration, &DesktopQmakeRunConfiguration::usingLibrarySearchPathChanged,
|
||||||
this, &DesktopQmakeRunConfigurationWidget::usingLibrarySearchPathChanged);
|
this, &DesktopQmakeRunConfigurationWidget::usingLibrarySearchPathChanged);
|
||||||
connect(qmakeRunConfiguration, &DesktopQmakeRunConfiguration::effectiveTargetInformationChanged,
|
|
||||||
this, &DesktopQmakeRunConfigurationWidget::effectiveTargetInformationChanged, Qt::QueuedConnection);
|
|
||||||
|
|
||||||
Core::VariableChooser::addSupportForChildWidgets(this, m_qmakeRunConfiguration->macroExpander());
|
Core::VariableChooser::addSupportForChildWidgets(this, m_qmakeRunConfiguration->macroExpander());
|
||||||
effectiveTargetInformationChanged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DesktopQmakeRunConfigurationWidget::usingDyldImageSuffixToggled(bool state)
|
void DesktopQmakeRunConfigurationWidget::usingDyldImageSuffixToggled(bool state)
|
||||||
@@ -191,11 +185,6 @@ void DesktopQmakeRunConfigurationWidget::usingLibrarySearchPathChanged(bool stat
|
|||||||
m_usingLibrarySearchPath->setChecked(state);
|
m_usingLibrarySearchPath->setChecked(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DesktopQmakeRunConfigurationWidget::effectiveTargetInformationChanged()
|
|
||||||
{
|
|
||||||
m_executableLineLabel->setText(QDir::toNativeSeparators(m_qmakeRunConfiguration->executable()));
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget *DesktopQmakeRunConfiguration::createConfigurationWidget()
|
QWidget *DesktopQmakeRunConfiguration::createConfigurationWidget()
|
||||||
{
|
{
|
||||||
return wrapWidget(new DesktopQmakeRunConfigurationWidget(this));
|
return wrapWidget(new DesktopQmakeRunConfigurationWidget(this));
|
||||||
@@ -204,7 +193,7 @@ QWidget *DesktopQmakeRunConfiguration::createConfigurationWidget()
|
|||||||
Runnable DesktopQmakeRunConfiguration::runnable() const
|
Runnable DesktopQmakeRunConfiguration::runnable() const
|
||||||
{
|
{
|
||||||
StandardRunnable r;
|
StandardRunnable r;
|
||||||
r.executable = executable();
|
r.executable = extraAspect<ExecutableAspect>()->executable().toString();
|
||||||
r.commandLineArguments = extraAspect<ArgumentsAspect>()->arguments();
|
r.commandLineArguments = extraAspect<ArgumentsAspect>()->arguments();
|
||||||
r.workingDirectory = extraAspect<WorkingDirectoryAspect>()->workingDirectory().toString();
|
r.workingDirectory = extraAspect<WorkingDirectoryAspect>()->workingDirectory().toString();
|
||||||
r.environment = extraAspect<LocalEnvironmentAspect>()->environment();
|
r.environment = extraAspect<LocalEnvironmentAspect>()->environment();
|
||||||
@@ -243,12 +232,6 @@ void DesktopQmakeRunConfiguration::doAdditionalSetup(const RunConfigurationCreat
|
|||||||
updateTargetInformation();
|
updateTargetInformation();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DesktopQmakeRunConfiguration::executable() const
|
|
||||||
{
|
|
||||||
BuildTargetInfo bti = target()->applicationTargets().buildTargetInfo(buildKey());
|
|
||||||
return bti.targetFilePath.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DesktopQmakeRunConfiguration::isUsingDyldImageSuffix() const
|
bool DesktopQmakeRunConfiguration::isUsingDyldImageSuffix() const
|
||||||
{
|
{
|
||||||
return m_isUsingDyldImageSuffix;
|
return m_isUsingDyldImageSuffix;
|
||||||
|
@@ -51,7 +51,6 @@ public:
|
|||||||
QWidget *createConfigurationWidget() override;
|
QWidget *createConfigurationWidget() override;
|
||||||
|
|
||||||
ProjectExplorer::Runnable runnable() const override;
|
ProjectExplorer::Runnable runnable() const override;
|
||||||
QString executable() const;
|
|
||||||
|
|
||||||
bool isUsingDyldImageSuffix() const;
|
bool isUsingDyldImageSuffix() const;
|
||||||
void setUsingDyldImageSuffix(bool state);
|
void setUsingDyldImageSuffix(bool state);
|
||||||
@@ -99,7 +98,6 @@ public:
|
|||||||
explicit DesktopQmakeRunConfigurationWidget(DesktopQmakeRunConfiguration *qmakeRunConfiguration);
|
explicit DesktopQmakeRunConfigurationWidget(DesktopQmakeRunConfiguration *qmakeRunConfiguration);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void effectiveTargetInformationChanged();
|
|
||||||
void usingDyldImageSuffixToggled(bool);
|
void usingDyldImageSuffixToggled(bool);
|
||||||
void usingDyldImageSuffixChanged(bool);
|
void usingDyldImageSuffixChanged(bool);
|
||||||
void usingLibrarySearchPathToggled(bool state);
|
void usingLibrarySearchPathToggled(bool state);
|
||||||
@@ -108,7 +106,6 @@ private:
|
|||||||
private:
|
private:
|
||||||
DesktopQmakeRunConfiguration *m_qmakeRunConfiguration = nullptr;
|
DesktopQmakeRunConfiguration *m_qmakeRunConfiguration = nullptr;
|
||||||
bool m_ignoreChange = false;
|
bool m_ignoreChange = false;
|
||||||
QLabel *m_executableLineLabel = nullptr;
|
|
||||||
QCheckBox *m_usingDyldImageSuffix = nullptr;
|
QCheckBox *m_usingDyldImageSuffix = nullptr;
|
||||||
QCheckBox *m_usingLibrarySearchPath = nullptr;
|
QCheckBox *m_usingLibrarySearchPath = nullptr;
|
||||||
QLineEdit *m_qmlDebugPort = nullptr;
|
QLineEdit *m_qmlDebugPort = nullptr;
|
||||||
|
Reference in New Issue
Block a user