forked from qt-creator/qt-creator
Qnx: Use new Core::Id interfaces
Less conversions, shorter code. Change-Id: I7c7aba1e7ee3096ea436250520e626259f519a38 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
@@ -41,15 +41,9 @@
|
|||||||
using namespace Qnx;
|
using namespace Qnx;
|
||||||
using namespace Qnx::Internal;
|
using namespace Qnx::Internal;
|
||||||
|
|
||||||
namespace {
|
static QString pathFromId(const Core::Id id)
|
||||||
QString pathFromId(const Core::Id id)
|
|
||||||
{
|
{
|
||||||
QString idStr = id.toString();
|
return id.suffixAfter(Constants::QNX_BB_RUNCONFIGURATION_PREFIX);
|
||||||
if (idStr.startsWith(QLatin1String(Constants::QNX_BB_RUNCONFIGURATION_PREFIX)))
|
|
||||||
return idStr.mid(QString::fromLatin1(Constants::QNX_BB_RUNCONFIGURATION_PREFIX).size());
|
|
||||||
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BlackBerryRunConfigurationFactory::BlackBerryRunConfigurationFactory(QObject *parent) :
|
BlackBerryRunConfigurationFactory::BlackBerryRunConfigurationFactory(QObject *parent) :
|
||||||
@@ -80,7 +74,7 @@ QString BlackBerryRunConfigurationFactory::displayNameForId(const Core::Id id) c
|
|||||||
if (path.isEmpty())
|
if (path.isEmpty())
|
||||||
return QString();
|
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 tr("%1 on BlackBerry Device").arg(QFileInfo(path).completeBaseName());
|
||||||
|
|
||||||
return QString();
|
return QString();
|
||||||
@@ -95,7 +89,7 @@ bool BlackBerryRunConfigurationFactory::canCreate(ProjectExplorer::Target *paren
|
|||||||
if (!qt4Project)
|
if (!qt4Project)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!id.toString().startsWith(QLatin1String(Constants::QNX_BB_RUNCONFIGURATION_PREFIX)))
|
if (!id.name().startsWith(Constants::QNX_BB_RUNCONFIGURATION_PREFIX))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return qt4Project->hasApplicationProFile(pathFromId(id));
|
return qt4Project->hasApplicationProFile(pathFromId(id));
|
||||||
@@ -116,7 +110,7 @@ bool BlackBerryRunConfigurationFactory::canRestore(ProjectExplorer::Target *pare
|
|||||||
if (!canHandle(parent))
|
if (!canHandle(parent))
|
||||||
return false;
|
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(
|
ProjectExplorer::RunConfiguration *BlackBerryRunConfigurationFactory::restore(
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ QList<Core::Id> QnxDeployConfigurationFactory::availableCreationIds(ProjectExplo
|
|||||||
|
|
||||||
QString QnxDeployConfigurationFactory::displayNameForId(const Core::Id id) const
|
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 tr("Deploy to QNX Device");
|
||||||
|
|
||||||
return QString();
|
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
|
bool QnxDeployConfigurationFactory::canCreate(ProjectExplorer::Target *parent, const Core::Id id) const
|
||||||
{
|
{
|
||||||
if (!canHandle(parent)
|
return canHandle(parent) && id.name().startsWith(Constants::QNX_QNX_DEPLOYCONFIGURATION_ID);
|
||||||
|| !id.toString().startsWith(QLatin1String(Constants::QNX_QNX_DEPLOYCONFIGURATION_ID)))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorer::DeployConfiguration *QnxDeployConfigurationFactory::create(ProjectExplorer::Target *parent, const Core::Id id)
|
ProjectExplorer::DeployConfiguration *QnxDeployConfigurationFactory::create(ProjectExplorer::Target *parent, const Core::Id id)
|
||||||
|
|||||||
@@ -42,15 +42,9 @@
|
|||||||
using namespace Qnx;
|
using namespace Qnx;
|
||||||
using namespace Qnx::Internal;
|
using namespace Qnx::Internal;
|
||||||
|
|
||||||
namespace {
|
static QString pathFromId(const Core::Id id)
|
||||||
QString pathFromId(const Core::Id id)
|
|
||||||
{
|
{
|
||||||
const QString idStr = id.toString();
|
return id.suffixAfter(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX);
|
||||||
if (idStr.startsWith(QLatin1String(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX)))
|
|
||||||
return idStr.mid(QString::fromLatin1(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX).size());
|
|
||||||
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QnxRunConfigurationFactory::QnxRunConfigurationFactory(QObject *parent) :
|
QnxRunConfigurationFactory::QnxRunConfigurationFactory(QObject *parent) :
|
||||||
@@ -80,7 +74,7 @@ QString QnxRunConfigurationFactory::displayNameForId(const Core::Id id) const
|
|||||||
if (path.isEmpty())
|
if (path.isEmpty())
|
||||||
return QString();
|
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 tr("%1 on QNX Device").arg(QFileInfo(path).completeBaseName());
|
||||||
|
|
||||||
return QString();
|
return QString();
|
||||||
@@ -103,7 +97,7 @@ ProjectExplorer::RunConfiguration *QnxRunConfigurationFactory::create(ProjectExp
|
|||||||
if (!canCreate(parent, id))
|
if (!canCreate(parent, id))
|
||||||
return 0;
|
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 new QnxRunConfiguration(parent, id, pathFromId(id));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -111,10 +105,8 @@ ProjectExplorer::RunConfiguration *QnxRunConfigurationFactory::create(ProjectExp
|
|||||||
|
|
||||||
bool QnxRunConfigurationFactory::canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const
|
bool QnxRunConfigurationFactory::canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const
|
||||||
{
|
{
|
||||||
if (!canHandle(parent))
|
return canHandle(parent)
|
||||||
return false;
|
&& ProjectExplorer::idFromMap(map).name().startsWith(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX);
|
||||||
|
|
||||||
return ProjectExplorer::idFromMap(map).toString().startsWith(QLatin1String(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorer::RunConfiguration *QnxRunConfigurationFactory::restore(ProjectExplorer::Target *parent, const QVariantMap &map)
|
ProjectExplorer::RunConfiguration *QnxRunConfigurationFactory::restore(ProjectExplorer::Target *parent, const QVariantMap &map)
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ bool QnxRunControlFactory::canRun(RunConfiguration *runConfiguration, RunMode mo
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!runConfiguration->isEnabled()
|
if (!runConfiguration->isEnabled()
|
||||||
|| !runConfiguration->id().toString().startsWith(QLatin1String(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX))) {
|
|| !runConfiguration->id().name().startsWith(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user