diff --git a/src/plugins/qnx/blackberryrunconfigurationfactory.cpp b/src/plugins/qnx/blackberryrunconfigurationfactory.cpp index ed573681fba..57808a3cbec 100644 --- a/src/plugins/qnx/blackberryrunconfigurationfactory.cpp +++ b/src/plugins/qnx/blackberryrunconfigurationfactory.cpp @@ -41,15 +41,9 @@ using namespace Qnx; using namespace Qnx::Internal; -namespace { -QString pathFromId(const Core::Id id) +static QString pathFromId(const Core::Id id) { - QString idStr = id.toString(); - if (idStr.startsWith(QLatin1String(Constants::QNX_BB_RUNCONFIGURATION_PREFIX))) - return idStr.mid(QString::fromLatin1(Constants::QNX_BB_RUNCONFIGURATION_PREFIX).size()); - - return QString(); -} + return id.suffixAfter(Constants::QNX_BB_RUNCONFIGURATION_PREFIX); } BlackBerryRunConfigurationFactory::BlackBerryRunConfigurationFactory(QObject *parent) : @@ -80,7 +74,7 @@ QString BlackBerryRunConfigurationFactory::displayNameForId(const Core::Id id) c if (path.isEmpty()) return QString(); - if (id.toString().startsWith(QLatin1String(Constants::QNX_BB_RUNCONFIGURATION_PREFIX))) + if (id.name().startsWith(Constants::QNX_BB_RUNCONFIGURATION_PREFIX)) return tr("%1 on BlackBerry Device").arg(QFileInfo(path).completeBaseName()); return QString(); @@ -95,7 +89,7 @@ bool BlackBerryRunConfigurationFactory::canCreate(ProjectExplorer::Target *paren if (!qt4Project) return false; - if (!id.toString().startsWith(QLatin1String(Constants::QNX_BB_RUNCONFIGURATION_PREFIX))) + if (!id.name().startsWith(Constants::QNX_BB_RUNCONFIGURATION_PREFIX)) return false; return qt4Project->hasApplicationProFile(pathFromId(id)); @@ -116,7 +110,7 @@ bool BlackBerryRunConfigurationFactory::canRestore(ProjectExplorer::Target *pare if (!canHandle(parent)) return false; - return ProjectExplorer::idFromMap(map).toString().startsWith(QLatin1String(Constants::QNX_BB_RUNCONFIGURATION_PREFIX)); + return ProjectExplorer::idFromMap(map).name().startsWith(Constants::QNX_BB_RUNCONFIGURATION_PREFIX); } ProjectExplorer::RunConfiguration *BlackBerryRunConfigurationFactory::restore( diff --git a/src/plugins/qnx/qnxdeployconfigurationfactory.cpp b/src/plugins/qnx/qnxdeployconfigurationfactory.cpp index 01e44d76d13..e84ea7552b7 100644 --- a/src/plugins/qnx/qnxdeployconfigurationfactory.cpp +++ b/src/plugins/qnx/qnxdeployconfigurationfactory.cpp @@ -59,7 +59,7 @@ QList QnxDeployConfigurationFactory::availableCreationIds(ProjectExplo QString QnxDeployConfigurationFactory::displayNameForId(const Core::Id id) const { - if (id.toString().startsWith(QLatin1String(Constants::QNX_QNX_DEPLOYCONFIGURATION_ID))) + if (id.name().startsWith(Constants::QNX_QNX_DEPLOYCONFIGURATION_ID)) return tr("Deploy to QNX Device"); return QString(); @@ -67,11 +67,7 @@ QString QnxDeployConfigurationFactory::displayNameForId(const Core::Id id) const bool QnxDeployConfigurationFactory::canCreate(ProjectExplorer::Target *parent, const Core::Id id) const { - if (!canHandle(parent) - || !id.toString().startsWith(QLatin1String(Constants::QNX_QNX_DEPLOYCONFIGURATION_ID))) - return false; - - return true; + return canHandle(parent) && id.name().startsWith(Constants::QNX_QNX_DEPLOYCONFIGURATION_ID); } ProjectExplorer::DeployConfiguration *QnxDeployConfigurationFactory::create(ProjectExplorer::Target *parent, const Core::Id id) diff --git a/src/plugins/qnx/qnxrunconfigurationfactory.cpp b/src/plugins/qnx/qnxrunconfigurationfactory.cpp index 37f997628af..1459f591e2f 100644 --- a/src/plugins/qnx/qnxrunconfigurationfactory.cpp +++ b/src/plugins/qnx/qnxrunconfigurationfactory.cpp @@ -42,15 +42,9 @@ using namespace Qnx; using namespace Qnx::Internal; -namespace { -QString pathFromId(const Core::Id id) +static QString pathFromId(const Core::Id id) { - const QString idStr = id.toString(); - if (idStr.startsWith(QLatin1String(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX))) - return idStr.mid(QString::fromLatin1(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX).size()); - - return QString(); -} + return id.suffixAfter(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX); } QnxRunConfigurationFactory::QnxRunConfigurationFactory(QObject *parent) : @@ -80,7 +74,7 @@ QString QnxRunConfigurationFactory::displayNameForId(const Core::Id id) const if (path.isEmpty()) return QString(); - if (id.toString().startsWith(QLatin1String(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX))) + if (id.name().startsWith(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX)) return tr("%1 on QNX Device").arg(QFileInfo(path).completeBaseName()); return QString(); @@ -103,7 +97,7 @@ ProjectExplorer::RunConfiguration *QnxRunConfigurationFactory::create(ProjectExp if (!canCreate(parent, id)) return 0; - if (id.toString().startsWith(QLatin1String(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX))) + if (id.name().startsWith(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX)) return new QnxRunConfiguration(parent, id, pathFromId(id)); return 0; @@ -111,10 +105,8 @@ ProjectExplorer::RunConfiguration *QnxRunConfigurationFactory::create(ProjectExp bool QnxRunConfigurationFactory::canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const { - if (!canHandle(parent)) - return false; - - return ProjectExplorer::idFromMap(map).toString().startsWith(QLatin1String(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX)); + return canHandle(parent) + && ProjectExplorer::idFromMap(map).name().startsWith(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX); } ProjectExplorer::RunConfiguration *QnxRunConfigurationFactory::restore(ProjectExplorer::Target *parent, const QVariantMap &map) diff --git a/src/plugins/qnx/qnxruncontrolfactory.cpp b/src/plugins/qnx/qnxruncontrolfactory.cpp index c3899b5cbe2..b2ef1489f83 100644 --- a/src/plugins/qnx/qnxruncontrolfactory.cpp +++ b/src/plugins/qnx/qnxruncontrolfactory.cpp @@ -97,7 +97,7 @@ bool QnxRunControlFactory::canRun(RunConfiguration *runConfiguration, RunMode mo return false; if (!runConfiguration->isEnabled() - || !runConfiguration->id().toString().startsWith(QLatin1String(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX))) { + || !runConfiguration->id().name().startsWith(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX)) { return false; }