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)
|
||||
: RunConfiguration(target, id)
|
||||
: RunConfiguration(target, id), iosDeviceType(this, this)
|
||||
{
|
||||
auto executableAspect = addAspect<ExecutableAspect>();
|
||||
executableAspect->setDeviceSelector(target, ExecutableAspect::RunDevice);
|
||||
executable.setDeviceSelector(target, ExecutableAspect::RunDevice);
|
||||
|
||||
auto argsAspect = addAspect<ArgumentsAspect>();
|
||||
argsAspect->setMacroExpander(macroExpander());
|
||||
arguments.setMacroExpander(macroExpander());
|
||||
|
||||
m_deviceTypeAspect = addAspect<IosDeviceTypeAspect>(this);
|
||||
|
||||
setUpdater([this, target, executableAspect] {
|
||||
setUpdater([this, target] {
|
||||
IDevice::ConstPtr dev = DeviceKitAspect::device(target->kit());
|
||||
const QString devName = dev.isNull() ? IosDevice::name() : dev->displayName();
|
||||
setDefaultDisplayName(Tr::tr("Run on %1").arg(devName));
|
||||
setDisplayName(Tr::tr("Run %1 on %2").arg(applicationName()).arg(devName));
|
||||
|
||||
executableAspect->setExecutable(localExecutable());
|
||||
|
||||
m_deviceTypeAspect->updateDeviceType();
|
||||
executable.setExecutable(localExecutable());
|
||||
iosDeviceType.updateDeviceType();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -279,7 +274,7 @@ QString IosRunConfiguration::disabledReason() const
|
||||
|
||||
IosDeviceType IosRunConfiguration::deviceType() const
|
||||
{
|
||||
return m_deviceTypeAspect->deviceType();
|
||||
return iosDeviceType.deviceType();
|
||||
}
|
||||
|
||||
IosDeviceType IosDeviceTypeAspect::deviceType() const
|
||||
@@ -311,8 +306,8 @@ void IosDeviceTypeAspect::setDeviceType(const IosDeviceType &deviceType)
|
||||
m_deviceType = deviceType;
|
||||
}
|
||||
|
||||
IosDeviceTypeAspect::IosDeviceTypeAspect(IosRunConfiguration *runConfiguration)
|
||||
: m_runConfiguration(runConfiguration)
|
||||
IosDeviceTypeAspect::IosDeviceTypeAspect(AspectContainer *container, IosRunConfiguration *rc)
|
||||
: BaseAspect(container), m_runConfiguration(rc)
|
||||
{
|
||||
addDataExtractor(this, &IosDeviceTypeAspect::deviceType, &Data::deviceType);
|
||||
addDataExtractor(this, &IosDeviceTypeAspect::bundleDirectory, &Data::bundleDirectory);
|
||||
|
@@ -8,6 +8,7 @@
|
||||
#include "iossimulator.h"
|
||||
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
#include <projectexplorer/runconfigurationaspects.h>
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
@@ -23,7 +24,8 @@ class IosDeviceTypeAspect : public Utils::BaseAspect
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit IosDeviceTypeAspect(IosRunConfiguration *runConfiguration);
|
||||
explicit IosDeviceTypeAspect(Utils::AspectContainer *container,
|
||||
IosRunConfiguration *runConfiguration);
|
||||
|
||||
void fromMap(const QVariantMap &map) override;
|
||||
void toMap(QVariantMap &map) const override;
|
||||
@@ -74,7 +76,9 @@ public:
|
||||
private:
|
||||
bool isEnabled() const final;
|
||||
|
||||
IosDeviceTypeAspect *m_deviceTypeAspect = nullptr;
|
||||
ProjectExplorer::ExecutableAspect executable{this};
|
||||
ProjectExplorer::ArgumentsAspect arguments{this};
|
||||
IosDeviceTypeAspect iosDeviceType;
|
||||
};
|
||||
|
||||
class IosRunConfigurationFactory : public ProjectExplorer::RunConfigurationFactory
|
||||
|
Reference in New Issue
Block a user