Device support: Use Core::Id for device type.

Change-Id: Ic51f6239a34ad752064d7ee6b6f48a9851311135
Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
Christian Kandeler
2012-05-16 10:46:21 +02:00
parent 383b9e00ad
commit 092134f539
25 changed files with 98 additions and 99 deletions

View File

@@ -53,7 +53,7 @@ MaddeDevice::Ptr MaddeDevice::create()
return Ptr(new MaddeDevice); return Ptr(new MaddeDevice);
} }
MaddeDevice::Ptr MaddeDevice::create(const QString &name, const QString &type, MaddeDevice::Ptr MaddeDevice::create(const QString &name, Core::Id type,
MachineType machineType, Origin origin, Core::Id id) MachineType machineType, Origin origin, Core::Id id)
{ {
return Ptr(new MaddeDevice(name, type, machineType, origin, id)); return Ptr(new MaddeDevice(name, type, machineType, origin, id));
@@ -63,7 +63,7 @@ MaddeDevice::MaddeDevice()
{ {
} }
MaddeDevice::MaddeDevice(const QString &name, const QString &type, MachineType machineType, MaddeDevice::MaddeDevice(const QString &name, Core::Id type, MachineType machineType,
Origin origin, Core::Id id) Origin origin, Core::Id id)
: LinuxDeviceConfiguration(name, type, machineType, origin, id) : LinuxDeviceConfiguration(name, type, machineType, origin, id)
{ {
@@ -120,11 +120,11 @@ void MaddeDevice::executeAction(Core::Id actionId, QWidget *parent) const
d->exec(); d->exec();
} }
QString MaddeDevice::maddeDisplayType(const QString &type) QString MaddeDevice::maddeDisplayType(Core::Id type)
{ {
if (type == QLatin1String(Maemo5OsType)) if (type == Core::Id(Maemo5OsType))
return tr("Maemo5/Fremantle"); return tr("Maemo5/Fremantle");
if (type == QLatin1String(HarmattanOsType)) if (type == Core::Id(HarmattanOsType))
return tr("MeeGo 1.2 Harmattan"); return tr("MeeGo 1.2 Harmattan");
return tr("Other MeeGo OS"); return tr("Other MeeGo OS");
} }

View File

@@ -47,7 +47,7 @@ public:
typedef QSharedPointer<const MaddeDevice> ConstPtr; typedef QSharedPointer<const MaddeDevice> ConstPtr;
static Ptr create(); static Ptr create();
static Ptr create(const QString &name, const QString &type, MachineType machineType, static Ptr create(const QString &name, Core::Id type, MachineType machineType,
Origin origin = ManuallyAdded, Core::Id id = Core::Id()); Origin origin = ManuallyAdded, Core::Id id = Core::Id());
QString displayType() const; QString displayType() const;
@@ -55,11 +55,11 @@ public:
QString displayNameForActionId(Core::Id actionId) const; QString displayNameForActionId(Core::Id actionId) const;
void executeAction(Core::Id actionId, QWidget *parent) const; void executeAction(Core::Id actionId, QWidget *parent) const;
ProjectExplorer::IDevice::Ptr clone() const; ProjectExplorer::IDevice::Ptr clone() const;
static QString maddeDisplayType(const QString &type); static QString maddeDisplayType(Core::Id type);
private: private:
MaddeDevice(); MaddeDevice();
MaddeDevice(const QString &name, const QString &type, MachineType machineType, MaddeDevice(const QString &name, Core::Id type, MachineType machineType,
Origin origin, Core::Id id); Origin origin, Core::Id id);
MaddeDevice(const MaddeDevice &other); MaddeDevice(const MaddeDevice &other);

View File

@@ -68,9 +68,9 @@ IDevice::Ptr MaddeDeviceConfigurationFactory::create() const
bool MaddeDeviceConfigurationFactory::canRestore(const QVariantMap &map) const bool MaddeDeviceConfigurationFactory::canRestore(const QVariantMap &map) const
{ {
const QString type = IDevice::typeFromMap(map); const Core::Id type = IDevice::typeFromMap(map);
return type == QLatin1String(Maemo5OsType) || type == QLatin1String(HarmattanOsType) return type == Core::Id(Maemo5OsType) || type == Core::Id(HarmattanOsType)
|| type == QLatin1String(MeeGoOsType); || type == Core::Id(MeeGoOsType);
} }
IDevice::Ptr MaddeDeviceConfigurationFactory::restore(const QVariantMap &map) const IDevice::Ptr MaddeDeviceConfigurationFactory::restore(const QVariantMap &map) const

View File

@@ -117,7 +117,7 @@ void MaddeDeviceTester::handleGenericTestFinished(TestResult result)
connect(m_processRunner, SIGNAL(processClosed(int)), SLOT(handleProcessFinished(int))); connect(m_processRunner, SIGNAL(processClosed(int)), SLOT(handleProcessFinished(int)));
QString qtInfoCmd; QString qtInfoCmd;
if (m_deviceConfiguration->type() == QLatin1String(MeeGoOsType)) { if (m_deviceConfiguration->type() == Core::Id(MeeGoOsType)) {
qtInfoCmd = QLatin1String("rpm -qa 'libqt*' --queryformat '%{NAME} %{VERSION}\\n'"); qtInfoCmd = QLatin1String("rpm -qa 'libqt*' --queryformat '%{NAME} %{VERSION}\\n'");
} else { } else {
qtInfoCmd = QLatin1String("dpkg-query -W -f " qtInfoCmd = QLatin1String("dpkg-query -W -f "
@@ -212,7 +212,7 @@ void MaddeDeviceTester::handleMadDeveloperTestFinished(int exitStatus)
} else if (m_processRunner->processExitCode() != 0) { } else if (m_processRunner->processExitCode() != 0) {
QString message = tr("Connectivity tool not installed on device. " QString message = tr("Connectivity tool not installed on device. "
"Deployment currently not possible."); "Deployment currently not possible.");
if (m_deviceConfiguration->type() == QLatin1String(HarmattanOsType)) { if (m_deviceConfiguration->type() == Core::Id(HarmattanOsType)) {
message += tr("Please switch the device to developer mode " message += tr("Please switch the device to developer mode "
"via Settings -> Security."); "via Settings -> Security.");
} }
@@ -222,7 +222,7 @@ void MaddeDeviceTester::handleMadDeveloperTestFinished(int exitStatus)
emit progressMessage(tr("Connectivity tool present.\n")); emit progressMessage(tr("Connectivity tool present.\n"));
} }
if (m_deviceConfiguration->type() != QLatin1String(HarmattanOsType)) { if (m_deviceConfiguration->type() != Core::Id(HarmattanOsType)) {
setFinished(); setFinished();
return; return;
} }
@@ -263,7 +263,7 @@ QString MaddeDeviceTester::processedQtLibsList()
QString unfilteredLibs = QString::fromUtf8(m_stdout); QString unfilteredLibs = QString::fromUtf8(m_stdout);
QString filteredLibs; QString filteredLibs;
QString patternString; QString patternString;
if (m_deviceConfiguration->type() == QLatin1String(MeeGoOsType)) if (m_deviceConfiguration->type() == Core::Id(MeeGoOsType))
patternString = QLatin1String("(libqt\\S+) ((\\d+)\\.(\\d+)\\.(\\d+))"); patternString = QLatin1String("(libqt\\S+) ((\\d+)\\.(\\d+)\\.(\\d+))");
else else
patternString = QLatin1String("(\\S+) (\\S*(\\d+)\\.(\\d+)\\.(\\d+)\\S*) \\S+ \\S+ \\S+"); patternString = QLatin1String("(\\S+) (\\S*(\\d+)\\.(\\d+)\\.(\\d+)\\S*) \\S+ \\S+ \\S+");

View File

@@ -62,9 +62,9 @@ namespace Madde {
namespace Internal { namespace Internal {
namespace { namespace {
QString defaultUser(const QString &deviceType) QString defaultUser(Core::Id deviceType)
{ {
if (deviceType == QLatin1String(MeeGoOsType)) if (deviceType == Core::Id(MeeGoOsType))
return QLatin1String("meego"); return QLatin1String("meego");
return QLatin1String("developer"); return QLatin1String("developer");
} }
@@ -78,7 +78,7 @@ struct WizardData
{ {
QString configName; QString configName;
QString hostName; QString hostName;
QString deviceType; Core::Id deviceType;
SshConnectionParameters::AuthenticationType authType; SshConnectionParameters::AuthenticationType authType;
LinuxDeviceConfiguration::MachineType machineType; LinuxDeviceConfiguration::MachineType machineType;
QString privateKeyFilePath; QString privateKeyFilePath;
@@ -105,12 +105,13 @@ public:
setTitle(tr("General Information")); setTitle(tr("General Information"));
setSubTitle(QLatin1String(" ")); // For Qt bug (background color) setSubTitle(QLatin1String(" ")); // For Qt bug (background color)
m_ui->osTypeComboBox->addItem(MaddeDevice::maddeDisplayType(QLatin1String(Maemo5OsType)), m_ui->osTypeComboBox->addItem(MaddeDevice::maddeDisplayType(Core::Id(Maemo5OsType)),
QLatin1String(Maemo5OsType)); QVariant::fromValue(Core::Id(Maemo5OsType)));
m_ui->osTypeComboBox->addItem(MaddeDevice::maddeDisplayType(QLatin1String(HarmattanOsType)), const QVariant harmattanIdVariant = QVariant::fromValue(Core::Id(HarmattanOsType));
QLatin1String(HarmattanOsType)); m_ui->osTypeComboBox->addItem(MaddeDevice::maddeDisplayType(Core::Id(HarmattanOsType)),
m_ui->osTypeComboBox->addItem(MaddeDevice::maddeDisplayType(QLatin1String(MeeGoOsType)), harmattanIdVariant);
QLatin1String(MeeGoOsType)); m_ui->osTypeComboBox->addItem(MaddeDevice::maddeDisplayType(Core::Id(MeeGoOsType)),
QVariant::fromValue(Core::Id(MeeGoOsType)));
QButtonGroup *buttonGroup = new QButtonGroup(this); QButtonGroup *buttonGroup = new QButtonGroup(this);
buttonGroup->setExclusive(true); buttonGroup->setExclusive(true);
@@ -119,7 +120,7 @@ public:
connect(buttonGroup, SIGNAL(buttonClicked(int)), SLOT(handleMachineTypeChanged())); connect(buttonGroup, SIGNAL(buttonClicked(int)), SLOT(handleMachineTypeChanged()));
m_ui->nameLineEdit->setText(tr("MeeGo Device")); m_ui->nameLineEdit->setText(tr("MeeGo Device"));
m_ui->osTypeComboBox->setCurrentIndex(m_ui->osTypeComboBox->findData(QLatin1String(HarmattanOsType))); m_ui->osTypeComboBox->setCurrentIndex(m_ui->osTypeComboBox->findData(harmattanIdVariant));
m_ui->hwButton->setChecked(true); m_ui->hwButton->setChecked(true);
handleMachineTypeChanged(); handleMachineTypeChanged();
m_ui->hostNameLineEdit->setText(defaultHost(machineType())); m_ui->hostNameLineEdit->setText(defaultHost(machineType()));
@@ -146,9 +147,9 @@ public:
: m_ui->hostNameLineEdit->text().trimmed(); : m_ui->hostNameLineEdit->text().trimmed();
} }
QString deviceType() const Core::Id deviceType() const
{ {
return m_ui->osTypeComboBox->itemData(m_ui->osTypeComboBox->currentIndex()).toString(); return m_ui->osTypeComboBox->itemData(m_ui->osTypeComboBox->currentIndex()).value<Core::Id>();
} }
LinuxDeviceConfiguration::MachineType machineType() const LinuxDeviceConfiguration::MachineType machineType() const
@@ -566,7 +567,7 @@ IDevice::Ptr MaemoDeviceConfigWizard::device()
sshParams.port = d->wizardData.sshPort; sshParams.port = d->wizardData.sshPort;
if (d->wizardData.machineType == LinuxDeviceConfiguration::Emulator) { if (d->wizardData.machineType == LinuxDeviceConfiguration::Emulator) {
sshParams.authenticationType = Utils::SshConnectionParameters::AuthenticationByPassword; sshParams.authenticationType = Utils::SshConnectionParameters::AuthenticationByPassword;
sshParams.password = d->wizardData.deviceType == QLatin1String(MeeGoOsType) sshParams.password = d->wizardData.deviceType == Core::Id(MeeGoOsType)
? QLatin1String("meego") : QString(); ? QLatin1String("meego") : QString();
sshParams.timeout = 30; sshParams.timeout = 30;
freePortsSpec = QLatin1String("13219,14168"); freePortsSpec = QLatin1String("13219,14168");

View File

@@ -80,20 +80,20 @@ bool MaemoGlobal::isMeegoTargetId(const Core::Id id)
bool MaemoGlobal::isValidMaemo5QtVersion(const QString &qmakePath) bool MaemoGlobal::isValidMaemo5QtVersion(const QString &qmakePath)
{ {
return isValidMaemoQtVersion(qmakePath, QLatin1String(Maemo5OsType)); return isValidMaemoQtVersion(qmakePath, Core::Id(Maemo5OsType));
} }
bool MaemoGlobal::isValidHarmattanQtVersion(const QString &qmakePath) bool MaemoGlobal::isValidHarmattanQtVersion(const QString &qmakePath)
{ {
return isValidMaemoQtVersion(qmakePath, QLatin1String(HarmattanOsType)); return isValidMaemoQtVersion(qmakePath, Core::Id(HarmattanOsType));
} }
bool MaemoGlobal::isValidMeegoQtVersion(const QString &qmakePath) bool MaemoGlobal::isValidMeegoQtVersion(const QString &qmakePath)
{ {
return isValidMaemoQtVersion(qmakePath, QLatin1String(MeeGoOsType)); return isValidMaemoQtVersion(qmakePath, Core::Id(MeeGoOsType));
} }
bool MaemoGlobal::isValidMaemoQtVersion(const QString &qmakePath, const QString &deviceType) bool MaemoGlobal::isValidMaemoQtVersion(const QString &qmakePath, Core::Id deviceType)
{ {
if (MaemoGlobal::deviceType(qmakePath) != deviceType) if (MaemoGlobal::deviceType(qmakePath) != deviceType)
return false; return false;
@@ -133,12 +133,12 @@ int MaemoGlobal::applicationIconSize(const ProjectExplorer::Target *target)
return qobject_cast<const Qt4HarmattanTarget *>(target) ? 80 : 64; return qobject_cast<const Qt4HarmattanTarget *>(target) ? 80 : 64;
} }
QString MaemoGlobal::remoteSudo(const QString &deviceType, const QString &uname) QString MaemoGlobal::remoteSudo(Core::Id deviceType, const QString &uname)
{ {
if (uname == QLatin1String("root")) if (uname == QLatin1String("root"))
return QString(); return QString();
if (deviceType == QLatin1String(Maemo5OsType) || deviceType == QLatin1String(HarmattanOsType) if (deviceType == Core::Id(Maemo5OsType) || deviceType == Core::Id(HarmattanOsType)
|| deviceType == QLatin1String(MeeGoOsType)) { || deviceType == Core::Id(MeeGoOsType)) {
return devrootshPath(); return devrootshPath();
} }
return QString(); // Using sudo would open a can of worms. return QString(); // Using sudo would open a can of worms.
@@ -200,22 +200,22 @@ QString MaemoGlobal::madCommand(const QString &qmakePath)
return maddeRoot(qmakePath) + QLatin1String("/bin/mad"); return maddeRoot(qmakePath) + QLatin1String("/bin/mad");
} }
QString MaemoGlobal::madDeveloperUiName(const QString &deviceType) QString MaemoGlobal::madDeveloperUiName(Core::Id deviceType)
{ {
return deviceType == QLatin1String(HarmattanOsType) return deviceType == Core::Id(HarmattanOsType)
? tr("SDK Connectivity") : tr("Mad Developer"); ? tr("SDK Connectivity") : tr("Mad Developer");
} }
QString MaemoGlobal::deviceType(const QString &qmakePath) Core::Id MaemoGlobal::deviceType(const QString &qmakePath)
{ {
const QString &name = targetName(qmakePath); const QString &name = targetName(qmakePath);
if (name.startsWith(QLatin1String("fremantle"))) if (name.startsWith(QLatin1String("fremantle")))
return QLatin1String(Maemo5OsType); return Core::Id(Maemo5OsType);
if (name.startsWith(QLatin1String("harmattan"))) if (name.startsWith(QLatin1String("harmattan")))
return QLatin1String(HarmattanOsType); return Core::Id(HarmattanOsType);
if (name.startsWith(QLatin1String("meego"))) if (name.startsWith(QLatin1String("meego")))
return QLatin1String(MeeGoOsType); return Core::Id(MeeGoOsType);
return QLatin1String(RemoteLinux::Constants::GenericLinuxOsType); return Core::Id(RemoteLinux::Constants::GenericLinuxOsType);
} }
QString MaemoGlobal::architecture(const QString &qmakePath) QString MaemoGlobal::architecture(const QString &qmakePath)

View File

@@ -95,7 +95,7 @@ public:
static QString homeDirOnDevice(const QString &uname); static QString homeDirOnDevice(const QString &uname);
static QString devrootshPath(); static QString devrootshPath();
static int applicationIconSize(const ProjectExplorer::Target *target); static int applicationIconSize(const ProjectExplorer::Target *target);
static QString remoteSudo(const QString &deviceType, const QString &uname); static QString remoteSudo(Core::Id deviceType, const QString &uname);
static QString remoteSourceProfilesCommand(); static QString remoteSourceProfilesCommand();
static Utils::PortList freePorts(const QSharedPointer<const RemoteLinux::LinuxDeviceConfiguration> &devConf, static Utils::PortList freePorts(const QSharedPointer<const RemoteLinux::LinuxDeviceConfiguration> &devConf,
const QtSupport::BaseQtVersion *qtVersion); const QtSupport::BaseQtVersion *qtVersion);
@@ -106,8 +106,8 @@ public:
static QString targetRoot(const QString &qmakePath); static QString targetRoot(const QString &qmakePath);
static QString targetName(const QString &qmakePath); static QString targetName(const QString &qmakePath);
static QString madCommand(const QString &qmakePath); static QString madCommand(const QString &qmakePath);
static QString madDeveloperUiName(const QString &deviceType); static QString madDeveloperUiName(Core::Id deviceType);
static QString deviceType(const QString &qmakePath); static Core::Id deviceType(const QString &qmakePath);
// TODO: IS this still needed with Qt Version having an Abi? // TODO: IS this still needed with Qt Version having an Abi?
static QString architecture(const QString &qmakePath); static QString architecture(const QString &qmakePath);
@@ -117,7 +117,7 @@ public:
static bool callMadAdmin(QProcess &proc, const QStringList &args, static bool callMadAdmin(QProcess &proc, const QStringList &args,
const QString &qmakePath, bool useTarget); const QString &qmakePath, bool useTarget);
static bool isValidMaemoQtVersion(const QString &qmakePath, const QString &deviceType); static bool isValidMaemoQtVersion(const QString &qmakePath, Core::Id deviceType);
private: private:
static QString madAdminCommand(const QString &qmakePath); static QString madAdminCommand(const QString &qmakePath);
static bool callMaddeShellScript(QProcess &proc, const QString &qmakePath, static bool callMaddeShellScript(QProcess &proc, const QString &qmakePath,

View File

@@ -86,7 +86,7 @@ void MaemoPublishingBuildSettingsPageFremantleFree::collectBuildConfigurations(c
QtSupport::BaseQtVersion *lqt = qt4Bc->qtVersion(); QtSupport::BaseQtVersion *lqt = qt4Bc->qtVersion();
if (!lqt) if (!lqt)
continue; continue;
if (MaemoGlobal::deviceType(lqt->qmakeCommand().toString()) == QLatin1String(Maemo5OsType)) if (MaemoGlobal::deviceType(lqt->qmakeCommand().toString()) == Core::Id(Maemo5OsType))
m_buildConfigs << qt4Bc; m_buildConfigs << qt4Bc;
} }
break; break;

View File

@@ -84,7 +84,7 @@ bool MaemoPublishingWizardFactoryFremantleFree::canCreateWizard(const Project *p
QtSupport::BaseQtVersion *qt = qt4Bc->qtVersion(); QtSupport::BaseQtVersion *qt = qt4Bc->qtVersion();
if (!qt) if (!qt)
continue; continue;
if (MaemoGlobal::deviceType(qt->qmakeCommand().toString()) == QLatin1String(Maemo5OsType)) if (MaemoGlobal::deviceType(qt->qmakeCommand().toString()) == Core::Id(Maemo5OsType))
return true; return true;
} }
break; break;

View File

@@ -124,16 +124,16 @@ QList<ProjectExplorer::Abi> MaemoQtVersion::detectQtAbis() const
QList<ProjectExplorer::Abi> result; QList<ProjectExplorer::Abi> result;
if (!isValid()) if (!isValid())
return result; return result;
if (m_deviceType == QLatin1String(Maemo5OsType)) { if (m_deviceType == Core::Id(Maemo5OsType)) {
result.append(ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture, ProjectExplorer::Abi::LinuxOS, result.append(ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture, ProjectExplorer::Abi::LinuxOS,
ProjectExplorer::Abi::MaemoLinuxFlavor, ProjectExplorer::Abi::ElfFormat, ProjectExplorer::Abi::MaemoLinuxFlavor, ProjectExplorer::Abi::ElfFormat,
32)); 32));
} else if (m_deviceType == QLatin1String(HarmattanOsType)) { } else if (m_deviceType == Core::Id(HarmattanOsType)) {
result.append(ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture, ProjectExplorer::Abi::LinuxOS, result.append(ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture, ProjectExplorer::Abi::LinuxOS,
ProjectExplorer::Abi::HarmattanLinuxFlavor, ProjectExplorer::Abi::HarmattanLinuxFlavor,
ProjectExplorer::Abi::ElfFormat, ProjectExplorer::Abi::ElfFormat,
32)); 32));
} else if (m_deviceType == QLatin1String(MeeGoOsType)) { } else if (m_deviceType == Core::Id(MeeGoOsType)) {
result.append(ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture, ProjectExplorer::Abi::LinuxOS, result.append(ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture, ProjectExplorer::Abi::LinuxOS,
ProjectExplorer::Abi::MeegoLinuxFlavor, ProjectExplorer::Abi::MeegoLinuxFlavor,
ProjectExplorer::Abi::ElfFormat, 32)); ProjectExplorer::Abi::ElfFormat, 32));
@@ -151,11 +151,11 @@ QSet<Core::Id> MaemoQtVersion::supportedTargetIds() const
QSet<Core::Id> result; QSet<Core::Id> result;
if (!isValid()) if (!isValid())
return result; return result;
if (m_deviceType == QLatin1String(Maemo5OsType)) { if (m_deviceType == Core::Id(Maemo5OsType)) {
result.insert(Core::Id(Constants::MAEMO5_DEVICE_TARGET_ID)); result.insert(Core::Id(Constants::MAEMO5_DEVICE_TARGET_ID));
} else if (m_deviceType == QLatin1String(HarmattanOsType)) { } else if (m_deviceType == Core::Id(HarmattanOsType)) {
result.insert(Core::Id(Constants::HARMATTAN_DEVICE_TARGET_ID)); result.insert(Core::Id(Constants::HARMATTAN_DEVICE_TARGET_ID));
} else if (m_deviceType == QLatin1String(MeeGoOsType)) { } else if (m_deviceType == Core::Id(MeeGoOsType)) {
result.insert(Core::Id(Constants::MEEGO_DEVICE_TARGET_ID)); result.insert(Core::Id(Constants::MEEGO_DEVICE_TARGET_ID));
} }
return result; return result;
@@ -163,11 +163,11 @@ QSet<Core::Id> MaemoQtVersion::supportedTargetIds() const
QString MaemoQtVersion::description() const QString MaemoQtVersion::description() const
{ {
if (m_deviceType == QLatin1String(Maemo5OsType)) if (m_deviceType == Core::Id(Maemo5OsType))
return QCoreApplication::translate("QtVersion", "Maemo", "Qt Version is meant for Maemo5"); return QCoreApplication::translate("QtVersion", "Maemo", "Qt Version is meant for Maemo5");
else if (m_deviceType == QLatin1String(HarmattanOsType)) else if (m_deviceType == Core::Id(HarmattanOsType))
return QCoreApplication::translate("QtVersion", "Harmattan ", "Qt Version is meant for Harmattan"); return QCoreApplication::translate("QtVersion", "Harmattan ", "Qt Version is meant for Harmattan");
else if (m_deviceType == QLatin1String(MeeGoOsType)) else if (m_deviceType == Core::Id(MeeGoOsType))
return QCoreApplication::translate("QtVersion", "MeeGo", "Qt Version is meant for MeeGo"); return QCoreApplication::translate("QtVersion", "MeeGo", "Qt Version is meant for MeeGo");
return QString(); return QString();
} }
@@ -180,7 +180,7 @@ bool MaemoQtVersion::supportsShadowBuilds() const
return true; return true;
} }
QString MaemoQtVersion::deviceType() const Core::Id MaemoQtVersion::deviceType() const
{ {
return m_deviceType; return m_deviceType;
} }
@@ -192,7 +192,7 @@ Core::FeatureSet MaemoQtVersion::availableFeatures() const
features |= Core::FeatureSet(QtSupport::Constants::FEATURE_QTQUICK_COMPONENTS_MEEGO); features |= Core::FeatureSet(QtSupport::Constants::FEATURE_QTQUICK_COMPONENTS_MEEGO);
features |= Core::FeatureSet(QtSupport::Constants::FEATURE_MOBILE); features |= Core::FeatureSet(QtSupport::Constants::FEATURE_MOBILE);
if (deviceType() != QLatin1String(Maemo5OsType)) //Only Maemo5 has proper support for Widgets if (deviceType() != Core::Id(Maemo5OsType)) //Only Maemo5 has proper support for Widgets
features.remove(Core::Feature(QtSupport::Constants::FEATURE_QWIDGETS)); features.remove(Core::Feature(QtSupport::Constants::FEATURE_QWIDGETS));
return features; return features;

View File

@@ -59,14 +59,14 @@ public:
QString description() const; QString description() const;
bool supportsShadowBuilds() const; bool supportsShadowBuilds() const;
QString deviceType() const; Core::Id deviceType() const;
Core::FeatureSet availableFeatures() const; Core::FeatureSet availableFeatures() const;
QString platformName() const; QString platformName() const;
QString platformDisplayName() const; QString platformDisplayName() const;
private: private:
mutable QString m_systemRoot; mutable QString m_systemRoot;
mutable QString m_deviceType; mutable Core::Id m_deviceType;
mutable bool m_isvalidVersion; mutable bool m_isvalidVersion;
mutable bool m_initialized; mutable bool m_initialized;
}; };

View File

@@ -125,7 +125,7 @@ QString MaemoRunConfiguration::commandPrefix() const
return QString(); return QString();
QString prefix = environmentPreparationCommand() + QLatin1Char(';'); QString prefix = environmentPreparationCommand() + QLatin1Char(';');
if (deviceConfig()->type() == QLatin1String(MeeGoOsType)) if (deviceConfig()->type() == Core::Id(MeeGoOsType))
prefix += QLatin1String("DISPLAY=:0.0 "); prefix += QLatin1String("DISPLAY=:0.0 ");
return QString::fromLatin1("%1 %2").arg(prefix, userEnvironmentChangesAsString()); return QString::fromLatin1("%1 %2").arg(prefix, userEnvironmentChangesAsString());

View File

@@ -1133,7 +1133,7 @@ Qt4Maemo5Target::~Qt4Maemo5Target() {}
bool Qt4Maemo5Target::supportsDevice(const ProjectExplorer::IDevice::ConstPtr &device) const bool Qt4Maemo5Target::supportsDevice(const ProjectExplorer::IDevice::ConstPtr &device) const
{ {
return device->type() == QLatin1String(Maemo5OsType); return device->type() == Core::Id(Maemo5OsType);
} }
QString Qt4Maemo5Target::defaultDisplayName() QString Qt4Maemo5Target::defaultDisplayName()
@@ -1177,7 +1177,7 @@ Qt4HarmattanTarget::~Qt4HarmattanTarget() {}
bool Qt4HarmattanTarget::supportsDevice(const ProjectExplorer::IDevice::ConstPtr &device) const bool Qt4HarmattanTarget::supportsDevice(const ProjectExplorer::IDevice::ConstPtr &device) const
{ {
return device->type() == QLatin1String(HarmattanOsType); return device->type() == Core::Id(HarmattanOsType);
} }
QString Qt4HarmattanTarget::defaultDisplayName() QString Qt4HarmattanTarget::defaultDisplayName()
@@ -1253,7 +1253,7 @@ Qt4MeegoTarget::~Qt4MeegoTarget() {}
bool Qt4MeegoTarget::supportsDevice(const ProjectExplorer::IDevice::ConstPtr &device) const bool Qt4MeegoTarget::supportsDevice(const ProjectExplorer::IDevice::ConstPtr &device) const
{ {
return device->type() == QLatin1String(MeeGoOsType); return device->type() == Core::Id(MeeGoOsType);
} }
QString Qt4MeegoTarget::defaultDisplayName() QString Qt4MeegoTarget::defaultDisplayName()

View File

@@ -74,8 +74,7 @@ IDevice::Ptr DesktopDevice::clone() const
return Ptr(new DesktopDevice(*this)); return Ptr(new DesktopDevice(*this));
} }
DesktopDevice::DesktopDevice() : DesktopDevice::DesktopDevice() : IDevice(Core::Id("Desktop"), IDevice::AutoDetected, Id)
IDevice(QLatin1String("Desktop"), IDevice::AutoDetected, Id)
{ {
setDisplayName(QCoreApplication::translate("ProjectExplorer::DesktopDevice", "Run locally")); setDisplayName(QCoreApplication::translate("ProjectExplorer::DesktopDevice", "Run locally"));
} }

View File

@@ -54,7 +54,7 @@ namespace ProjectExplorer {
namespace Internal { namespace Internal {
static IDevice::Ptr findAutoDetectedDevice(const QList<IDevice::Ptr> &deviceList, static IDevice::Ptr findAutoDetectedDevice(const QList<IDevice::Ptr> &deviceList,
const QString &type, const Core::Id id) Core::Id type, const Core::Id id)
{ {
foreach (const IDevice::Ptr &device, deviceList) { foreach (const IDevice::Ptr &device, deviceList) {
if (device->isAutoDetected() && device->type() == type && device->id() == id) if (device->isAutoDetected() && device->type() == type && device->id() == id)
@@ -73,7 +73,7 @@ public:
static DeviceManager *clonedInstance; static DeviceManager *clonedInstance;
QList<IDevice::Ptr> devices; QList<IDevice::Ptr> devices;
QList<IDevice::Ptr> inactiveAutoDetectedDevices; QList<IDevice::Ptr> inactiveAutoDetectedDevices;
QHash<QString, Core::Id> defaultDevices; QHash<Core::Id, Core::Id> defaultDevices;
}; };
DeviceManager *DeviceManagerPrivate::clonedInstance = 0; DeviceManager *DeviceManagerPrivate::clonedInstance = 0;
@@ -151,7 +151,7 @@ void DeviceManager::loadPre2_6()
const QVariantHash defaultDevsHash = settings->value(QLatin1String("DefaultConfigs")).toHash(); const QVariantHash defaultDevsHash = settings->value(QLatin1String("DefaultConfigs")).toHash();
for (QVariantHash::ConstIterator it = defaultDevsHash.constBegin(); for (QVariantHash::ConstIterator it = defaultDevsHash.constBegin();
it != defaultDevsHash.constEnd(); ++it) { it != defaultDevsHash.constEnd(); ++it) {
d->defaultDevices.insert(it.key(), Core::Id(it.value().toString())); d->defaultDevices.insert(Core::Id(it.key()), Core::Id(it.value().toString()));
} }
int count = settings->beginReadArray(QLatin1String("ConfigList")); int count = settings->beginReadArray(QLatin1String("ConfigList"));
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
@@ -175,7 +175,7 @@ void DeviceManager::fromMap(const QVariantMap &map)
const QVariantMap defaultDevsMap = map.value(QLatin1String(DefaultDevicesKey)).toMap(); const QVariantMap defaultDevsMap = map.value(QLatin1String(DefaultDevicesKey)).toMap();
for (QVariantMap::ConstIterator it = defaultDevsMap.constBegin(); for (QVariantMap::ConstIterator it = defaultDevsMap.constBegin();
it != defaultDevsMap.constEnd(); ++it) { it != defaultDevsMap.constEnd(); ++it) {
d->defaultDevices.insert(it.key(), Core::Id(it.value().toString())); d->defaultDevices.insert(Core::Id(it.key()), Core::Id(it.value().toString()));
} }
const QVariantList deviceList = map.value(QLatin1String(DeviceListKey)).toList(); const QVariantList deviceList = map.value(QLatin1String(DeviceListKey)).toList();
foreach (const QVariant &v, deviceList) { foreach (const QVariant &v, deviceList) {
@@ -196,10 +196,10 @@ QVariantMap DeviceManager::toMap() const
{ {
QVariantMap map; QVariantMap map;
QVariantMap defaultDeviceMap; QVariantMap defaultDeviceMap;
typedef QHash<QString, Core::Id> TypeIdHash; typedef QHash<Core::Id, Core::Id> TypeIdHash;
for (TypeIdHash::ConstIterator it = d->defaultDevices.constBegin(); for (TypeIdHash::ConstIterator it = d->defaultDevices.constBegin();
it != d->defaultDevices.constEnd(); ++it) { it != d->defaultDevices.constEnd(); ++it) {
defaultDeviceMap.insert(it.key(), it.value().toString()); defaultDeviceMap.insert(it.key().toString(), it.value().toString());
} }
map.insert(QLatin1String(DefaultDevicesKey), defaultDeviceMap); map.insert(QLatin1String(DefaultDevicesKey), defaultDeviceMap);
QVariantList deviceList; QVariantList deviceList;
@@ -271,7 +271,7 @@ void DeviceManager::removeDevice(Core::Id id)
QTC_ASSERT(this != instance() || device->isAutoDetected(), return); QTC_ASSERT(this != instance() || device->isAutoDetected(), return);
const bool wasDefault = d->defaultDevices.value(device->type()) == device->id(); const bool wasDefault = d->defaultDevices.value(device->type()) == device->id();
const QString deviceType = device->type(); const Core::Id deviceType = device->type();
d->devices.removeAt(indexForId(id)); d->devices.removeAt(indexForId(id));
emit deviceRemoved(device->id()); emit deviceRemoved(device->id());
@@ -317,7 +317,7 @@ const IDeviceFactory *DeviceManager::restoreFactory(const QVariantMap &map)
return factory; return factory;
} }
qWarning("Warning: No factory found for device of type '%s'.", qWarning("Warning: No factory found for device of type '%s'.",
qPrintable(IDevice::typeFromMap(map))); qPrintable(IDevice::typeFromMap(map).toString()));
return 0; return 0;
} }
@@ -361,13 +361,12 @@ IDevice::ConstPtr DeviceManager::find(Core::Id id) const
return index == -1 ? IDevice::ConstPtr() : deviceAt(index); return index == -1 ? IDevice::ConstPtr() : deviceAt(index);
} }
IDevice::ConstPtr DeviceManager::findInactiveAutoDetectedDevice(const QString &type, IDevice::ConstPtr DeviceManager::findInactiveAutoDetectedDevice(Core::Id type, Core::Id id)
Core::Id id)
{ {
return findAutoDetectedDevice(d->inactiveAutoDetectedDevices, type, id); return findAutoDetectedDevice(d->inactiveAutoDetectedDevices, type, id);
} }
IDevice::ConstPtr DeviceManager::defaultDevice(const QString &deviceType) const IDevice::ConstPtr DeviceManager::defaultDevice(Core::Id deviceType) const
{ {
const Core::Id id = d->defaultDevices.value(deviceType, IDevice::invalidId()); const Core::Id id = d->defaultDevices.value(deviceType, IDevice::invalidId());
if (id == IDevice::invalidId()) if (id == IDevice::invalidId())

View File

@@ -62,8 +62,8 @@ public:
IDevice::ConstPtr deviceAt(int index) const; IDevice::ConstPtr deviceAt(int index) const;
IDevice::ConstPtr find(Core::Id id) const; IDevice::ConstPtr find(Core::Id id) const;
IDevice::ConstPtr findInactiveAutoDetectedDevice(const QString &type, Core::Id id); IDevice::ConstPtr findInactiveAutoDetectedDevice(Core::Id type, Core::Id id);
IDevice::ConstPtr defaultDevice(const QString &deviceType) const; IDevice::ConstPtr defaultDevice(Core::Id deviceType) const;
bool hasDevice(const QString &name) const; bool hasDevice(const QString &name) const;
Core::Id deviceId(const IDevice::ConstPtr &device) const; Core::Id deviceId(const IDevice::ConstPtr &device) const;

View File

@@ -160,7 +160,7 @@ public:
{ } { }
QString displayName; QString displayName;
QString type; Core::Id type;
IDevice::Origin origin; IDevice::Origin origin;
Core::Id id; Core::Id id;
IDevice::AvailabilityState availability; IDevice::AvailabilityState availability;
@@ -170,7 +170,7 @@ public:
IDevice::IDevice() : d(new Internal::IDevicePrivate) IDevice::IDevice() : d(new Internal::IDevicePrivate)
{ } { }
IDevice::IDevice(const QString &type, Origin origin, Core::Id id) : d(new Internal::IDevicePrivate) IDevice::IDevice(Core::Id type, Origin origin, Core::Id id) : d(new Internal::IDevicePrivate)
{ {
d->type = type; d->type = type;
d->origin = origin; d->origin = origin;
@@ -216,7 +216,7 @@ IDevice::DeviceInfo IDevice::deviceInformation() const
return result; return result;
} }
QString IDevice::type() const Core::Id IDevice::type() const
{ {
return d->type; return d->type;
} }
@@ -248,9 +248,9 @@ Core::Id IDevice::invalidId()
return Core::Id(); return Core::Id();
} }
QString IDevice::typeFromMap(const QVariantMap &map) Core::Id IDevice::typeFromMap(const QVariantMap &map)
{ {
return map.value(QLatin1String(TypeKey)).toString(); return Core::Id(map.value(QLatin1String(TypeKey)).toByteArray().constData());
} }
Core::Id IDevice::idFromMap(const QVariantMap &map) Core::Id IDevice::idFromMap(const QVariantMap &map)
@@ -270,7 +270,7 @@ QVariantMap IDevice::toMap() const
{ {
QVariantMap map; QVariantMap map;
map.insert(QLatin1String(DisplayNameKey), d->displayName); map.insert(QLatin1String(DisplayNameKey), d->displayName);
map.insert(QLatin1String(TypeKey), d->type); map.insert(QLatin1String(TypeKey), d->type.name());
map.insert(QLatin1String(IdKey), d->id.name()); map.insert(QLatin1String(IdKey), d->id.name());
map.insert(QLatin1String(OriginKey), d->origin); map.insert(QLatin1String(OriginKey), d->origin);
return map; return map;

View File

@@ -74,7 +74,7 @@ public:
typedef QList<DeviceInfoItem> DeviceInfo; typedef QList<DeviceInfoItem> DeviceInfo;
virtual DeviceInfo deviceInformation() const; virtual DeviceInfo deviceInformation() const;
QString type() const; Core::Id type() const;
bool isAutoDetected() const; bool isAutoDetected() const;
Core::Id id() const; Core::Id id() const;
@@ -94,12 +94,12 @@ public:
static Core::Id invalidId(); static Core::Id invalidId();
static QString typeFromMap(const QVariantMap &map); static Core::Id typeFromMap(const QVariantMap &map);
static Core::Id idFromMap(const QVariantMap &map); static Core::Id idFromMap(const QVariantMap &map);
protected: protected:
IDevice(); IDevice();
IDevice(const QString &type, Origin origin, Core::Id id = Core::Id()); IDevice(Core::Id type, Origin origin, Core::Id id = Core::Id());
IDevice(const IDevice &other); IDevice(const IDevice &other);
Ptr sharedFromThis(); Ptr sharedFromThis();

View File

@@ -69,9 +69,9 @@ ProjectExplorer::IDevice::Ptr SymbianIDeviceFactory::restore(const QVariantMap &
return ProjectExplorer::IDevice::Ptr(dev); return ProjectExplorer::IDevice::Ptr(dev);
} }
QString SymbianIDeviceFactory::deviceType() Core::Id SymbianIDeviceFactory::deviceType()
{ {
return QLatin1String("Qt4ProjectManager.SymbianDevice"); return Core::Id("Qt4ProjectManager.SymbianDevice");
} }
} // namespace internal } // namespace internal

View File

@@ -51,7 +51,7 @@ public:
bool canRestore(const QVariantMap &map) const; bool canRestore(const QVariantMap &map) const;
ProjectExplorer::IDevice::Ptr restore(const QVariantMap &map) const; ProjectExplorer::IDevice::Ptr restore(const QVariantMap &map) const;
static QString deviceType(); static Core::Id deviceType();
}; };
} // namespace Internal } // namespace Internal

View File

@@ -74,7 +74,7 @@ Utils::FileName GenericEmbeddedLinuxTarget::mkspec(const Qt4ProjectManager::Qt4B
bool GenericEmbeddedLinuxTarget::supportsDevice(const ProjectExplorer::IDevice::ConstPtr &device) const bool GenericEmbeddedLinuxTarget::supportsDevice(const ProjectExplorer::IDevice::ConstPtr &device) const
{ {
return device->type() == QLatin1String(Constants::GenericLinuxOsType); return device->type() == Core::Id(Constants::GenericLinuxOsType);
} }
void GenericEmbeddedLinuxTarget::createApplicationProFiles(bool reparse) void GenericEmbeddedLinuxTarget::createApplicationProFiles(bool reparse)

View File

@@ -66,7 +66,7 @@ IDevice::Ptr GenericLinuxDeviceConfigurationFactory::create() const
bool GenericLinuxDeviceConfigurationFactory::canRestore(const QVariantMap &map) const bool GenericLinuxDeviceConfigurationFactory::canRestore(const QVariantMap &map) const
{ {
return IDevice::typeFromMap(map) == QLatin1String(Constants::GenericLinuxOsType); return IDevice::typeFromMap(map) == Core::Id(Constants::GenericLinuxOsType);
} }
IDevice::Ptr GenericLinuxDeviceConfigurationFactory::restore(const QVariantMap &map) const IDevice::Ptr GenericLinuxDeviceConfigurationFactory::restore(const QVariantMap &map) const

View File

@@ -87,7 +87,7 @@ IDevice::Ptr GenericLinuxDeviceConfigurationWizard::device()
else else
sshParams.privateKeyFile = d->setupPage.privateKeyFilePath(); sshParams.privateKeyFile = d->setupPage.privateKeyFilePath();
LinuxDeviceConfiguration::Ptr devConf = LinuxDeviceConfiguration::create(d->setupPage.configurationName(), LinuxDeviceConfiguration::Ptr devConf = LinuxDeviceConfiguration::create(d->setupPage.configurationName(),
QLatin1String(Constants::GenericLinuxOsType), LinuxDeviceConfiguration::Hardware); Core::Id(Constants::GenericLinuxOsType), LinuxDeviceConfiguration::Hardware);
devConf->setFreePorts(Utils::PortList::fromString(QLatin1String("10000-10100"))); devConf->setFreePorts(Utils::PortList::fromString(QLatin1String("10000-10100")));
devConf->setSshParameters(sshParams); devConf->setSshParameters(sshParams);
LinuxDeviceTestDialog dlg(devConf, new GenericLinuxDeviceTester(this), this); LinuxDeviceTestDialog dlg(devConf, new GenericLinuxDeviceTester(this), this);

View File

@@ -84,7 +84,7 @@ LinuxDeviceConfiguration::~LinuxDeviceConfiguration()
} }
LinuxDeviceConfiguration::Ptr LinuxDeviceConfiguration::create(const QString &name, LinuxDeviceConfiguration::Ptr LinuxDeviceConfiguration::create(const QString &name,
const QString &type, MachineType machineType, Origin origin, Core::Id id) Core::Id type, MachineType machineType, Origin origin, Core::Id id)
{ {
return Ptr(new LinuxDeviceConfiguration(name, type, machineType, origin, id)); return Ptr(new LinuxDeviceConfiguration(name, type, machineType, origin, id));
} }
@@ -141,7 +141,7 @@ LinuxDeviceConfiguration::LinuxDeviceConfiguration() : d(new LinuxDeviceConfigur
{ {
} }
LinuxDeviceConfiguration::LinuxDeviceConfiguration(const QString &name, const QString &type, LinuxDeviceConfiguration::LinuxDeviceConfiguration(const QString &name, Core::Id type,
MachineType machineType, Origin origin, Core::Id id) MachineType machineType, Origin origin, Core::Id id)
: IDevice(type, origin, id), d(new LinuxDeviceConfigurationPrivate) : IDevice(type, origin, id), d(new LinuxDeviceConfigurationPrivate)
{ {

View File

@@ -70,7 +70,7 @@ public:
static QString defaultPublicKeyFilePath(); static QString defaultPublicKeyFilePath();
static Ptr create(); static Ptr create();
static Ptr create(const QString &name, const QString &type, MachineType machineType, static Ptr create(const QString &name, Core::Id type, MachineType machineType,
Origin origin = ManuallyAdded, Core::Id id = Core::Id()); Origin origin = ManuallyAdded, Core::Id id = Core::Id());
QString displayType() const; QString displayType() const;
@@ -83,7 +83,7 @@ public:
protected: protected:
LinuxDeviceConfiguration(); LinuxDeviceConfiguration();
LinuxDeviceConfiguration(const QString &name, const QString &type, MachineType machineType, LinuxDeviceConfiguration(const QString &name, Core::Id type, MachineType machineType,
Origin origin, Core::Id id); Origin origin, Core::Id id);
LinuxDeviceConfiguration(const LinuxDeviceConfiguration &other); LinuxDeviceConfiguration(const LinuxDeviceConfiguration &other);