forked from qt-creator/qt-creator
iOS: Let user specify developer team and provisioning profile
Task-number: QTCREATORBUG-16936 Change-Id: Ie4a91125f34fbf35cda4e1593919899af5f4cdbb Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -34,7 +34,9 @@ HEADERS += \
|
|||||||
iosdeploystepfactory.h \
|
iosdeploystepfactory.h \
|
||||||
iosdeploystepwidget.h \
|
iosdeploystepwidget.h \
|
||||||
iosanalyzesupport.h \
|
iosanalyzesupport.h \
|
||||||
simulatorcontrol.h
|
simulatorcontrol.h \
|
||||||
|
iosbuildconfiguration.h \
|
||||||
|
iosbuildsettingswidget.h
|
||||||
|
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
@@ -63,13 +65,16 @@ SOURCES += \
|
|||||||
iosdeploystepfactory.cpp \
|
iosdeploystepfactory.cpp \
|
||||||
iosdeploystepwidget.cpp \
|
iosdeploystepwidget.cpp \
|
||||||
iosanalyzesupport.cpp \
|
iosanalyzesupport.cpp \
|
||||||
simulatorcontrol.cpp
|
simulatorcontrol.cpp \
|
||||||
|
iosbuildconfiguration.cpp \
|
||||||
|
iosbuildsettingswidget.cpp
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
iossettingswidget.ui \
|
iossettingswidget.ui \
|
||||||
iosbuildstep.ui \
|
iosbuildstep.ui \
|
||||||
iosdeploystepwidget.ui \
|
iosdeploystepwidget.ui \
|
||||||
iospresetbuildstep.ui
|
iospresetbuildstep.ui \
|
||||||
|
iosbuildsettingswidget.ui
|
||||||
|
|
||||||
DEFINES += IOS_LIBRARY
|
DEFINES += IOS_LIBRARY
|
||||||
|
|
||||||
|
193
src/plugins/ios/iosbuildconfiguration.cpp
Normal file
193
src/plugins/ios/iosbuildconfiguration.cpp
Normal file
@@ -0,0 +1,193 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** 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 "iosbuildconfiguration.h"
|
||||||
|
|
||||||
|
#include "iosconfigurations.h"
|
||||||
|
#include "iosconstants.h"
|
||||||
|
#include "iosbuildsettingswidget.h"
|
||||||
|
#include "iosmanager.h"
|
||||||
|
|
||||||
|
#include "projectexplorer/kitinformation.h"
|
||||||
|
#include "projectexplorer/namedwidget.h"
|
||||||
|
#include "projectexplorer/target.h"
|
||||||
|
#include "qmakeprojectmanager/qmakebuildinfo.h"
|
||||||
|
#include "utils/algorithm.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
using namespace QmakeProjectManager;
|
||||||
|
|
||||||
|
namespace Ios {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
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";
|
||||||
|
|
||||||
|
IosBuildConfiguration::IosBuildConfiguration(ProjectExplorer::Target *target) :
|
||||||
|
QmakeBuildConfiguration(target)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
IosBuildConfiguration::IosBuildConfiguration(ProjectExplorer::Target *target, IosBuildConfiguration *source) :
|
||||||
|
QmakeBuildConfiguration(target, source)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<ProjectExplorer::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);
|
||||||
|
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();
|
||||||
|
const QString forceOverrideArg("-after");
|
||||||
|
if (qmakeStepInstance) {
|
||||||
|
QStringList extraArgs = qmakeStepInstance->extraArguments();
|
||||||
|
// remove old extra arguments.
|
||||||
|
Utils::erase(extraArgs, [forceOverrideArg](const QString& arg) {
|
||||||
|
return arg.startsWith(qmakeIosTeamSettings)
|
||||||
|
|| arg.startsWith(qmakeProvisioningProfileSettings)
|
||||||
|
|| arg == forceOverrideArg;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Set force ovveride qmake switch
|
||||||
|
if (!m_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;
|
||||||
|
} else {
|
||||||
|
// Get the team id from provisioning profile
|
||||||
|
ProvisioningProfilePtr profile =
|
||||||
|
IosConfigurations::provisioningProfile(m_signingIdentifier);
|
||||||
|
QString teamId;
|
||||||
|
if (profile)
|
||||||
|
teamId = profile->developmentTeam()->identifier();
|
||||||
|
else
|
||||||
|
qCDebug(iosLog) << "No provisioing profile found for id:"<< m_signingIdentifier;
|
||||||
|
|
||||||
|
if (!teamId.isEmpty()) {
|
||||||
|
extraArgs << qmakeProvisioningProfileSettings + m_signingIdentifier;
|
||||||
|
extraArgs << qmakeIosTeamSettings + teamId;
|
||||||
|
} else {
|
||||||
|
qCDebug(iosLog) << "Development team unavailable for profile:" << profile;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
qmakeStepInstance->setExtraArguments(extraArgs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IosBuildConfigurationFactory::IosBuildConfigurationFactory(QObject *parent)
|
||||||
|
: QmakeBuildConfigurationFactory(parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int IosBuildConfigurationFactory::priority(const ProjectExplorer::Kit *k, const QString &projectPath) const
|
||||||
|
{
|
||||||
|
return (QmakeBuildConfigurationFactory::priority(k, projectPath) >= 0
|
||||||
|
&& IosManager::supportsIos(k)) ? 1 : -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int IosBuildConfigurationFactory::priority(const ProjectExplorer::Target *parent) const
|
||||||
|
{
|
||||||
|
return (QmakeBuildConfigurationFactory::priority(parent) >= 0
|
||||||
|
&& IosManager::supportsIos(parent)) ? 1 : -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ProjectExplorer::BuildConfiguration *IosBuildConfigurationFactory::create(ProjectExplorer::Target *parent,
|
||||||
|
const ProjectExplorer::BuildInfo *info) const
|
||||||
|
{
|
||||||
|
auto qmakeInfo = static_cast<const QmakeBuildInfo *>(info);
|
||||||
|
auto bc = new IosBuildConfiguration(parent);
|
||||||
|
configureBuildConfiguration(parent, bc, qmakeInfo);
|
||||||
|
return bc;
|
||||||
|
}
|
||||||
|
|
||||||
|
ProjectExplorer::BuildConfiguration *IosBuildConfigurationFactory::clone(ProjectExplorer::Target *parent,
|
||||||
|
ProjectExplorer::BuildConfiguration *source)
|
||||||
|
{
|
||||||
|
if (!canClone(parent, source))
|
||||||
|
return nullptr;
|
||||||
|
auto *oldbc = static_cast<IosBuildConfiguration *>(source);
|
||||||
|
return new IosBuildConfiguration(parent, oldbc);
|
||||||
|
}
|
||||||
|
|
||||||
|
ProjectExplorer::BuildConfiguration *IosBuildConfigurationFactory::restore(ProjectExplorer::Target *parent, const QVariantMap &map)
|
||||||
|
{
|
||||||
|
if (canRestore(parent, map)) {
|
||||||
|
std::unique_ptr<IosBuildConfiguration> bc(new IosBuildConfiguration(parent));
|
||||||
|
if (bc->fromMap(map))
|
||||||
|
return bc.release();
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Ios
|
75
src/plugins/ios/iosbuildconfiguration.h
Normal file
75
src/plugins/ios/iosbuildconfiguration.h
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** 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 "qmakeprojectmanager/qmakebuildconfiguration.h"
|
||||||
|
|
||||||
|
namespace ProjectExplorer {
|
||||||
|
class Target;
|
||||||
|
class Kit;
|
||||||
|
class NamedWidget;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Ios {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
class IosBuildConfiguration : public QmakeProjectManager::QmakeBuildConfiguration
|
||||||
|
{
|
||||||
|
friend class IosBuildConfigurationFactory;
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit IosBuildConfiguration(ProjectExplorer::Target *target);
|
||||||
|
IosBuildConfiguration(ProjectExplorer::Target *target, IosBuildConfiguration *source);
|
||||||
|
|
||||||
|
QList<ProjectExplorer::NamedWidget *> createSubConfigWidgets() override;
|
||||||
|
QVariantMap toMap() const override;
|
||||||
|
protected:
|
||||||
|
bool fromMap(const QVariantMap &map) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void onSigningSettingsChanged(bool autoManagedSigning, QString identifier);
|
||||||
|
void updateQmakeCommand();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString m_signingIdentifier;
|
||||||
|
bool m_autoManagedSigning = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class IosBuildConfigurationFactory : public QmakeProjectManager::QmakeBuildConfigurationFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit IosBuildConfigurationFactory(QObject *parent = 0);
|
||||||
|
|
||||||
|
int priority(const ProjectExplorer::Kit *k, const QString &projectPath) const override;
|
||||||
|
int priority(const ProjectExplorer::Target *parent) const override;
|
||||||
|
|
||||||
|
ProjectExplorer::BuildConfiguration *create(ProjectExplorer::Target *parent, const ProjectExplorer::BuildInfo *info) const override;
|
||||||
|
ProjectExplorer::BuildConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) override;
|
||||||
|
ProjectExplorer::BuildConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Ios
|
290
src/plugins/ios/iosbuildsettingswidget.cpp
Normal file
290
src/plugins/ios/iosbuildsettingswidget.cpp
Normal file
@@ -0,0 +1,290 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** 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 "utils/utilsicons.h"
|
||||||
|
#include "utils/algorithm.h"
|
||||||
|
#include "qmakeprojectmanager/qmakeproject.h"
|
||||||
|
#include "qmakeprojectmanager/qmakenodes.h"
|
||||||
|
#include "utils/detailswidget.h"
|
||||||
|
|
||||||
|
#include <QLoggingCategory>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
|
using namespace QmakeProjectManager;
|
||||||
|
|
||||||
|
namespace Ios {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
Q_LOGGING_CATEGORY(iosSettingsLog, "qtc.ios.common")
|
||||||
|
}
|
||||||
|
|
||||||
|
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) << "Can not 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()
|
||||||
|
{
|
||||||
|
// Populate Team id's
|
||||||
|
ui->m_signEntityCombo->blockSignals(true);
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
ui->m_signEntityCombo->blockSignals(false);
|
||||||
|
// Maintain previous selection.
|
||||||
|
setDefaultSigningIdentfier(m_lastTeamSelection);
|
||||||
|
updateWarningText();
|
||||||
|
}
|
||||||
|
|
||||||
|
void IosBuildSettingsWidget::populateProvisioningProfiles()
|
||||||
|
{
|
||||||
|
// Populate Team id's
|
||||||
|
ui->m_signEntityCombo->blockSignals(true);
|
||||||
|
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"));
|
||||||
|
}
|
||||||
|
ui->m_signEntityCombo->blockSignals(false);
|
||||||
|
// 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
|
80
src/plugins/ios/iosbuildsettingswidget.h
Normal file
80
src/plugins/ios/iosbuildsettingswidget.h
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** 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 = 0);
|
||||||
|
~IosBuildSettingsWidget();
|
||||||
|
|
||||||
|
public:
|
||||||
|
bool isSigningAutomaticallyManaged() const;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void onSigningEntityComboIndexChanged();
|
||||||
|
void onReset();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void signingSettingsChanged(bool isAutoManaged, QString identifier);
|
||||||
|
|
||||||
|
private:
|
||||||
|
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
|
137
src/plugins/ios/iosbuildsettingswidget.ui
Normal file
137
src/plugins/ios/iosbuildsettingswidget.ui
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
<?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>Form</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>
|
@@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include "iosplugin.h"
|
#include "iosplugin.h"
|
||||||
|
|
||||||
|
#include "iosbuildconfiguration.h"
|
||||||
#include "iosbuildstep.h"
|
#include "iosbuildstep.h"
|
||||||
#include "iosconfigurations.h"
|
#include "iosconfigurations.h"
|
||||||
#include "iosconstants.h"
|
#include "iosconstants.h"
|
||||||
@@ -64,6 +65,7 @@ bool IosPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
|||||||
|
|
||||||
Internal::IosConfigurations::initialize();
|
Internal::IosConfigurations::initialize();
|
||||||
|
|
||||||
|
addAutoReleasedObject(new Internal::IosBuildConfigurationFactory);
|
||||||
addAutoReleasedObject(new Internal::IosToolChainFactory);
|
addAutoReleasedObject(new Internal::IosToolChainFactory);
|
||||||
addAutoReleasedObject(new Internal::IosRunControlFactory);
|
addAutoReleasedObject(new Internal::IosRunControlFactory);
|
||||||
addAutoReleasedObject(new Internal::IosRunConfigurationFactory);
|
addAutoReleasedObject(new Internal::IosRunConfigurationFactory);
|
||||||
|
Reference in New Issue
Block a user