forked from qt-creator/qt-creator
Ios: Use aspects more directly in IosRunConfiguration
Change-Id: Ic6fd16287e28a16c231b0b30211f112aceb11795 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -56,25 +56,20 @@ static IosDeviceType toIosDeviceType(const SimulatorInfo &device)
|
|||||||
}
|
}
|
||||||
|
|
||||||
IosRunConfiguration::IosRunConfiguration(Target *target, Id id)
|
IosRunConfiguration::IosRunConfiguration(Target *target, Id id)
|
||||||
: RunConfiguration(target, id)
|
: RunConfiguration(target, id), iosDeviceType(this, this)
|
||||||
{
|
{
|
||||||
auto executableAspect = addAspect<ExecutableAspect>();
|
executable.setDeviceSelector(target, ExecutableAspect::RunDevice);
|
||||||
executableAspect->setDeviceSelector(target, ExecutableAspect::RunDevice);
|
|
||||||
|
|
||||||
auto argsAspect = addAspect<ArgumentsAspect>();
|
arguments.setMacroExpander(macroExpander());
|
||||||
argsAspect->setMacroExpander(macroExpander());
|
|
||||||
|
|
||||||
m_deviceTypeAspect = addAspect<IosDeviceTypeAspect>(this);
|
setUpdater([this, target] {
|
||||||
|
|
||||||
setUpdater([this, target, executableAspect] {
|
|
||||||
IDevice::ConstPtr dev = DeviceKitAspect::device(target->kit());
|
IDevice::ConstPtr dev = DeviceKitAspect::device(target->kit());
|
||||||
const QString devName = dev.isNull() ? IosDevice::name() : dev->displayName();
|
const QString devName = dev.isNull() ? IosDevice::name() : dev->displayName();
|
||||||
setDefaultDisplayName(Tr::tr("Run on %1").arg(devName));
|
setDefaultDisplayName(Tr::tr("Run on %1").arg(devName));
|
||||||
setDisplayName(Tr::tr("Run %1 on %2").arg(applicationName()).arg(devName));
|
setDisplayName(Tr::tr("Run %1 on %2").arg(applicationName()).arg(devName));
|
||||||
|
|
||||||
executableAspect->setExecutable(localExecutable());
|
executable.setExecutable(localExecutable());
|
||||||
|
iosDeviceType.updateDeviceType();
|
||||||
m_deviceTypeAspect->updateDeviceType();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -279,7 +274,7 @@ QString IosRunConfiguration::disabledReason() const
|
|||||||
|
|
||||||
IosDeviceType IosRunConfiguration::deviceType() const
|
IosDeviceType IosRunConfiguration::deviceType() const
|
||||||
{
|
{
|
||||||
return m_deviceTypeAspect->deviceType();
|
return iosDeviceType.deviceType();
|
||||||
}
|
}
|
||||||
|
|
||||||
IosDeviceType IosDeviceTypeAspect::deviceType() const
|
IosDeviceType IosDeviceTypeAspect::deviceType() const
|
||||||
@@ -311,8 +306,8 @@ void IosDeviceTypeAspect::setDeviceType(const IosDeviceType &deviceType)
|
|||||||
m_deviceType = deviceType;
|
m_deviceType = deviceType;
|
||||||
}
|
}
|
||||||
|
|
||||||
IosDeviceTypeAspect::IosDeviceTypeAspect(IosRunConfiguration *runConfiguration)
|
IosDeviceTypeAspect::IosDeviceTypeAspect(AspectContainer *container, IosRunConfiguration *rc)
|
||||||
: m_runConfiguration(runConfiguration)
|
: BaseAspect(container), m_runConfiguration(rc)
|
||||||
{
|
{
|
||||||
addDataExtractor(this, &IosDeviceTypeAspect::deviceType, &Data::deviceType);
|
addDataExtractor(this, &IosDeviceTypeAspect::deviceType, &Data::deviceType);
|
||||||
addDataExtractor(this, &IosDeviceTypeAspect::bundleDirectory, &Data::bundleDirectory);
|
addDataExtractor(this, &IosDeviceTypeAspect::bundleDirectory, &Data::bundleDirectory);
|
||||||
|
@@ -8,6 +8,7 @@
|
|||||||
#include "iossimulator.h"
|
#include "iossimulator.h"
|
||||||
|
|
||||||
#include <projectexplorer/runconfiguration.h>
|
#include <projectexplorer/runconfiguration.h>
|
||||||
|
#include <projectexplorer/runconfigurationaspects.h>
|
||||||
|
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
|
|
||||||
@@ -23,7 +24,8 @@ class IosDeviceTypeAspect : public Utils::BaseAspect
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit IosDeviceTypeAspect(IosRunConfiguration *runConfiguration);
|
explicit IosDeviceTypeAspect(Utils::AspectContainer *container,
|
||||||
|
IosRunConfiguration *runConfiguration);
|
||||||
|
|
||||||
void fromMap(const QVariantMap &map) override;
|
void fromMap(const QVariantMap &map) override;
|
||||||
void toMap(QVariantMap &map) const override;
|
void toMap(QVariantMap &map) const override;
|
||||||
@@ -74,7 +76,9 @@ public:
|
|||||||
private:
|
private:
|
||||||
bool isEnabled() const final;
|
bool isEnabled() const final;
|
||||||
|
|
||||||
IosDeviceTypeAspect *m_deviceTypeAspect = nullptr;
|
ProjectExplorer::ExecutableAspect executable{this};
|
||||||
|
ProjectExplorer::ArgumentsAspect arguments{this};
|
||||||
|
IosDeviceTypeAspect iosDeviceType;
|
||||||
};
|
};
|
||||||
|
|
||||||
class IosRunConfigurationFactory : public ProjectExplorer::RunConfigurationFactory
|
class IosRunConfigurationFactory : public ProjectExplorer::RunConfigurationFactory
|
||||||
|
Reference in New Issue
Block a user