forked from qt-creator/qt-creator
Ios: standardize IosRunConfiguration::initialize() signature
Most other signatures look like RunConfiguration::initialize(Core::Id), this here is part of unifying them completely. Change-Id: I7cd2acc8ebe6ec8cef05272f18f0fa5ded94f930 Reviewed-by: Vikas Pachdha <vikas.pachdha@qt.io>
This commit is contained in:
@@ -50,5 +50,7 @@ const quint16 IOS_SIMULATOR_PORT_END = 31000;
|
||||
|
||||
const char EXTRA_INFO_KEY[] = "extraInfo";
|
||||
|
||||
const char IOS_RC_ID_PREFIX[] = "Qt4ProjectManager.IosRunConfiguration:";
|
||||
|
||||
} // namespace Constants;
|
||||
} // namespace Ios
|
||||
|
@@ -105,10 +105,10 @@ IosRunConfiguration::IosRunConfiguration(Target *target)
|
||||
this, &IosRunConfiguration::deviceChanges);
|
||||
}
|
||||
|
||||
void IosRunConfiguration::initialize(Core::Id id, const FileName &path)
|
||||
void IosRunConfiguration::initialize(Core::Id id)
|
||||
{
|
||||
RunConfiguration::initialize(id);
|
||||
m_profilePath = path;
|
||||
m_profilePath = pathFromId(id);
|
||||
|
||||
updateDisplayNames();
|
||||
}
|
||||
@@ -265,6 +265,15 @@ QString IosRunConfiguration::buildSystemTarget() const
|
||||
return static_cast<QmakeProject *>(target()->project())->mapProFilePathToTarget(m_profilePath);
|
||||
}
|
||||
|
||||
FileName IosRunConfiguration::pathFromId(Core::Id id)
|
||||
{
|
||||
QString pathStr = id.toString();
|
||||
const QString prefix = Constants::IOS_RC_ID_PREFIX;
|
||||
if (!pathStr.startsWith(prefix))
|
||||
return Utils::FileName();
|
||||
return Utils::FileName::fromString(pathStr.mid(prefix.size()));
|
||||
}
|
||||
|
||||
QString IosRunConfiguration::disabledReason() const
|
||||
{
|
||||
Core::Id devType = DeviceTypeKitInformation::deviceTypeId(target()->kit());
|
||||
|
@@ -66,12 +66,14 @@ public:
|
||||
|
||||
QString buildSystemTarget() const final;
|
||||
|
||||
static Utils::FileName pathFromId(Core::Id id);
|
||||
|
||||
signals:
|
||||
void localExecutableChanged();
|
||||
|
||||
private:
|
||||
friend class ProjectExplorer::IRunConfigurationFactory;
|
||||
void initialize(Core::Id id, const Utils::FileName &path);
|
||||
void initialize(Core::Id id);
|
||||
|
||||
void deviceChanges();
|
||||
friend class IosRunConfigurationWidget;
|
||||
|
@@ -49,18 +49,6 @@ using namespace QmakeProjectManager;
|
||||
namespace Ios {
|
||||
namespace Internal {
|
||||
|
||||
#define IOS_PREFIX "Qt4ProjectManager.IosRunConfiguration"
|
||||
#define IOS_RC_ID_PREFIX IOS_PREFIX ":"
|
||||
|
||||
static Utils::FileName pathFromId(Core::Id id)
|
||||
{
|
||||
QString pathStr = id.toString();
|
||||
const QString prefix = QLatin1String(IOS_RC_ID_PREFIX);
|
||||
if (!pathStr.startsWith(prefix))
|
||||
return Utils::FileName();
|
||||
return Utils::FileName::fromString(pathStr.mid(prefix.size()));
|
||||
}
|
||||
|
||||
IosRunConfigurationFactory::IosRunConfigurationFactory(QObject *parent)
|
||||
: QmakeRunConfigurationFactory(parent)
|
||||
{
|
||||
@@ -80,7 +68,7 @@ bool IosRunConfigurationFactory::canRestore(Target *parent, const QVariantMap &m
|
||||
if (!canHandle(parent))
|
||||
return false;
|
||||
QString id = ProjectExplorer::idFromMap(map).toString();
|
||||
return id.startsWith(QLatin1String(IOS_RC_ID_PREFIX));
|
||||
return id.startsWith(Ios::Constants::IOS_RC_ID_PREFIX);
|
||||
}
|
||||
|
||||
bool IosRunConfigurationFactory::canClone(Target *parent, RunConfiguration *source) const
|
||||
@@ -94,14 +82,14 @@ QList<Core::Id> IosRunConfigurationFactory::availableCreationIds(Target *parent,
|
||||
return QList<Core::Id>();
|
||||
|
||||
auto project = static_cast<QmakeProject *>(parent->project());
|
||||
return project->creationIds(IOS_RC_ID_PREFIX, mode, {ProjectType::ApplicationTemplate,
|
||||
ProjectType::SharedLibraryTemplate,
|
||||
ProjectType::AuxTemplate});
|
||||
return project->creationIds(Constants::IOS_RC_ID_PREFIX, mode, {ProjectType::ApplicationTemplate,
|
||||
ProjectType::SharedLibraryTemplate,
|
||||
ProjectType::AuxTemplate});
|
||||
}
|
||||
|
||||
QString IosRunConfigurationFactory::displayNameForId(Core::Id id) const
|
||||
{
|
||||
return pathFromId(id).toFileInfo().completeBaseName();
|
||||
return IosRunConfiguration::pathFromId(id).toFileInfo().completeBaseName();
|
||||
}
|
||||
|
||||
bool IosRunConfigurationFactory::canHandle(Target *t) const
|
||||
@@ -125,13 +113,13 @@ QList<RunConfiguration *> IosRunConfigurationFactory::runConfigurationsForNode(T
|
||||
|
||||
RunConfiguration *IosRunConfigurationFactory::doCreate(Target *parent, Core::Id id)
|
||||
{
|
||||
return createHelper<IosRunConfiguration>(parent, id, pathFromId(id));
|
||||
return createHelper<IosRunConfiguration>(parent, id);
|
||||
}
|
||||
|
||||
RunConfiguration *IosRunConfigurationFactory::doRestore(Target *parent, const QVariantMap &map)
|
||||
{
|
||||
Core::Id id = ProjectExplorer::idFromMap(map);
|
||||
return createHelper<IosRunConfiguration>(parent, id, pathFromId(id));
|
||||
return createHelper<IosRunConfiguration>(parent, id);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
Reference in New Issue
Block a user