diff options
Diffstat (limited to 'src/plugins/ios')
41 files changed, 684 insertions, 1320 deletions
diff --git a/src/plugins/ios/CMakeLists.txt b/src/plugins/ios/CMakeLists.txt new file mode 100644 index 0000000000..87f6d1dbcb --- /dev/null +++ b/src/plugins/ios/CMakeLists.txt @@ -0,0 +1,32 @@ +add_qtc_plugin(Ios + DEPENDS QmlDebug Qt5::Xml + PLUGIN_DEPENDS Core Debugger ProjectExplorer QmakeProjectManager + SOURCES + createsimulatordialog.cpp createsimulatordialog.h createsimulatordialog.ui + ios.qrc + iosbuildconfiguration.cpp iosbuildconfiguration.h + iosbuildstep.cpp iosbuildstep.h iosbuildstep.ui + iosconfigurations.cpp iosconfigurations.h + iosconstants.h + iosdeploystep.cpp iosdeploystep.h + iosdevice.cpp iosdevice.h + iosdsymbuildstep.cpp iosdsymbuildstep.h + iosplugin.cpp iosplugin.h + iospresetbuildstep.ui + iosprobe.cpp iosprobe.h + iosqtversion.cpp iosqtversion.h + iosrunconfiguration.cpp iosrunconfiguration.h + iosrunner.cpp iosrunner.h + iossettingspage.cpp iossettingspage.h + iossettingswidget.cpp iossettingswidget.h iossettingswidget.ui + iossimulator.cpp iossimulator.h + iostoolhandler.cpp iostoolhandler.h + simulatorcontrol.cpp simulatorcontrol.h + simulatorinfomodel.cpp simulatorinfomodel.h + simulatoroperationdialog.cpp simulatoroperationdialog.h simulatoroperationdialog.ui +) + +extend_qtc_plugin(Ios + CONDITION APPLE + DEPENDS ${FWCoreFoundation} ${FWIOKit} +) diff --git a/src/plugins/ios/createsimulatordialog.cpp b/src/plugins/ios/createsimulatordialog.cpp index 6c8d711b68..1bfcc25f71 100644 --- a/src/plugins/ios/createsimulatordialog.cpp +++ b/src/plugins/ios/createsimulatordialog.cpp @@ -53,7 +53,7 @@ CreateSimulatorDialog::CreateSimulatorDialog(QWidget *parent) : m_ui->runtimeCombo->currentIndex() > 0); }; - const auto indexChanged = static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged); + const auto indexChanged = QOverload<int>::of(&QComboBox::currentIndexChanged); connect(m_ui->nameEdit, &QLineEdit::textChanged, enableOk); connect(m_ui->runtimeCombo, indexChanged, enableOk); connect(m_ui->deviceTypeCombo, indexChanged, [this, enableOk]() { diff --git a/src/plugins/ios/ios.pro b/src/plugins/ios/ios.pro index d4e4d9e05d..d8bfd14d15 100644 --- a/src/plugins/ios/ios.pro +++ b/src/plugins/ios/ios.pro @@ -15,21 +15,16 @@ HEADERS += \ iossettingswidget.h \ iosrunner.h \ iosdsymbuildstep.h \ - iosqtversionfactory.h \ iosqtversion.h \ iosplugin.h \ - iosdevicefactory.h \ iosdevice.h \ iossimulator.h \ - iossimulatorfactory.h \ iosprobe.h \ iosbuildstep.h \ iostoolhandler.h \ iosdeploystep.h \ - iosdeploystepwidget.h \ simulatorcontrol.h \ iosbuildconfiguration.h \ - iosbuildsettingswidget.h \ createsimulatordialog.h \ simulatoroperationdialog.h \ simulatorinfomodel.h @@ -42,21 +37,16 @@ SOURCES += \ iossettingswidget.cpp \ iosrunner.cpp \ iosdsymbuildstep.cpp \ - iosqtversionfactory.cpp \ iosqtversion.cpp \ iosplugin.cpp \ - iosdevicefactory.cpp \ iosdevice.cpp \ iossimulator.cpp \ - iossimulatorfactory.cpp \ iosprobe.cpp \ iosbuildstep.cpp \ iostoolhandler.cpp \ iosdeploystep.cpp \ - iosdeploystepwidget.cpp \ simulatorcontrol.cpp \ iosbuildconfiguration.cpp \ - iosbuildsettingswidget.cpp \ createsimulatordialog.cpp \ simulatoroperationdialog.cpp \ simulatorinfomodel.cpp @@ -64,9 +54,7 @@ SOURCES += \ FORMS += \ iossettingswidget.ui \ iosbuildstep.ui \ - iosdeploystepwidget.ui \ iospresetbuildstep.ui \ - iosbuildsettingswidget.ui \ createsimulatordialog.ui \ simulatoroperationdialog.ui diff --git a/src/plugins/ios/ios.qbs b/src/plugins/ios/ios.qbs index c5553f9e45..e338c9241f 100644 --- a/src/plugins/ios/ios.qbs +++ b/src/plugins/ios/ios.qbs @@ -20,9 +20,6 @@ QtcPlugin { "ios.qrc", "iosbuildconfiguration.cpp", "iosbuildconfiguration.h", - "iosbuildsettingswidget.cpp", - "iosbuildsettingswidget.h", - "iosbuildsettingswidget.ui", "iosbuildstep.cpp", "iosbuildstep.h", "iosbuildstep.ui", @@ -31,13 +28,8 @@ QtcPlugin { "iosconstants.h", "iosdeploystep.cpp", "iosdeploystep.h", - "iosdeploystepwidget.cpp", - "iosdeploystepwidget.h", - "iosdeploystepwidget.ui", "iosdevice.cpp", "iosdevice.h", - "iosdevicefactory.cpp", - "iosdevicefactory.h", "iosdsymbuildstep.cpp", "iosdsymbuildstep.h", "iosplugin.cpp", @@ -47,8 +39,6 @@ QtcPlugin { "iosprobe.h", "iosqtversion.cpp", "iosqtversion.h", - "iosqtversionfactory.cpp", - "iosqtversionfactory.h", "iosrunconfiguration.cpp", "iosrunconfiguration.h", "iosrunner.cpp", @@ -60,8 +50,6 @@ QtcPlugin { "iossettingswidget.ui", "iossimulator.cpp", "iossimulator.h", - "iossimulatorfactory.cpp", - "iossimulatorfactory.h", "iostoolhandler.cpp", "iostoolhandler.h", "simulatorcontrol.cpp", diff --git a/src/plugins/ios/iosbuildconfiguration.cpp b/src/plugins/ios/iosbuildconfiguration.cpp index 3f6de58d38..0ef0002071 100644 --- a/src/plugins/ios/iosbuildconfiguration.cpp +++ b/src/plugins/ios/iosbuildconfiguration.cpp @@ -27,16 +27,23 @@ #include "iosconfigurations.h" #include "iosconstants.h" -#include "iosbuildsettingswidget.h" -#include "projectexplorer/kitinformation.h" -#include "projectexplorer/namedwidget.h" -#include "projectexplorer/target.h" +#include <projectexplorer/kitinformation.h> +#include <projectexplorer/namedwidget.h> +#include <projectexplorer/target.h> -#include "qmakeprojectmanager/qmakebuildinfo.h" -#include "qmakeprojectmanager/qmakeprojectmanagerconstants.h" +#include <qmakeprojectmanager/qmakebuildinfo.h> +#include <qmakeprojectmanager/qmakeprojectmanagerconstants.h> #include <utils/algorithm.h> +#include <utils/detailswidget.h> +#include <utils/utilsicons.h> + +#include <QCheckBox> +#include <QComboBox> +#include <QHBoxLayout> +#include <QLabel> +#include <QPushButton> using namespace QmakeProjectManager; using namespace ProjectExplorer; @@ -44,58 +51,392 @@ using namespace ProjectExplorer; namespace Ios { namespace Internal { +Q_LOGGING_CATEGORY(iosSettingsLog, "qtc.ios.common", QtWarningMsg) + const char qmakeIosTeamSettings[] = "QMAKE_MAC_XCODE_SETTINGS+=qteam qteam.name=DEVELOPMENT_TEAM qteam.value="; const char qmakeProvisioningProfileSettings[] = "QMAKE_MAC_XCODE_SETTINGS+=qprofile qprofile.name=PROVISIONING_PROFILE_SPECIFIER qprofile.value="; const char signingIdentifierKey[] = "Ios.SigningIdentifier"; const char autoManagedSigningKey[] = "Ios.AutoManagedSigning"; +const int IdentifierRole = Qt::UserRole+1; + + +class IosBuildSettingsWidget : public NamedWidget +{ +public: + explicit IosBuildSettingsWidget(IosBuildConfiguration *iosBuildConfiguration); + + bool isSigningAutomaticallyManaged() const; + +private: + void announceSigningChanged(bool isAutoManaged, QString identifier); + void onSigningEntityComboIndexChanged(); + void onReset(); + + void setDefaultSigningIdentfier(const QString &identifier) const; + void configureSigningUi(bool autoManageSigning); + void populateDevelopmentTeams(); + void populateProvisioningProfiles(); + QString selectedIdentifier() const; + void updateInfoText(); + void updateWarningText(); + +private: + IosBuildConfiguration *m_bc = nullptr; + QString m_lastProfileSelection; + QString m_lastTeamSelection; + const bool m_isDevice; + + QPushButton *m_qmakeDefaults; + QComboBox *m_signEntityCombo; + QCheckBox *m_autoSignCheckbox; + QLabel *m_signEntityLabel; + QLabel *m_infoIconLabel; + QLabel *m_infoLabel; + QLabel *m_warningIconLabel; + QLabel *m_warningLabel; +}; + +IosBuildSettingsWidget::IosBuildSettingsWidget(IosBuildConfiguration *bc) + : m_bc(bc), + m_isDevice(DeviceTypeKitAspect::deviceTypeId(bc->target()->kit()) + == Constants::IOS_DEVICE_TYPE) +{ + auto detailsWidget = new Utils::DetailsWidget(this); + auto container = new QWidget(detailsWidget); + + m_qmakeDefaults = new QPushButton(container); + QSizePolicy sizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + m_qmakeDefaults->setSizePolicy(sizePolicy); + m_qmakeDefaults->setText(IosBuildConfiguration::tr("Reset")); + m_qmakeDefaults->setEnabled(m_isDevice); + + m_signEntityCombo = new QComboBox(container); + QSizePolicy sizePolicy1(QSizePolicy::Preferred, QSizePolicy::Fixed); + sizePolicy1.setHorizontalStretch(0); + sizePolicy1.setVerticalStretch(0); + m_signEntityCombo->setSizePolicy(sizePolicy1); + + m_autoSignCheckbox = new QCheckBox(container); + QSizePolicy sizePolicy2(QSizePolicy::Expanding, QSizePolicy::Fixed); + sizePolicy2.setHorizontalStretch(0); + sizePolicy2.setVerticalStretch(0); + m_autoSignCheckbox->setSizePolicy(sizePolicy2); + m_autoSignCheckbox->setChecked(true); + m_autoSignCheckbox->setText(IosBuildConfiguration::tr("Automatically manage signing")); + m_autoSignCheckbox->setChecked(bc->m_autoManagedSigning->value()); + m_autoSignCheckbox->setEnabled(m_isDevice); + + m_signEntityLabel = new QLabel(container); + + m_infoIconLabel = new QLabel(container); + QSizePolicy sizePolicy3(QSizePolicy::Maximum, QSizePolicy::Preferred); + sizePolicy3.setHorizontalStretch(0); + sizePolicy3.setVerticalStretch(0); + m_infoIconLabel->setSizePolicy(sizePolicy3); + + m_infoLabel = new QLabel(container); + QSizePolicy sizePolicy4(QSizePolicy::Preferred, QSizePolicy::Preferred); + sizePolicy4.setHorizontalStretch(0); + sizePolicy4.setVerticalStretch(0); + m_infoLabel->setSizePolicy(sizePolicy4); + m_infoLabel->setWordWrap(false); + + m_warningIconLabel = new QLabel(container); + m_warningIconLabel->setSizePolicy(sizePolicy3); + + m_warningLabel = new QLabel(container); + m_warningLabel->setSizePolicy(sizePolicy4); + m_warningLabel->setWordWrap(true); + + m_signEntityLabel->setText(IosBuildConfiguration::tr("Development team:")); + + connect(m_qmakeDefaults, &QPushButton::clicked, this, &IosBuildSettingsWidget::onReset); + + m_infoIconLabel->hide(); + m_infoIconLabel->setPixmap(Utils::Icons::INFO.pixmap()); + m_infoLabel->hide(); + + m_warningIconLabel->hide(); + m_warningIconLabel->setPixmap(Utils::Icons::WARNING.pixmap()); + m_warningLabel->hide(); + + detailsWidget->setState(Utils::DetailsWidget::NoSummary); + detailsWidget->setWidget(container); + + setDisplayName(IosBuildConfiguration::tr("iOS Settings")); + + if (m_isDevice) { + connect(IosConfigurations::instance(), &IosConfigurations::provisioningDataChanged, + this, &IosBuildSettingsWidget::populateDevelopmentTeams); + connect(m_signEntityCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), + this, &IosBuildSettingsWidget::onSigningEntityComboIndexChanged); + connect(m_autoSignCheckbox, &QCheckBox::toggled, + this, &IosBuildSettingsWidget::configureSigningUi); + configureSigningUi(m_autoSignCheckbox->isChecked()); + setDefaultSigningIdentfier(bc->m_signingIdentifier->value()); + } + + m_signEntityCombo->setEnabled(m_isDevice); + m_signEntityLabel->setEnabled(m_isDevice); + adjustSize(); + + auto rootLayout = new QVBoxLayout(this); + rootLayout->setMargin(0); + rootLayout->addWidget(detailsWidget); + + auto gridLayout = new QGridLayout(); + gridLayout->addWidget(m_signEntityLabel, 0, 0, 1, 1); + gridLayout->addWidget(m_signEntityCombo, 0, 1, 1, 1); + gridLayout->addWidget(m_autoSignCheckbox, 0, 2, 1, 1); + gridLayout->addWidget(m_qmakeDefaults, 1, 1, 1, 1); + + auto horizontalLayout = new QHBoxLayout(); + horizontalLayout->addWidget(m_infoIconLabel); + horizontalLayout->addWidget(m_infoLabel); + + auto horizontalLayout_2 = new QHBoxLayout(); + horizontalLayout_2->addWidget(m_warningIconLabel); + horizontalLayout_2->addWidget(m_warningLabel); + + auto verticalLayout = new QVBoxLayout(container); + verticalLayout->addLayout(gridLayout); + verticalLayout->addLayout(horizontalLayout); + verticalLayout->addLayout(horizontalLayout_2); +} + +void IosBuildSettingsWidget::setDefaultSigningIdentfier(const QString &identifier) const +{ + if (identifier.isEmpty()) { + m_signEntityCombo->setCurrentIndex(0); + return; + } + + int defaultIndex = -1; + for (int index = 0; index < m_signEntityCombo->count(); ++index) { + QString teamID = m_signEntityCombo->itemData(index, IdentifierRole).toString(); + if (teamID == identifier) { + defaultIndex = index; + break; + } + } + if (defaultIndex > -1) { + m_signEntityCombo->setCurrentIndex(defaultIndex); + } else { + // Reset to default + m_signEntityCombo->setCurrentIndex(0); + qCDebug(iosSettingsLog) << "Cannot find default" + << (m_autoSignCheckbox->isChecked() ? "team": "provisioning profile") + << ". Identifier: " << identifier; + } +} + +bool IosBuildSettingsWidget::isSigningAutomaticallyManaged() const +{ + return m_autoSignCheckbox->isChecked() && m_signEntityCombo->currentIndex() > 0; +} + +void IosBuildSettingsWidget::onSigningEntityComboIndexChanged() +{ + QString identifier = selectedIdentifier(); + (m_autoSignCheckbox->isChecked() ? m_lastTeamSelection : m_lastProfileSelection) = identifier; + + updateInfoText(); + updateWarningText(); + announceSigningChanged(m_autoSignCheckbox->isChecked(), identifier); +} + +void IosBuildSettingsWidget::onReset() +{ + m_lastTeamSelection.clear(); + m_lastProfileSelection.clear(); + m_autoSignCheckbox->setChecked(true); + setDefaultSigningIdentfier(""); +} + +void IosBuildSettingsWidget::configureSigningUi(bool autoManageSigning) +{ + m_signEntityLabel->setText(autoManageSigning ? IosBuildConfiguration::tr("Development team:") + : IosBuildConfiguration::tr("Provisioning profile:")); + if (autoManageSigning) + populateDevelopmentTeams(); + else + populateProvisioningProfiles(); + + updateInfoText(); + announceSigningChanged(autoManageSigning, selectedIdentifier()); +} + +void IosBuildSettingsWidget::announceSigningChanged(bool autoManagedSigning, QString identifier) +{ + if (m_bc->m_signingIdentifier->value().compare(identifier) != 0 + || m_bc->m_autoManagedSigning->value() != autoManagedSigning) { + m_bc->m_autoManagedSigning->setValue(autoManagedSigning); + m_bc->m_signingIdentifier->setValue(identifier); + m_bc->updateQmakeCommand(); + } +} + +void IosBuildSettingsWidget::populateDevelopmentTeams() +{ + { + QSignalBlocker blocker(m_signEntityCombo); + // Populate Team id's + m_signEntityCombo->clear(); + m_signEntityCombo->addItem(IosBuildConfiguration::tr("Default")); + foreach (auto team, IosConfigurations::developmentTeams()) { + m_signEntityCombo->addItem(team->displayName()); + const int index = m_signEntityCombo->count() - 1; + m_signEntityCombo->setItemData(index, team->identifier(), IdentifierRole); + m_signEntityCombo->setItemData(index, team->details(), Qt::ToolTipRole); + } + } + // Maintain previous selection. + setDefaultSigningIdentfier(m_lastTeamSelection); + updateWarningText(); +} + +void IosBuildSettingsWidget::populateProvisioningProfiles() +{ + { + // Populate Team id's + QSignalBlocker blocker(m_signEntityCombo); + m_signEntityCombo->clear(); + const ProvisioningProfiles profiles = IosConfigurations::provisioningProfiles(); + if (profiles.count() > 0) { + for (auto profile : profiles) { + m_signEntityCombo->addItem(profile->displayName()); + const int index = m_signEntityCombo->count() - 1; + m_signEntityCombo->setItemData(index, profile->identifier(), IdentifierRole); + m_signEntityCombo->setItemData(index, profile->details(), Qt::ToolTipRole); + } + } else { + m_signEntityCombo->addItem(IosBuildConfiguration::tr("None")); + } + } + // Maintain previous selection. + setDefaultSigningIdentfier(m_lastProfileSelection); + updateWarningText(); +} + +QString IosBuildSettingsWidget::selectedIdentifier() const +{ + return m_signEntityCombo->currentData(IdentifierRole).toString(); +} + +void IosBuildSettingsWidget::updateInfoText() +{ + if (!m_isDevice) + return; + + QString infoMessage; + auto addMessage = [&infoMessage](const QString &msg) { + if (!infoMessage.isEmpty()) + infoMessage += "\n"; + infoMessage += msg; + }; + + QString identifier = selectedIdentifier(); + bool configuringTeams = m_autoSignCheckbox->isChecked(); + + if (identifier.isEmpty()) { + // No signing entity selection. + if (configuringTeams) + addMessage(IosBuildConfiguration::tr("Development team is not selected.")); + else + addMessage(IosBuildConfiguration::tr("Provisioning profile is not selected.")); + + addMessage(IosBuildConfiguration::tr("Using default development team and provisioning profile.")); + } else { + if (!configuringTeams) { + ProvisioningProfilePtr profile = IosConfigurations::provisioningProfile(identifier); + QTC_ASSERT(profile, return); + auto team = profile->developmentTeam(); + if (team) { + // Display corresponding team information. + addMessage(IosBuildConfiguration::tr("Development team: %1 (%2)").arg(team->displayName()) + .arg(team->identifier())); + addMessage(IosBuildConfiguration::tr("Settings defined here override the QMake environment.")); + } else { + qCDebug(iosSettingsLog) << "Development team not found for profile" << profile; + } + } else { + addMessage(IosBuildConfiguration::tr("Settings defined here override the QMake environment.")); + } + } + + m_infoIconLabel->setVisible(!infoMessage.isEmpty()); + m_infoLabel->setVisible(!infoMessage.isEmpty()); + m_infoLabel->setText(infoMessage); +} + +void IosBuildSettingsWidget::updateWarningText() +{ + if (!m_isDevice) + return; + + QString warningText; + bool configuringTeams = m_autoSignCheckbox->isChecked(); + if (m_signEntityCombo->count() < 2) { + warningText = IosBuildConfiguration::tr("%1 not configured. Use Xcode and Apple " + "developer account to configure the " + "provisioning profiles and teams.") + .arg(configuringTeams ? IosBuildConfiguration::tr("Development teams") + : IosBuildConfiguration::tr("Provisioning profiles")); + } else { + QString identifier = selectedIdentifier(); + if (configuringTeams) { + auto team = IosConfigurations::developmentTeam(identifier); + if (team && !team->hasProvisioningProfile()) + warningText = IosBuildConfiguration::tr("No provisioning profile found for the selected team."); + } else { + auto profile = IosConfigurations::provisioningProfile(identifier); + if (profile && QDateTime::currentDateTimeUtc() > profile->expirationDate()) { + warningText = IosBuildConfiguration::tr("Provisioning profile expired. Expiration date: %1") + .arg(profile->expirationDate().toLocalTime().toString(Qt::SystemLocaleLongDate)); + } + } + } + + m_warningLabel->setVisible(!warningText.isEmpty()); + m_warningIconLabel->setVisible(!warningText.isEmpty()); + m_warningLabel->setText(warningText); +} + + +// IosBuildConfiguration + IosBuildConfiguration::IosBuildConfiguration(Target *target, Core::Id id) : QmakeBuildConfiguration(target, id) { + m_signingIdentifier = addAspect<BaseStringAspect>(); + m_signingIdentifier->setSettingsKey(signingIdentifierKey); + + m_autoManagedSigning = addAspect<BaseBoolAspect>(); + m_autoManagedSigning->setDefaultValue(true); + m_autoManagedSigning->setSettingsKey(autoManagedSigningKey); } -QList<ProjectExplorer::NamedWidget *> IosBuildConfiguration::createSubConfigWidgets() +QList<NamedWidget *> IosBuildConfiguration::createSubConfigWidgets() { auto subConfigWidgets = QmakeBuildConfiguration::createSubConfigWidgets(); - Core::Id devType = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(target()->kit()); // Ownership of this widget is with BuildSettingsWidget - auto buildSettingsWidget = new IosBuildSettingsWidget(devType, m_signingIdentifier, - m_autoManagedSigning); + auto buildSettingsWidget = new IosBuildSettingsWidget(this); subConfigWidgets.prepend(buildSettingsWidget); - connect(buildSettingsWidget, &IosBuildSettingsWidget::signingSettingsChanged, - this, &IosBuildConfiguration::onSigningSettingsChanged); return subConfigWidgets; } -QVariantMap IosBuildConfiguration::toMap() const -{ - QVariantMap map(QmakeBuildConfiguration::toMap()); - map.insert(signingIdentifierKey, m_signingIdentifier); - map.insert(autoManagedSigningKey, m_autoManagedSigning); - return map; -} - bool IosBuildConfiguration::fromMap(const QVariantMap &map) { if (!QmakeBuildConfiguration::fromMap(map)) return false; - m_autoManagedSigning = map.value(autoManagedSigningKey).toBool(); - m_signingIdentifier = map.value(signingIdentifierKey).toString(); updateQmakeCommand(); return true; } -void IosBuildConfiguration::onSigningSettingsChanged(bool autoManagedSigning, QString identifier) -{ - if (m_signingIdentifier.compare(identifier) != 0 - || m_autoManagedSigning != autoManagedSigning) { - m_autoManagedSigning = autoManagedSigning; - m_signingIdentifier = identifier; - updateQmakeCommand(); - } -} - void IosBuildConfiguration::updateQmakeCommand() { QMakeStep *qmakeStepInstance = qmakeStep(); @@ -110,25 +451,26 @@ void IosBuildConfiguration::updateQmakeCommand() }); // Set force ovveride qmake switch - if (!m_signingIdentifier.isEmpty() ) + const QString signingIdentifier = m_signingIdentifier->value(); + if (signingIdentifier.isEmpty() ) extraArgs << forceOverrideArg; - Core::Id devType = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(target()->kit()); - if (devType == Constants::IOS_DEVICE_TYPE && !m_signingIdentifier.isEmpty()) { - if (m_autoManagedSigning) { - extraArgs << qmakeIosTeamSettings + m_signingIdentifier; + Core::Id devType = DeviceTypeKitAspect::deviceTypeId(target()->kit()); + if (devType == Constants::IOS_DEVICE_TYPE && !signingIdentifier.isEmpty()) { + if (m_autoManagedSigning->value()) { + extraArgs << qmakeIosTeamSettings + signingIdentifier; } else { // Get the team id from provisioning profile ProvisioningProfilePtr profile = - IosConfigurations::provisioningProfile(m_signingIdentifier); + IosConfigurations::provisioningProfile(signingIdentifier); QString teamId; if (profile) teamId = profile->developmentTeam()->identifier(); else - qCDebug(iosLog) << "No provisioing profile found for id:"<< m_signingIdentifier; + qCDebug(iosLog) << "No provisioing profile found for id:" << signingIdentifier; if (!teamId.isEmpty()) { - extraArgs << qmakeProvisioningProfileSettings + m_signingIdentifier; + extraArgs << qmakeProvisioningProfileSettings + signingIdentifier; extraArgs << qmakeIosTeamSettings + teamId; } else { qCDebug(iosLog) << "Development team unavailable for profile:" << profile; diff --git a/src/plugins/ios/iosbuildconfiguration.h b/src/plugins/ios/iosbuildconfiguration.h index aa3b529e94..d575b328b0 100644 --- a/src/plugins/ios/iosbuildconfiguration.h +++ b/src/plugins/ios/iosbuildconfiguration.h @@ -26,6 +26,8 @@ #include "qmakeprojectmanager/qmakebuildconfiguration.h" +#include <projectexplorer/projectconfigurationaspects.h> + namespace Ios { namespace Internal { @@ -37,15 +39,15 @@ public: IosBuildConfiguration(ProjectExplorer::Target *target, Core::Id id); private: + friend class IosBuildSettingsWidget; + QList<ProjectExplorer::NamedWidget *> createSubConfigWidgets() override; - QVariantMap toMap() const override; bool fromMap(const QVariantMap &map) override; - void onSigningSettingsChanged(bool autoManagedSigning, QString identifier); void updateQmakeCommand(); - QString m_signingIdentifier; - bool m_autoManagedSigning = true; + ProjectExplorer::BaseStringAspect *m_signingIdentifier = nullptr; + ProjectExplorer::BaseBoolAspect *m_autoManagedSigning = nullptr; }; class IosBuildConfigurationFactory : public QmakeProjectManager::QmakeBuildConfigurationFactory diff --git a/src/plugins/ios/iosbuildsettingswidget.cpp b/src/plugins/ios/iosbuildsettingswidget.cpp deleted file mode 100644 index f7c90b3aa9..0000000000 --- a/src/plugins/ios/iosbuildsettingswidget.cpp +++ /dev/null @@ -1,296 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "iosbuildsettingswidget.h" -#include "ui_iosbuildsettingswidget.h" -#include "iosconfigurations.h" -#include "iosconstants.h" - -#include <qmakeprojectmanager/qmakeproject.h> -#include <qmakeprojectmanager/qmakenodes.h> - -#include <projectexplorer/runconfiguration.h> - -#include <utils/algorithm.h> -#include <utils/detailswidget.h> -#include <utils/qtcassert.h> -#include <utils/utilsicons.h> - -#include <QLoggingCategory> -#include <QVBoxLayout> - -using namespace QmakeProjectManager; - -namespace Ios { -namespace Internal { - -namespace { -Q_LOGGING_CATEGORY(iosSettingsLog, "qtc.ios.common", QtWarningMsg) -} - -static const int IdentifierRole = Qt::UserRole+1; - -IosBuildSettingsWidget::IosBuildSettingsWidget(const Core::Id &deviceType, - const QString &signingIdentifier, - bool isSigningAutoManaged, QWidget *parent) : - ProjectExplorer::NamedWidget(parent), - ui(new Ui::IosBuildSettingsWidget), - m_detailsWidget(new Utils::DetailsWidget(this)), - m_deviceType(deviceType) -{ - auto rootLayout = new QVBoxLayout(this); - rootLayout->setMargin(0); - rootLayout->addWidget(m_detailsWidget); - - auto container = new QWidget(m_detailsWidget); - ui->setupUi(container); - ui->m_autoSignCheckbox->setChecked(isSigningAutoManaged); - connect(ui->m_qmakeDefaults, &QPushButton::clicked, this, &IosBuildSettingsWidget::onReset); - - ui->m_infoIconLabel->hide(); - ui->m_infoIconLabel->setPixmap(Utils::Icons::INFO.pixmap()); - ui->m_infoLabel->hide(); - - ui->m_warningIconLabel->hide(); - ui->m_warningIconLabel->setPixmap(Utils::Icons::WARNING.pixmap()); - ui->m_warningLabel->hide(); - - m_detailsWidget->setState(Utils::DetailsWidget::NoSummary); - m_detailsWidget->setWidget(container); - - setDisplayName(tr("iOS Settings")); - - const bool isDevice = m_deviceType == Constants::IOS_DEVICE_TYPE; - if (isDevice) { - connect(IosConfigurations::instance(), &IosConfigurations::provisioningDataChanged, - this, &IosBuildSettingsWidget::populateDevelopmentTeams); - connect(ui->m_signEntityCombo, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), - this, &IosBuildSettingsWidget::onSigningEntityComboIndexChanged); - connect(ui->m_autoSignCheckbox, &QCheckBox::toggled, - this, &IosBuildSettingsWidget::configureSigningUi); - configureSigningUi(ui->m_autoSignCheckbox->isChecked()); - setDefaultSigningIdentfier(signingIdentifier); - } - - ui->m_autoSignCheckbox->setEnabled(isDevice); - ui->m_signEntityCombo->setEnabled(isDevice); - ui->m_qmakeDefaults->setEnabled(isDevice); - ui->m_signEntityLabel->setEnabled(isDevice); - adjustSize(); -} - -IosBuildSettingsWidget::~IosBuildSettingsWidget() -{ - delete ui; -} - -void IosBuildSettingsWidget::setDefaultSigningIdentfier(const QString &identifier) const -{ - if (identifier.isEmpty()) { - ui->m_signEntityCombo->setCurrentIndex(0); - return; - } - - int defaultIndex = -1; - for (int index = 0; index < ui->m_signEntityCombo->count(); ++index) { - QString teamID = ui->m_signEntityCombo->itemData(index, IdentifierRole).toString(); - if (teamID == identifier) { - defaultIndex = index; - break; - } - } - if (defaultIndex > -1) { - ui->m_signEntityCombo->setCurrentIndex(defaultIndex); - } else { - // Reset to default - ui->m_signEntityCombo->setCurrentIndex(0); - qCDebug(iosSettingsLog) << "Cannot find default" - << (ui->m_autoSignCheckbox->isChecked() ? "team": "provisioning profile") - << ". Identifier: " << identifier; - } -} - -bool IosBuildSettingsWidget::isSigningAutomaticallyManaged() const -{ - return ui->m_autoSignCheckbox->isChecked() && ui->m_signEntityCombo->currentIndex() > 0; -} - -void IosBuildSettingsWidget::onSigningEntityComboIndexChanged() -{ - QString identifier = selectedIdentifier(); - (ui->m_autoSignCheckbox->isChecked() ? m_lastTeamSelection : m_lastProfileSelection) = identifier; - - updateInfoText(); - updateWarningText(); - emit signingSettingsChanged(ui->m_autoSignCheckbox->isChecked(), identifier); -} - -void IosBuildSettingsWidget::onReset() -{ - m_lastTeamSelection.clear(); - m_lastProfileSelection.clear(); - ui->m_autoSignCheckbox->setChecked(true); - setDefaultSigningIdentfier(""); -} - -void IosBuildSettingsWidget::configureSigningUi(bool autoManageSigning) -{ - ui->m_signEntityLabel->setText(autoManageSigning ? tr("Development team:") - : tr("Provisioning profile:")); - if (autoManageSigning) - populateDevelopmentTeams(); - else - populateProvisioningProfiles(); - - updateInfoText(); - emit signingSettingsChanged(autoManageSigning, selectedIdentifier()); -} - -void IosBuildSettingsWidget::populateDevelopmentTeams() -{ - { - QSignalBlocker blocker(ui->m_signEntityCombo); - // Populate Team id's - ui->m_signEntityCombo->clear(); - ui->m_signEntityCombo->addItem(tr("Default")); - foreach (auto team, IosConfigurations::developmentTeams()) { - ui->m_signEntityCombo->addItem(team->displayName()); - const int index = ui->m_signEntityCombo->count() - 1; - ui->m_signEntityCombo->setItemData(index, team->identifier(), IdentifierRole); - ui->m_signEntityCombo->setItemData(index, team->details(), Qt::ToolTipRole); - } - } - // Maintain previous selection. - setDefaultSigningIdentfier(m_lastTeamSelection); - updateWarningText(); -} - -void IosBuildSettingsWidget::populateProvisioningProfiles() -{ - { - // Populate Team id's - QSignalBlocker blocker(ui->m_signEntityCombo); - ui->m_signEntityCombo->clear(); - ProvisioningProfiles profiles = IosConfigurations::provisioningProfiles(); - if (profiles.count() > 0) { - foreach (auto profile, profiles) { - ui->m_signEntityCombo->addItem(profile->displayName()); - const int index = ui->m_signEntityCombo->count() - 1; - ui->m_signEntityCombo->setItemData(index, profile->identifier(), IdentifierRole); - ui->m_signEntityCombo->setItemData(index, profile->details(), Qt::ToolTipRole); - } - } else { - ui->m_signEntityCombo->addItem(tr("None")); - } - } - // Maintain previous selection. - setDefaultSigningIdentfier(m_lastProfileSelection); - updateWarningText(); -} - -QString IosBuildSettingsWidget::selectedIdentifier() const -{ - return ui->m_signEntityCombo->currentData(IdentifierRole).toString(); -} - -void IosBuildSettingsWidget::updateInfoText() -{ - if (m_deviceType != Constants::IOS_DEVICE_TYPE) - return; - - QString infoMessage; - auto addMessage = [&infoMessage](const QString &msg) { - if (!infoMessage.isEmpty()) - infoMessage += "\n"; - infoMessage += msg; - }; - - QString identifier = selectedIdentifier(); - bool configuringTeams = ui->m_autoSignCheckbox->isChecked(); - - if (identifier.isEmpty()) { - // No signing entity selection. - if (configuringTeams) - addMessage(tr("Development team is not selected.")); - else - addMessage(tr("Provisioning profile is not selected.")); - - addMessage(tr("Using default development team and provisioning profile.")); - } else { - if (!configuringTeams) { - ProvisioningProfilePtr profile = IosConfigurations::provisioningProfile(identifier); - QTC_ASSERT(profile, return); - auto team = profile->developmentTeam(); - if (team) { - // Display corresponding team information. - addMessage(tr("Development team: %1 (%2)").arg(team->displayName()) - .arg(team->identifier())); - addMessage(tr("Settings defined here override the QMake environment.")); - } else { - qCDebug(iosSettingsLog) << "Development team not found for profile" << profile; - } - } else { - addMessage(tr("Settings defined here override the QMake environment.")); - } - } - - ui->m_infoIconLabel->setVisible(!infoMessage.isEmpty()); - ui->m_infoLabel->setVisible(!infoMessage.isEmpty()); - ui->m_infoLabel->setText(infoMessage); -} - -void IosBuildSettingsWidget::updateWarningText() -{ - if (m_deviceType != Constants::IOS_DEVICE_TYPE) - return; - - QString warningText; - bool configuringTeams = ui->m_autoSignCheckbox->isChecked(); - if (ui->m_signEntityCombo->count() < 2) { - warningText = tr("%1 not configured. Use Xcode and Apple developer account to configure the " - "provisioning profiles and teams.") - .arg(configuringTeams ? tr("Development teams") : tr("Provisioning profiles")); - } else { - QString identifier = selectedIdentifier(); - if (configuringTeams) { - auto team = IosConfigurations::developmentTeam(identifier); - if (team && !team->hasProvisioningProfile()) - warningText = tr("No provisioning profile found for the selected team."); - } else { - auto profile = IosConfigurations::provisioningProfile(identifier); - if (profile && QDateTime::currentDateTimeUtc() > profile->expirationDate()) { - warningText = tr("Provisioning profile expired. Expiration date: %1") - .arg(profile->expirationDate().toLocalTime().toString(Qt::SystemLocaleLongDate)); - } - } - } - - ui->m_warningLabel->setVisible(!warningText.isEmpty()); - ui->m_warningIconLabel->setVisible(!warningText.isEmpty()); - ui->m_warningLabel->setText(warningText); -} - -} // namespace Internal -} // namespace Ios diff --git a/src/plugins/ios/iosbuildsettingswidget.h b/src/plugins/ios/iosbuildsettingswidget.h deleted file mode 100644 index e8641fefcb..0000000000 --- a/src/plugins/ios/iosbuildsettingswidget.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ -#pragma once - -#include <coreplugin/id.h> -#include "projectexplorer/namedwidget.h" - -#include <QWidget> - -namespace Utils { -class DetailsWidget; -} - - -namespace Ios { -namespace Internal { -namespace Ui { - class IosBuildSettingsWidget; -} - -class IosBuildSettingsWidget : public ProjectExplorer::NamedWidget -{ - Q_OBJECT - -public: - explicit IosBuildSettingsWidget(const Core::Id &deviceType, const QString &signingIdentifier, - bool isSigningAutoManaged, QWidget *parent = nullptr); - ~IosBuildSettingsWidget() override; - - bool isSigningAutomaticallyManaged() const; - -signals: - void signingSettingsChanged(bool isAutoManaged, QString identifier); - -private: - void onSigningEntityComboIndexChanged(); - void onReset(); - - void setDefaultSigningIdentfier(const QString &identifier) const; - void configureSigningUi(bool autoManageSigning); - void populateDevelopmentTeams(); - void populateProvisioningProfiles(); - QString selectedIdentifier() const; - void updateInfoText(); - void updateWarningText(); - -private: - Ui::IosBuildSettingsWidget *ui; - Utils::DetailsWidget *m_detailsWidget; - QString m_lastProfileSelection; - QString m_lastTeamSelection; - const Core::Id m_deviceType; -}; - -} // namespace Internal -} // namespace Ios diff --git a/src/plugins/ios/iosbuildsettingswidget.ui b/src/plugins/ios/iosbuildsettingswidget.ui deleted file mode 100644 index 3a947d42c8..0000000000 --- a/src/plugins/ios/iosbuildsettingswidget.ui +++ /dev/null @@ -1,137 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>Ios::Internal::IosBuildSettingsWidget</class> - <widget class="QWidget" name="Ios::Internal::IosBuildSettingsWidget"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>467</width> - <height>141</height> - </rect> - </property> - <property name="windowTitle"> - <string/> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <layout class="QGridLayout" name="gridLayout"> - <item row="1" column="1"> - <widget class="QPushButton" name="m_qmakeDefaults"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Reset</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QComboBox" name="m_signEntityCombo"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QCheckBox" name="m_autoSignCheckbox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Automatically manage signing</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="m_signEntityLabel"> - <property name="text"> - <string>Development team:</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QLabel" name="m_infoIconLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="m_infoLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string/> - </property> - <property name="wordWrap"> - <bool>false</bool> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <widget class="QLabel" name="m_warningIconLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="m_warningLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string/> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - <resources/> - <connections/> -</ui> diff --git a/src/plugins/ios/iosbuildstep.cpp b/src/plugins/ios/iosbuildstep.cpp index 8d78446c51..0fbcb44305 100644 --- a/src/plugins/ios/iosbuildstep.cpp +++ b/src/plugins/ios/iosbuildstep.cpp @@ -76,7 +76,7 @@ bool IosBuildStep::init() if (!bc) emit addTask(Task::buildConfigurationMissingTask()); - ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit(), ProjectExplorer::Constants::CXX_LANGUAGE_ID); + ToolChain *tc = ToolChainKitAspect::toolChain(target()->kit(), ProjectExplorer::Constants::CXX_LANGUAGE_ID); if (!tc) emit addTask(Task::compilerMissingTask()); @@ -87,11 +87,11 @@ bool IosBuildStep::init() ProcessParameters *pp = processParameters(); pp->setMacroExpander(bc->macroExpander()); - pp->setWorkingDirectory(bc->buildDirectory().toString()); + pp->setWorkingDirectory(bc->buildDirectory()); Utils::Environment env = bc->environment(); Utils::Environment::setupEnglishOutput(&env); pp->setEnvironment(env); - pp->setCommand(buildCommand()); + pp->setCommand(Utils::FilePath::fromString(buildCommand())); pp->setArguments(Utils::QtcProcess::joinArgs(allArguments())); pp->resolveAll(); @@ -138,7 +138,7 @@ QStringList IosBuildStep::defaultArguments() const { QStringList res; Kit *kit = target()->kit(); - ToolChain *tc = ToolChainKitInformation::toolChain(kit, ProjectExplorer::Constants::CXX_LANGUAGE_ID); + ToolChain *tc = ToolChainKitAspect::toolChain(kit, ProjectExplorer::Constants::CXX_LANGUAGE_ID); switch (buildConfiguration()->buildType()) { case BuildConfiguration::Debug : res << "-configuration" << "Debug"; @@ -158,8 +158,8 @@ QStringList IosBuildStep::defaultArguments() const auto gtc = static_cast<GccToolChain *>(tc); res << gtc->platformCodeGenFlags(); } - if (!SysRootKitInformation::sysRoot(kit).isEmpty()) - res << "-sdk" << SysRootKitInformation::sysRoot(kit).toString(); + if (!SysRootKitAspect::sysRoot(kit).isEmpty()) + res << "-sdk" << SysRootKitAspect::sysRoot(kit).toString(); res << "SYMROOT=" + buildConfiguration()->buildDirectory().toString(); return res; } @@ -251,9 +251,9 @@ void IosBuildStepConfigWidget::updateDetails() ProcessParameters param; param.setMacroExpander(bc->macroExpander()); - param.setWorkingDirectory(bc->buildDirectory().toString()); + param.setWorkingDirectory(bc->buildDirectory()); param.setEnvironment(bc->environment()); - param.setCommand(m_buildStep->buildCommand()); + param.setCommand(Utils::FilePath::fromString(m_buildStep->buildCommand())); param.setArguments(Utils::QtcProcess::joinArgs(m_buildStep->allArguments())); setSummaryText(param.summary(displayName())); diff --git a/src/plugins/ios/iosconfigurations.cpp b/src/plugins/ios/iosconfigurations.cpp index 3ceec86714..6b4c244386 100644 --- a/src/plugins/ios/iosconfigurations.cpp +++ b/src/plugins/ios/iosconfigurations.cpp @@ -136,7 +136,7 @@ static ToolChainPair findToolChainForPlatform(const XcodePlatform &platform, const QList<ClangToolChain *> &toolChains) { ToolChainPair platformToolChains; - auto toolchainMatch = [](ClangToolChain *toolChain, const Utils::FileName &compilerPath, const QStringList &flags) { + auto toolchainMatch = [](ClangToolChain *toolChain, const Utils::FilePath &compilerPath, const QStringList &flags) { return compilerPath == toolChain->compilerCommand() && flags == toolChain->platformCodeGenFlags() && flags == toolChain->platformLinkerFlags(); @@ -168,7 +168,7 @@ static QHash<XcodePlatform::ToolchainTarget, ToolChainPair> findToolChains(const static QSet<Kit *> existingAutoDetectedIosKits() { return Utils::filtered(KitManager::kits(), [](Kit *kit) -> bool { - Core::Id deviceKind = DeviceTypeKitInformation::deviceTypeId(kit); + Core::Id deviceKind = DeviceTypeKitAspect::deviceTypeId(kit); return kit->isAutoDetected() && (deviceKind == Constants::IOS_DEVICE_TYPE || deviceKind == Constants::IOS_SIMULATOR_TYPE); }).toSet(); @@ -181,40 +181,40 @@ static void printKits(const QSet<Kit *> &kits) } static void setupKit(Kit *kit, Core::Id pDeviceType, const ToolChainPair& toolChains, - const QVariant &debuggerId, const Utils::FileName &sdkPath, BaseQtVersion *qtVersion) + const QVariant &debuggerId, const Utils::FilePath &sdkPath, BaseQtVersion *qtVersion) { - DeviceTypeKitInformation::setDeviceTypeId(kit, pDeviceType); + DeviceTypeKitAspect::setDeviceTypeId(kit, pDeviceType); if (toolChains.first) - ToolChainKitInformation::setToolChain(kit, toolChains.first); + ToolChainKitAspect::setToolChain(kit, toolChains.first); else - ToolChainKitInformation::clearToolChain(kit, ProjectExplorer::Constants::C_LANGUAGE_ID); + ToolChainKitAspect::clearToolChain(kit, ProjectExplorer::Constants::C_LANGUAGE_ID); if (toolChains.second) - ToolChainKitInformation::setToolChain(kit, toolChains.second); + ToolChainKitAspect::setToolChain(kit, toolChains.second); else - ToolChainKitInformation::clearToolChain(kit, ProjectExplorer::Constants::CXX_LANGUAGE_ID); + ToolChainKitAspect::clearToolChain(kit, ProjectExplorer::Constants::CXX_LANGUAGE_ID); - QtKitInformation::setQtVersion(kit, qtVersion); + QtKitAspect::setQtVersion(kit, qtVersion); // only replace debugger with the default one if we find an unusable one here // (since the user could have changed it) - if ((!DebuggerKitInformation::debugger(kit) - || !DebuggerKitInformation::debugger(kit)->isValid() - || DebuggerKitInformation::debugger(kit)->engineType() != LldbEngineType) + if ((!DebuggerKitAspect::debugger(kit) + || !DebuggerKitAspect::debugger(kit)->isValid() + || DebuggerKitAspect::debugger(kit)->engineType() != LldbEngineType) && debuggerId.isValid()) - DebuggerKitInformation::setDebugger(kit, debuggerId); + DebuggerKitAspect::setDebugger(kit, debuggerId); - kit->setMutable(DeviceKitInformation::id(), true); - kit->setSticky(QtKitInformation::id(), true); - kit->setSticky(ToolChainKitInformation::id(), true); - kit->setSticky(DeviceTypeKitInformation::id(), true); - kit->setSticky(SysRootKitInformation::id(), true); - kit->setSticky(DebuggerKitInformation::id(), false); + kit->setMutable(DeviceKitAspect::id(), true); + kit->setSticky(QtKitAspect::id(), true); + kit->setSticky(ToolChainKitAspect::id(), true); + kit->setSticky(DeviceTypeKitAspect::id(), true); + kit->setSticky(SysRootKitAspect::id(), true); + kit->setSticky(DebuggerKitAspect::id(), false); - SysRootKitInformation::setSysRoot(kit, sdkPath); + SysRootKitAspect::setSysRoot(kit, sdkPath); } -static QVersionNumber findXcodeVersion(const Utils::FileName &developerPath) +static QVersionNumber findXcodeVersion(const Utils::FilePath &developerPath) { - FileName xcodeInfo = developerPath.parentDir().appendPath("Info.plist"); + const FilePath xcodeInfo = developerPath.parentDir().pathAppended("Info.plist"); if (xcodeInfo.exists()) { QSettings settings(xcodeInfo.toString(), QSettings::NativeFormat); return QVersionNumber::fromString(settings.value("CFBundleShortVersionString").toString()); @@ -287,10 +287,10 @@ void IosConfigurations::updateAutomaticKitList() Kit *kit = Utils::findOrDefault(existingKits, [&pDeviceType, &platformToolchains, &qtVersion](const Kit *kit) { // we do not compare the sdk (thus automatically upgrading it in place if a // new Xcode is used). Change? - return DeviceTypeKitInformation::deviceTypeId(kit) == pDeviceType - && ToolChainKitInformation::toolChain(kit, ProjectExplorer::Constants::CXX_LANGUAGE_ID) == platformToolchains.second - && ToolChainKitInformation::toolChain(kit, ProjectExplorer::Constants::C_LANGUAGE_ID) == platformToolchains.first - && QtKitInformation::qtVersion(kit) == qtVersion; + return DeviceTypeKitAspect::deviceTypeId(kit) == pDeviceType + && ToolChainKitAspect::toolChain(kit, ProjectExplorer::Constants::CXX_LANGUAGE_ID) == platformToolchains.second + && ToolChainKitAspect::toolChain(kit, ProjectExplorer::Constants::C_LANGUAGE_ID) == platformToolchains.first + && QtKitAspect::qtVersion(kit) == qtVersion; }); QTC_ASSERT(!resultingKits.contains(kit), continue); if (kit) { @@ -300,17 +300,15 @@ void IosConfigurations::updateAutomaticKitList() kit->unblockNotification(); } else { qCDebug(kitSetupLog) << " - Setting up new kit"; - auto newKit = std::make_unique<Kit>(); - kit = newKit.get(); - kit->blockNotification(); - kit->setAutoDetected(true); - const QString baseDisplayName = isSimulatorDeviceId(pDeviceType) - ? tr("%1 Simulator").arg(qtVersion->unexpandedDisplayName()) - : qtVersion->unexpandedDisplayName(); - kit->setUnexpandedDisplayName(baseDisplayName); - setupKit(kit, pDeviceType, platformToolchains, debuggerId, sdk.path, qtVersion); - kit->unblockNotification(); - KitManager::registerKit(std::move(newKit)); + const auto init = [&](Kit *k) { + k->setAutoDetected(true); + const QString baseDisplayName = isSimulatorDeviceId(pDeviceType) + ? tr("%1 Simulator").arg(qtVersion->unexpandedDisplayName()) + : qtVersion->unexpandedDisplayName(); + k->setUnexpandedDisplayName(baseDisplayName); + setupKit(k, pDeviceType, platformToolchains, debuggerId, sdk.path, qtVersion); + }; + kit = KitManager::registerKit(init); } resultingKits.insert(kit); } @@ -359,7 +357,7 @@ void IosConfigurations::setIgnoreAllDevices(bool ignoreDevices) } } -void IosConfigurations::setScreenshotDir(const FileName &path) +void IosConfigurations::setScreenshotDir(const FilePath &path) { if (m_instance->m_screenshotDir != path) { m_instance->m_screenshotDir = path; @@ -367,12 +365,12 @@ void IosConfigurations::setScreenshotDir(const FileName &path) } } -FileName IosConfigurations::screenshotDir() +FilePath IosConfigurations::screenshotDir() { return m_instance->m_screenshotDir; } -FileName IosConfigurations::developerPath() +FilePath IosConfigurations::developerPath() { return m_instance->m_developerPath; } @@ -404,11 +402,11 @@ void IosConfigurations::load() QSettings *settings = Core::ICore::settings(); settings->beginGroup(SettingsGroup); m_ignoreAllDevices = settings->value(ignoreAllDevicesKey, false).toBool(); - m_screenshotDir = FileName::fromString(settings->value(screenshotDirPathKey).toString()); + m_screenshotDir = FilePath::fromString(settings->value(screenshotDirPathKey).toString()); if (!m_screenshotDir.exists()) { QString defaultDir = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation).constFirst(); - m_screenshotDir = FileName::fromString(defaultDir); + m_screenshotDir = FilePath::fromString(defaultDir); } settings->endGroup(); @@ -427,7 +425,7 @@ void IosConfigurations::updateSimulators() SimulatorControl::updateAvailableSimulators(); } -void IosConfigurations::setDeveloperPath(const FileName &devPath) +void IosConfigurations::setDeveloperPath(const FilePath &devPath) { static bool hasDevPath = false; if (devPath != m_instance->m_developerPath) { @@ -588,7 +586,8 @@ static ClangToolChain *createToolChain(const XcodePlatform &platform, && l != Core::Id(ProjectExplorer::Constants::CXX_LANGUAGE_ID)) return nullptr; - auto toolChain = new ClangToolChain(ToolChain::AutoDetection); + auto toolChain = new ClangToolChain; + toolChain->setDetection(ToolChain::AutoDetection); toolChain->setLanguage(l); toolChain->setDisplayName(target.name); toolChain->setPlatformCodeGenFlags(target.backendFlags); @@ -599,12 +598,10 @@ static ClangToolChain *createToolChain(const XcodePlatform &platform, return toolChain; } -QSet<Core::Id> IosToolChainFactory::supportedLanguages() const +IosToolChainFactory::IosToolChainFactory() { - return { - ProjectExplorer::Constants::C_LANGUAGE_ID, - ProjectExplorer::Constants::CXX_LANGUAGE_ID - }; + setSupportedLanguages({ProjectExplorer::Constants::C_LANGUAGE_ID, + ProjectExplorer::Constants::CXX_LANGUAGE_ID}); } QList<ToolChain *> IosToolChainFactory::autoDetect(const QList<ToolChain *> &existingToolChains) diff --git a/src/plugins/ios/iosconfigurations.h b/src/plugins/ios/iosconfigurations.h index 9b3faa348e..cddf0a5806 100644 --- a/src/plugins/ios/iosconfigurations.h +++ b/src/plugins/ios/iosconfigurations.h @@ -98,7 +98,8 @@ class IosToolChainFactory : public ProjectExplorer::ToolChainFactory Q_OBJECT public: - QSet<Core::Id> supportedLanguages() const override; + IosToolChainFactory(); + QList<ProjectExplorer::ToolChain *> autoDetect(const QList<ProjectExplorer::ToolChain *> &existingToolChains) override; }; @@ -111,11 +112,11 @@ public: static void initialize(); static bool ignoreAllDevices(); static void setIgnoreAllDevices(bool ignoreDevices); - static void setScreenshotDir(const Utils::FileName &path); - static Utils::FileName screenshotDir(); - static Utils::FileName developerPath(); + static void setScreenshotDir(const Utils::FilePath &path); + static Utils::FilePath screenshotDir(); + static Utils::FilePath developerPath(); static QVersionNumber xcodeVersion(); - static Utils::FileName lldbPath(); + static Utils::FilePath lldbPath(); static void updateAutomaticKitList(); static const DevelopmentTeams &developmentTeams(); static DevelopmentTeamPtr developmentTeam(const QString &teamID); @@ -131,12 +132,12 @@ private: void save(); void kitsRestored(); void updateSimulators(); - static void setDeveloperPath(const Utils::FileName &devPath); + static void setDeveloperPath(const Utils::FilePath &devPath); void initializeProvisioningData(); void loadProvisioningData(bool notify = true); - Utils::FileName m_developerPath; - Utils::FileName m_screenshotDir; + Utils::FilePath m_developerPath; + Utils::FilePath m_screenshotDir; QVersionNumber m_xcodeVersion; bool m_ignoreAllDevices; QFileSystemWatcher *m_provisioningDataWatcher = nullptr; diff --git a/src/plugins/ios/iosconstants.h b/src/plugins/ios/iosconstants.h index 540896e0e6..9731960bde 100644 --- a/src/plugins/ios/iosconstants.h +++ b/src/plugins/ios/iosconstants.h @@ -44,6 +44,9 @@ const char IOS_SIMULATOR_DEVICE_ID[] = "iOS Simulator Device "; const char IOS_PRESET_BUILD_STEP_ID[] = "Ios.IosPresetBuildStep"; const char IOS_DSYM_BUILD_STEP_ID[] = "Ios.IosDsymBuildStep"; +const char IosTarget[] = "IosTarget"; // QString +const char IosBuildDir[] = "IosBuildDir"; // QString + const quint16 IOS_DEVICE_PORT_START = 30000; const quint16 IOS_DEVICE_PORT_END = 31000; const quint16 IOS_SIMULATOR_PORT_START = 30000; diff --git a/src/plugins/ios/iosdeploystep.cpp b/src/plugins/ios/iosdeploystep.cpp index 65a225e7e6..2a0da618af 100644 --- a/src/plugins/ios/iosdeploystep.cpp +++ b/src/plugins/ios/iosdeploystep.cpp @@ -23,7 +23,6 @@ ** ****************************************************************************/ -#include "iosdeploystepwidget.h" #include "iosdeploystep.h" #include "iosbuildstep.h" #include "iosconstants.h" @@ -31,6 +30,7 @@ #include "iostoolhandler.h" #include <coreplugin/messagemanager.h> + #include <projectexplorer/buildconfiguration.h> #include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/target.h> @@ -50,6 +50,7 @@ #define ASSERT_STATE(state) ASSERT_STATE_GENERIC(State, state, m_state) using namespace ProjectExplorer; +using namespace Utils; namespace Ios { namespace Internal { @@ -73,7 +74,7 @@ Core::Id IosDeployStep::stepId() void IosDeployStep::updateDisplayNames() { IDevice::ConstPtr dev = - DeviceKitInformation::device(target()->kit()); + DeviceKitAspect::device(target()->kit()); const QString devName = dev.isNull() ? IosDevice::name() : dev->displayName(); setDefaultDisplayName(tr("Deploy to %1").arg(devName)); setDisplayName(tr("Deploy to %1").arg(devName)); @@ -82,11 +83,11 @@ void IosDeployStep::updateDisplayNames() bool IosDeployStep::init() { QTC_ASSERT(m_transferStatus == NoTransfer, return false); - m_device = DeviceKitInformation::device(target()->kit()); + m_device = DeviceKitAspect::device(target()->kit()); auto runConfig = qobject_cast<const IosRunConfiguration *>( this->target()->activeRunConfiguration()); QTC_ASSERT(runConfig, return false); - m_bundlePath = runConfig->bundleDirectory().toString(); + m_bundlePath = runConfig->bundleDirectory(); if (iosdevice()) { m_deviceType = IosDeviceType(IosDeviceType::IosDevice, deviceId()); @@ -122,7 +123,7 @@ void IosDeployStep::doRun() connect(m_toolHandler, &IosToolHandler::errorMsg, this, &IosDeployStep::handleErrorMsg); checkProvisioningProfile(); - m_toolHandler->requestTransferApp(appBundle(), m_deviceType.identifier); + m_toolHandler->requestTransferApp(m_bundlePath.toString(), m_deviceType.identifier); } void IosDeployStep::doCancel() @@ -197,7 +198,16 @@ void IosDeployStep::handleErrorMsg(IosToolHandler *handler, const QString &msg) BuildStepConfigWidget *IosDeployStep::createConfigWidget() { - return new IosDeployStepWidget(this); + auto widget = new BuildStepConfigWidget(this); + + widget->setObjectName("IosDeployStepWidget"); + widget->setDisplayName(QString("<b>%1</b>").arg(displayName())); + widget->setSummaryText(widget->displayName()); + + connect(this, &ProjectConfiguration::displayNameChanged, + widget, &BuildStepConfigWidget::updateSummary); + + return widget; } bool IosDeployStep::fromMap(const QVariantMap &map) @@ -218,14 +228,9 @@ QString IosDeployStep::deviceId() const return iosdevice()->uniqueDeviceID(); } -QString IosDeployStep::appBundle() const -{ - return m_bundlePath; -} - void IosDeployStep::raiseError(const QString &errorString) { - emit addTask(Task(Task::Error, errorString, Utils::FileName::fromString(QString()), -1, + emit addTask(Task(Task::Error, errorString, Utils::FilePath::fromString(QString()), -1, ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT)); } @@ -240,8 +245,7 @@ void IosDeployStep::checkProvisioningProfile() if (device.isNull()) return; - Utils::FileName provisioningFilePath = Utils::FileName::fromString(appBundle()); - provisioningFilePath.appendPath(QLatin1String("embedded.mobileprovision")); + const FilePath provisioningFilePath = m_bundlePath.pathAppended("embedded.mobileprovision"); // the file is a signed plist stored in DER format // we simply search for start and end of the plist instead of decoding the DER payload @@ -281,7 +285,7 @@ void IosDeployStep::checkProvisioningProfile() "does not cover the device %3 (%4). Deployment to it will fail.") .arg(provisioningProfile, provisioningUid, device->displayName(), targetId), - Utils::FileName(), /* filename */ + Utils::FilePath(), /* filename */ -1, /* line */ ProjectExplorer::Constants::TASK_CATEGORY_COMPILE); emit addTask(task); diff --git a/src/plugins/ios/iosdeploystep.h b/src/plugins/ios/iosdeploystep.h index 56ce87fec3..77b386583e 100644 --- a/src/plugins/ios/iosdeploystep.h +++ b/src/plugins/ios/iosdeploystep.h @@ -76,7 +76,6 @@ private: IosSimulator::ConstPtr iossimulator() const; QString deviceId() const; - QString appBundle() const; void raiseError(const QString &error); void writeOutput(const QString &text, OutputFormat = OutputFormat::NormalMessage); void checkProvisioningProfile(); @@ -84,7 +83,7 @@ private: TransferStatus m_transferStatus = NoTransfer; IosToolHandler *m_toolHandler = nullptr; ProjectExplorer::IDevice::ConstPtr m_device; - QString m_bundlePath; + Utils::FilePath m_bundlePath; IosDeviceType m_deviceType; static const Core::Id Id; bool m_expectFail = false; diff --git a/src/plugins/ios/iosdeploystepwidget.cpp b/src/plugins/ios/iosdeploystepwidget.cpp deleted file mode 100644 index d24b2d38b7..0000000000 --- a/src/plugins/ios/iosdeploystepwidget.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "iosdeploystepwidget.h" -#include "ui_iosdeploystepwidget.h" - -#include "iosdeploystep.h" -#include "iosrunconfiguration.h" - -#include <coreplugin/icore.h> - -namespace Ios { -namespace Internal { - -IosDeployStepWidget::IosDeployStepWidget(IosDeployStep *step) : - ProjectExplorer::BuildStepConfigWidget(step), - ui(new Ui::IosDeployStepWidget), - m_step(step) -{ - setDisplayName(QString::fromLatin1("<b>%1</b>").arg(m_step->displayName())); - setSummaryText(displayName()); - ui->setupUi(this); - connect(m_step, &ProjectExplorer::ProjectConfiguration::displayNameChanged, - this, &ProjectExplorer::BuildStepConfigWidget::updateSummary); -} - -IosDeployStepWidget::~IosDeployStepWidget() -{ - delete ui; -} - -} // namespace Internal -} // namespace Ios diff --git a/src/plugins/ios/iosdeploystepwidget.h b/src/plugins/ios/iosdeploystepwidget.h deleted file mode 100644 index fb07a8cee0..0000000000 --- a/src/plugins/ios/iosdeploystepwidget.h +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#pragma once - -#include <projectexplorer/buildstep.h> - -namespace Ios { -namespace Internal { - -namespace Ui { class IosDeployStepWidget; } - -class IosDeployStep; - -class IosDeployStepWidget : public ProjectExplorer::BuildStepConfigWidget -{ - Q_OBJECT - -public: - IosDeployStepWidget(IosDeployStep *step); - ~IosDeployStepWidget() override; - -private: - Ui::IosDeployStepWidget *ui; - IosDeployStep *m_step; -}; - -} // namespace Internal -} // namespace Ios diff --git a/src/plugins/ios/iosdeploystepwidget.ui b/src/plugins/ios/iosdeploystepwidget.ui deleted file mode 100644 index e89429281e..0000000000 --- a/src/plugins/ios/iosdeploystepwidget.ui +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>Ios::Internal::IosDeployStepWidget</class> - <widget class="QWidget" name="IosDeployStepWidget"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>479</width> - <height>76</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="windowTitle"> - <string/> - </property> - <layout class="QGridLayout" name="gridLayout"/> - </widget> - <resources/> - <connections/> -</ui> diff --git a/src/plugins/ios/iosdevice.cpp b/src/plugins/ios/iosdevice.cpp index 0f8cd500a0..6fe7bfe40c 100644 --- a/src/plugins/ios/iosdevice.cpp +++ b/src/plugins/ios/iosdevice.cpp @@ -92,8 +92,6 @@ IosDevice::IosDevice() setFreePorts(ports); } -IosDevice::IosDevice(const IosDevice &other) = default; - IosDevice::IosDevice(const QString &uid) : m_lastPort(Constants::IOS_DEVICE_PORT_START) { @@ -133,11 +131,6 @@ DeviceProcessSignalOperation::Ptr IosDevice::signalOperation() const return DeviceProcessSignalOperation::Ptr(); } -IDevice::Ptr IosDevice::clone() const -{ - return IDevice::Ptr(new IosDevice(*this)); -} - void IosDevice::fromMap(const QVariantMap &map) { IDevice::fromMap(map); @@ -234,14 +227,10 @@ void IosDeviceManager::deviceConnected(const QString &uid, const QString &name) } else if (dev->deviceState() != IDevice::DeviceConnected && dev->deviceState() != IDevice::DeviceReadyToUse) { qCDebug(detectLog) << "updating ios device " << uid; - IosDevice *newDev = nullptr; - if (dev->type() == devType) { - auto iosDev = static_cast<const IosDevice *>(dev.data()); - newDev = new IosDevice(*iosDev); - } else { - newDev = new IosDevice(uid); - } - devManager->addDevice(IDevice::ConstPtr(newDev)); + if (dev->type() == devType) // FIXME: Should that be a QTC_ASSERT? + devManager->addDevice(dev->clone()); + else + devManager->addDevice(IDevice::ConstPtr(new IosDevice(uid))); } updateInfo(uid); } @@ -294,7 +283,8 @@ void IosDeviceManager::deviceInfo(IosToolHandler *, const QString &uid, skipUpdate = true; newDev = const_cast<IosDevice *>(iosDev); } else { - newDev = new IosDevice(*iosDev); + newDev = new IosDevice(); + newDev->fromMap(iosDev->toMap()); } } else { newDev = new IosDevice(uid); @@ -538,13 +528,25 @@ void IosDeviceManager::updateAvailableDevices(const QStringList &devices) } } -IosDevice::ConstPtr IosKitInformation::device(Kit *kit) +// Factory + +IosDeviceFactory::IosDeviceFactory() + : IDeviceFactory(Constants::IOS_DEVICE_TYPE) { - if (!kit) - return IosDevice::ConstPtr(); - IDevice::ConstPtr dev = DeviceKitInformation::device(kit); - IosDevice::ConstPtr res = dev.dynamicCast<const IosDevice>(); - return res; + setObjectName(QLatin1String("IosDeviceFactory")); + setDisplayName(IosDevice::name()); + setCombinedIcon(":/ios/images/iosdevicesmall.png", + ":/ios/images/iosdevice.png"); + setConstructionFunction([] { return IDevice::Ptr(new IosDevice); }); +} + +bool IosDeviceFactory::canRestore(const QVariantMap &map) const +{ + QVariantMap vMap = map.value(QLatin1String(Constants::EXTRA_INFO_KEY)).toMap(); + if (vMap.isEmpty() + || vMap.value(QLatin1String("deviceName")).toString() == QLatin1String("*unknown*")) + return false; // transient device (probably generated during an activation) + return true; } } // namespace Internal diff --git a/src/plugins/ios/iosdevice.h b/src/plugins/ios/iosdevice.h index 54f5785e70..79037d8eb3 100644 --- a/src/plugins/ios/iosdevice.h +++ b/src/plugins/ios/iosdevice.h @@ -28,17 +28,14 @@ #include "iostoolhandler.h" #include <projectexplorer/devicesupport/idevice.h> +#include <projectexplorer/devicesupport/idevicefactory.h> #include <QVariantMap> #include <QMap> #include <QString> -#include <QSharedPointer> #include <QStringList> #include <QTimer> -namespace ProjectExplorer{ -class Kit; -} namespace Ios { class IosConfigurations; @@ -57,11 +54,9 @@ public: ProjectExplorer::DeviceProcessSignalOperation::Ptr signalOperation() const override; QString displayType() const override; - ProjectExplorer::IDevice::Ptr clone() const override; void fromMap(const QVariantMap &map) override; QVariantMap toMap() const override; QString uniqueDeviceID() const; - IosDevice(const QString &uid); QString osVersion() const; Utils::Port nextPort() const; bool canAutoDetectPorts() const override; @@ -73,13 +68,24 @@ protected: friend class IosDeviceFactory; friend class Ios::Internal::IosDeviceManager; IosDevice(); - IosDevice(const IosDevice &other); + IosDevice(const QString &uid); + Dict m_extraInfo; bool m_ignoreDevice = false; mutable quint16 m_lastPort; }; -class IosDeviceManager : public QObject { +class IosDeviceFactory : public ProjectExplorer::IDeviceFactory +{ + Q_OBJECT +public: + IosDeviceFactory(); + + bool canRestore(const QVariantMap &map) const override; +}; + +class IosDeviceManager : public QObject +{ Q_OBJECT public: using TranslationMap = QHash<QString, QString>; @@ -103,10 +109,5 @@ private: QStringList m_userModeDeviceIds; }; -namespace IosKitInformation { -IosDevice::ConstPtr device(ProjectExplorer::Kit *); -} - } // namespace Internal - } // namespace Ios diff --git a/src/plugins/ios/iosdevicefactory.cpp b/src/plugins/ios/iosdevicefactory.cpp deleted file mode 100644 index 6370cbce40..0000000000 --- a/src/plugins/ios/iosdevicefactory.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "iosdevicefactory.h" -#include "iosdevice.h" - -#include "iosconstants.h" - -namespace Ios { -namespace Internal { - -IosDeviceFactory::IosDeviceFactory() - : ProjectExplorer::IDeviceFactory(Constants::IOS_DEVICE_ID) -{ - setObjectName(QLatin1String("IosDeviceFactory")); - setDisplayName(IosDevice::name()); - setCombinedIcon(":/ios/images/iosdevicesmall.png", - ":/ios/images/iosdevice.png"); - setConstructionFunction([] { return ProjectExplorer::IDevice::Ptr(new IosDevice); }); -} - -bool IosDeviceFactory::canRestore(const QVariantMap &map) const -{ - QVariantMap vMap = map.value(QLatin1String(Constants::EXTRA_INFO_KEY)).toMap(); - if (vMap.isEmpty() - || vMap.value(QLatin1String("deviceName")).toString() == QLatin1String("*unknown*")) - return false; // transient device (probably generated during an activation) - return true; -} - -} // namespace Internal -} // namespace Ios diff --git a/src/plugins/ios/iosdevicefactory.h b/src/plugins/ios/iosdevicefactory.h deleted file mode 100644 index cdf3d61ffd..0000000000 --- a/src/plugins/ios/iosdevicefactory.h +++ /dev/null @@ -1,43 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#pragma once - -#include <projectexplorer/devicesupport/idevicefactory.h> - -namespace Ios { -namespace Internal { - -class IosDeviceFactory : public ProjectExplorer::IDeviceFactory -{ - Q_OBJECT -public: - IosDeviceFactory(); - - bool canRestore(const QVariantMap &map) const override; -}; - -} // namespace Internal -} // namespace Ios diff --git a/src/plugins/ios/iosdsymbuildstep.cpp b/src/plugins/ios/iosdsymbuildstep.cpp index c8b550352c..d238bcfb95 100644 --- a/src/plugins/ios/iosdsymbuildstep.cpp +++ b/src/plugins/ios/iosdsymbuildstep.cpp @@ -68,11 +68,11 @@ bool IosDsymBuildStep::init() ProcessParameters *pp = processParameters(); pp->setMacroExpander(bc->macroExpander()); - pp->setWorkingDirectory(bc->buildDirectory().toString()); + pp->setWorkingDirectory(bc->buildDirectory()); Utils::Environment env = bc->environment(); Utils::Environment::setupEnglishOutput(&env); pp->setEnvironment(env); - pp->setCommand(command()); + pp->setCommand(Utils::FilePath::fromString(command())); pp->setArguments(Utils::QtcProcess::joinArgs(arguments())); pp->resolveAll(); @@ -146,8 +146,8 @@ QStringList IosDsymBuildStep::defaultCleanCmdList() const QStringList IosDsymBuildStep::defaultCmdList() const { QString dsymutilCmd = "dsymutil"; - Utils::FileName dsymUtilPath = IosConfigurations::developerPath() - .appendPath("Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil"); + const Utils::FilePath dsymUtilPath = IosConfigurations::developerPath() + .pathAppended("Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil"); if (dsymUtilPath.exists()) dsymutilCmd = dsymUtilPath.toUserOutput(); auto runConf = qobject_cast<const IosRunConfiguration *>(target()->activeRunConfiguration()); @@ -268,9 +268,9 @@ void IosDsymBuildStepConfigWidget::updateDetails() ProcessParameters param; param.setMacroExpander(bc->macroExpander()); - param.setWorkingDirectory(bc->buildDirectory().toString()); + param.setWorkingDirectory(bc->buildDirectory()); param.setEnvironment(bc->environment()); - param.setCommand(m_buildStep->command()); + param.setCommand(Utils::FilePath::fromString(m_buildStep->command())); param.setArguments(Utils::QtcProcess::joinArgs(m_buildStep->arguments())); setSummaryText(param.summary(displayName())); diff --git a/src/plugins/ios/iosplugin.cpp b/src/plugins/ios/iosplugin.cpp index 401b2a050c..080f9dcde7 100644 --- a/src/plugins/ios/iosplugin.cpp +++ b/src/plugins/ios/iosplugin.cpp @@ -30,13 +30,12 @@ #include "iosconfigurations.h" #include "iosconstants.h" #include "iosdeploystep.h" -#include "iosdevicefactory.h" +#include "iosdevice.h" #include "iosdsymbuildstep.h" -#include "iosqtversionfactory.h" +#include "iosqtversion.h" #include "iosrunner.h" #include "iossettingspage.h" #include "iossimulator.h" -#include "iossimulatorfactory.h" #include "iostoolhandler.h" #include "iosrunconfiguration.h" @@ -95,6 +94,13 @@ public: IosDeployStepFactory deployStepFactory; IosDsymBuildStepFactory dsymBuildStepFactory; IosDeployConfigurationFactory deployConfigurationFactory; + + SimpleRunWorkerFactory<Internal::IosRunSupport, IosRunConfiguration> + runWorkerFactory{ProjectExplorer::Constants::NORMAL_RUN_MODE}; + SimpleRunWorkerFactory<Internal::IosDebugSupport, IosRunConfiguration> + debugWorkerFactory{ProjectExplorer::Constants::DEBUG_RUN_MODE}; + SimpleRunWorkerFactory<Internal::IosQmlProfilerSupport, IosRunConfiguration> + qmlProfilerWorkerFactory{ProjectExplorer::Constants::QML_PROFILER_RUN_MODE}; }; IosPlugin::~IosPlugin() @@ -113,17 +119,6 @@ bool IosPlugin::initialize(const QStringList &arguments, QString *errorMessage) d = new IosPluginPrivate; - auto constraint = [](RunConfiguration *runConfig) { - return qobject_cast<IosRunConfiguration *>(runConfig) != nullptr; - }; - - RunControl::registerWorker<Internal::IosRunSupport> - (ProjectExplorer::Constants::NORMAL_RUN_MODE, constraint); - RunControl::registerWorker<Internal::IosDebugSupport> - (ProjectExplorer::Constants::DEBUG_RUN_MODE, constraint); - RunControl::registerWorker<Internal::IosQmlProfilerSupport> - (ProjectExplorer::Constants::QML_PROFILER_RUN_MODE, constraint); - return true; } diff --git a/src/plugins/ios/iosprobe.cpp b/src/plugins/ios/iosprobe.cpp index 35bcaff544..8e19eecc4f 100644 --- a/src/plugins/ios/iosprobe.cpp +++ b/src/plugins/ios/iosprobe.cpp @@ -87,15 +87,15 @@ void XcodeProbe::setupDefaultToolchains(const QString &devPath) }; XcodePlatform clangProfile; - clangProfile.developerPath = Utils::FileName::fromString(devPath); + clangProfile.developerPath = Utils::FilePath::fromString(devPath); const QFileInfo clangCInfo = getClangInfo("clang"); if (clangCInfo.exists()) - clangProfile.cCompilerPath = Utils::FileName(clangCInfo); + clangProfile.cCompilerPath = Utils::FilePath::fromFileInfo(clangCInfo); const QFileInfo clangCppInfo = getClangInfo("clang++"); if (clangCppInfo.exists()) - clangProfile.cxxCompilerPath = Utils::FileName(clangCppInfo); + clangProfile.cxxCompilerPath = Utils::FilePath::fromFileInfo(clangCppInfo); QSet<QString> allArchitectures; static const std::map<QString, QStringList> sdkConfigs { @@ -111,7 +111,7 @@ void XcodeProbe::setupDefaultToolchains(const QString &devPath) for (const auto &sdkConfig : sdkConfigs) { XcodePlatform::SDK sdk; sdk.directoryName = sdkConfig.first; - sdk.path = Utils::FileName::fromString(devPath + sdk.path = Utils::FilePath::fromString(devPath + QString(QLatin1String("/Platforms/%1.platform/Developer/SDKs/%1.sdk")).arg( sdk.directoryName)); sdk.architectures = sdkConfig.second; diff --git a/src/plugins/ios/iosprobe.h b/src/plugins/ios/iosprobe.h index ccaddcc5cc..52cf3015c5 100644 --- a/src/plugins/ios/iosprobe.h +++ b/src/plugins/ios/iosprobe.h @@ -39,7 +39,7 @@ public: { public: QString directoryName; - Utils::FileName path; + Utils::FilePath path; QStringList architectures; }; class ToolchainTarget @@ -51,9 +51,9 @@ public: bool operator==(const ToolchainTarget &other) const; }; - Utils::FileName developerPath; - Utils::FileName cxxCompilerPath; - Utils::FileName cCompilerPath; + Utils::FilePath developerPath; + Utils::FilePath cxxCompilerPath; + Utils::FilePath cCompilerPath; std::vector<ToolchainTarget> targets; std::vector<SDK> sdks; @@ -67,7 +67,7 @@ uint qHash(const XcodePlatform::ToolchainTarget &target); class XcodeProbe { public: - static Utils::FileName sdkPath(const QString &devPath, const QString &platformName); + static Utils::FilePath sdkPath(const QString &devPath, const QString &platformName); static QMap<QString, XcodePlatform> detectPlatforms(const QString &devPath = QString()); private: diff --git a/src/plugins/ios/iosqtversion.cpp b/src/plugins/ios/iosqtversion.cpp index 7b83b6b5ea..e508c53cfe 100644 --- a/src/plugins/ios/iosqtversion.cpp +++ b/src/plugins/ios/iosqtversion.cpp @@ -42,23 +42,6 @@ using namespace ProjectExplorer; IosQtVersion::IosQtVersion() = default; -IosQtVersion::IosQtVersion(const Utils::FileName &path, bool isAutodetected, - const QString &autodetectionSource) - : QtSupport::BaseQtVersion(path, isAutodetected, autodetectionSource) -{ - setUnexpandedDisplayName(defaultUnexpandedDisplayName(path, false)); -} - -IosQtVersion *IosQtVersion::clone() const -{ - return new IosQtVersion(*this); -} - -QString IosQtVersion::type() const -{ - return QLatin1String(Constants::IOSQT); -} - bool IosQtVersion::isValid() const { if (!BaseQtVersion::isValid()) @@ -76,9 +59,9 @@ QString IosQtVersion::invalidReason() const return tmp; } -QList<Abi> IosQtVersion::detectQtAbis() const +Abis IosQtVersion::detectQtAbis() const { - QList<Abi> abis = qtAbisFromLibrary(qtCorePaths()); + Abis abis = BaseQtVersion::detectQtAbis(); for (int i = 0; i < abis.count(); ++i) { abis[i] = Abi(abis.at(i).architecture(), abis.at(i).os(), @@ -115,3 +98,16 @@ QSet<Core::Id> IosQtVersion::targetDeviceTypes() const // iOS Qt version supports ios devices as well as simulator. return {Constants::IOS_DEVICE_TYPE, Constants::IOS_SIMULATOR_TYPE}; } + + +// Factory + +IosQtVersionFactory::IosQtVersionFactory() +{ + setQtVersionCreator([] { return new IosQtVersion; }); + setSupportedType(Constants::IOSQT); + setPriority(90); + setRestrictionChecker([](const SetupData &setup) { + return setup.platforms.contains("ios"); + }); +} diff --git a/src/plugins/ios/iosqtversion.h b/src/plugins/ios/iosqtversion.h index 6d4a093ba5..fa119d2f6f 100644 --- a/src/plugins/ios/iosqtversion.h +++ b/src/plugins/ios/iosqtversion.h @@ -26,6 +26,7 @@ #pragma once #include <qtsupport/baseqtversion.h> +#include <qtsupport/qtversionfactory.h> #include <QCoreApplication> @@ -38,15 +39,11 @@ class IosQtVersion : public QtSupport::BaseQtVersion public: IosQtVersion(); - IosQtVersion(const Utils::FileName &path, bool isAutodetected = false, - const QString &autodetectionSource = QString()); - IosQtVersion *clone() const override; - QString type() const override; bool isValid() const override; QString invalidReason() const override; - QList<ProjectExplorer::Abi> detectQtAbis() const override; + ProjectExplorer::Abis detectQtAbis() const override; void addToEnvironment(const ProjectExplorer::Kit *k, Utils::Environment &env) const override; @@ -56,5 +53,11 @@ public: QString description() const override; }; +class IosQtVersionFactory : public QtSupport::QtVersionFactory +{ +public: + IosQtVersionFactory(); +}; + } // namespace Internal } // namespace Ios diff --git a/src/plugins/ios/iosqtversionfactory.cpp b/src/plugins/ios/iosqtversionfactory.cpp deleted file mode 100644 index 4ef21af112..0000000000 --- a/src/plugins/ios/iosqtversionfactory.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "iosqtversionfactory.h" -#include "iosqtversion.h" -#include "iosconstants.h" -#include <qtsupport/qtsupportconstants.h> -#include <utils/qtcassert.h> -#include <proparser/profileevaluator.h> - -#include <QFileInfo> - -namespace Ios { -namespace Internal { - -IosQtVersionFactory::IosQtVersionFactory(QObject *parent) - : QtSupport::QtVersionFactory(parent) -{ -} - -bool IosQtVersionFactory::canRestore(const QString &type) -{ - return type == QLatin1String(Constants::IOSQT); -} - -QtSupport::BaseQtVersion *IosQtVersionFactory::restore(const QString &type, - const QVariantMap &data) -{ - QTC_ASSERT(canRestore(type), return nullptr); - auto v = new IosQtVersion; - v->fromMap(data); - return v; -} - -int IosQtVersionFactory::priority() const -{ - return 90; -} - -QtSupport::BaseQtVersion *IosQtVersionFactory::create(const Utils::FileName &qmakePath, - ProFileEvaluator *evaluator, - bool isAutoDetected, - const QString &autoDetectionSource) -{ - if (!(evaluator->values(QLatin1String("QMAKE_PLATFORM")).contains(QLatin1String("ios")))) - return nullptr; - return new IosQtVersion(qmakePath, isAutoDetected, autoDetectionSource); -} - -} // Internal -} // Ios diff --git a/src/plugins/ios/iosqtversionfactory.h b/src/plugins/ios/iosqtversionfactory.h deleted file mode 100644 index 4810e2ee8e..0000000000 --- a/src/plugins/ios/iosqtversionfactory.h +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#pragma once - -#include <qtsupport/qtversionfactory.h> - -namespace Ios { -namespace Internal { - -class IosQtVersionFactory : public QtSupport::QtVersionFactory -{ -public: - explicit IosQtVersionFactory(QObject *parent = nullptr); - - bool canRestore(const QString &type) override; - QtSupport::BaseQtVersion *restore(const QString &type, const QVariantMap &data) override; - - int priority() const override; - QtSupport::BaseQtVersion *create(const Utils::FileName &qmakePath, ProFileEvaluator *evaluator, - bool isAutoDetected = false, - const QString &autoDetectionSource = QString()) override; -}; - -} // namespace Internal -} // namespace Ios diff --git a/src/plugins/ios/iosrunconfiguration.cpp b/src/plugins/ios/iosrunconfiguration.cpp index 0d26ba7e8f..db732fe953 100644 --- a/src/plugins/ios/iosrunconfiguration.cpp +++ b/src/plugins/ios/iosrunconfiguration.cpp @@ -34,13 +34,11 @@ #include <projectexplorer/deployconfiguration.h> #include <projectexplorer/devicesupport/devicemanager.h> #include <projectexplorer/kitinformation.h> +#include <projectexplorer/project.h> +#include <projectexplorer/projectnodes.h> #include <projectexplorer/runconfigurationaspects.h> #include <projectexplorer/target.h> -#include <qmakeprojectmanager/qmakenodes.h> -#include <qmakeprojectmanager/qmakeproject.h> -#include <qmakeprojectmanager/qmakeprojectmanagerconstants.h> - #include <qtsupport/qtoutputformatter.h> #include <qtsupport/qtkitinformation.h> @@ -62,7 +60,6 @@ #include <QWidget> using namespace ProjectExplorer; -using namespace QmakeProjectManager; using namespace Utils; namespace Ios { @@ -125,7 +122,7 @@ void IosDeviceTypeAspect::deviceChanges() void IosDeviceTypeAspect::updateDeviceType() { - if (DeviceTypeKitInformation::deviceTypeId(m_runConfiguration->target()->kit()) + if (DeviceTypeKitAspect::deviceTypeId(m_runConfiguration->target()->kit()) == Constants::IOS_DEVICE_TYPE) m_deviceType = IosDeviceType(IosDeviceType::IosDevice); else if (m_deviceType.type == IosDeviceType::IosDevice) @@ -134,7 +131,7 @@ void IosDeviceTypeAspect::updateDeviceType() void IosRunConfiguration::updateDisplayNames() { - IDevice::ConstPtr dev = DeviceKitInformation::device(target()->kit()); + 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)); @@ -144,12 +141,12 @@ void IosRunConfiguration::updateDisplayNames() void IosRunConfiguration::updateEnabledState() { - Core::Id devType = DeviceTypeKitInformation::deviceTypeId(target()->kit()); + Core::Id devType = DeviceTypeKitAspect::deviceTypeId(target()->kit()); if (devType != Constants::IOS_DEVICE_TYPE && devType != Constants::IOS_SIMULATOR_TYPE) { setEnabled(false); return; } - IDevice::ConstPtr dev = DeviceKitInformation::device(target()->kit()); + IDevice::ConstPtr dev = DeviceKitAspect::device(target()->kit()); if (dev.isNull() || dev->deviceState() != IDevice::DeviceReadyToUse) { setEnabled(false); return; @@ -157,68 +154,56 @@ void IosRunConfiguration::updateEnabledState() return RunConfiguration::updateEnabledState(); } -bool IosRunConfiguration::canRunForNode(const Node *node) const -{ - return node->filePath().toString() == buildKey(); -} - QString IosRunConfiguration::applicationName() const { Project *project = target()->project(); - if (auto pro = dynamic_cast<const QmakeProFileNode *>(project->findNodeForBuildKey(buildKey()))) { - TargetInformation ti = pro->targetInformation(); - if (ti.valid) - return ti.target; - } + if (ProjectNode *node = project->findNodeForBuildKey(buildKey())) + return node->data(Constants::IosTarget).toString(); + return QString(); } -FileName IosRunConfiguration::bundleDirectory() const +FilePath IosRunConfiguration::bundleDirectory() const { - FileName res; - Core::Id devType = DeviceTypeKitInformation::deviceTypeId(target()->kit()); + Core::Id devType = DeviceTypeKitAspect::deviceTypeId(target()->kit()); bool isDevice = (devType == Constants::IOS_DEVICE_TYPE); if (!isDevice && devType != Constants::IOS_SIMULATOR_TYPE) { qCWarning(iosLog) << "unexpected device type in bundleDirForTarget: " << devType.toString(); - return res; + return {}; } + FilePath res; if (BuildConfiguration *bc = target()->activeBuildConfiguration()) { Project *project = target()->project(); - auto pro = dynamic_cast<const QmakeProFileNode *>(project->findNodeForBuildKey(buildKey())); - if (pro) { - TargetInformation ti = pro->targetInformation(); - if (ti.valid) - res = ti.buildDir; - } + if (ProjectNode *node = project->findNodeForBuildKey(buildKey())) + res = FilePath::fromString(node->data(Constants::IosBuildDir).toString()); if (res.isEmpty()) res = bc->buildDirectory(); switch (bc->buildType()) { case BuildConfiguration::Debug : case BuildConfiguration::Unknown : if (isDevice) - res.appendPath(QLatin1String("Debug-iphoneos")); + res = res.pathAppended("Debug-iphoneos"); else - res.appendPath(QLatin1String("Debug-iphonesimulator")); + res = res.pathAppended("Debug-iphonesimulator"); break; case BuildConfiguration::Profile : case BuildConfiguration::Release : if (isDevice) - res.appendPath(QLatin1String("Release-iphoneos")); + res = res.pathAppended("Release-iphoneos"); else - res.appendPath(QLatin1String("Release-iphonesimulator")); + res = res.pathAppended("Release-iphonesimulator"); break; default: qCWarning(iosLog) << "IosBuildStep had an unknown buildType " << target()->activeBuildConfiguration()->buildType(); } } - res.appendPath(applicationName() + QLatin1String(".app")); - return res; + return res.pathAppended(applicationName() + ".app"); } -FileName IosRunConfiguration::localExecutable() const +FilePath IosRunConfiguration::localExecutable() const { - return bundleDirectory().appendPath(applicationName()); + return bundleDirectory().pathAppended(applicationName()); } void IosDeviceTypeAspect::fromMap(const QVariantMap &map) @@ -238,10 +223,10 @@ void IosDeviceTypeAspect::toMap(QVariantMap &map) const QString IosRunConfiguration::disabledReason() const { - Core::Id devType = DeviceTypeKitInformation::deviceTypeId(target()->kit()); + Core::Id devType = DeviceTypeKitAspect::deviceTypeId(target()->kit()); if (devType != Constants::IOS_DEVICE_TYPE && devType != Constants::IOS_SIMULATOR_TYPE) return tr("Kit has incorrect device type for running on iOS devices."); - IDevice::ConstPtr dev = DeviceKitInformation::device(target()->kit()); + IDevice::ConstPtr dev = DeviceKitAspect::device(target()->kit()); QString validDevName; bool hasConncetedDev = false; if (devType == Constants::IOS_DEVICE_TYPE) { @@ -347,7 +332,7 @@ void IosDeviceTypeAspect::addToConfigurationLayout(QFormLayout *layout) updateValues(); - connect(m_deviceTypeComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), + connect(m_deviceTypeComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &IosDeviceTypeAspect::setDeviceTypeIndex); } @@ -405,7 +390,6 @@ IosRunConfigurationFactory::IosRunConfigurationFactory() registerRunConfiguration<IosRunConfiguration>("Qt4ProjectManager.IosRunConfiguration:"); addSupportedTargetDeviceType(Constants::IOS_DEVICE_TYPE); addSupportedTargetDeviceType(Constants::IOS_SIMULATOR_TYPE); - addSupportedProjectType(QmakeProjectManager::Constants::QMAKEPROJECT_ID); } } // namespace Internal diff --git a/src/plugins/ios/iosrunconfiguration.h b/src/plugins/ios/iosrunconfiguration.h index 72d30b0227..a5072abddf 100644 --- a/src/plugins/ios/iosrunconfiguration.h +++ b/src/plugins/ios/iosrunconfiguration.h @@ -44,10 +44,10 @@ class IosRunConfiguration : public ProjectExplorer::RunConfiguration public: IosRunConfiguration(ProjectExplorer::Target *target, Core::Id id); - Utils::FileName profilePath() const; + Utils::FilePath profilePath() const; QString applicationName() const; - Utils::FileName bundleDirectory() const; - Utils::FileName localExecutable() const; + Utils::FilePath bundleDirectory() const; + Utils::FilePath localExecutable() const; QString disabledReason() const override; IosDeviceType deviceType() const; @@ -57,7 +57,6 @@ private: friend class IosDeviceTypeAspect; void updateDisplayNames(); void updateEnabledState() final; - bool canRunForNode(const ProjectExplorer::Node *node) const final; IosDeviceTypeAspect *m_deviceTypeAspect = nullptr; }; diff --git a/src/plugins/ios/iosrunner.cpp b/src/plugins/ios/iosrunner.cpp index dc6d222e0f..5c34309921 100644 --- a/src/plugins/ios/iosrunner.cpp +++ b/src/plugins/ios/iosrunner.cpp @@ -79,9 +79,8 @@ static void stopRunningRunControl(RunControl *runControl) { static QMap<Core::Id, QPointer<RunControl>> activeRunControls; - RunConfiguration *runConfig = runControl->runConfiguration(); - Target *target = runConfig->target(); - Core::Id devId = DeviceKitInformation::deviceId(target->kit()); + Target *target = runControl->target(); + Core::Id devId = DeviceKitAspect::deviceId(target->kit()); // The device can only run an application at a time, if an app is running stop it. if (activeRunControls.contains(devId)) { @@ -100,8 +99,8 @@ IosRunner::IosRunner(RunControl *runControl) stopRunningRunControl(runControl); auto runConfig = qobject_cast<IosRunConfiguration *>(runControl->runConfiguration()); m_bundleDir = runConfig->bundleDirectory().toString(); - m_arguments = runConfig->aspect<ArgumentsAspect>()->arguments(runConfig->macroExpander()); - m_device = DeviceKitInformation::device(runConfig->target()->kit()); + m_arguments = runControl->aspect<ArgumentsAspect>()->arguments(runConfig->macroExpander()); + m_device = DeviceKitAspect::device(runControl->target()->kit()); m_deviceType = runConfig->deviceType(); } @@ -387,7 +386,7 @@ IosQmlProfilerSupport::IosQmlProfilerSupport(RunControl *runControl) Runnable runnable; runnable.executable = iosRunConfig->localExecutable().toUserOutput(); runnable.commandLineArguments = - iosRunConfig->aspect<ArgumentsAspect>()->arguments(iosRunConfig->macroExpander()); + runControl->aspect<ArgumentsAspect>()->arguments(iosRunConfig->macroExpander()); runControl->setDisplayName(iosRunConfig->applicationName()); runControl->setRunnable(runnable); @@ -438,23 +437,21 @@ void IosDebugSupport::start() return; } - RunConfiguration *runConfig = runControl()->runConfiguration(); - if (device()->type() == Ios::Constants::IOS_DEVICE_TYPE) { IosDevice::ConstPtr dev = device().dynamicCast<const IosDevice>(); setStartMode(AttachToRemoteProcess); setIosPlatform("remote-ios"); QString osVersion = dev->osVersion(); - FileName deviceSdk1 = FileName::fromString(QDir::homePath() + FilePath deviceSdk1 = FilePath::fromString(QDir::homePath() + "/Library/Developer/Xcode/iOS DeviceSupport/" + osVersion + "/Symbols"); QString deviceSdk; if (deviceSdk1.toFileInfo().isDir()) { deviceSdk = deviceSdk1.toString(); } else { - FileName deviceSdk2 = IosConfigurations::developerPath() - .appendPath("Platforms/iPhoneOS.platform/DeviceSupport/") - .appendPath(osVersion).appendPath("Symbols"); + const FilePath deviceSdk2 = IosConfigurations::developerPath() + .pathAppended("Platforms/iPhoneOS.platform/DeviceSupport/" + + osVersion + "/Symbols"); if (deviceSdk2.toFileInfo().isDir()) { deviceSdk = deviceSdk2.toString(); } else { @@ -472,7 +469,7 @@ void IosDebugSupport::start() setIosPlatform("ios-simulator"); } - auto iosRunConfig = qobject_cast<IosRunConfiguration *>(runConfig); + auto iosRunConfig = qobject_cast<IosRunConfiguration *>(runControl()->runConfiguration()); setRunControlName(iosRunConfig->applicationName()); setContinueAfterAttach(true); @@ -488,7 +485,7 @@ void IosDebugSupport::start() QString bundlePath = iosRunConfig->bundleDirectory().toString(); bundlePath.chop(4); - FileName dsymPath = FileName::fromString(bundlePath.append(".dSYM")); + FilePath dsymPath = FilePath::fromString(bundlePath.append(".dSYM")); if (dsymPath.exists() && dsymPath.toFileInfo().lastModified() < QFileInfo(iosRunConfig->localExecutable().toUserOutput()).lastModified()) { TaskHub::addTask(Task::Warning, diff --git a/src/plugins/ios/iossettingswidget.cpp b/src/plugins/ios/iossettingswidget.cpp index 4f7cd37f58..467ded471d 100644 --- a/src/plugins/ios/iossettingswidget.cpp +++ b/src/plugins/ios/iossettingswidget.cpp @@ -275,7 +275,7 @@ void IosSettingsWidget::onScreenshot() const auto generatePath = [this](const SimulatorInfo &info) { const QString fileName = QString("%1_%2_%3.png").arg(info.name).arg(info.runtimeName) .arg(QDateTime::currentDateTime().toString("yyyy-MM-dd_HH-mm-ss-z")).replace(' ', '_'); - return m_ui->pathWidget->fileName().appendPath(fileName).toString(); + return m_ui->pathWidget->fileName().pathAppended(fileName).toString(); }; QPointer<SimulatorOperationDialog> statusDialog = new SimulatorOperationDialog(this); diff --git a/src/plugins/ios/iossimulator.cpp b/src/plugins/ios/iossimulator.cpp index 6a8ad80735..2312a5b10c 100644 --- a/src/plugins/ios/iossimulator.cpp +++ b/src/plugins/ios/iossimulator.cpp @@ -64,14 +64,6 @@ IosSimulator::IosSimulator() setDeviceState(DeviceReadyToUse); } -IosSimulator::IosSimulator(const IosSimulator &other) - : IDevice(other), m_lastPort(other.m_lastPort) -{ - setDisplayName(QCoreApplication::translate("Ios::Internal::IosSimulator", "iOS Simulator")); - setDeviceState(DeviceReadyToUse); -} - - IDevice::DeviceInfo IosSimulator::deviceInformation() const { return IDevice::DeviceInfo(); @@ -92,22 +84,6 @@ DeviceProcessSignalOperation::Ptr IosSimulator::signalOperation() const return DeviceProcessSignalOperation::Ptr(); } -IDevice::Ptr IosSimulator::clone() const -{ - return IDevice::Ptr(new IosSimulator(*this)); -} - -void IosSimulator::fromMap(const QVariantMap &map) -{ - IDevice::fromMap(map); -} - -QVariantMap IosSimulator::toMap() const -{ - QVariantMap res = IDevice::toMap(); - return res; -} - Utils::Port IosSimulator::nextPort() const { for (int i = 0; i < 100; ++i) { @@ -140,14 +116,7 @@ Utils::OsType IosSimulator::osType() const return Utils::OsTypeMac; } -IosSimulator::ConstPtr IosKitInformation::simulator(Kit *kit) -{ - if (!kit) - return IosSimulator::ConstPtr(); - IDevice::ConstPtr dev = DeviceKitInformation::device(kit); - IosSimulator::ConstPtr res = dev.dynamicCast<const IosSimulator>(); - return res; -} +// IosDeviceType IosDeviceType::IosDeviceType(IosDeviceType::Type type, const QString &identifier, const QString &displayName) : type(type), identifier(identifier), displayName(displayName) @@ -281,5 +250,17 @@ QDebug operator <<(QDebug debug, const IosDeviceType &deviceType) return debug; } +// Factory + +IosSimulatorFactory::IosSimulatorFactory() + : ProjectExplorer::IDeviceFactory(Constants::IOS_SIMULATOR_TYPE) +{ + setObjectName(QLatin1String("IosSimulatorFactory")); + setDisplayName(tr("iOS Simulator")); + setCombinedIcon(":/ios/images/iosdevicesmall.png", + ":/ios/images/iosdevice.png"); + setConstructionFunction([] { return ProjectExplorer::IDevice::Ptr(new IosSimulator()); }); +} + } // namespace Internal } // namespace Ios diff --git a/src/plugins/ios/iossimulator.h b/src/plugins/ios/iossimulator.h index d4652dfe4b..c2a390a5fe 100644 --- a/src/plugins/ios/iossimulator.h +++ b/src/plugins/ios/iossimulator.h @@ -26,19 +26,20 @@ #pragma once #include <projectexplorer/devicesupport/idevice.h> +#include <projectexplorer/devicesupport/idevicefactory.h> + #include <utils/fileutils.h> -#include <QMutex> #include <QDebug> -#include <QSharedPointer> -namespace ProjectExplorer { class Kit; } namespace Ios { namespace Internal { + class IosConfigurations; class IosSimulatorFactory; -class IosDeviceType { +class IosDeviceType +{ public: enum Type { IosDevice, @@ -58,6 +59,7 @@ public: QString identifier; QString displayName; }; + QDebug operator <<(QDebug debug, const IosDeviceType &deviceType); class IosSimulator : public ProjectExplorer::IDevice @@ -70,26 +72,27 @@ public: QString displayType() const override; ProjectExplorer::IDeviceWidget *createWidget() override; ProjectExplorer::DeviceProcessSignalOperation::Ptr signalOperation() const override; - void fromMap(const QVariantMap &map) override; - QVariantMap toMap() const override; Utils::Port nextPort() const; bool canAutoDetectPorts() const override; Utils::OsType osType() const override; - ProjectExplorer::IDevice::Ptr clone() const override; protected: friend class IosSimulatorFactory; friend class IosConfigurations; IosSimulator(); IosSimulator(Core::Id id); - IosSimulator(const IosSimulator &other); + private: mutable quint16 m_lastPort; }; -namespace IosKitInformation { -IosSimulator::ConstPtr simulator(ProjectExplorer::Kit *kit); -} // namespace IosKitInformation +class IosSimulatorFactory : public ProjectExplorer::IDeviceFactory +{ + Q_OBJECT +public: + IosSimulatorFactory(); +}; + } // namespace Internal } // namespace Ios diff --git a/src/plugins/ios/iossimulatorfactory.cpp b/src/plugins/ios/iossimulatorfactory.cpp deleted file mode 100644 index 163bfac1b4..0000000000 --- a/src/plugins/ios/iossimulatorfactory.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "iossimulatorfactory.h" - -#include "iosconstants.h" -#include "iossimulator.h" - -#include <utils/qtcassert.h> - -namespace Ios { -namespace Internal { - -IosSimulatorFactory::IosSimulatorFactory() - : ProjectExplorer::IDeviceFactory(Constants::IOS_SIMULATOR_TYPE) -{ - setObjectName(QLatin1String("IosSimulatorFactory")); - setDisplayName(tr("iOS Simulator")); - setCombinedIcon(":/ios/images/iosdevicesmall.png", - ":/ios/images/iosdevice.png"); - setConstructionFunction([] { return ProjectExplorer::IDevice::Ptr(new IosSimulator()); }); -} - -} // namespace Internal -} // namespace Ios diff --git a/src/plugins/ios/iossimulatorfactory.h b/src/plugins/ios/iossimulatorfactory.h deleted file mode 100644 index 5d05c7b370..0000000000 --- a/src/plugins/ios/iossimulatorfactory.h +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#pragma once - -#include <projectexplorer/devicesupport/idevicefactory.h> - -namespace Ios { -namespace Internal { - -class IosSimulatorFactory : public ProjectExplorer::IDeviceFactory -{ - Q_OBJECT -public: - IosSimulatorFactory(); -}; - -} // namespace Internal -} // namespace Ios diff --git a/src/plugins/ios/iostoolhandler.cpp b/src/plugins/ios/iostoolhandler.cpp index 2526ecfdc3..646183db05 100644 --- a/src/plugins/ios/iostoolhandler.cpp +++ b/src/plugins/ios/iostoolhandler.cpp @@ -657,18 +657,14 @@ IosDeviceToolHandlerPrivate::IosDeviceToolHandlerPrivate(const IosDeviceType &de if (k.startsWith(QLatin1String("DYLD_"))) env.remove(k); QStringList frameworkPaths; - Utils::FileName xcPath = IosConfigurations::developerPath(); - QString privateFPath = xcPath.appendPath(QLatin1String("Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks")).toFileInfo().canonicalFilePath(); - if (!privateFPath.isEmpty()) - frameworkPaths << privateFPath; - QString otherFPath = xcPath.appendPath(QLatin1String("../OtherFrameworks")).toFileInfo().canonicalFilePath(); - if (!otherFPath.isEmpty()) - frameworkPaths << otherFPath; - QString sharedFPath = xcPath.appendPath(QLatin1String("../SharedFrameworks")).toFileInfo().canonicalFilePath(); - if (!sharedFPath.isEmpty()) - frameworkPaths << sharedFPath; - frameworkPaths << QLatin1String("/System/Library/Frameworks") - << QLatin1String("/System/Library/PrivateFrameworks"); + const Utils::FilePath libPath = IosConfigurations::developerPath().pathAppended("Platforms/iPhoneSimulator.platform/Developer/Library"); + for (const auto framework : {"PrivateFrameworks", "OtherFrameworks", "SharedFrameworks"}) { + const QString frameworkPath = + libPath.pathAppended(QLatin1String(framework)).toFileInfo().canonicalFilePath(); + if (!frameworkPath.isEmpty()) + frameworkPaths << frameworkPath; + } + frameworkPaths << "/System/Library/Frameworks" << "/System/Library/PrivateFrameworks"; env.insert(QLatin1String("DYLD_FALLBACK_FRAMEWORK_PATH"), frameworkPaths.join(QLatin1Char(':'))); qCDebug(toolHandlerLog) << "IosToolHandler runEnv:" << env.toStringList(); process->setProcessEnvironment(env); @@ -676,7 +672,7 @@ IosDeviceToolHandlerPrivate::IosDeviceToolHandlerPrivate(const IosDeviceType &de QObject::connect(process.get(), &QProcess::readyReadStandardOutput, std::bind(&IosDeviceToolHandlerPrivate::subprocessHasData,this)); - QObject::connect(process.get(), static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), + QObject::connect(process.get(), QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), std::bind(&IosDeviceToolHandlerPrivate::subprocessFinished,this, _1,_2)); QObject::connect(process.get(), &QProcess::errorOccurred, @@ -857,7 +853,7 @@ void IosSimulatorToolHandlerPrivate::requestRunApp(const QString &appBundlePath, m_deviceId = m_devType.identifier; m_runKind = runType; - Utils::FileName appBundle = Utils::FileName::fromString(m_bundlePath); + Utils::FilePath appBundle = Utils::FilePath::fromString(m_bundlePath); if (!appBundle.exists()) { errorMsg(IosToolHandler::tr("Application launch on simulator failed. Invalid bundle path %1") .arg(m_bundlePath)); @@ -931,13 +927,13 @@ void IosSimulatorToolHandlerPrivate::installAppOnSimulator() }; isTransferringApp(m_bundlePath, m_deviceId, 20, 100, ""); - auto installFuture = simCtl->installApp(m_deviceId, Utils::FileName::fromString(m_bundlePath)); + auto installFuture = simCtl->installApp(m_deviceId, Utils::FilePath::fromString(m_bundlePath)); futureList << Utils::onResultReady(installFuture, onResponseAppInstall); } void IosSimulatorToolHandlerPrivate::launchAppOnSimulator(const QStringList &extraArgs) { - const Utils::FileName appBundle = Utils::FileName::fromString(m_bundlePath); + const Utils::FilePath appBundle = Utils::FilePath::fromString(m_bundlePath); const QString bundleId = SimulatorControl::bundleIdentifier(appBundle); const bool debugRun = m_runKind == IosToolHandler::DebugRun; bool captureConsole = IosConfigurations::xcodeVersion() >= QVersionNumber(8); diff --git a/src/plugins/ios/simulatorcontrol.cpp b/src/plugins/ios/simulatorcontrol.cpp index cdf2a3da6a..baecf63a9c 100644 --- a/src/plugins/ios/simulatorcontrol.cpp +++ b/src/plugins/ios/simulatorcontrol.cpp @@ -96,7 +96,7 @@ static bool runSimCtlCommand(QStringList args, QString *output) static bool launchSimulator(const QString &simUdid) { QTC_ASSERT(!simUdid.isEmpty(), return false); const QString simulatorAppPath = IosConfigurations::developerPath() - .appendPath("Applications/Simulator.app/Contents/MacOS/Simulator").toString(); + .pathAppended("Applications/Simulator.app/Contents/MacOS/Simulator").toString(); if (IosConfigurations::xcodeVersion() >= QVersionNumber(9)) { // For XCode 9 boot the second device instead of launching simulator app twice. @@ -172,12 +172,12 @@ private: ~SimulatorControlPrivate(); static SimulatorInfo deviceInfo(const QString &simUdid); - static QString bundleIdentifier(const Utils::FileName &bundlePath); - static QString bundleExecutable(const Utils::FileName &bundlePath); + static QString bundleIdentifier(const Utils::FilePath &bundlePath); + static QString bundleExecutable(const Utils::FilePath &bundlePath); void startSimulator(QFutureInterface<SimulatorControl::ResponseData> &fi, const QString &simUdid); void installApp(QFutureInterface<SimulatorControl::ResponseData> &fi, const QString &simUdid, - const Utils::FileName &bundlePath); + const Utils::FilePath &bundlePath); void launchApp(QFutureInterface<SimulatorControl::ResponseData> &fi, const QString &simUdid, const QString &bundleIdentifier, bool waitForDebugger, const QStringList &extraArgs, const QString &stdoutPath, @@ -291,12 +291,12 @@ bool SimulatorControl::isSimulatorRunning(const QString &simUdid) return SimulatorControlPrivate::deviceInfo(simUdid).isBooted(); } -QString SimulatorControl::bundleIdentifier(const Utils::FileName &bundlePath) +QString SimulatorControl::bundleIdentifier(const Utils::FilePath &bundlePath) { return SimulatorControlPrivate::bundleIdentifier(bundlePath); } -QString SimulatorControl::bundleExecutable(const Utils::FileName &bundlePath) +QString SimulatorControl::bundleExecutable(const Utils::FilePath &bundlePath) { return SimulatorControlPrivate::bundleExecutable(bundlePath); } @@ -307,7 +307,7 @@ QFuture<SimulatorControl::ResponseData> SimulatorControl::startSimulator(const Q } QFuture<SimulatorControl::ResponseData> -SimulatorControl::installApp(const QString &simUdid, const Utils::FileName &bundlePath) const +SimulatorControl::installApp(const QString &simUdid, const Utils::FilePath &bundlePath) const { return Utils::runAsync(&SimulatorControlPrivate::installApp, d, simUdid, bundlePath); } @@ -372,7 +372,7 @@ SimulatorInfo SimulatorControlPrivate::deviceInfo(const QString &simUdid) return device; } -QString SimulatorControlPrivate::bundleIdentifier(const Utils::FileName &bundlePath) +QString SimulatorControlPrivate::bundleIdentifier(const Utils::FilePath &bundlePath) { QString bundleID; #ifdef Q_OS_MAC @@ -392,7 +392,7 @@ QString SimulatorControlPrivate::bundleIdentifier(const Utils::FileName &bundleP return bundleID; } -QString SimulatorControlPrivate::bundleExecutable(const Utils::FileName &bundlePath) +QString SimulatorControlPrivate::bundleExecutable(const Utils::FilePath &bundlePath) { QString executable; #ifdef Q_OS_MAC @@ -470,7 +470,7 @@ void SimulatorControlPrivate::startSimulator(QFutureInterface<SimulatorControl:: } void SimulatorControlPrivate::installApp(QFutureInterface<SimulatorControl::ResponseData> &fi, - const QString &simUdid, const Utils::FileName &bundlePath) + const QString &simUdid, const Utils::FilePath &bundlePath) { QTC_CHECK(bundlePath.exists()); diff --git a/src/plugins/ios/simulatorcontrol.h b/src/plugins/ios/simulatorcontrol.h index c21469cd17..5d4351ae50 100644 --- a/src/plugins/ios/simulatorcontrol.h +++ b/src/plugins/ios/simulatorcontrol.h @@ -100,12 +100,12 @@ public: static QList<SimulatorInfo> availableSimulators(); static QFuture<QList<SimulatorInfo> > updateAvailableSimulators(); static bool isSimulatorRunning(const QString &simUdid); - static QString bundleIdentifier(const Utils::FileName &bundlePath); - static QString bundleExecutable(const Utils::FileName &bundlePath); + static QString bundleIdentifier(const Utils::FilePath &bundlePath); + static QString bundleExecutable(const Utils::FilePath &bundlePath); public: QFuture<ResponseData> startSimulator(const QString &simUdid) const; - QFuture<ResponseData> installApp(const QString &simUdid, const Utils::FileName &bundlePath) const; + QFuture<ResponseData> installApp(const QString &simUdid, const Utils::FilePath &bundlePath) const; QFuture<ResponseData> launchApp(const QString &simUdid, const QString &bundleIdentifier, bool waitForDebugger, const QStringList &extraArgs, const QString& stdoutPath = QString(), |