forked from qt-creator/qt-creator
ProjectExplorer: Introduce runconfig aspects for some bool values
And use it to handle adding extra library path for qbs and qmake and and the DYLD debug suffix for qmake. Could possibly be used more uniformly at some stage e.g. for CMake. Change-Id: I0c4581b4e36960fc76d056c65c487d7c43a1be08 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -25,9 +25,11 @@
|
||||
|
||||
#include "runconfigurationaspects.h"
|
||||
|
||||
#include "project.h"
|
||||
#include "runconfiguration.h"
|
||||
#include "environmentaspect.h"
|
||||
#include "project.h"
|
||||
#include "projectexplorer.h"
|
||||
#include "projectexplorersettings.h"
|
||||
#include "runconfiguration.h"
|
||||
|
||||
#include <utils/utilsicons.h>
|
||||
#include <utils/fancylineedit.h>
|
||||
@@ -336,4 +338,81 @@ void ExecutableAspect::addToMainConfigurationWidget(QWidget *parent, QFormLayout
|
||||
layout->addRow(labelText + ':', m_executableDisplay);
|
||||
}
|
||||
|
||||
/*!
|
||||
\class ProjectExplorer::BaseBoolAspect
|
||||
*/
|
||||
|
||||
BaseBoolAspect::BaseBoolAspect(RunConfiguration *runConfig, const QString &key) :
|
||||
IRunConfigurationAspect(runConfig)
|
||||
{
|
||||
setSettingsKey(key);
|
||||
}
|
||||
|
||||
void BaseBoolAspect::addToMainConfigurationWidget(QWidget *parent, QFormLayout *layout)
|
||||
{
|
||||
QTC_CHECK(!m_checkBox);
|
||||
m_checkBox = new QCheckBox(m_label, parent);
|
||||
m_checkBox->setChecked(m_value);
|
||||
layout->addRow(QString(), m_checkBox);
|
||||
connect(m_checkBox.data(), &QAbstractButton::clicked, this, [this] {
|
||||
m_value = m_checkBox->isChecked();
|
||||
emit changed();
|
||||
});
|
||||
}
|
||||
|
||||
void BaseBoolAspect::fromMap(const QVariantMap &map)
|
||||
{
|
||||
m_value = map.value(settingsKey(), false).toBool();
|
||||
}
|
||||
|
||||
void BaseBoolAspect::toMap(QVariantMap &data) const
|
||||
{
|
||||
data.insert(settingsKey(), m_value);
|
||||
}
|
||||
|
||||
bool BaseBoolAspect::value() const
|
||||
{
|
||||
return m_value;
|
||||
}
|
||||
|
||||
void BaseBoolAspect::setValue(bool value)
|
||||
{
|
||||
m_value = value;
|
||||
if (m_checkBox)
|
||||
m_checkBox->setChecked(m_value);
|
||||
}
|
||||
|
||||
void BaseBoolAspect::setLabel(const QString &label)
|
||||
{
|
||||
m_label = label;
|
||||
}
|
||||
|
||||
/*!
|
||||
\class ProjectExplorer::UseLibraryPathsAspect
|
||||
*/
|
||||
|
||||
UseLibraryPathsAspect::UseLibraryPathsAspect(RunConfiguration *rc, const QString &settingsKey)
|
||||
: BaseBoolAspect(rc, settingsKey)
|
||||
{
|
||||
setId("UseLibraryPath");
|
||||
if (HostOsInfo::isMacHost())
|
||||
setLabel(tr("Add build library search path to DYLD_LIBRARY_PATH and DYLD_FRAMEWORK_PATH"));
|
||||
else if (HostOsInfo::isWindowsHost())
|
||||
setLabel(tr("Add build library search path to PATH"));
|
||||
else
|
||||
setLabel(tr("Add build library search path to LD_LIBRARY_PATH"));
|
||||
setValue(ProjectExplorerPlugin::projectExplorerSettings().addLibraryPathsToRunEnv);
|
||||
}
|
||||
|
||||
/*!
|
||||
\class ProjectExplorer::UseDyldSuffixAspect
|
||||
*/
|
||||
|
||||
UseDyldSuffixAspect::UseDyldSuffixAspect(RunConfiguration *rc, const QString &settingsKey)
|
||||
: BaseBoolAspect(rc, settingsKey)
|
||||
{
|
||||
setId("UseDyldSuffix");
|
||||
setLabel(tr("Use debug version of frameworks (DYLD_IMAGE_SUFFIX=_debug)"));
|
||||
}
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
@@ -150,4 +150,45 @@ private:
|
||||
QPointer<QLabel> m_executableDisplay;
|
||||
};
|
||||
|
||||
class PROJECTEXPLORER_EXPORT BaseBoolAspect : public IRunConfigurationAspect
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
BaseBoolAspect(RunConfiguration *rc, const QString &settingsKey);
|
||||
|
||||
void addToMainConfigurationWidget(QWidget *parent, QFormLayout *layout);
|
||||
bool value() const;
|
||||
void setValue(bool val);
|
||||
|
||||
void setLabel(const QString &label);
|
||||
|
||||
signals:
|
||||
void changed();
|
||||
|
||||
private:
|
||||
void fromMap(const QVariantMap &map) override;
|
||||
void toMap(QVariantMap &map) const override;
|
||||
|
||||
bool m_value = false;
|
||||
QString m_label;
|
||||
QPointer<QCheckBox> m_checkBox; // Owned by RunConfigWidget
|
||||
};
|
||||
|
||||
class PROJECTEXPLORER_EXPORT UseLibraryPathsAspect : public BaseBoolAspect
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
UseLibraryPathsAspect(RunConfiguration *rc, const QString &settingsKey);
|
||||
};
|
||||
|
||||
class PROJECTEXPLORER_EXPORT UseDyldSuffixAspect : public BaseBoolAspect
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
UseDyldSuffixAspect(RunConfiguration *rc, const QString &settingsKey);
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
@@ -33,8 +33,6 @@
|
||||
|
||||
#include <projectexplorer/localenvironmentaspect.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/projectexplorersettings.h>
|
||||
#include <projectexplorer/runconfigurationaspects.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
@@ -52,8 +50,6 @@ namespace Internal {
|
||||
|
||||
const char QBS_RC_PREFIX[] = "Qbs.RunConfiguration:";
|
||||
|
||||
static QString usingLibraryPathsKey() { return QString("Qbs.RunConfiguration.UsingLibraryPaths"); }
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// QbsRunConfigurationWidget:
|
||||
// --------------------------------------------------------------------
|
||||
@@ -61,7 +57,7 @@ static QString usingLibraryPathsKey() { return QString("Qbs.RunConfiguration.Usi
|
||||
class QbsRunConfigurationWidget : public QWidget
|
||||
{
|
||||
public:
|
||||
explicit QbsRunConfigurationWidget(QbsRunConfiguration *rc)
|
||||
explicit QbsRunConfigurationWidget(RunConfiguration *rc)
|
||||
{
|
||||
auto toplayout = new QFormLayout(this);
|
||||
|
||||
@@ -69,13 +65,7 @@ public:
|
||||
rc->extraAspect<ArgumentsAspect>()->addToMainConfigurationWidget(this, toplayout);
|
||||
rc->extraAspect<WorkingDirectoryAspect>()->addToMainConfigurationWidget(this, toplayout);
|
||||
rc->extraAspect<TerminalAspect>()->addToMainConfigurationWidget(this, toplayout);
|
||||
|
||||
auto usingLibPathsCheckBox = new QCheckBox;
|
||||
usingLibPathsCheckBox->setText(QbsRunConfiguration::tr("Add library paths to run environment"));
|
||||
usingLibPathsCheckBox->setChecked(rc->usingLibraryPaths());
|
||||
connect(usingLibPathsCheckBox, &QCheckBox::toggled,
|
||||
rc, &QbsRunConfiguration::setUsingLibraryPaths);
|
||||
toplayout->addRow(QString(), usingLibPathsCheckBox);
|
||||
rc->extraAspect<UseLibraryPathsAspect>()->addToMainConfigurationWidget(this, toplayout);
|
||||
|
||||
Core::VariableChooser::addSupportForChildWidgets(this, rc->macroExpander());
|
||||
}
|
||||
@@ -88,8 +78,6 @@ public:
|
||||
QbsRunConfiguration::QbsRunConfiguration(Target *target)
|
||||
: RunConfiguration(target, QBS_RC_PREFIX)
|
||||
{
|
||||
m_usingLibraryPaths = ProjectExplorerPlugin::projectExplorerSettings().addLibraryPathsToRunEnv;
|
||||
|
||||
auto envAspect = new LocalEnvironmentAspect(this,
|
||||
[](RunConfiguration *rc, Environment &env) {
|
||||
static_cast<QbsRunConfiguration *>(rc)->addToBaseEnvironment(env);
|
||||
@@ -103,6 +91,11 @@ QbsRunConfiguration::QbsRunConfiguration(Target *target)
|
||||
|
||||
setOutputFormatter<QtSupport::QtOutputFormatter>();
|
||||
|
||||
auto libAspect = new UseLibraryPathsAspect(this, "Qbs.RunConfiguration.UsingLibraryPaths");
|
||||
addExtraAspect(libAspect);
|
||||
connect(libAspect, &UseLibraryPathsAspect::changed,
|
||||
envAspect, &EnvironmentAspect::environmentChanged);
|
||||
|
||||
connect(project(), &Project::parsingFinished, this,
|
||||
[envAspect]() { envAspect->buildEnvironmentHasChanged(); });
|
||||
|
||||
@@ -120,9 +113,7 @@ QbsRunConfiguration::QbsRunConfiguration(Target *target)
|
||||
|
||||
QVariantMap QbsRunConfiguration::toMap() const
|
||||
{
|
||||
QVariantMap map = RunConfiguration::toMap();
|
||||
map.insert(usingLibraryPathsKey(), usingLibraryPaths());
|
||||
return map;
|
||||
return RunConfiguration::toMap();
|
||||
}
|
||||
|
||||
bool QbsRunConfiguration::fromMap(const QVariantMap &map)
|
||||
@@ -130,8 +121,6 @@ bool QbsRunConfiguration::fromMap(const QVariantMap &map)
|
||||
if (!RunConfiguration::fromMap(map))
|
||||
return false;
|
||||
|
||||
m_usingLibraryPaths = map.value(usingLibraryPathsKey(), true).toBool();
|
||||
|
||||
updateTargetInformation();
|
||||
return true;
|
||||
}
|
||||
@@ -158,15 +147,11 @@ Runnable QbsRunConfiguration::runnable() const
|
||||
return r;
|
||||
}
|
||||
|
||||
void QbsRunConfiguration::setUsingLibraryPaths(bool useLibPaths)
|
||||
{
|
||||
m_usingLibraryPaths = useLibPaths;
|
||||
extraAspect<LocalEnvironmentAspect>()->environmentChanged();
|
||||
}
|
||||
|
||||
void QbsRunConfiguration::addToBaseEnvironment(Utils::Environment &env) const
|
||||
{
|
||||
const auto key = qMakePair(env.toStringList(), m_usingLibraryPaths);
|
||||
bool usingLibraryPaths = extraAspect<UseLibraryPathsAspect>()->value();
|
||||
|
||||
const auto key = qMakePair(env.toStringList(), usingLibraryPaths);
|
||||
const auto it = m_envCache.constFind(key);
|
||||
if (it != m_envCache.constEnd()) {
|
||||
env = it.value();
|
||||
@@ -174,7 +159,7 @@ void QbsRunConfiguration::addToBaseEnvironment(Utils::Environment &env) const
|
||||
}
|
||||
BuildTargetInfo bti = target()->applicationTargets().buildTargetInfo(buildKey());
|
||||
if (bti.runEnvModifier)
|
||||
bti.runEnvModifier(env, m_usingLibraryPaths);
|
||||
bti.runEnvModifier(env, usingLibraryPaths);
|
||||
m_envCache.insert(key, env);
|
||||
}
|
||||
|
||||
|
@@ -52,9 +52,6 @@ public:
|
||||
|
||||
void addToBaseEnvironment(Utils::Environment &env) const;
|
||||
|
||||
bool usingLibraryPaths() const { return m_usingLibraryPaths; }
|
||||
void setUsingLibraryPaths(bool useLibPaths);
|
||||
|
||||
private:
|
||||
QVariantMap toMap() const final;
|
||||
bool fromMap(const QVariantMap &map) final;
|
||||
@@ -65,7 +62,6 @@ private:
|
||||
|
||||
using EnvCache = QHash<QPair<QStringList, bool>, Utils::Environment>;
|
||||
mutable EnvCache m_envCache;
|
||||
bool m_usingLibraryPaths = true;
|
||||
};
|
||||
|
||||
class QbsRunConfigurationFactory : public ProjectExplorer::RunConfigurationFactory
|
||||
|
@@ -30,8 +30,6 @@
|
||||
#include <coreplugin/variablechooser.h>
|
||||
#include <projectexplorer/localenvironmentaspect.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/projectexplorersettings.h>
|
||||
#include <projectexplorer/projectnodes.h>
|
||||
#include <projectexplorer/runnables.h>
|
||||
#include <projectexplorer/runconfigurationaspects.h>
|
||||
@@ -61,8 +59,6 @@ namespace Internal {
|
||||
|
||||
const char QMAKE_RC_PREFIX[] = "Qt4ProjectManager.Qt4RunConfiguration:";
|
||||
const char PRO_FILE_KEY[] = "Qt4ProjectManager.Qt4RunConfiguration.ProFile";
|
||||
const char USE_DYLD_IMAGE_SUFFIX_KEY[] = "Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix";
|
||||
const char USE_LIBRARY_SEARCH_PATH[] = "QmakeProjectManager.QmakeRunConfiguration.UseLibrarySearchPath";
|
||||
|
||||
//
|
||||
// DesktopQmakeRunConfiguration
|
||||
@@ -71,19 +67,30 @@ const char USE_LIBRARY_SEARCH_PATH[] = "QmakeProjectManager.QmakeRunConfiguratio
|
||||
DesktopQmakeRunConfiguration::DesktopQmakeRunConfiguration(Target *target)
|
||||
: RunConfiguration(target, QMAKE_RC_PREFIX)
|
||||
{
|
||||
m_isUsingLibrarySearchPath
|
||||
= ProjectExplorerPlugin::projectExplorerSettings().addLibraryPathsToRunEnv;
|
||||
auto envAspect = new LocalEnvironmentAspect(this, [](RunConfiguration *rc, Environment &env) {
|
||||
static_cast<DesktopQmakeRunConfiguration *>(rc)->addToBaseEnvironment(env);
|
||||
});
|
||||
addExtraAspect(envAspect);
|
||||
|
||||
addExtraAspect(new ExecutableAspect(this));
|
||||
addExtraAspect(new LocalEnvironmentAspect(this, [](RunConfiguration *rc, Environment &env) {
|
||||
static_cast<DesktopQmakeRunConfiguration *>(rc)->addToBaseEnvironment(env);
|
||||
}));
|
||||
addExtraAspect(new ArgumentsAspect(this, "Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"));
|
||||
addExtraAspect(new TerminalAspect(this, "Qt4ProjectManager.Qt4RunConfiguration.UseTerminal"));
|
||||
addExtraAspect(new WorkingDirectoryAspect(this, "Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"));
|
||||
|
||||
setOutputFormatter<QtSupport::QtOutputFormatter>();
|
||||
|
||||
auto libAspect = new UseLibraryPathsAspect(this, "QmakeProjectManager.QmakeRunConfiguration.UseLibrarySearchPath");
|
||||
addExtraAspect(libAspect);
|
||||
connect(libAspect, &UseLibraryPathsAspect::changed,
|
||||
envAspect, &EnvironmentAspect::environmentChanged);
|
||||
|
||||
if (HostOsInfo::isMacHost()) {
|
||||
auto dyldAspect = new UseDyldSuffixAspect(this, "QmakeProjectManager.QmakeRunConfiguration.UseDyldImageSuffix");
|
||||
addExtraAspect(dyldAspect);
|
||||
connect(dyldAspect, &UseLibraryPathsAspect::changed,
|
||||
envAspect, &EnvironmentAspect::environmentChanged);
|
||||
}
|
||||
|
||||
connect(target->project(), &Project::parsingFinished,
|
||||
this, &DesktopQmakeRunConfiguration::updateTargetInformation);
|
||||
}
|
||||
@@ -113,76 +120,21 @@ void DesktopQmakeRunConfiguration::updateTargetInformation()
|
||||
// DesktopQmakeRunConfigurationWidget
|
||||
//
|
||||
|
||||
DesktopQmakeRunConfigurationWidget::DesktopQmakeRunConfigurationWidget(DesktopQmakeRunConfiguration *qmakeRunConfiguration)
|
||||
: m_qmakeRunConfiguration(qmakeRunConfiguration)
|
||||
DesktopQmakeRunConfigurationWidget::DesktopQmakeRunConfigurationWidget(RunConfiguration *rc)
|
||||
: m_runConfiguration(rc)
|
||||
{
|
||||
auto toplayout = new QFormLayout(this);
|
||||
|
||||
m_qmakeRunConfiguration->extraAspect<ExecutableAspect>()->addToMainConfigurationWidget(this, toplayout);
|
||||
m_qmakeRunConfiguration->extraAspect<ArgumentsAspect>()->addToMainConfigurationWidget(this, toplayout);
|
||||
m_qmakeRunConfiguration->extraAspect<WorkingDirectoryAspect>()->addToMainConfigurationWidget(this, toplayout);
|
||||
m_qmakeRunConfiguration->extraAspect<TerminalAspect>()->addToMainConfigurationWidget(this, toplayout);
|
||||
rc->extraAspect<ExecutableAspect>()->addToMainConfigurationWidget(this, toplayout);
|
||||
rc->extraAspect<ArgumentsAspect>()->addToMainConfigurationWidget(this, toplayout);
|
||||
rc->extraAspect<WorkingDirectoryAspect>()->addToMainConfigurationWidget(this, toplayout);
|
||||
rc->extraAspect<TerminalAspect>()->addToMainConfigurationWidget(this, toplayout);
|
||||
rc->extraAspect<UseLibraryPathsAspect>()->addToMainConfigurationWidget(this, toplayout);
|
||||
|
||||
if (HostOsInfo::isMacHost()) {
|
||||
m_usingDyldImageSuffix = new QCheckBox(tr("Use debug version of frameworks (DYLD_IMAGE_SUFFIX=_debug)"), this);
|
||||
m_usingDyldImageSuffix->setChecked(m_qmakeRunConfiguration->isUsingDyldImageSuffix());
|
||||
toplayout->addRow(QString(), m_usingDyldImageSuffix);
|
||||
connect(m_usingDyldImageSuffix, &QAbstractButton::toggled,
|
||||
this, &DesktopQmakeRunConfigurationWidget::usingDyldImageSuffixToggled);
|
||||
}
|
||||
if (HostOsInfo::isMacHost())
|
||||
rc->extraAspect<UseDyldSuffixAspect>()->addToMainConfigurationWidget(this, toplayout);
|
||||
|
||||
QString librarySeachPathLabel;
|
||||
if (HostOsInfo::isMacHost()) {
|
||||
librarySeachPathLabel
|
||||
= tr("Add build library search path to DYLD_LIBRARY_PATH and DYLD_FRAMEWORK_PATH");
|
||||
} else if (HostOsInfo::isWindowsHost()) {
|
||||
librarySeachPathLabel
|
||||
= tr("Add build library search path to PATH");
|
||||
} else if (HostOsInfo::isLinuxHost() || HostOsInfo::isAnyUnixHost()) {
|
||||
librarySeachPathLabel
|
||||
= tr("Add build library search path to LD_LIBRARY_PATH");
|
||||
}
|
||||
|
||||
if (!librarySeachPathLabel.isEmpty()) {
|
||||
m_usingLibrarySearchPath = new QCheckBox(librarySeachPathLabel);
|
||||
m_usingLibrarySearchPath->setChecked(m_qmakeRunConfiguration->isUsingLibrarySearchPath());
|
||||
toplayout->addRow(QString(), m_usingLibrarySearchPath);
|
||||
connect(m_usingLibrarySearchPath, &QCheckBox::toggled,
|
||||
this, &DesktopQmakeRunConfigurationWidget::usingLibrarySearchPathToggled);
|
||||
}
|
||||
|
||||
connect(qmakeRunConfiguration, &DesktopQmakeRunConfiguration::usingDyldImageSuffixChanged,
|
||||
this, &DesktopQmakeRunConfigurationWidget::usingDyldImageSuffixChanged);
|
||||
connect(qmakeRunConfiguration, &DesktopQmakeRunConfiguration::usingLibrarySearchPathChanged,
|
||||
this, &DesktopQmakeRunConfigurationWidget::usingLibrarySearchPathChanged);
|
||||
|
||||
Core::VariableChooser::addSupportForChildWidgets(this, m_qmakeRunConfiguration->macroExpander());
|
||||
}
|
||||
|
||||
void DesktopQmakeRunConfigurationWidget::usingDyldImageSuffixToggled(bool state)
|
||||
{
|
||||
m_ignoreChange = true;
|
||||
m_qmakeRunConfiguration->setUsingDyldImageSuffix(state);
|
||||
m_ignoreChange = false;
|
||||
}
|
||||
|
||||
void DesktopQmakeRunConfigurationWidget::usingLibrarySearchPathToggled(bool state)
|
||||
{
|
||||
m_ignoreChange = true;
|
||||
m_qmakeRunConfiguration->setUsingLibrarySearchPath(state);
|
||||
m_ignoreChange = false;
|
||||
}
|
||||
|
||||
void DesktopQmakeRunConfigurationWidget::usingDyldImageSuffixChanged(bool state)
|
||||
{
|
||||
if (!m_ignoreChange && m_usingDyldImageSuffix)
|
||||
m_usingDyldImageSuffix->setChecked(state);
|
||||
}
|
||||
|
||||
void DesktopQmakeRunConfigurationWidget::usingLibrarySearchPathChanged(bool state)
|
||||
{
|
||||
if (!m_ignoreChange && m_usingLibrarySearchPath)
|
||||
m_usingLibrarySearchPath->setChecked(state);
|
||||
Core::VariableChooser::addSupportForChildWidgets(this, rc->macroExpander());
|
||||
}
|
||||
|
||||
QWidget *DesktopQmakeRunConfiguration::createConfigurationWidget()
|
||||
@@ -207,8 +159,6 @@ QVariantMap DesktopQmakeRunConfiguration::toMap() const
|
||||
const QDir projectDir = QDir(target()->project()->projectDirectory().toString());
|
||||
QVariantMap map(RunConfiguration::toMap());
|
||||
map.insert(QLatin1String(PRO_FILE_KEY), projectDir.relativeFilePath(proFilePath().toString()));
|
||||
map.insert(QLatin1String(USE_DYLD_IMAGE_SUFFIX_KEY), m_isUsingDyldImageSuffix);
|
||||
map.insert(QLatin1String(USE_LIBRARY_SEARCH_PATH), m_isUsingLibrarySearchPath);
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -218,9 +168,6 @@ bool DesktopQmakeRunConfiguration::fromMap(const QVariantMap &map)
|
||||
if (!res)
|
||||
return false;
|
||||
|
||||
m_isUsingDyldImageSuffix = map.value(QLatin1String(USE_DYLD_IMAGE_SUFFIX_KEY), false).toBool();
|
||||
m_isUsingLibrarySearchPath = map.value(QLatin1String(USE_LIBRARY_SEARCH_PATH), true).toBool();
|
||||
|
||||
updateTargetInformation();
|
||||
return true;
|
||||
}
|
||||
@@ -230,40 +177,17 @@ void DesktopQmakeRunConfiguration::doAdditionalSetup(const RunConfigurationCreat
|
||||
updateTargetInformation();
|
||||
}
|
||||
|
||||
bool DesktopQmakeRunConfiguration::isUsingDyldImageSuffix() const
|
||||
{
|
||||
return m_isUsingDyldImageSuffix;
|
||||
}
|
||||
|
||||
void DesktopQmakeRunConfiguration::setUsingDyldImageSuffix(bool state)
|
||||
{
|
||||
m_isUsingDyldImageSuffix = state;
|
||||
emit usingDyldImageSuffixChanged(state);
|
||||
|
||||
return extraAspect<LocalEnvironmentAspect>()->environmentChanged();
|
||||
}
|
||||
|
||||
bool DesktopQmakeRunConfiguration::isUsingLibrarySearchPath() const
|
||||
{
|
||||
return m_isUsingLibrarySearchPath;
|
||||
}
|
||||
|
||||
void DesktopQmakeRunConfiguration::setUsingLibrarySearchPath(bool state)
|
||||
{
|
||||
m_isUsingLibrarySearchPath = state;
|
||||
emit usingLibrarySearchPathChanged(state);
|
||||
|
||||
return extraAspect<LocalEnvironmentAspect>()->environmentChanged();
|
||||
}
|
||||
|
||||
void DesktopQmakeRunConfiguration::addToBaseEnvironment(Environment &env) const
|
||||
{
|
||||
BuildTargetInfo bti = target()->applicationTargets().buildTargetInfo(buildKey());
|
||||
if (bti.runEnvModifier)
|
||||
bti.runEnvModifier(env, m_isUsingLibrarySearchPath);
|
||||
if (m_isUsingDyldImageSuffix)
|
||||
bti.runEnvModifier(env, extraAspect<UseLibraryPathsAspect>()->value());
|
||||
|
||||
if (auto dyldAspect = extraAspect<UseDyldSuffixAspect>()) {
|
||||
if (dyldAspect->value())
|
||||
env.set(QLatin1String("DYLD_IMAGE_SUFFIX"), QLatin1String("_debug"));
|
||||
}
|
||||
}
|
||||
|
||||
bool DesktopQmakeRunConfiguration::canRunForNode(const Node *node) const
|
||||
{
|
||||
|
@@ -30,14 +30,6 @@
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QCheckBox;
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace QmakeProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
@@ -51,21 +43,12 @@ public:
|
||||
QWidget *createConfigurationWidget() override;
|
||||
|
||||
ProjectExplorer::Runnable runnable() const override;
|
||||
|
||||
bool isUsingDyldImageSuffix() const;
|
||||
void setUsingDyldImageSuffix(bool state);
|
||||
|
||||
bool isUsingLibrarySearchPath() const;
|
||||
void setUsingLibrarySearchPath(bool state);
|
||||
|
||||
QVariantMap toMap() const override;
|
||||
|
||||
void addToBaseEnvironment(Utils::Environment &env) const;
|
||||
|
||||
signals:
|
||||
void baseWorkingDirectoryChanged(const QString&);
|
||||
void usingDyldImageSuffixChanged(bool);
|
||||
void usingLibrarySearchPathChanged(bool);
|
||||
|
||||
// Note: These signals might not get emitted for every change!
|
||||
void effectiveTargetInformationChanged();
|
||||
@@ -80,8 +63,6 @@ private:
|
||||
bool canRunForNode(const ProjectExplorer::Node *node) const final;
|
||||
|
||||
Utils::FileName proFilePath() const;
|
||||
bool m_isUsingDyldImageSuffix = false;
|
||||
bool m_isUsingLibrarySearchPath = true;
|
||||
};
|
||||
|
||||
class DesktopQmakeRunConfigurationWidget : public QWidget
|
||||
@@ -89,20 +70,10 @@ class DesktopQmakeRunConfigurationWidget : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DesktopQmakeRunConfigurationWidget(DesktopQmakeRunConfiguration *qmakeRunConfiguration);
|
||||
explicit DesktopQmakeRunConfigurationWidget(ProjectExplorer::RunConfiguration *rc);
|
||||
|
||||
private:
|
||||
void usingDyldImageSuffixToggled(bool);
|
||||
void usingDyldImageSuffixChanged(bool);
|
||||
void usingLibrarySearchPathToggled(bool state);
|
||||
void usingLibrarySearchPathChanged(bool state);
|
||||
|
||||
private:
|
||||
DesktopQmakeRunConfiguration *m_qmakeRunConfiguration = nullptr;
|
||||
bool m_ignoreChange = false;
|
||||
QCheckBox *m_usingDyldImageSuffix = nullptr;
|
||||
QCheckBox *m_usingLibrarySearchPath = nullptr;
|
||||
QLineEdit *m_qmlDebugPort = nullptr;
|
||||
ProjectExplorer::RunConfiguration *m_runConfiguration = nullptr;
|
||||
};
|
||||
|
||||
class DesktopQmakeRunConfigurationFactory : public ProjectExplorer::RunConfigurationFactory
|
||||
|
Reference in New Issue
Block a user