forked from qt-creator/qt-creator
De-noise RunConfigurations
Change-Id: I9def38768c0243358022f56bba80af2080ac8d05 Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -55,6 +55,7 @@
|
||||
|
||||
using namespace CMakeProjectManager;
|
||||
using namespace CMakeProjectManager::Internal;
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace {
|
||||
const char CMAKE_RC_PREFIX[] = "CMakeProjectManager.CMakeRunConfiguration.";
|
||||
@@ -66,21 +67,21 @@ const char ARGUMENTS_KEY[] = "CMakeProjectManager.CMakeRunConfiguration.Argument
|
||||
|
||||
} // namespace
|
||||
|
||||
CMakeRunConfiguration::CMakeRunConfiguration(ProjectExplorer::Target *parent, Core::Id id, const QString &target,
|
||||
CMakeRunConfiguration::CMakeRunConfiguration(Target *parent, Core::Id id, const QString &target,
|
||||
const QString &workingDirectory, const QString &title) :
|
||||
ProjectExplorer::LocalApplicationRunConfiguration(parent, id),
|
||||
LocalApplicationRunConfiguration(parent, id),
|
||||
m_runMode(Gui),
|
||||
m_buildTarget(target),
|
||||
m_workingDirectory(workingDirectory),
|
||||
m_title(title),
|
||||
m_enabled(true)
|
||||
{
|
||||
addExtraAspect(new ProjectExplorer::LocalEnvironmentAspect(this));
|
||||
addExtraAspect(new LocalEnvironmentAspect(this));
|
||||
ctor();
|
||||
}
|
||||
|
||||
CMakeRunConfiguration::CMakeRunConfiguration(ProjectExplorer::Target *parent, CMakeRunConfiguration *source) :
|
||||
ProjectExplorer::LocalApplicationRunConfiguration(parent, source),
|
||||
CMakeRunConfiguration::CMakeRunConfiguration(Target *parent, CMakeRunConfiguration *source) :
|
||||
LocalApplicationRunConfiguration(parent, source),
|
||||
m_runMode(source->m_runMode),
|
||||
m_buildTarget(source->m_buildTarget),
|
||||
m_workingDirectory(source->m_workingDirectory),
|
||||
@@ -106,7 +107,7 @@ QString CMakeRunConfiguration::executable() const
|
||||
return m_buildTarget;
|
||||
}
|
||||
|
||||
ProjectExplorer::LocalApplicationRunConfiguration::RunMode CMakeRunConfiguration::runMode() const
|
||||
LocalApplicationRunConfiguration::RunMode CMakeRunConfiguration::runMode() const
|
||||
{
|
||||
return m_runMode;
|
||||
}
|
||||
@@ -118,7 +119,7 @@ void CMakeRunConfiguration::setRunMode(RunMode runMode)
|
||||
|
||||
QString CMakeRunConfiguration::workingDirectory() const
|
||||
{
|
||||
ProjectExplorer::EnvironmentAspect *aspect = extraAspect<ProjectExplorer::EnvironmentAspect>();
|
||||
EnvironmentAspect *aspect = extraAspect<EnvironmentAspect>();
|
||||
QTC_ASSERT(aspect, return QString());
|
||||
return QDir::cleanPath(aspect->environment().expandVariables(
|
||||
Utils::expandMacros(baseWorkingDirectory(), macroExpander())));
|
||||
@@ -170,7 +171,7 @@ void CMakeRunConfiguration::setUserWorkingDirectory(const QString &wd)
|
||||
|
||||
QVariantMap CMakeRunConfiguration::toMap() const
|
||||
{
|
||||
QVariantMap map(ProjectExplorer::LocalApplicationRunConfiguration::toMap());
|
||||
QVariantMap map(LocalApplicationRunConfiguration::toMap());
|
||||
|
||||
map.insert(QLatin1String(USER_WORKING_DIRECTORY_KEY), m_userWorkingDirectory);
|
||||
map.insert(QLatin1String(USE_TERMINAL_KEY), m_runMode == Console);
|
||||
@@ -251,8 +252,8 @@ CMakeRunConfigurationWidget::CMakeRunConfigurationWidget(CMakeRunConfiguration *
|
||||
m_workingDirectoryEdit->setBaseFileName(m_cmakeRunConfiguration->target()->project()->projectDirectory());
|
||||
m_workingDirectoryEdit->setPath(m_cmakeRunConfiguration->baseWorkingDirectory());
|
||||
m_workingDirectoryEdit->setHistoryCompleter(QLatin1String("CMake.WorkingDir.History"));
|
||||
ProjectExplorer::EnvironmentAspect *aspect
|
||||
= m_cmakeRunConfiguration->extraAspect<ProjectExplorer::EnvironmentAspect>();
|
||||
EnvironmentAspect *aspect
|
||||
= m_cmakeRunConfiguration->extraAspect<EnvironmentAspect>();
|
||||
if (aspect) {
|
||||
connect(aspect, SIGNAL(environmentChanged()), this, SLOT(environmentWasChanged()));
|
||||
environmentWasChanged();
|
||||
@@ -325,14 +326,13 @@ void CMakeRunConfigurationWidget::resetWorkingDirectory()
|
||||
|
||||
void CMakeRunConfigurationWidget::runInTerminalToggled(bool toggled)
|
||||
{
|
||||
m_cmakeRunConfiguration->setRunMode(toggled ? ProjectExplorer::LocalApplicationRunConfiguration::Console
|
||||
: ProjectExplorer::LocalApplicationRunConfiguration::Gui);
|
||||
m_cmakeRunConfiguration->setRunMode(toggled ? LocalApplicationRunConfiguration::Console
|
||||
: LocalApplicationRunConfiguration::Gui);
|
||||
}
|
||||
|
||||
void CMakeRunConfigurationWidget::environmentWasChanged()
|
||||
{
|
||||
ProjectExplorer::EnvironmentAspect *aspect
|
||||
= m_cmakeRunConfiguration->extraAspect<ProjectExplorer::EnvironmentAspect>();
|
||||
EnvironmentAspect *aspect = m_cmakeRunConfiguration->extraAspect<EnvironmentAspect>();
|
||||
QTC_ASSERT(aspect, return);
|
||||
m_workingDirectoryEdit->setEnvironment(aspect->environment());
|
||||
}
|
||||
@@ -343,7 +343,7 @@ void CMakeRunConfigurationWidget::setArguments(const QString &args)
|
||||
|
||||
// Factory
|
||||
CMakeRunConfigurationFactory::CMakeRunConfigurationFactory(QObject *parent) :
|
||||
ProjectExplorer::IRunConfigurationFactory(parent)
|
||||
IRunConfigurationFactory(parent)
|
||||
{ setObjectName(QLatin1String("CMakeRunConfigurationFactory")); }
|
||||
|
||||
CMakeRunConfigurationFactory::~CMakeRunConfigurationFactory()
|
||||
@@ -351,7 +351,7 @@ CMakeRunConfigurationFactory::~CMakeRunConfigurationFactory()
|
||||
}
|
||||
|
||||
// used to show the list of possible additons to a project, returns a list of ids
|
||||
QList<Core::Id> CMakeRunConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const
|
||||
QList<Core::Id> CMakeRunConfigurationFactory::availableCreationIds(Target *parent) const
|
||||
{
|
||||
if (!canHandle(parent))
|
||||
return QList<Core::Id>();
|
||||
@@ -368,14 +368,14 @@ QString CMakeRunConfigurationFactory::displayNameForId(const Core::Id id) const
|
||||
return buildTargetFromId(id);
|
||||
}
|
||||
|
||||
bool CMakeRunConfigurationFactory::canHandle(ProjectExplorer::Target *parent) const
|
||||
bool CMakeRunConfigurationFactory::canHandle(Target *parent) const
|
||||
{
|
||||
if (!parent->project()->supportsKit(parent->kit()))
|
||||
return false;
|
||||
return qobject_cast<CMakeProject *>(parent->project());
|
||||
}
|
||||
|
||||
bool CMakeRunConfigurationFactory::canCreate(ProjectExplorer::Target *parent, const Core::Id id) const
|
||||
bool CMakeRunConfigurationFactory::canCreate(Target *parent, const Core::Id id) const
|
||||
{
|
||||
if (!canHandle(parent))
|
||||
return false;
|
||||
@@ -383,8 +383,7 @@ bool CMakeRunConfigurationFactory::canCreate(ProjectExplorer::Target *parent, co
|
||||
return project->hasBuildTarget(buildTargetFromId(id));
|
||||
}
|
||||
|
||||
ProjectExplorer::RunConfiguration *CMakeRunConfigurationFactory::doCreate(ProjectExplorer::Target *parent,
|
||||
const Core::Id id)
|
||||
RunConfiguration *CMakeRunConfigurationFactory::doCreate(Target *parent, const Core::Id id)
|
||||
{
|
||||
CMakeProject *project = static_cast<CMakeProject *>(parent->project());
|
||||
const QString title(buildTargetFromId(id));
|
||||
@@ -392,14 +391,14 @@ ProjectExplorer::RunConfiguration *CMakeRunConfigurationFactory::doCreate(Projec
|
||||
return new CMakeRunConfiguration(parent, id, ct.executable, ct.workingDirectory, ct.title);
|
||||
}
|
||||
|
||||
bool CMakeRunConfigurationFactory::canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const
|
||||
bool CMakeRunConfigurationFactory::canClone(Target *parent, RunConfiguration *source) const
|
||||
{
|
||||
if (!canHandle(parent))
|
||||
return false;
|
||||
return source->id().name().startsWith(CMAKE_RC_PREFIX);
|
||||
}
|
||||
|
||||
ProjectExplorer::RunConfiguration *CMakeRunConfigurationFactory::clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration * source)
|
||||
RunConfiguration *CMakeRunConfigurationFactory::clone(Target *parent, RunConfiguration * source)
|
||||
{
|
||||
if (!canClone(parent, source))
|
||||
return 0;
|
||||
@@ -407,18 +406,16 @@ ProjectExplorer::RunConfiguration *CMakeRunConfigurationFactory::clone(ProjectEx
|
||||
return new CMakeRunConfiguration(parent, crc);
|
||||
}
|
||||
|
||||
bool CMakeRunConfigurationFactory::canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const
|
||||
bool CMakeRunConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
|
||||
{
|
||||
if (!qobject_cast<CMakeProject *>(parent->project()))
|
||||
return false;
|
||||
return ProjectExplorer::idFromMap(map).name().startsWith(CMAKE_RC_PREFIX);
|
||||
return idFromMap(map).name().startsWith(CMAKE_RC_PREFIX);
|
||||
}
|
||||
|
||||
ProjectExplorer::RunConfiguration *CMakeRunConfigurationFactory::doRestore(ProjectExplorer::Target *parent,
|
||||
const QVariantMap &map)
|
||||
RunConfiguration *CMakeRunConfigurationFactory::doRestore(Target *parent, const QVariantMap &map)
|
||||
{
|
||||
return new CMakeRunConfiguration(parent, ProjectExplorer::idFromMap(map),
|
||||
QString(), QString(), QString());
|
||||
return new CMakeRunConfiguration(parent, idFromMap(map), QString(), QString(), QString());
|
||||
}
|
||||
|
||||
QString CMakeRunConfigurationFactory::buildTargetFromId(Core::Id id)
|
||||
|
||||
@@ -162,8 +162,7 @@ void IosRunConfiguration::updateDisplayNames()
|
||||
m_deviceType = IosDeviceType::IosDevice;
|
||||
else if (m_deviceType == IosDeviceType::IosDevice)
|
||||
m_deviceType = IosDeviceType::SimulatedIphoneRetina4Inch;
|
||||
ProjectExplorer::IDevice::ConstPtr dev =
|
||||
ProjectExplorer::DeviceKitInformation::device(target()->kit());
|
||||
IDevice::ConstPtr dev = DeviceKitInformation::device(target()->kit());
|
||||
const QString devName = dev.isNull() ? IosDevice::name() : dev->displayName();
|
||||
setDefaultDisplayName(tr("Run on %1").arg(devName));
|
||||
setDisplayName(tr("Run %1 on %2").arg(applicationName()).arg(devName));
|
||||
@@ -173,9 +172,9 @@ IosDeployStep *IosRunConfiguration::deployStep() const
|
||||
{
|
||||
IosDeployStep * step = 0;
|
||||
DeployConfiguration *config = target()->activeDeployConfiguration();
|
||||
ProjectExplorer::BuildStepList *bsl = config->stepList();
|
||||
BuildStepList *bsl = config->stepList();
|
||||
if (bsl) {
|
||||
const QList<ProjectExplorer::BuildStep *> &buildSteps = bsl->steps();
|
||||
const QList<BuildStep *> &buildSteps = bsl->steps();
|
||||
for (int i = buildSteps.count() - 1; i >= 0; --i) {
|
||||
step = qobject_cast<IosDeployStep *>(buildSteps.at(i));
|
||||
if (step)
|
||||
@@ -210,7 +209,7 @@ QString IosRunConfiguration::applicationName() const
|
||||
Utils::FileName IosRunConfiguration::bundleDirectory() const
|
||||
{
|
||||
Utils::FileName res;
|
||||
Core::Id devType = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(target()->kit());
|
||||
Core::Id devType = DeviceTypeKitInformation::deviceTypeId(target()->kit());
|
||||
bool isDevice = (devType == Constants::IOS_DEVICE_TYPE);
|
||||
if (!isDevice && devType != Constants::IOS_SIMULATOR_TYPE) {
|
||||
qDebug() << "unexpected device type in bundleDirForTarget: " << devType.toString();
|
||||
@@ -291,10 +290,10 @@ bool IosRunConfiguration::isEnabled() const
|
||||
{
|
||||
if (m_parseInProgress || !m_parseSuccess)
|
||||
return false;
|
||||
Core::Id devType = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(target()->kit());
|
||||
Core::Id devType = DeviceTypeKitInformation::deviceTypeId(target()->kit());
|
||||
if (devType != Constants::IOS_DEVICE_TYPE && devType != Constants::IOS_SIMULATOR_TYPE)
|
||||
return false;
|
||||
IDevice::ConstPtr dev = ProjectExplorer::DeviceKitInformation::device(target()->kit());
|
||||
IDevice::ConstPtr dev = DeviceKitInformation::device(target()->kit());
|
||||
if (dev.isNull() || dev->deviceState() != IDevice::DeviceReadyToUse)
|
||||
return false;
|
||||
return RunConfiguration::isEnabled();
|
||||
@@ -308,10 +307,10 @@ QString IosRunConfiguration::disabledReason() const
|
||||
if (!m_parseSuccess)
|
||||
return static_cast<QmakeProject *>(target()->project())
|
||||
->disabledReasonForRunConfiguration(m_profilePath);
|
||||
Core::Id devType = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(target()->kit());
|
||||
Core::Id devType = DeviceTypeKitInformation::deviceTypeId(target()->kit());
|
||||
if (devType != Constants::IOS_DEVICE_TYPE && devType != Constants::IOS_SIMULATOR_TYPE)
|
||||
return tr("Kit has incorrect device type for running on iOS devices.");
|
||||
IDevice::ConstPtr dev = ProjectExplorer::DeviceKitInformation::device(target()->kit());
|
||||
IDevice::ConstPtr dev = DeviceKitInformation::device(target()->kit());
|
||||
QString validDevName;
|
||||
bool hasConncetedDev = false;
|
||||
if (devType == Constants::IOS_DEVICE_TYPE) {
|
||||
|
||||
@@ -59,6 +59,8 @@
|
||||
#include <QComboBox>
|
||||
#include <QDir>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace {
|
||||
|
||||
const char QBS_RC_PREFIX[] = "Qbs.RunConfiguration:";
|
||||
@@ -89,19 +91,19 @@ namespace Internal {
|
||||
// QbsRunConfiguration:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
QbsRunConfiguration::QbsRunConfiguration(ProjectExplorer::Target *parent, Core::Id id) :
|
||||
QbsRunConfiguration::QbsRunConfiguration(Target *parent, Core::Id id) :
|
||||
LocalApplicationRunConfiguration(parent, id),
|
||||
m_qbsProduct(productFromId(id)),
|
||||
m_runMode(Gui),
|
||||
m_currentInstallStep(0),
|
||||
m_currentBuildStepList(0)
|
||||
{
|
||||
addExtraAspect(new ProjectExplorer::LocalEnvironmentAspect(this));
|
||||
addExtraAspect(new LocalEnvironmentAspect(this));
|
||||
|
||||
ctor();
|
||||
}
|
||||
|
||||
QbsRunConfiguration::QbsRunConfiguration(ProjectExplorer::Target *parent, QbsRunConfiguration *source) :
|
||||
QbsRunConfiguration::QbsRunConfiguration(Target *parent, QbsRunConfiguration *source) :
|
||||
LocalApplicationRunConfiguration(parent, source),
|
||||
m_qbsProduct(source->m_qbsProduct),
|
||||
m_commandLineArguments(source->m_commandLineArguments),
|
||||
@@ -207,7 +209,7 @@ QString QbsRunConfiguration::executable() const
|
||||
return pro->qbsProject().targetExecutable(product, installOptions());
|
||||
}
|
||||
|
||||
ProjectExplorer::LocalApplicationRunConfiguration::RunMode QbsRunConfiguration::runMode() const
|
||||
LocalApplicationRunConfiguration::RunMode QbsRunConfiguration::runMode() const
|
||||
{
|
||||
return m_runMode;
|
||||
}
|
||||
@@ -226,8 +228,7 @@ bool QbsRunConfiguration::isConsoleApplication() const
|
||||
|
||||
QString QbsRunConfiguration::workingDirectory() const
|
||||
{
|
||||
ProjectExplorer::EnvironmentAspect *aspect
|
||||
= extraAspect<ProjectExplorer::EnvironmentAspect>();
|
||||
EnvironmentAspect *aspect = extraAspect<EnvironmentAspect>();
|
||||
QTC_ASSERT(aspect, baseWorkingDirectory());
|
||||
return QDir::cleanPath(aspect->environment().expandVariables(
|
||||
Utils::expandMacros(baseWorkingDirectory(), macroExpander())));
|
||||
@@ -338,7 +339,7 @@ QbsRunConfigurationWidget::QbsRunConfigurationWidget(QbsRunConfiguration *rc, QW
|
||||
QHBoxLayout *hl = new QHBoxLayout();
|
||||
hl->addStretch();
|
||||
m_disabledIcon = new QLabel(this);
|
||||
m_disabledIcon->setPixmap(QPixmap(QLatin1String(ProjectExplorer::Constants::ICON_WARNING)));
|
||||
m_disabledIcon->setPixmap(QPixmap(QLatin1String(Constants::ICON_WARNING)));
|
||||
hl->addWidget(m_disabledIcon);
|
||||
m_disabledReason = new QLabel(this);
|
||||
m_disabledReason->setVisible(false);
|
||||
@@ -368,8 +369,7 @@ QbsRunConfigurationWidget::QbsRunConfigurationWidget(QbsRunConfiguration *rc, QW
|
||||
m_workingDirectoryEdit = new Utils::PathChooser(this);
|
||||
m_workingDirectoryEdit->setHistoryCompleter(QLatin1String("Qbs.WorkingDir.History"));
|
||||
m_workingDirectoryEdit->setExpectedKind(Utils::PathChooser::Directory);
|
||||
ProjectExplorer::EnvironmentAspect *aspect
|
||||
= m_rc->extraAspect<ProjectExplorer::EnvironmentAspect>();
|
||||
EnvironmentAspect *aspect = m_rc->extraAspect<EnvironmentAspect>();
|
||||
if (aspect) {
|
||||
connect(aspect, SIGNAL(environmentChanged()), this, SLOT(environmentWasChanged()));
|
||||
environmentWasChanged();
|
||||
@@ -422,8 +422,7 @@ QbsRunConfigurationWidget::QbsRunConfigurationWidget(QbsRunConfiguration *rc, QW
|
||||
|
||||
void QbsRunConfigurationWidget::environmentWasChanged()
|
||||
{
|
||||
ProjectExplorer::EnvironmentAspect *aspect
|
||||
= m_rc->extraAspect<ProjectExplorer::EnvironmentAspect>();
|
||||
EnvironmentAspect *aspect = m_rc->extraAspect<EnvironmentAspect>();
|
||||
QTC_ASSERT(aspect, return);
|
||||
m_workingDirectoryEdit->setEnvironment(aspect->environment());
|
||||
}
|
||||
@@ -435,7 +434,7 @@ void QbsRunConfigurationWidget::runConfigurationEnabledChange()
|
||||
m_disabledReason->setVisible(!enabled);
|
||||
m_disabledReason->setText(m_rc->disabledReason());
|
||||
|
||||
m_useTerminalCheck->setChecked(m_rc->runMode() == ProjectExplorer::LocalApplicationRunConfiguration::Console);
|
||||
m_useTerminalCheck->setChecked(m_rc->runMode() == LocalApplicationRunConfiguration::Console);
|
||||
targetInformationHasChanged();
|
||||
}
|
||||
|
||||
@@ -465,8 +464,8 @@ void QbsRunConfigurationWidget::argumentsEdited(const QString &args)
|
||||
void QbsRunConfigurationWidget::termToggled(bool on)
|
||||
{
|
||||
m_ignoreChange = true;
|
||||
m_rc->setRunMode(on ? ProjectExplorer::LocalApplicationRunConfiguration::Console
|
||||
: ProjectExplorer::LocalApplicationRunConfiguration::Gui);
|
||||
m_rc->setRunMode(on ? LocalApplicationRunConfiguration::Console
|
||||
: LocalApplicationRunConfiguration::Gui);
|
||||
m_ignoreChange = false;
|
||||
}
|
||||
|
||||
@@ -493,10 +492,10 @@ void QbsRunConfigurationWidget::commandLineArgumentsChanged(const QString &args)
|
||||
m_argumentsLineEdit->setText(args);
|
||||
}
|
||||
|
||||
void QbsRunConfigurationWidget::runModeChanged(ProjectExplorer::LocalApplicationRunConfiguration::RunMode runMode)
|
||||
void QbsRunConfigurationWidget::runModeChanged(LocalApplicationRunConfiguration::RunMode runMode)
|
||||
{
|
||||
if (!m_ignoreChange)
|
||||
m_useTerminalCheck->setChecked(runMode == ProjectExplorer::LocalApplicationRunConfiguration::Console);
|
||||
m_useTerminalCheck->setChecked(runMode == LocalApplicationRunConfiguration::Console);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
@@ -504,7 +503,7 @@ void QbsRunConfigurationWidget::runModeChanged(ProjectExplorer::LocalApplication
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
QbsRunConfigurationFactory::QbsRunConfigurationFactory(QObject *parent) :
|
||||
ProjectExplorer::IRunConfigurationFactory(parent)
|
||||
IRunConfigurationFactory(parent)
|
||||
{
|
||||
setObjectName(QLatin1String("QbsRunConfigurationFactory"));
|
||||
}
|
||||
@@ -512,7 +511,7 @@ QbsRunConfigurationFactory::QbsRunConfigurationFactory(QObject *parent) :
|
||||
QbsRunConfigurationFactory::~QbsRunConfigurationFactory()
|
||||
{ }
|
||||
|
||||
bool QbsRunConfigurationFactory::canCreate(ProjectExplorer::Target *parent, const Core::Id id) const
|
||||
bool QbsRunConfigurationFactory::canCreate(Target *parent, const Core::Id id) const
|
||||
{
|
||||
if (!canHandle(parent))
|
||||
return false;
|
||||
@@ -521,30 +520,29 @@ bool QbsRunConfigurationFactory::canCreate(ProjectExplorer::Target *parent, cons
|
||||
return findProduct(project->qbsProjectData(), productFromId(id)).isValid();
|
||||
}
|
||||
|
||||
ProjectExplorer::RunConfiguration *QbsRunConfigurationFactory::doCreate(ProjectExplorer::Target *parent, const Core::Id id)
|
||||
RunConfiguration *QbsRunConfigurationFactory::doCreate(Target *parent, const Core::Id id)
|
||||
{
|
||||
return new QbsRunConfiguration(parent, id);
|
||||
}
|
||||
|
||||
bool QbsRunConfigurationFactory::canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const
|
||||
bool QbsRunConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
|
||||
{
|
||||
if (!canHandle(parent))
|
||||
return false;
|
||||
return ProjectExplorer::idFromMap(map).toString().startsWith(QLatin1String(QBS_RC_PREFIX));
|
||||
return idFromMap(map).toString().startsWith(QLatin1String(QBS_RC_PREFIX));
|
||||
}
|
||||
|
||||
ProjectExplorer::RunConfiguration *QbsRunConfigurationFactory::doRestore(ProjectExplorer::Target *parent,
|
||||
const QVariantMap &map)
|
||||
RunConfiguration *QbsRunConfigurationFactory::doRestore(Target *parent, const QVariantMap &map)
|
||||
{
|
||||
return new QbsRunConfiguration(parent, ProjectExplorer::idFromMap(map));
|
||||
return new QbsRunConfiguration(parent, idFromMap(map));
|
||||
}
|
||||
|
||||
bool QbsRunConfigurationFactory::canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const
|
||||
bool QbsRunConfigurationFactory::canClone(Target *parent, RunConfiguration *source) const
|
||||
{
|
||||
return canCreate(parent, source->id());
|
||||
}
|
||||
|
||||
ProjectExplorer::RunConfiguration *QbsRunConfigurationFactory::clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source)
|
||||
RunConfiguration *QbsRunConfigurationFactory::clone(Target *parent, RunConfiguration *source)
|
||||
{
|
||||
if (!canClone(parent, source))
|
||||
return 0;
|
||||
@@ -552,7 +550,7 @@ ProjectExplorer::RunConfiguration *QbsRunConfigurationFactory::clone(ProjectExpl
|
||||
return new QbsRunConfiguration(parent, old);
|
||||
}
|
||||
|
||||
QList<Core::Id> QbsRunConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const
|
||||
QList<Core::Id> QbsRunConfigurationFactory::availableCreationIds(Target *parent) const
|
||||
{
|
||||
QList<Core::Id> result;
|
||||
if (!canHandle(parent))
|
||||
@@ -575,14 +573,14 @@ QString QbsRunConfigurationFactory::displayNameForId(const Core::Id id) const
|
||||
return productFromId(id);
|
||||
}
|
||||
|
||||
bool QbsRunConfigurationFactory::canHandle(ProjectExplorer::Target *t) const
|
||||
bool QbsRunConfigurationFactory::canHandle(Target *t) const
|
||||
{
|
||||
if (!t->project()->supportsKit(t->kit()))
|
||||
return false;
|
||||
if (!qobject_cast<QbsProject *>(t->project()))
|
||||
return false;
|
||||
Core::Id devType = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(t->kit());
|
||||
return devType == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE;
|
||||
Core::Id devType = DeviceTypeKitInformation::deviceTypeId(t->kit());
|
||||
return devType == Constants::DESKTOP_DEVICE_TYPE;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -46,14 +46,15 @@
|
||||
#include <utils/winutils.h>
|
||||
|
||||
using namespace Core;
|
||||
using namespace ProjectExplorer;
|
||||
using namespace QmlProjectManager::Internal;
|
||||
|
||||
namespace QmlProjectManager {
|
||||
|
||||
const char M_CURRENT_FILE[] = "CurrentFile";
|
||||
|
||||
QmlProjectRunConfiguration::QmlProjectRunConfiguration(ProjectExplorer::Target *parent, Id id) :
|
||||
ProjectExplorer::LocalApplicationRunConfiguration(parent, id),
|
||||
QmlProjectRunConfiguration::QmlProjectRunConfiguration(Target *parent, Id id) :
|
||||
LocalApplicationRunConfiguration(parent, id),
|
||||
m_scriptFile(QLatin1String(M_CURRENT_FILE)),
|
||||
m_isEnabled(false)
|
||||
{
|
||||
@@ -62,9 +63,9 @@ QmlProjectRunConfiguration::QmlProjectRunConfiguration(ProjectExplorer::Target *
|
||||
ctor();
|
||||
}
|
||||
|
||||
QmlProjectRunConfiguration::QmlProjectRunConfiguration(ProjectExplorer::Target *parent,
|
||||
QmlProjectRunConfiguration::QmlProjectRunConfiguration(Target *parent,
|
||||
QmlProjectRunConfiguration *source) :
|
||||
ProjectExplorer::LocalApplicationRunConfiguration(parent, source),
|
||||
LocalApplicationRunConfiguration(parent, source),
|
||||
m_currentFileFilename(source->m_currentFileFilename),
|
||||
m_mainScriptFilename(source->m_mainScriptFilename),
|
||||
m_scriptFile(source->m_scriptFile),
|
||||
@@ -114,7 +115,7 @@ QString QmlProjectRunConfiguration::executable() const
|
||||
return version->qmlviewerCommand();
|
||||
}
|
||||
|
||||
ProjectExplorer::LocalApplicationRunConfiguration::RunMode QmlProjectRunConfiguration::runMode() const
|
||||
LocalApplicationRunConfiguration::RunMode QmlProjectRunConfiguration::runMode() const
|
||||
{
|
||||
return Gui;
|
||||
}
|
||||
@@ -218,16 +219,16 @@ void QmlProjectRunConfiguration::setScriptSource(MainScriptSource source,
|
||||
emit scriptSourceChanged();
|
||||
}
|
||||
|
||||
ProjectExplorer::Abi QmlProjectRunConfiguration::abi() const
|
||||
Abi QmlProjectRunConfiguration::abi() const
|
||||
{
|
||||
ProjectExplorer::Abi hostAbi = ProjectExplorer::Abi::hostAbi();
|
||||
return ProjectExplorer::Abi(hostAbi.architecture(), hostAbi.os(), hostAbi.osFlavor(),
|
||||
ProjectExplorer::Abi::RuntimeQmlFormat, hostAbi.wordWidth());
|
||||
Abi hostAbi = Abi::hostAbi();
|
||||
return Abi(hostAbi.architecture(), hostAbi.os(), hostAbi.osFlavor(),
|
||||
Abi::RuntimeQmlFormat, hostAbi.wordWidth());
|
||||
}
|
||||
|
||||
QVariantMap QmlProjectRunConfiguration::toMap() const
|
||||
{
|
||||
QVariantMap map(ProjectExplorer::RunConfiguration::toMap());
|
||||
QVariantMap map(RunConfiguration::toMap());
|
||||
|
||||
map.insert(QLatin1String(Constants::QML_VIEWER_ARGUMENTS_KEY), m_qmlViewerArgs);
|
||||
map.insert(QLatin1String(Constants::QML_MAINSCRIPT_KEY), m_scriptFile);
|
||||
@@ -273,7 +274,7 @@ void QmlProjectRunConfiguration::updateEnabled()
|
||||
|| MimeDatabase::findByFile(mainScript()).type() == QLatin1String("application/x-qmlproject")) {
|
||||
// find a qml file with lowercase filename. This is slow, but only done
|
||||
// in initialization/other border cases.
|
||||
foreach (const QString &filename, target()->project()->files(ProjectExplorer::Project::AllFiles)) {
|
||||
foreach (const QString &filename, target()->project()->files(Project::AllFiles)) {
|
||||
const QFileInfo fi(filename);
|
||||
|
||||
if (!filename.isEmpty() && fi.baseName()[0].isLower()
|
||||
|
||||
@@ -43,17 +43,18 @@
|
||||
|
||||
using namespace Qnx;
|
||||
using namespace Qnx::Internal;
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
BlackBerryRunConfiguration::BlackBerryRunConfiguration(ProjectExplorer::Target *parent, const Core::Id id, const QString &path)
|
||||
: ProjectExplorer::RunConfiguration(parent, id)
|
||||
BlackBerryRunConfiguration::BlackBerryRunConfiguration(Target *parent, const Core::Id id, const QString &path)
|
||||
: RunConfiguration(parent, id)
|
||||
, m_proFilePath(path)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
BlackBerryRunConfiguration::BlackBerryRunConfiguration(ProjectExplorer::Target *parent,
|
||||
BlackBerryRunConfiguration *source)
|
||||
: ProjectExplorer::RunConfiguration(parent, source)
|
||||
BlackBerryRunConfiguration::BlackBerryRunConfiguration(Target *parent,
|
||||
BlackBerryRunConfiguration *source)
|
||||
: RunConfiguration(parent, source)
|
||||
, m_proFilePath(source->m_proFilePath)
|
||||
{
|
||||
init();
|
||||
@@ -117,7 +118,7 @@ QString BlackBerryRunConfiguration::localExecutableFilePath() const
|
||||
|
||||
bool BlackBerryRunConfiguration::fromMap(const QVariantMap &map)
|
||||
{
|
||||
if (!ProjectExplorer::RunConfiguration::fromMap(map))
|
||||
if (!RunConfiguration::fromMap(map))
|
||||
return false;
|
||||
|
||||
m_proFilePath = map.value(QLatin1String(Constants::QNX_PROFILEPATH_KEY)).toString();
|
||||
@@ -130,7 +131,7 @@ bool BlackBerryRunConfiguration::fromMap(const QVariantMap &map)
|
||||
|
||||
QVariantMap BlackBerryRunConfiguration::toMap() const
|
||||
{
|
||||
QVariantMap map(ProjectExplorer::RunConfiguration::toMap());
|
||||
QVariantMap map(RunConfiguration::toMap());
|
||||
map.insert(QLatin1String(Constants::QNX_PROFILEPATH_KEY), m_proFilePath);
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
|
||||
using namespace QtSupport;
|
||||
using namespace QtSupport::Internal;
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace {
|
||||
const char CUSTOM_EXECUTABLE_ID[] = "ProjectExplorer.CustomExecutableRunConfiguration";
|
||||
@@ -67,21 +68,21 @@ void CustomExecutableRunConfiguration::ctor()
|
||||
setDefaultDisplayName(defaultDisplayName());
|
||||
}
|
||||
|
||||
CustomExecutableRunConfiguration::CustomExecutableRunConfiguration(ProjectExplorer::Target *parent) :
|
||||
ProjectExplorer::LocalApplicationRunConfiguration(parent, Core::Id(CUSTOM_EXECUTABLE_ID)),
|
||||
m_workingDirectory(QLatin1String(ProjectExplorer::Constants::DEFAULT_WORKING_DIR)),
|
||||
CustomExecutableRunConfiguration::CustomExecutableRunConfiguration(Target *parent) :
|
||||
LocalApplicationRunConfiguration(parent, Core::Id(CUSTOM_EXECUTABLE_ID)),
|
||||
m_workingDirectory(QLatin1String(Constants::DEFAULT_WORKING_DIR)),
|
||||
m_runMode(Gui)
|
||||
{
|
||||
addExtraAspect(new ProjectExplorer::LocalEnvironmentAspect(this));
|
||||
addExtraAspect(new LocalEnvironmentAspect(this));
|
||||
|
||||
if (!parent->activeBuildConfiguration())
|
||||
m_workingDirectory = QLatin1String(ProjectExplorer::Constants::DEFAULT_WORKING_DIR_ALTERNATE);
|
||||
m_workingDirectory = QLatin1String(Constants::DEFAULT_WORKING_DIR_ALTERNATE);
|
||||
ctor();
|
||||
}
|
||||
|
||||
CustomExecutableRunConfiguration::CustomExecutableRunConfiguration(ProjectExplorer::Target *parent,
|
||||
CustomExecutableRunConfiguration::CustomExecutableRunConfiguration(Target *parent,
|
||||
CustomExecutableRunConfiguration *source) :
|
||||
ProjectExplorer::LocalApplicationRunConfiguration(parent, source),
|
||||
LocalApplicationRunConfiguration(parent, source),
|
||||
m_executable(source->m_executable),
|
||||
m_workingDirectory(source->m_workingDirectory),
|
||||
m_cmdArguments(source->m_cmdArguments),
|
||||
@@ -177,7 +178,7 @@ bool CustomExecutableRunConfiguration::validateExecutable(QString *executable, Q
|
||||
return false;
|
||||
}
|
||||
Utils::Environment env;
|
||||
ProjectExplorer::EnvironmentAspect *aspect = extraAspect<ProjectExplorer::EnvironmentAspect>();
|
||||
EnvironmentAspect *aspect = extraAspect<EnvironmentAspect>();
|
||||
if (aspect)
|
||||
env = aspect->environment();
|
||||
const QString exec = env.searchInPath(Utils::expandMacros(m_executable, macroExpander()),
|
||||
@@ -210,14 +211,14 @@ bool CustomExecutableRunConfiguration::isConfigured() const
|
||||
return !m_executable.isEmpty();
|
||||
}
|
||||
|
||||
ProjectExplorer::LocalApplicationRunConfiguration::RunMode CustomExecutableRunConfiguration::runMode() const
|
||||
LocalApplicationRunConfiguration::RunMode CustomExecutableRunConfiguration::runMode() const
|
||||
{
|
||||
return m_runMode;
|
||||
}
|
||||
|
||||
QString CustomExecutableRunConfiguration::workingDirectory() const
|
||||
{
|
||||
ProjectExplorer::EnvironmentAspect *aspect = extraAspect<ProjectExplorer::EnvironmentAspect>();
|
||||
EnvironmentAspect *aspect = extraAspect<EnvironmentAspect>();
|
||||
QTC_ASSERT(aspect, return baseWorkingDirectory());
|
||||
return QDir::cleanPath(aspect->environment().expandVariables(
|
||||
Utils::expandMacros(baseWorkingDirectory(), macroExpander())));
|
||||
@@ -289,7 +290,7 @@ void CustomExecutableRunConfiguration::setBaseWorkingDirectory(const QString &wo
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void CustomExecutableRunConfiguration::setRunMode(ProjectExplorer::LocalApplicationRunConfiguration::RunMode runMode)
|
||||
void CustomExecutableRunConfiguration::setRunMode(LocalApplicationRunConfiguration::RunMode runMode)
|
||||
{
|
||||
m_runMode = runMode;
|
||||
emit changed();
|
||||
@@ -300,72 +301,70 @@ QWidget *CustomExecutableRunConfiguration::createConfigurationWidget()
|
||||
return new CustomExecutableConfigurationWidget(this);
|
||||
}
|
||||
|
||||
ProjectExplorer::Abi CustomExecutableRunConfiguration::abi() const
|
||||
Abi CustomExecutableRunConfiguration::abi() const
|
||||
{
|
||||
return ProjectExplorer::Abi(); // return an invalid ABI: We do not know what we will end up running!
|
||||
return Abi(); // return an invalid ABI: We do not know what we will end up running!
|
||||
}
|
||||
|
||||
// Factory
|
||||
|
||||
CustomExecutableRunConfigurationFactory::CustomExecutableRunConfigurationFactory(QObject *parent) :
|
||||
ProjectExplorer::IRunConfigurationFactory(parent)
|
||||
IRunConfigurationFactory(parent)
|
||||
{ setObjectName(QLatin1String("CustomExecutableRunConfigurationFactory")); }
|
||||
|
||||
CustomExecutableRunConfigurationFactory::~CustomExecutableRunConfigurationFactory()
|
||||
{ }
|
||||
|
||||
bool CustomExecutableRunConfigurationFactory::canCreate(ProjectExplorer::Target *parent,
|
||||
const Core::Id id) const
|
||||
bool CustomExecutableRunConfigurationFactory::canCreate(Target *parent, const Core::Id id) const
|
||||
{
|
||||
if (!canHandle(parent))
|
||||
return false;
|
||||
return id == CUSTOM_EXECUTABLE_ID;
|
||||
}
|
||||
|
||||
ProjectExplorer::RunConfiguration *
|
||||
CustomExecutableRunConfigurationFactory::doCreate(ProjectExplorer::Target *parent, const Core::Id id)
|
||||
RunConfiguration *
|
||||
CustomExecutableRunConfigurationFactory::doCreate(Target *parent, const Core::Id id)
|
||||
{
|
||||
Q_UNUSED(id);
|
||||
return new CustomExecutableRunConfiguration(parent);
|
||||
}
|
||||
|
||||
bool CustomExecutableRunConfigurationFactory::canRestore(ProjectExplorer::Target *parent,
|
||||
bool CustomExecutableRunConfigurationFactory::canRestore(Target *parent,
|
||||
const QVariantMap &map) const
|
||||
{
|
||||
if (!canHandle(parent))
|
||||
return false;
|
||||
Core::Id id(ProjectExplorer::idFromMap(map));
|
||||
Core::Id id(idFromMap(map));
|
||||
return canCreate(parent, id);
|
||||
}
|
||||
|
||||
ProjectExplorer::RunConfiguration *
|
||||
CustomExecutableRunConfigurationFactory::doRestore(ProjectExplorer::Target *parent, const QVariantMap &map)
|
||||
RunConfiguration *
|
||||
CustomExecutableRunConfigurationFactory::doRestore(Target *parent, const QVariantMap &map)
|
||||
{
|
||||
Q_UNUSED(map);
|
||||
return new CustomExecutableRunConfiguration(parent);
|
||||
}
|
||||
|
||||
bool CustomExecutableRunConfigurationFactory::canClone(ProjectExplorer::Target *parent,
|
||||
ProjectExplorer::RunConfiguration *source) const
|
||||
bool CustomExecutableRunConfigurationFactory::canClone(Target *parent,
|
||||
RunConfiguration *source) const
|
||||
{
|
||||
return canCreate(parent, source->id());
|
||||
}
|
||||
|
||||
ProjectExplorer::RunConfiguration *
|
||||
CustomExecutableRunConfigurationFactory::clone(ProjectExplorer::Target *parent,
|
||||
ProjectExplorer::RunConfiguration *source)
|
||||
RunConfiguration *
|
||||
CustomExecutableRunConfigurationFactory::clone(Target *parent, RunConfiguration *source)
|
||||
{
|
||||
if (!canClone(parent, source))
|
||||
return 0;
|
||||
return new CustomExecutableRunConfiguration(parent, static_cast<CustomExecutableRunConfiguration*>(source));
|
||||
}
|
||||
|
||||
bool CustomExecutableRunConfigurationFactory::canHandle(ProjectExplorer::Target *parent) const
|
||||
bool CustomExecutableRunConfigurationFactory::canHandle(Target *parent) const
|
||||
{
|
||||
return parent->project()->supportsKit(parent->kit());
|
||||
}
|
||||
|
||||
QList<Core::Id> CustomExecutableRunConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const
|
||||
QList<Core::Id> CustomExecutableRunConfigurationFactory::availableCreationIds(Target *parent) const
|
||||
{
|
||||
if (!canHandle(parent))
|
||||
return QList<Core::Id>();
|
||||
|
||||
Reference in New Issue
Block a user