Android: Use new Core::Id::suffixAfter function

Change-Id: Ia2b11aa713e2f28433583da1f4c8bb10754b55fc
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
hjk
2013-03-21 16:21:51 +01:00
parent d106b0853c
commit 77094e6e5d

View File

@@ -52,16 +52,11 @@ using namespace Qt4ProjectManager;
namespace Android { namespace Android {
namespace Internal { namespace Internal {
#define ANDROID_PREFIX "Qt4ProjectManager.AndroidRunConfiguration" static const char ANDROID_RC_ID_PREFIX[] = "Qt4ProjectManager.AndroidRunConfiguration:";
static const char ANDROID_RC_ID_PREFIX[] = ANDROID_PREFIX ":";
static QString pathFromId(const Core::Id id) static QString pathFromId(const Core::Id id)
{ {
QString pathStr = id.toString(); return id.suffixAfter(ANDROID_RC_ID_PREFIX);
const QString prefix = QLatin1String(ANDROID_RC_ID_PREFIX);
if (!pathStr.startsWith(prefix))
return QString();
return pathStr.mid(prefix.size());
} }
AndroidRunConfigurationFactory::AndroidRunConfigurationFactory(QObject *parent) AndroidRunConfigurationFactory::AndroidRunConfigurationFactory(QObject *parent)
@@ -81,8 +76,7 @@ bool AndroidRunConfigurationFactory::canRestore(Target *parent, const QVariantMa
{ {
if (!canHandle(parent)) if (!canHandle(parent))
return false; return false;
QString id = ProjectExplorer::idFromMap(map).toString(); return ProjectExplorer::idFromMap(map).name().startsWith(ANDROID_RC_ID_PREFIX);
return id.startsWith(QLatin1String(ANDROID_RC_ID_PREFIX));
} }
bool AndroidRunConfigurationFactory::canClone(Target *parent, RunConfiguration *source) const bool AndroidRunConfigurationFactory::canClone(Target *parent, RunConfiguration *source) const