iOS: Use new central RunConfiguration::update

Change-Id: If19926aac16b501aee7a1117c7915f915af061fc
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-12-04 09:51:46 +01:00
parent d79c76eb11
commit bd63a47d67
2 changed files with 11 additions and 15 deletions

View File

@@ -111,12 +111,20 @@ IosRunConfiguration::IosRunConfiguration(Target *target, Core::Id id)
addAspect<ArgumentsAspect>(); addAspect<ArgumentsAspect>();
m_deviceTypeAspect = addAspect<IosDeviceTypeAspect>(this); m_deviceTypeAspect = addAspect<IosDeviceTypeAspect>(this);
setUpdater([this, target, executableAspect] {
IDevice::ConstPtr dev = DeviceKitAspect::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));
executableAspect->setExecutable(localExecutable());
});
} }
void IosDeviceTypeAspect::deviceChanges() void IosDeviceTypeAspect::deviceChanges()
{ {
updateDeviceType(); updateDeviceType();
m_runConfiguration->updateDisplayNames();
m_runConfiguration->update(); m_runConfiguration->update();
} }
@@ -129,16 +137,6 @@ void IosDeviceTypeAspect::updateDeviceType()
m_deviceType = IosDeviceType(IosDeviceType::SimulatedDevice); m_deviceType = IosDeviceType(IosDeviceType::SimulatedDevice);
} }
void IosRunConfiguration::updateDisplayNames()
{
IDevice::ConstPtr dev = DeviceKitAspect::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));
aspect<ExecutableAspect>()->setExecutable(localExecutable());
}
bool IosRunConfiguration::isEnabled() const bool IosRunConfiguration::isEnabled() const
{ {
Core::Id devType = DeviceTypeKitAspect::deviceTypeId(target()->kit()); Core::Id devType = DeviceTypeKitAspect::deviceTypeId(target()->kit());
@@ -211,7 +209,7 @@ void IosDeviceTypeAspect::fromMap(const QVariantMap &map)
if (deviceTypeIsInt || !m_deviceType.fromMap(map.value(deviceTypeKey).toMap())) if (deviceTypeIsInt || !m_deviceType.fromMap(map.value(deviceTypeKey).toMap()))
updateDeviceType(); updateDeviceType();
m_runConfiguration->updateDisplayNames(); m_runConfiguration->update();
} }
void IosDeviceTypeAspect::toMap(QVariantMap &map) const void IosDeviceTypeAspect::toMap(QVariantMap &map) const
@@ -307,7 +305,7 @@ void IosDeviceTypeAspect::setDeviceType(const IosDeviceType &deviceType)
void IosRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo &) void IosRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo &)
{ {
m_deviceTypeAspect->updateDeviceType(); m_deviceTypeAspect->updateDeviceType();
updateDisplayNames(); update();
} }
IosDeviceTypeAspect::IosDeviceTypeAspect(IosRunConfiguration *runConfiguration) IosDeviceTypeAspect::IosDeviceTypeAspect(IosRunConfiguration *runConfiguration)

View File

@@ -53,8 +53,6 @@ public:
void doAdditionalSetup(const ProjectExplorer::RunConfigurationCreationInfo &) override; void doAdditionalSetup(const ProjectExplorer::RunConfigurationCreationInfo &) override;
private: private:
friend class IosDeviceTypeAspect;
void updateDisplayNames();
bool isEnabled() const final; bool isEnabled() const final;
IosDeviceTypeAspect *m_deviceTypeAspect = nullptr; IosDeviceTypeAspect *m_deviceTypeAspect = nullptr;