forked from qt-creator/qt-creator
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:
@@ -15,6 +15,7 @@
|
|||||||
#include <projectexplorer/devicesupport/devicemanager.h>
|
#include <projectexplorer/devicesupport/devicemanager.h>
|
||||||
#include <projectexplorer/kitaspects.h>
|
#include <projectexplorer/kitaspects.h>
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <projectexplorer/projectnodes.h>
|
#include <projectexplorer/projectnodes.h>
|
||||||
#include <projectexplorer/runconfigurationaspects.h>
|
#include <projectexplorer/runconfigurationaspects.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
@@ -87,7 +88,7 @@ void IosDeviceTypeAspect::updateDeviceType()
|
|||||||
m_deviceType = IosDeviceType(IosDeviceType::SimulatedDevice);
|
m_deviceType = IosDeviceType(IosDeviceType::SimulatedDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IosRunConfiguration::isEnabled() const
|
bool IosRunConfiguration::isEnabled(Id runMode) const
|
||||||
{
|
{
|
||||||
Utils::Id devType = DeviceTypeKitAspect::deviceTypeId(kit());
|
Utils::Id devType = DeviceTypeKitAspect::deviceTypeId(kit());
|
||||||
if (devType != Constants::IOS_DEVICE_TYPE && devType != Constants::IOS_SIMULATOR_TYPE)
|
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)
|
if (dev.isNull() || dev->deviceState() != IDevice::DeviceReadyToUse)
|
||||||
return false;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,7 +230,7 @@ void IosDeviceTypeAspect::toMap(Store &map) const
|
|||||||
map.insert(deviceTypeKey, QVariant::fromValue(deviceType().toMap()));
|
map.insert(deviceTypeKey, QVariant::fromValue(deviceType().toMap()));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString IosRunConfiguration::disabledReason() const
|
QString IosRunConfiguration::disabledReason(Id runMode) const
|
||||||
{
|
{
|
||||||
Utils::Id devType = DeviceTypeKitAspect::deviceTypeId(kit());
|
Utils::Id devType = DeviceTypeKitAspect::deviceTypeId(kit());
|
||||||
if (devType != Constants::IOS_DEVICE_TYPE && devType != Constants::IOS_SIMULATOR_TYPE)
|
if (devType != Constants::IOS_DEVICE_TYPE && devType != Constants::IOS_SIMULATOR_TYPE)
|
||||||
@@ -270,8 +277,14 @@ QString IosRunConfiguration::disabledReason() const
|
|||||||
else
|
else
|
||||||
return Tr::tr("%1 is not connected.").arg(dev->displayName());
|
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
|
IosDeviceType IosRunConfiguration::deviceType() const
|
||||||
|
|||||||
@@ -70,11 +70,11 @@ public:
|
|||||||
QString applicationName() const;
|
QString applicationName() const;
|
||||||
Utils::FilePath bundleDirectory() const;
|
Utils::FilePath bundleDirectory() const;
|
||||||
Utils::FilePath localExecutable() const;
|
Utils::FilePath localExecutable() const;
|
||||||
QString disabledReason() const override;
|
QString disabledReason(Utils::Id runMode) const override;
|
||||||
IosDeviceType deviceType() const;
|
IosDeviceType deviceType() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool isEnabled() const final;
|
bool isEnabled(Utils::Id runMode) const final;
|
||||||
|
|
||||||
ProjectExplorer::ExecutableAspect executable{this};
|
ProjectExplorer::ExecutableAspect executable{this};
|
||||||
ProjectExplorer::ArgumentsAspect arguments{this};
|
ProjectExplorer::ArgumentsAspect arguments{this};
|
||||||
|
|||||||
@@ -59,12 +59,12 @@ public:
|
|||||||
connect(target->project(), &Project::displayNameChanged, this, &RunConfiguration::update);
|
connect(target->project(), &Project::displayNameChanged, this, &RunConfiguration::update);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isEnabled() const override
|
bool isEnabled(Utils::Id runMode) const override
|
||||||
{
|
{
|
||||||
if (disabled)
|
if (disabled)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return RunConfiguration::isEnabled();
|
return RunConfiguration::isEnabled(runMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool disabled;
|
static bool disabled;
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ CustomExecutableRunConfiguration::CustomExecutableRunConfiguration(Target *targe
|
|||||||
setDefaultDisplayName(defaultDisplayName());
|
setDefaultDisplayName(defaultDisplayName());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CustomExecutableRunConfiguration::isEnabled() const
|
bool CustomExecutableRunConfiguration::isEnabled(Id) const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Utils::ProcessRunData runnable() const override;
|
Utils::ProcessRunData runnable() const override;
|
||||||
bool isEnabled() const override;
|
bool isEnabled(Utils::Id) const override;
|
||||||
Tasks checkForIssues() const override;
|
Tasks checkForIssues() const override;
|
||||||
|
|
||||||
void configurationDialogFinished();
|
void configurationDialogFinished();
|
||||||
|
|||||||
@@ -2980,7 +2980,7 @@ void ProjectExplorerPlugin::runRunConfiguration(RunConfiguration *rc,
|
|||||||
Id runMode,
|
Id runMode,
|
||||||
const bool forceSkipDeploy)
|
const bool forceSkipDeploy)
|
||||||
{
|
{
|
||||||
if (!rc->isEnabled())
|
if (!rc->isEnabled(runMode))
|
||||||
return;
|
return;
|
||||||
const auto delay = [rc, runMode] {
|
const auto delay = [rc, runMode] {
|
||||||
dd->m_runMode = runMode;
|
dd->m_runMode = runMode;
|
||||||
@@ -3004,7 +3004,7 @@ void ProjectExplorerPlugin::runRunConfiguration(RunConfiguration *rc,
|
|||||||
delay();
|
delay();
|
||||||
break;
|
break;
|
||||||
case BuildForRunConfigStatus::NotBuilding:
|
case BuildForRunConfigStatus::NotBuilding:
|
||||||
if (rc->isEnabled())
|
if (rc->isEnabled(runMode))
|
||||||
dd->executeRunConfiguration(rc, runMode);
|
dd->executeRunConfiguration(rc, runMode);
|
||||||
else
|
else
|
||||||
delay();
|
delay();
|
||||||
@@ -3108,8 +3108,8 @@ expected_str<void> ProjectExplorerPlugin::canRunStartupProject(Utils::Id runMode
|
|||||||
.arg(target->displayName(), project->displayName()));
|
.arg(target->displayName(), project->displayName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!activeRC->isEnabled())
|
if (!activeRC->isEnabled(runMode))
|
||||||
return make_unexpected(activeRC->disabledReason());
|
return make_unexpected(activeRC->disabledReason(runMode));
|
||||||
|
|
||||||
if (dd->m_projectExplorerSettings.buildBeforeDeploy != BuildBeforeRunMode::Off
|
if (dd->m_projectExplorerSettings.buildBeforeDeploy != BuildBeforeRunMode::Off
|
||||||
&& dd->m_projectExplorerSettings.deployBeforeRun
|
&& dd->m_projectExplorerSettings.deployBeforeRun
|
||||||
|
|||||||
@@ -186,13 +186,13 @@ RunConfiguration::RunConfiguration(Target *target, Utils::Id id)
|
|||||||
|
|
||||||
RunConfiguration::~RunConfiguration() = default;
|
RunConfiguration::~RunConfiguration() = default;
|
||||||
|
|
||||||
QString RunConfiguration::disabledReason() const
|
QString RunConfiguration::disabledReason(Utils::Id) const
|
||||||
{
|
{
|
||||||
BuildSystem *bs = activeBuildSystem();
|
BuildSystem *bs = activeBuildSystem();
|
||||||
return bs ? bs->disabledReason(m_buildKey) : Tr::tr("No build system active");
|
return bs ? bs->disabledReason(m_buildKey) : Tr::tr("No build system active");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RunConfiguration::isEnabled() const
|
bool RunConfiguration::isEnabled(Utils::Id) const
|
||||||
{
|
{
|
||||||
BuildSystem *bs = activeBuildSystem();
|
BuildSystem *bs = activeBuildSystem();
|
||||||
return bs && bs->hasParsingData();
|
return bs && bs->hasParsingData();
|
||||||
|
|||||||
@@ -78,8 +78,8 @@ class PROJECTEXPLORER_EXPORT RunConfiguration : public ProjectConfiguration
|
|||||||
public:
|
public:
|
||||||
~RunConfiguration() override;
|
~RunConfiguration() override;
|
||||||
|
|
||||||
virtual QString disabledReason() const;
|
virtual QString disabledReason(Utils::Id runMode) const;
|
||||||
virtual bool isEnabled() const;
|
virtual bool isEnabled(Utils::Id runMode) const;
|
||||||
|
|
||||||
QWidget *createConfigurationWidget();
|
QWidget *createConfigurationWidget();
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include "buildstepspage.h"
|
#include "buildstepspage.h"
|
||||||
#include "deployconfiguration.h"
|
#include "deployconfiguration.h"
|
||||||
#include "projectconfigurationmodel.h"
|
#include "projectconfigurationmodel.h"
|
||||||
|
#include "projectexplorerconstants.h"
|
||||||
#include "projectexplorertr.h"
|
#include "projectexplorertr.h"
|
||||||
#include "runconfiguration.h"
|
#include "runconfiguration.h"
|
||||||
#include "target.h"
|
#include "target.h"
|
||||||
@@ -523,8 +524,12 @@ void RunSettingsWidget::removeSubWidgets()
|
|||||||
|
|
||||||
void RunSettingsWidget::updateEnabledState()
|
void RunSettingsWidget::updateEnabledState()
|
||||||
{
|
{
|
||||||
const bool enable = m_runConfiguration ? m_runConfiguration->isEnabled() : false;
|
const bool enable = m_runConfiguration
|
||||||
const QString reason = m_runConfiguration ? m_runConfiguration->disabledReason() : QString();
|
? m_runConfiguration->isEnabled(Constants::NORMAL_RUN_MODE)
|
||||||
|
: false;
|
||||||
|
const QString reason = m_runConfiguration
|
||||||
|
? m_runConfiguration->disabledReason(Constants::NORMAL_RUN_MODE)
|
||||||
|
: QString();
|
||||||
|
|
||||||
m_runConfigurationWidget->setEnabled(enable);
|
m_runConfigurationWidget->setEnabled(enable);
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
#include "project.h"
|
#include "project.h"
|
||||||
#include "projectconfigurationmodel.h"
|
#include "projectconfigurationmodel.h"
|
||||||
#include "projectexplorer.h"
|
#include "projectexplorer.h"
|
||||||
|
#include "projectexplorerconstants.h"
|
||||||
#include "projectexplorericons.h"
|
#include "projectexplorericons.h"
|
||||||
#include "projectexplorersettings.h"
|
#include "projectexplorersettings.h"
|
||||||
#include "projectexplorertr.h"
|
#include "projectexplorertr.h"
|
||||||
@@ -780,12 +781,12 @@ void Target::updateDefaultRunConfigurations()
|
|||||||
|
|
||||||
// Make sure a configured RC will be active after we delete the RCs:
|
// Make sure a configured RC will be active after we delete the RCs:
|
||||||
RunConfiguration *active = activeRunConfiguration();
|
RunConfiguration *active = activeRunConfiguration();
|
||||||
if (active && (removalList.contains(active) || !active->isEnabled())) {
|
if (active && (removalList.contains(active) || !active->isEnabled(Constants::NORMAL_RUN_MODE))) {
|
||||||
RunConfiguration *newConfiguredDefault = newConfigured.isEmpty() ? nullptr : newConfigured.at(0);
|
RunConfiguration *newConfiguredDefault = newConfigured.isEmpty() ? nullptr : newConfigured.at(0);
|
||||||
|
|
||||||
RunConfiguration *rc
|
RunConfiguration *rc = Utils::findOrDefault(existingConfigured, [](RunConfiguration *rc) {
|
||||||
= Utils::findOrDefault(existingConfigured,
|
return rc->isEnabled(Constants::NORMAL_RUN_MODE);
|
||||||
[](RunConfiguration *rc) { return rc->isEnabled(); });
|
});
|
||||||
if (!rc) {
|
if (!rc) {
|
||||||
rc = Utils::findOr(newConfigured, newConfiguredDefault,
|
rc = Utils::findOr(newConfigured, newConfiguredDefault,
|
||||||
Utils::equal(&RunConfiguration::displayName, project()->displayName()));
|
Utils::equal(&RunConfiguration::displayName, project()->displayName()));
|
||||||
|
|||||||
@@ -57,8 +57,8 @@ public:
|
|||||||
QmlProjectRunConfiguration(Target *target, Id id);
|
QmlProjectRunConfiguration(Target *target, Id id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString disabledReason() const final;
|
QString disabledReason(Utils::Id runMode) const final;
|
||||||
bool isEnabled() const final;
|
bool isEnabled(Utils::Id) const final;
|
||||||
|
|
||||||
FilePath mainScript() const;
|
FilePath mainScript() const;
|
||||||
FilePath qmlRuntimeFilePath() const;
|
FilePath qmlRuntimeFilePath() const;
|
||||||
@@ -180,7 +180,7 @@ QmlProjectRunConfiguration::QmlProjectRunConfiguration(Target *target, Id id)
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QmlProjectRunConfiguration::disabledReason() const
|
QString QmlProjectRunConfiguration::disabledReason(Utils::Id runMode) const
|
||||||
{
|
{
|
||||||
if (mainScript().isEmpty())
|
if (mainScript().isEmpty())
|
||||||
return Tr::tr("No script file to execute.");
|
return Tr::tr("No script file to execute.");
|
||||||
@@ -193,7 +193,7 @@ QString QmlProjectRunConfiguration::disabledReason() const
|
|||||||
}
|
}
|
||||||
if (viewer.isEmpty())
|
if (viewer.isEmpty())
|
||||||
return Tr::tr("No QML utility specified for target device.");
|
return Tr::tr("No QML utility specified for target device.");
|
||||||
return RunConfiguration::disabledReason();
|
return RunConfiguration::disabledReason(runMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
FilePath QmlProjectRunConfiguration::qmlRuntimeFilePath() const
|
FilePath QmlProjectRunConfiguration::qmlRuntimeFilePath() const
|
||||||
@@ -306,7 +306,7 @@ void QmlProjectRunConfiguration::setupQtVersionAspect()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmlProjectRunConfiguration::isEnabled() const
|
bool QmlProjectRunConfiguration::isEnabled(Id) const
|
||||||
{
|
{
|
||||||
return const_cast<QmlProjectRunConfiguration *>(this)->qmlMainFile.isQmlFilePresent()
|
return const_cast<QmlProjectRunConfiguration *>(this)->qmlMainFile.isQmlFilePresent()
|
||||||
&& !commandLine().executable().isEmpty()
|
&& !commandLine().executable().isEmpty()
|
||||||
|
|||||||
Reference in New Issue
Block a user