2013-04-25 16:02:17 +02:00
|
|
|
/****************************************************************************
|
|
|
|
**
|
2014-01-07 13:27:11 +01:00
|
|
|
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
2013-04-25 16:02:17 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
|
|
|
**
|
|
|
|
** 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 Digia. For licensing terms and
|
2014-10-01 13:21:18 +02:00
|
|
|
** conditions see http://www.qt.io/licensing. For further information
|
|
|
|
** use the contact form at http://www.qt.io/contact-us.
|
2013-04-25 16:02:17 +02:00
|
|
|
**
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
2014-10-01 13:21:18 +02:00
|
|
|
** General Public License version 2.1 or version 3 as published by the Free
|
|
|
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
|
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
|
|
** following information to ensure the GNU Lesser General Public License
|
|
|
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2013-04-25 16:02:17 +02:00
|
|
|
**
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
**
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include "iosrunconfiguration.h"
|
2014-07-07 09:24:17 +02:00
|
|
|
#include "iosconstants.h"
|
2013-04-25 16:02:17 +02:00
|
|
|
#include "iosmanager.h"
|
|
|
|
#include "iosdeploystep.h"
|
2014-02-14 01:02:30 +01:00
|
|
|
#include "ui_iosrunconfiguration.h"
|
2013-04-25 16:02:17 +02:00
|
|
|
|
|
|
|
#include <projectexplorer/kitinformation.h>
|
|
|
|
#include <projectexplorer/target.h>
|
|
|
|
#include <projectexplorer/deployconfiguration.h>
|
2014-02-14 01:02:30 +01:00
|
|
|
#include <projectexplorer/devicesupport/devicemanager.h>
|
2013-04-25 16:02:17 +02:00
|
|
|
#include <projectexplorer/buildstep.h>
|
|
|
|
#include <projectexplorer/buildsteplist.h>
|
2013-10-29 16:19:24 +01:00
|
|
|
#include <qmakeprojectmanager/qmakebuildconfiguration.h>
|
|
|
|
#include <qmakeprojectmanager/qmakeproject.h>
|
|
|
|
#include <qmakeprojectmanager/qmakenodes.h>
|
2013-04-25 16:02:17 +02:00
|
|
|
#include <qtsupport/qtoutputformatter.h>
|
|
|
|
#include <qtsupport/qtkitinformation.h>
|
|
|
|
|
|
|
|
#include <QList>
|
|
|
|
|
|
|
|
#include <utils/qtcprocess.h>
|
|
|
|
#include <utils/qtcassert.h>
|
|
|
|
|
|
|
|
using namespace ProjectExplorer;
|
2013-10-16 11:02:37 +02:00
|
|
|
using namespace QmakeProjectManager;
|
2014-02-05 10:43:21 +01:00
|
|
|
using namespace Utils;
|
2013-04-25 16:02:17 +02:00
|
|
|
|
|
|
|
namespace Ios {
|
|
|
|
namespace Internal {
|
|
|
|
|
2014-03-28 19:05:35 +01:00
|
|
|
static const QLatin1String runConfigurationKey("Ios.run_arguments");
|
|
|
|
static const QLatin1String deviceTypeKey("Ios.device_type");
|
2014-01-16 18:35:36 +01:00
|
|
|
|
2013-04-25 16:02:17 +02:00
|
|
|
class IosRunConfigurationWidget : public RunConfigWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
IosRunConfigurationWidget(IosRunConfiguration *runConfiguration);
|
|
|
|
~IosRunConfigurationWidget();
|
|
|
|
QString argListToString(const QStringList &args) const;
|
|
|
|
QStringList stringToArgList(const QString &args) const;
|
|
|
|
QString displayName() const;
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void argumentsLineEditTextEdited();
|
|
|
|
void updateValues();
|
2014-03-28 19:05:35 +01:00
|
|
|
void setDeviceTypeIndex(int devIndex);
|
2013-04-25 16:02:17 +02:00
|
|
|
private:
|
|
|
|
Ui::IosRunConfiguration *m_ui;
|
|
|
|
IosRunConfiguration *m_runConfiguration;
|
|
|
|
};
|
|
|
|
|
|
|
|
IosRunConfiguration::IosRunConfiguration(Target *parent, Core::Id id, const QString &path)
|
|
|
|
: RunConfiguration(parent, id)
|
|
|
|
, m_profilePath(path)
|
|
|
|
{
|
|
|
|
init();
|
|
|
|
}
|
|
|
|
|
|
|
|
IosRunConfiguration::IosRunConfiguration(Target *parent, IosRunConfiguration *source)
|
|
|
|
: RunConfiguration(parent, source)
|
|
|
|
, m_profilePath(source->m_profilePath)
|
2014-01-16 18:35:36 +01:00
|
|
|
, m_arguments(source->m_arguments)
|
2013-04-25 16:02:17 +02:00
|
|
|
{
|
|
|
|
init();
|
|
|
|
}
|
|
|
|
|
|
|
|
void IosRunConfiguration::init()
|
|
|
|
{
|
2014-02-14 01:02:30 +01:00
|
|
|
QmakeProject *project = static_cast<QmakeProject *>(target()->project());
|
|
|
|
m_parseSuccess = project->validParse(m_profilePath);
|
|
|
|
m_parseInProgress = project->parseInProgress(m_profilePath);
|
|
|
|
m_lastIsEnabled = isEnabled();
|
|
|
|
m_lastDisabledReason = disabledReason();
|
2014-04-01 18:40:56 +02:00
|
|
|
m_deviceType = IosDeviceType::IosDevice;
|
2014-03-26 16:50:12 +01:00
|
|
|
updateDisplayNames();
|
2014-02-14 01:02:30 +01:00
|
|
|
connect(DeviceManager::instance(), SIGNAL(updated()),
|
|
|
|
SLOT(deviceChanges()));
|
|
|
|
connect(KitManager::instance(), SIGNAL(kitsChanged()),
|
|
|
|
SLOT(deviceChanges()));
|
|
|
|
connect(target()->project(), SIGNAL(proFileUpdated(QmakeProjectManager::QmakeProFileNode*,bool,bool)),
|
|
|
|
this, SLOT(proFileUpdated(QmakeProjectManager::QmakeProFileNode*,bool,bool)));
|
|
|
|
}
|
|
|
|
|
|
|
|
void IosRunConfiguration::enabledCheck()
|
|
|
|
{
|
|
|
|
bool newIsEnabled = isEnabled();
|
|
|
|
QString newDisabledReason = disabledReason();
|
|
|
|
if (newDisabledReason != m_lastDisabledReason || newIsEnabled != m_lastIsEnabled) {
|
|
|
|
m_lastDisabledReason = newDisabledReason;
|
|
|
|
m_lastIsEnabled = newIsEnabled;
|
|
|
|
emit enabledChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void IosRunConfiguration::deviceChanges() {
|
2014-03-26 16:50:12 +01:00
|
|
|
updateDisplayNames();
|
2014-02-14 01:02:30 +01:00
|
|
|
enabledCheck();
|
|
|
|
}
|
|
|
|
|
|
|
|
void IosRunConfiguration::proFileUpdated(QmakeProjectManager::QmakeProFileNode *pro, bool success,
|
|
|
|
bool parseInProgress)
|
|
|
|
{
|
|
|
|
if (m_profilePath != pro->path())
|
|
|
|
return;
|
|
|
|
m_parseSuccess = success;
|
|
|
|
m_parseInProgress = parseInProgress;
|
2014-03-27 18:50:08 +01:00
|
|
|
if (success && !parseInProgress) {
|
2014-03-26 16:50:12 +01:00
|
|
|
updateDisplayNames();
|
2014-03-27 18:50:08 +01:00
|
|
|
emit localExecutableChanged();
|
|
|
|
}
|
2014-02-14 01:02:30 +01:00
|
|
|
enabledCheck();
|
2013-04-25 16:02:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
QWidget *IosRunConfiguration::createConfigurationWidget()
|
|
|
|
{
|
|
|
|
return new IosRunConfigurationWidget(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
Utils::OutputFormatter *IosRunConfiguration::createOutputFormatter() const
|
|
|
|
{
|
|
|
|
return new QtSupport::QtOutputFormatter(target()->project());
|
|
|
|
}
|
|
|
|
|
|
|
|
QStringList IosRunConfiguration::commandLineArguments()
|
|
|
|
{
|
|
|
|
return m_arguments;
|
|
|
|
}
|
|
|
|
|
2014-03-26 16:50:12 +01:00
|
|
|
void IosRunConfiguration::updateDisplayNames()
|
2013-04-25 16:02:17 +02:00
|
|
|
{
|
2014-04-01 18:40:56 +02:00
|
|
|
if (DeviceTypeKitInformation::deviceTypeId(target()->kit()) == Constants::IOS_DEVICE_TYPE)
|
|
|
|
m_deviceType = IosDeviceType::IosDevice;
|
|
|
|
else if (m_deviceType == IosDeviceType::IosDevice)
|
|
|
|
m_deviceType = IosDeviceType::SimulatedIphoneRetina4Inch;
|
2014-05-26 22:13:14 +03:00
|
|
|
IDevice::ConstPtr dev = DeviceKitInformation::device(target()->kit());
|
2013-11-04 15:08:41 +01:00
|
|
|
const QString devName = dev.isNull() ? IosDevice::name() : dev->displayName();
|
2014-03-26 16:50:12 +01:00
|
|
|
setDefaultDisplayName(tr("Run on %1").arg(devName));
|
2014-04-10 11:35:36 +02:00
|
|
|
setDisplayName(tr("Run %1 on %2").arg(applicationName()).arg(devName));
|
2013-04-25 16:02:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
IosDeployStep *IosRunConfiguration::deployStep() const
|
|
|
|
{
|
|
|
|
IosDeployStep * step = 0;
|
|
|
|
DeployConfiguration *config = target()->activeDeployConfiguration();
|
2014-05-26 22:13:14 +03:00
|
|
|
BuildStepList *bsl = config->stepList();
|
2013-04-25 16:02:17 +02:00
|
|
|
if (bsl) {
|
2014-05-26 22:13:14 +03:00
|
|
|
const QList<BuildStep *> &buildSteps = bsl->steps();
|
2013-04-25 16:02:17 +02:00
|
|
|
for (int i = buildSteps.count() - 1; i >= 0; --i) {
|
|
|
|
step = qobject_cast<IosDeployStep *>(buildSteps.at(i));
|
|
|
|
if (step)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Q_ASSERT_X(step, Q_FUNC_INFO, "Impossible: iOS build configuration without deploy step.");
|
|
|
|
return step;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString IosRunConfiguration::profilePath() const
|
|
|
|
{
|
|
|
|
return m_profilePath;
|
|
|
|
}
|
|
|
|
|
2014-04-10 11:35:36 +02:00
|
|
|
QString IosRunConfiguration::applicationName() const
|
2013-04-25 16:02:17 +02:00
|
|
|
{
|
2013-10-29 14:22:31 +01:00
|
|
|
QmakeProject *pro = qobject_cast<QmakeProject *>(target()->project());
|
2014-03-26 16:57:57 +01:00
|
|
|
const QmakeProFileNode *node = 0;
|
|
|
|
if (pro)
|
|
|
|
node = pro->rootQmakeProjectNode();
|
|
|
|
if (node)
|
|
|
|
node = node->findProFileFor(profilePath());
|
|
|
|
if (node) {
|
|
|
|
TargetInformation ti = node->targetInformation();
|
|
|
|
if (ti.valid)
|
|
|
|
return ti.target;
|
2013-04-25 16:02:17 +02:00
|
|
|
}
|
|
|
|
return QString();
|
|
|
|
}
|
|
|
|
|
2014-04-10 11:35:36 +02:00
|
|
|
Utils::FileName IosRunConfiguration::bundleDirectory() const
|
2013-04-25 16:02:17 +02:00
|
|
|
{
|
|
|
|
Utils::FileName res;
|
2014-05-26 22:13:14 +03:00
|
|
|
Core::Id devType = DeviceTypeKitInformation::deviceTypeId(target()->kit());
|
2013-04-25 16:02:17 +02:00
|
|
|
bool isDevice = (devType == Constants::IOS_DEVICE_TYPE);
|
|
|
|
if (!isDevice && devType != Constants::IOS_SIMULATOR_TYPE) {
|
2014-07-07 09:24:17 +02:00
|
|
|
qCWarning(iosLog) << "unexpected device type in bundleDirForTarget: " << devType.toString();
|
2013-04-25 16:02:17 +02:00
|
|
|
return res;
|
|
|
|
}
|
2013-10-16 14:00:45 +02:00
|
|
|
QmakeBuildConfiguration *bc =
|
|
|
|
qobject_cast<QmakeBuildConfiguration *>(target()->activeBuildConfiguration());
|
2013-04-25 16:02:17 +02:00
|
|
|
if (bc) {
|
2014-03-10 16:30:32 +01:00
|
|
|
QmakeProject *pro = qobject_cast<QmakeProject *>(target()->project());
|
2014-03-26 16:57:57 +01:00
|
|
|
const QmakeProFileNode *node = 0;
|
|
|
|
if (pro)
|
|
|
|
node = pro->rootQmakeProjectNode();
|
|
|
|
if (node)
|
|
|
|
node = node->findProFileFor(profilePath());
|
2014-03-10 16:30:32 +01:00
|
|
|
if (node) {
|
|
|
|
TargetInformation ti = node->targetInformation();
|
|
|
|
if (ti.valid)
|
|
|
|
res = FileName::fromString(ti.buildDir);
|
|
|
|
}
|
|
|
|
if (res.isEmpty())
|
|
|
|
res = bc->buildDirectory();
|
2013-04-25 16:02:17 +02:00
|
|
|
switch (bc->buildType()) {
|
|
|
|
case BuildConfiguration::Debug :
|
|
|
|
case BuildConfiguration::Unknown :
|
|
|
|
if (isDevice)
|
|
|
|
res.appendPath(QLatin1String("Debug-iphoneos"));
|
|
|
|
else
|
|
|
|
res.appendPath(QLatin1String("Debug-iphonesimulator"));
|
|
|
|
break;
|
|
|
|
case BuildConfiguration::Release :
|
|
|
|
if (isDevice)
|
|
|
|
res.appendPath(QLatin1String("Release-iphoneos"));
|
|
|
|
else
|
2014-03-11 11:34:39 +01:00
|
|
|
res.appendPath(QLatin1String("Release-iphonesimulator"));
|
2013-04-25 16:02:17 +02:00
|
|
|
break;
|
|
|
|
default:
|
2014-07-07 09:24:17 +02:00
|
|
|
qCWarning(iosLog) << "IosBuildStep had an unknown buildType "
|
2013-04-25 16:02:17 +02:00
|
|
|
<< target()->activeBuildConfiguration()->buildType();
|
|
|
|
}
|
|
|
|
}
|
2014-04-10 11:35:36 +02:00
|
|
|
res.appendPath(applicationName() + QLatin1String(".app"));
|
2013-04-25 16:02:17 +02:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2014-04-10 11:35:36 +02:00
|
|
|
Utils::FileName IosRunConfiguration::localExecutable() const
|
2013-04-25 16:02:17 +02:00
|
|
|
{
|
2014-04-10 11:35:36 +02:00
|
|
|
return bundleDirectory().appendPath(applicationName());
|
2013-04-25 16:02:17 +02:00
|
|
|
}
|
|
|
|
|
2014-01-16 18:35:36 +01:00
|
|
|
bool IosRunConfiguration::fromMap(const QVariantMap &map)
|
|
|
|
{
|
|
|
|
m_arguments = map.value(runConfigurationKey).toStringList();
|
2014-03-28 19:05:35 +01:00
|
|
|
IosDeviceType::Enum deviceType = static_cast<IosDeviceType::Enum>(map.value(deviceTypeKey)
|
|
|
|
.toInt());
|
|
|
|
bool valid = false;
|
|
|
|
for (int i = 0 ; i < nSimulatedDevices; ++i)
|
|
|
|
if (simulatedDevices[i] == m_deviceType)
|
|
|
|
valid = true;
|
|
|
|
if (valid)
|
|
|
|
m_deviceType = deviceType;
|
2014-03-31 16:20:22 +02:00
|
|
|
else if (DeviceTypeKitInformation::deviceTypeId(target()->kit()) == Constants::IOS_DEVICE_TYPE)
|
|
|
|
m_deviceType = IosDeviceType::IosDevice;
|
|
|
|
else
|
|
|
|
m_deviceType = IosDeviceType::SimulatedIphoneRetina4Inch;
|
2014-03-28 19:05:35 +01:00
|
|
|
|
2014-01-16 18:35:36 +01:00
|
|
|
return RunConfiguration::fromMap(map);
|
|
|
|
}
|
|
|
|
|
|
|
|
QVariantMap IosRunConfiguration::toMap() const
|
|
|
|
{
|
|
|
|
QVariantMap res = RunConfiguration::toMap();
|
|
|
|
res[runConfigurationKey] = m_arguments;
|
2014-03-28 19:05:35 +01:00
|
|
|
res[deviceTypeKey] = m_deviceType;
|
2014-01-16 18:35:36 +01:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2014-02-14 01:02:30 +01:00
|
|
|
bool IosRunConfiguration::isEnabled() const
|
|
|
|
{
|
|
|
|
if (m_parseInProgress || !m_parseSuccess)
|
|
|
|
return false;
|
2014-05-26 22:13:14 +03:00
|
|
|
Core::Id devType = DeviceTypeKitInformation::deviceTypeId(target()->kit());
|
2014-02-14 01:02:30 +01:00
|
|
|
if (devType != Constants::IOS_DEVICE_TYPE && devType != Constants::IOS_SIMULATOR_TYPE)
|
|
|
|
return false;
|
2014-05-26 22:13:14 +03:00
|
|
|
IDevice::ConstPtr dev = DeviceKitInformation::device(target()->kit());
|
2014-02-14 01:02:30 +01:00
|
|
|
if (dev.isNull() || dev->deviceState() != IDevice::DeviceReadyToUse)
|
|
|
|
return false;
|
|
|
|
return RunConfiguration::isEnabled();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString IosRunConfiguration::disabledReason() const
|
|
|
|
{
|
|
|
|
if (m_parseInProgress)
|
2014-04-17 14:09:47 +02:00
|
|
|
return tr("The .pro file \"%1\" is currently being parsed.")
|
2014-02-14 01:02:30 +01:00
|
|
|
.arg(QFileInfo(m_profilePath).fileName());
|
|
|
|
if (!m_parseSuccess)
|
|
|
|
return static_cast<QmakeProject *>(target()->project())
|
|
|
|
->disabledReasonForRunConfiguration(m_profilePath);
|
2014-05-26 22:13:14 +03:00
|
|
|
Core::Id devType = DeviceTypeKitInformation::deviceTypeId(target()->kit());
|
2014-02-14 01:02:30 +01:00
|
|
|
if (devType != Constants::IOS_DEVICE_TYPE && devType != Constants::IOS_SIMULATOR_TYPE)
|
|
|
|
return tr("Kit has incorrect device type for running on iOS devices.");
|
2014-05-26 22:13:14 +03:00
|
|
|
IDevice::ConstPtr dev = DeviceKitInformation::device(target()->kit());
|
2014-02-14 01:02:30 +01:00
|
|
|
QString validDevName;
|
|
|
|
bool hasConncetedDev = false;
|
|
|
|
if (devType == Constants::IOS_DEVICE_TYPE) {
|
|
|
|
DeviceManager *dm = DeviceManager::instance();
|
|
|
|
for (int idev = 0; idev < dm->deviceCount(); ++idev) {
|
|
|
|
IDevice::ConstPtr availDev = dm->deviceAt(idev);
|
|
|
|
if (!availDev.isNull() && availDev->type() == Constants::IOS_DEVICE_TYPE) {
|
|
|
|
if (availDev->deviceState() == IDevice::DeviceReadyToUse) {
|
2014-08-29 14:00:18 +02:00
|
|
|
validDevName += QLatin1Char(' ');
|
2014-02-14 01:02:30 +01:00
|
|
|
validDevName += availDev->displayName();
|
|
|
|
} else if (availDev->deviceState() == IDevice::DeviceConnected) {
|
|
|
|
hasConncetedDev = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dev.isNull()) {
|
|
|
|
if (!validDevName.isEmpty())
|
|
|
|
return tr("No device chosen. Select %1.").arg(validDevName); // should not happen
|
|
|
|
else if (hasConncetedDev)
|
|
|
|
return tr("No device chosen. Enable developer mode on a device."); // should not happen
|
|
|
|
else
|
|
|
|
return tr("No device available.");
|
|
|
|
} else {
|
|
|
|
switch (dev->deviceState()) {
|
|
|
|
case IDevice::DeviceReadyToUse:
|
|
|
|
break;
|
|
|
|
case IDevice::DeviceConnected:
|
|
|
|
return tr("To use this device you need to enable developer mode on it.");
|
|
|
|
case IDevice::DeviceDisconnected:
|
|
|
|
case IDevice::DeviceStateUnknown:
|
|
|
|
if (!validDevName.isEmpty())
|
|
|
|
return tr("%1 is not connected. Select %2?")
|
|
|
|
.arg(dev->displayName(), validDevName);
|
|
|
|
else if (hasConncetedDev)
|
|
|
|
return tr("%1 is not connected. Enable developer mode on a device?")
|
|
|
|
.arg(dev->displayName());
|
|
|
|
else
|
|
|
|
return tr("%1 is not connected.").arg(dev->displayName());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return RunConfiguration::disabledReason();
|
|
|
|
}
|
|
|
|
|
2014-03-28 19:05:35 +01:00
|
|
|
IosDeviceType::Enum IosRunConfiguration::deviceType() const
|
|
|
|
{
|
|
|
|
return m_deviceType;
|
|
|
|
}
|
|
|
|
|
|
|
|
void IosRunConfiguration::setDeviceType(IosDeviceType::Enum deviceType)
|
|
|
|
{
|
|
|
|
m_deviceType = deviceType;
|
|
|
|
}
|
|
|
|
|
2013-04-25 16:02:17 +02:00
|
|
|
IosRunConfigurationWidget::IosRunConfigurationWidget(IosRunConfiguration *runConfiguration) :
|
|
|
|
m_ui(new Ui::IosRunConfiguration), m_runConfiguration(runConfiguration)
|
|
|
|
{
|
|
|
|
m_ui->setupUi(this);
|
|
|
|
|
|
|
|
updateValues();
|
2014-03-28 19:05:35 +01:00
|
|
|
connect(m_ui->deviceTypeComboBox, SIGNAL(currentIndexChanged(int)),
|
|
|
|
SLOT(setDeviceTypeIndex(int)));
|
2013-04-25 16:02:17 +02:00
|
|
|
connect(m_ui->argumentsLineEdit, SIGNAL(editingFinished()),
|
2013-12-16 13:38:19 +01:00
|
|
|
SLOT(argumentsLineEditTextEdited()));
|
2014-03-27 18:50:08 +01:00
|
|
|
connect(runConfiguration, SIGNAL(localExecutableChanged()),
|
2013-12-16 13:38:19 +01:00
|
|
|
SLOT(updateValues()));
|
2013-04-25 16:02:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
IosRunConfigurationWidget::~IosRunConfigurationWidget()
|
|
|
|
{
|
|
|
|
delete m_ui;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString IosRunConfigurationWidget::argListToString(const QStringList &args) const
|
|
|
|
{
|
|
|
|
return Utils::QtcProcess::joinArgs(args);
|
|
|
|
}
|
|
|
|
|
|
|
|
QStringList IosRunConfigurationWidget::stringToArgList(const QString &args) const
|
|
|
|
{
|
2014-02-05 10:43:21 +01:00
|
|
|
QtcProcess::SplitError err;
|
|
|
|
QStringList res = QtcProcess::splitArgs(args, OsTypeMac, false, &err);
|
2013-04-25 16:02:17 +02:00
|
|
|
switch (err) {
|
2014-02-05 10:43:21 +01:00
|
|
|
case QtcProcess::SplitOk:
|
2013-04-25 16:02:17 +02:00
|
|
|
break;
|
2014-02-05 10:43:21 +01:00
|
|
|
case QtcProcess::BadQuoting:
|
2013-04-25 16:02:17 +02:00
|
|
|
if (args.at(args.size()-1) == QLatin1Char('\\')) {
|
2014-02-05 10:43:21 +01:00
|
|
|
res = QtcProcess::splitArgs(args + QLatin1Char('\\'), OsTypeMac, false, &err);
|
|
|
|
if (err != QtcProcess::SplitOk)
|
|
|
|
res = QtcProcess::splitArgs(args + QLatin1Char('\\') + QLatin1Char('\''),
|
|
|
|
OsTypeMac, false, &err);
|
|
|
|
if (err != QtcProcess::SplitOk)
|
|
|
|
res = QtcProcess::splitArgs(args + QLatin1Char('\\') + QLatin1Char('\"'),
|
|
|
|
OsTypeMac, false, &err);
|
2013-04-25 16:02:17 +02:00
|
|
|
}
|
2014-02-05 10:43:21 +01:00
|
|
|
if (err != QtcProcess::SplitOk)
|
|
|
|
res = QtcProcess::splitArgs(args + QLatin1Char('\''), OsTypeMac, false, &err);
|
|
|
|
if (err != QtcProcess::SplitOk)
|
|
|
|
res = QtcProcess::splitArgs(args + QLatin1Char('\"'), OsTypeMac, false, &err);
|
2013-04-25 16:02:17 +02:00
|
|
|
break;
|
2014-02-05 10:43:21 +01:00
|
|
|
case QtcProcess::FoundMeta:
|
2014-07-07 09:24:17 +02:00
|
|
|
qCWarning(iosLog) << "IosRunConfigurationWidget FoundMeta (should not happen)";
|
2013-04-25 16:02:17 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString IosRunConfigurationWidget::displayName() const
|
|
|
|
{
|
|
|
|
return tr("iOS run settings");
|
|
|
|
}
|
|
|
|
|
|
|
|
void IosRunConfigurationWidget::argumentsLineEditTextEdited()
|
|
|
|
{
|
|
|
|
QString argsString = m_ui->argumentsLineEdit->text();
|
|
|
|
QStringList args = stringToArgList(argsString);
|
|
|
|
m_runConfiguration->m_arguments = args;
|
|
|
|
m_ui->argumentsLineEdit->setText(argListToString(args));
|
|
|
|
}
|
|
|
|
|
2014-03-28 19:05:35 +01:00
|
|
|
void IosRunConfigurationWidget::setDeviceTypeIndex(int devIndex)
|
|
|
|
{
|
|
|
|
if (devIndex >= 0 && devIndex < nSimulatedDevices)
|
|
|
|
m_runConfiguration->setDeviceType(simulatedDevices[devIndex]);
|
|
|
|
else
|
|
|
|
m_runConfiguration->setDeviceType(IosDeviceType::SimulatedIphoneRetina4Inch);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-04-25 16:02:17 +02:00
|
|
|
void IosRunConfigurationWidget::updateValues()
|
|
|
|
{
|
2014-04-01 18:40:56 +02:00
|
|
|
bool showDeviceSelector = m_runConfiguration->deviceType() != IosDeviceType::IosDevice;
|
|
|
|
m_ui->deviceTypeLabel->setVisible(showDeviceSelector);
|
|
|
|
m_ui->deviceTypeComboBox->setVisible(showDeviceSelector);
|
2014-03-28 19:05:35 +01:00
|
|
|
QStringList args = m_runConfiguration->commandLineArguments();
|
2013-04-25 16:02:17 +02:00
|
|
|
QString argsString = argListToString(args);
|
2014-03-28 19:05:35 +01:00
|
|
|
|
|
|
|
if (m_runConfiguration->deviceType() == IosDeviceType::IosDevice)
|
|
|
|
for (int i = 0; i < nSimulatedDevices; ++i)
|
|
|
|
if (simulatedDevices[i] == m_runConfiguration->deviceType())
|
|
|
|
m_ui->deviceTypeComboBox->setCurrentIndex(i);
|
2013-04-25 16:02:17 +02:00
|
|
|
m_ui->argumentsLineEdit->setText(argsString);
|
2014-04-10 11:35:36 +02:00
|
|
|
m_ui->executableLineEdit->setText(m_runConfiguration->localExecutable().toUserOutput());
|
2013-04-25 16:02:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
} // namespace Ios
|
|
|
|
|
|
|
|
#include "iosrunconfiguration.moc"
|