diff options
author | Vikas Pachdha <vikas.pachdha@qt.io> | 2018-05-14 16:16:03 +0200 |
---|---|---|
committer | Vikas Pachdha <vikas.pachdha@qt.io> | 2018-05-16 07:08:27 +0000 |
commit | 5cd1bb6f73bcf2fbe5d514d69cec372a672afdd8 (patch) | |
tree | ef51e12468b6eb8168befa41c85e9ee9c14c0abd /src | |
parent | 5912a93fd5669e7e7d11f3deddf16fab85f2ed50 (diff) |
iOS: Fix incorrect device type in run configuration
Task-number: QTCREATORBUG-20413
Change-Id: I5b96273161401e83567da80770f0f1c3482b7311
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/ios/iosrunconfiguration.cpp | 24 | ||||
-rw-r--r-- | src/plugins/ios/iosrunconfiguration.h | 2 |
2 files changed, 18 insertions, 8 deletions
diff --git a/src/plugins/ios/iosrunconfiguration.cpp b/src/plugins/ios/iosrunconfiguration.cpp index 10370dd8db..092500de6d 100644 --- a/src/plugins/ios/iosrunconfiguration.cpp +++ b/src/plugins/ios/iosrunconfiguration.cpp @@ -108,10 +108,19 @@ IosRunConfiguration::IosRunConfiguration(Target *target, Core::Id id) void IosRunConfiguration::deviceChanges() { + updateDeviceType(); updateDisplayNames(); updateEnabledState(); } +void IosRunConfiguration::updateDeviceType() +{ + if (DeviceTypeKitInformation::deviceTypeId(target()->kit()) == Constants::IOS_DEVICE_TYPE) + m_deviceType = IosDeviceType(IosDeviceType::IosDevice); + else if (m_deviceType.type == IosDeviceType::IosDevice) + m_deviceType = IosDeviceType(IosDeviceType::SimulatedDevice); +} + QWidget *IosRunConfiguration::createConfigurationWidget() { return new IosRunConfigurationWidget(this); @@ -119,10 +128,6 @@ QWidget *IosRunConfiguration::createConfigurationWidget() void IosRunConfiguration::updateDisplayNames() { - if (DeviceTypeKitInformation::deviceTypeId(target()->kit()) == Constants::IOS_DEVICE_TYPE) - m_deviceType = IosDeviceType(IosDeviceType::IosDevice); - else if (m_deviceType.type == IosDeviceType::IosDevice) - m_deviceType = IosDeviceType(IosDeviceType::SimulatedDevice); IDevice::ConstPtr dev = DeviceKitInformation::device(target()->kit()); const QString devName = dev.isNull() ? IosDevice::name() : dev->displayName(); setDefaultDisplayName(tr("Run on %1").arg(devName)); @@ -235,10 +240,7 @@ bool IosRunConfiguration::fromMap(const QVariantMap &map) bool deviceTypeIsInt; map.value(deviceTypeKey).toInt(&deviceTypeIsInt); if (deviceTypeIsInt || !m_deviceType.fromMap(map.value(deviceTypeKey).toMap())) { - if (DeviceTypeKitInformation::deviceTypeId(target()->kit()) == Constants::IOS_DEVICE_TYPE) - m_deviceType = IosDeviceType(IosDeviceType::IosDevice); - else - m_deviceType = IosDeviceType(IosDeviceType::SimulatedDevice); + updateDeviceType(); } updateDisplayNames(); @@ -332,6 +334,12 @@ void IosRunConfiguration::setDeviceType(const IosDeviceType &deviceType) m_deviceType = deviceType; } +void IosRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo &) +{ + updateDeviceType(); + updateDisplayNames(); +} + IosRunConfigurationWidget::IosRunConfigurationWidget(IosRunConfiguration *runConfiguration) : m_runConfiguration(runConfiguration) { diff --git a/src/plugins/ios/iosrunconfiguration.h b/src/plugins/ios/iosrunconfiguration.h index 6bb07db6d2..817ed7db5f 100644 --- a/src/plugins/ios/iosrunconfiguration.h +++ b/src/plugins/ios/iosrunconfiguration.h @@ -57,6 +57,7 @@ public: IosDeviceType deviceType() const; void setDeviceType(const IosDeviceType &deviceType); + void doAdditionalSetup(const ProjectExplorer::RunConfigurationCreationInfo &) override; bool fromMap(const QVariantMap &map) override; QVariantMap toMap() const override; @@ -66,6 +67,7 @@ signals: private: void deviceChanges(); friend class IosRunConfigurationWidget; + void updateDeviceType(); void updateDisplayNames(); void updateEnabledState() final; bool canRunForNode(const ProjectExplorer::Node *node) const final; |