iOS: Disable anything but running for iOS 17+ devices

We currently cannot support anything than running for devices with iOS
17 and later.

Make it possible for RunConfigurations to state that they are disabled
depending on run mode.

Change-Id: I13df4dd482f6381cda15168c38ede00d95e1d692
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Eike Ziller
2024-01-15 15:38:18 +01:00
parent 76a8966739
commit 479f1f34ce
11 changed files with 47 additions and 28 deletions

View File

@@ -15,6 +15,7 @@
#include <projectexplorer/devicesupport/devicemanager.h>
#include <projectexplorer/kitaspects.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/projectnodes.h>
#include <projectexplorer/runconfigurationaspects.h>
#include <projectexplorer/target.h>
@@ -87,7 +88,7 @@ void IosDeviceTypeAspect::updateDeviceType()
m_deviceType = IosDeviceType(IosDeviceType::SimulatedDevice);
}
bool IosRunConfiguration::isEnabled() const
bool IosRunConfiguration::isEnabled(Id runMode) const
{
Utils::Id devType = DeviceTypeKitAspect::deviceTypeId(kit());
if (devType != Constants::IOS_DEVICE_TYPE && devType != Constants::IOS_SIMULATOR_TYPE)
@@ -99,6 +100,12 @@ bool IosRunConfiguration::isEnabled() const
if (dev.isNull() || dev->deviceState() != IDevice::DeviceReadyToUse)
return false;
IosDevice::ConstPtr iosdevice = dev.dynamicCast<const IosDevice>();
if (iosdevice && iosdevice->handler() == IosDevice::Handler::DeviceCtl
&& runMode != ProjectExplorer::Constants::NORMAL_RUN_MODE) {
return false;
}
return true;
}
@@ -223,7 +230,7 @@ void IosDeviceTypeAspect::toMap(Store &map) const
map.insert(deviceTypeKey, QVariant::fromValue(deviceType().toMap()));
}
QString IosRunConfiguration::disabledReason() const
QString IosRunConfiguration::disabledReason(Id runMode) const
{
Utils::Id devType = DeviceTypeKitAspect::deviceTypeId(kit());
if (devType != Constants::IOS_DEVICE_TYPE && devType != Constants::IOS_SIMULATOR_TYPE)
@@ -270,8 +277,14 @@ QString IosRunConfiguration::disabledReason() const
else
return Tr::tr("%1 is not connected.").arg(dev->displayName());
}
IosDevice::ConstPtr iosdevice = dev.dynamicCast<const IosDevice>();
if (iosdevice && iosdevice->handler() == IosDevice::Handler::DeviceCtl
&& runMode != ProjectExplorer::Constants::NORMAL_RUN_MODE) {
return Tr::tr("Debugging and profiling is currently not supported for devices with iOS "
"17 and later.");
}
}
return RunConfiguration::disabledReason();
return RunConfiguration::disabledReason(runMode);
}
IosDeviceType IosRunConfiguration::deviceType() const

View File

@@ -70,11 +70,11 @@ public:
QString applicationName() const;
Utils::FilePath bundleDirectory() const;
Utils::FilePath localExecutable() const;
QString disabledReason() const override;
QString disabledReason(Utils::Id runMode) const override;
IosDeviceType deviceType() const;
private:
bool isEnabled() const final;
bool isEnabled(Utils::Id runMode) const final;
ProjectExplorer::ExecutableAspect executable{this};
ProjectExplorer::ArgumentsAspect arguments{this};