Commit 0ee99ff2 authored by Christian Kandeler's avatar Christian Kandeler

Maemo: Move OsVersion type from MaemoGlobal to MaemoDeviceConfig.

Also move freePorts() method from AbstractMaemoDeployStep
to MaemoGlobal.
parent 5294db3d
......@@ -394,23 +394,12 @@ void AbstractMaemoDeployStep::handleRemoteStderr(const QString &output)
}
}
MaemoPortList AbstractMaemoDeployStep::freePorts() const
{
return freePorts(m_deviceConfig);
}
MaemoPortList AbstractMaemoDeployStep::freePorts(const MaemoDeviceConfig::ConstPtr &devConf) const
{
const Qt4BuildConfiguration * const qt4bc = qt4BuildConfiguration();
if (!devConf)
if (!qt4bc)
return MaemoPortList();
if (devConf->type() == MaemoDeviceConfig::Emulator && qt4bc) {
MaemoQemuRuntime rt;
const int id = qt4bc->qtVersion()->uniqueId();
if (MaemoQemuManager::instance().runtimeForQtVersion(id, &rt))
return rt.m_freePorts;
}
return devConf->freePorts();
return MaemoGlobal::freePorts(devConf, qt4bc->qtVersion());
}
const Qt4BuildConfiguration *AbstractMaemoDeployStep::qt4BuildConfiguration() const
......
......@@ -68,7 +68,6 @@ public:
bool currentlyNeedsDeployment(const QString &host,
const MaemoDeployable &deployable) const;
void setDeployed(const QString &host, const MaemoDeployable &deployable);
MaemoPortList freePorts() const;
Qt4MaemoDeployConfiguration *maemoDeployConfig() const;
bool isDeploymentPossible(QString &whyNot) const;
......
......@@ -32,6 +32,7 @@
**************************************************************************/
#include "maemoanalyzersupport.h"
#include "maemoglobal.h"
#include <analyzerbase/analyzermanager.h>
#include <analyzerbase/analyzerstartparameters.h>
......
......@@ -98,7 +98,7 @@ void MaemoConfigTestDialog::startConfigTest()
SLOT(processSshOutput(QByteArray)));
const QLatin1String sysInfoCmd("uname -rsm");
QString command = sysInfoCmd;
if (m_config->osVersion() != MaemoGlobal::GenericLinux) {
if (m_config->osVersion() != MaemoDeviceConfig::GenericLinux) {
const bool osUsesRpm = MaemoGlobal::packagingSystem(m_config->osVersion()) == MaemoGlobal::Rpm;
const QLatin1String qtInfoCmd(osUsesRpm
? "rpm -qa 'libqt*' --queryformat '%{NAME} %{VERSION}\\n'"
......@@ -151,7 +151,7 @@ void MaemoConfigTestDialog::handleGeneralTestResult(int exitStatus)
m_ui->testResultEdit->setPlainText(output);
}
if (m_config->osVersion() == MaemoGlobal::GenericLinux) {
if (m_config->osVersion() == MaemoDeviceConfig::GenericLinux) {
testPorts();
return;
}
......@@ -174,7 +174,7 @@ void MaemoConfigTestDialog::handleMadDeveloperTestResult(int exitStatus)
+ tr("%1 is not installed.<br>You will not be able to deploy "
"to this device.")
.arg(MaemoGlobal::madDeveloperUiName(m_config->osVersion()));
if (m_config->osVersion() == MaemoGlobal::Maemo6) {
if (m_config->osVersion() == MaemoDeviceConfig::Maemo6) {
errorMsg += QLatin1String("<br>")
+ tr("Please switch the device to developer mode via Settings -> Security.");
}
......@@ -256,7 +256,7 @@ QString MaemoConfigTestDialog::parseTestOutput()
output = tr("Hardware architecture: %1\n").arg(unamePattern.cap(2));
output.append(tr("Kernel version: %1\n").arg(unamePattern.cap(1)));
if (m_config->osVersion() == MaemoGlobal::GenericLinux) {
if (m_config->osVersion() == MaemoDeviceConfig::GenericLinux) {
m_qtVersionOk = true;
return output;
}
......
......@@ -248,7 +248,7 @@ bool MaemoDeployableListModel::addDesktopFile()
const QtVersion * const version = qtVersion();
QTC_ASSERT(version, return false);
QString remoteDir = QLatin1String("/usr/share/applications");
if (MaemoGlobal::version(version) == MaemoGlobal::Maemo5)
if (MaemoGlobal::version(version) == MaemoDeviceConfig::Maemo5)
remoteDir += QLatin1String("/hildon");
const QLatin1String filesLine("desktopfile.files = $${TARGET}.desktop");
const QString pathLine = QLatin1String("desktopfile.path = ") + remoteDir;
......@@ -330,7 +330,7 @@ QString MaemoDeployableListModel::proFileScope() const
{
const QtVersion *const qv = qtVersion();
QTC_ASSERT(qv, return QString());
return QLatin1String(MaemoGlobal::version(qv) == MaemoGlobal::Maemo5
return QLatin1String(MaemoGlobal::version(qv) == MaemoDeviceConfig::Maemo5
? "maemo5" : "unix:!symbian:!maemo5");
}
......
......@@ -31,6 +31,7 @@
**************************************************************************/
#include "maemodeviceconfigurations.h"
#include "maemoglobal.h"
#include <coreplugin/icore.h>
......@@ -224,7 +225,7 @@ MaemoDeviceConfig::Ptr MaemoDeviceConfig::create(const ConstPtr &other)
}
MaemoDeviceConfig::Ptr MaemoDeviceConfig::createHardwareConfig(const QString &name,
MaemoGlobal::OsVersion osVersion, const QString &hostName,
MaemoDeviceConfig::OsVersion osVersion, const QString &hostName,
const QString &privateKeyFilePath, Id &nextId)
{
Utils::SshConnectionParameters sshParams(Utils::SshConnectionParameters::NoProxy);
......@@ -245,7 +246,7 @@ MaemoDeviceConfig::Ptr MaemoDeviceConfig::createGenericLinuxConfigUsingPassword(
sshParams.host = hostName;
sshParams.userName = userName;
sshParams.password = password;
return Ptr(new MaemoDeviceConfig(name, MaemoGlobal::GenericLinux, Physical,
return Ptr(new MaemoDeviceConfig(name, MaemoDeviceConfig::GenericLinux, Physical,
sshParams, nextId));
}
......@@ -259,12 +260,12 @@ MaemoDeviceConfig::Ptr MaemoDeviceConfig::createGenericLinuxConfigUsingKey(const
sshParams.host = hostName;
sshParams.userName = userName;
sshParams.privateKeyFile = privateKeyFile;
return Ptr(new MaemoDeviceConfig(name, MaemoGlobal::GenericLinux, Physical,
return Ptr(new MaemoDeviceConfig(name, MaemoDeviceConfig::GenericLinux, Physical,
sshParams, nextId));
}
MaemoDeviceConfig::Ptr MaemoDeviceConfig::createEmulatorConfig(const QString &name,
MaemoGlobal::OsVersion osVersion, Id &nextId)
MaemoDeviceConfig::OsVersion osVersion, Id &nextId)
{
Utils::SshConnectionParameters sshParams(Utils::SshConnectionParameters::NoProxy);
sshParams.authenticationType = Utils::SshConnectionParameters::AuthenticationByPassword;
......@@ -275,7 +276,7 @@ MaemoDeviceConfig::Ptr MaemoDeviceConfig::createEmulatorConfig(const QString &na
}
MaemoDeviceConfig::MaemoDeviceConfig(const QString &name,
MaemoGlobal::OsVersion osVersion, DeviceType devType,
MaemoDeviceConfig::OsVersion osVersion, DeviceType devType,
const Utils::SshConnectionParameters &sshParams, Id &nextId)
: m_sshParameters(sshParams),
m_name(name),
......@@ -293,7 +294,7 @@ MaemoDeviceConfig::MaemoDeviceConfig(const QSettings &settings,
Id &nextId)
: m_sshParameters(Utils::SshConnectionParameters::NoProxy),
m_name(settings.value(NameKey).toString()),
m_osVersion(static_cast<MaemoGlobal::OsVersion>(settings.value(OsVersionKey, MaemoGlobal::Maemo5).toInt())),
m_osVersion(static_cast<MaemoDeviceConfig::OsVersion>(settings.value(OsVersionKey, MaemoDeviceConfig::Maemo5).toInt())),
m_type(static_cast<DeviceType>(settings.value(TypeKey, DefaultDeviceType).toInt())),
m_portsSpec(settings.value(PortsSpecKey, defaultPortsSpec(m_type)).toString()),
m_isDefault(settings.value(IsDefaultKey, false).toBool()),
......@@ -340,14 +341,14 @@ QString MaemoDeviceConfig::defaultPortsSpec(DeviceType type) const
return QLatin1String(type == Physical ? "10000-10100" : "13219,14168");
}
QString MaemoDeviceConfig::defaultHost(DeviceType type, MaemoGlobal::OsVersion osVersion)
QString MaemoDeviceConfig::defaultHost(DeviceType type, MaemoDeviceConfig::OsVersion osVersion)
{
switch (osVersion) {
case MaemoGlobal::Maemo5:
case MaemoGlobal::Maemo6:
case MaemoGlobal::Meego:
case MaemoDeviceConfig::Maemo5:
case MaemoDeviceConfig::Maemo6:
case MaemoDeviceConfig::Meego:
return QLatin1String(type == Physical ? "192.168.2.15" : "localhost");
case MaemoGlobal::GenericLinux:
case MaemoDeviceConfig::GenericLinux:
return QString();
default:
qFatal("%s: Missing case in switch", Q_FUNC_INFO);
......@@ -366,15 +367,15 @@ QString MaemoDeviceConfig::defaultPublicKeyFilePath()
return defaultPrivateKeyFilePath() + QLatin1String(".pub");
}
QString MaemoDeviceConfig::defaultUser(MaemoGlobal::OsVersion osVersion)
QString MaemoDeviceConfig::defaultUser(MaemoDeviceConfig::OsVersion osVersion)
{
switch (osVersion) {
case MaemoGlobal::Maemo5:
case MaemoGlobal::Maemo6:
case MaemoDeviceConfig::Maemo5:
case MaemoDeviceConfig::Maemo6:
return QLatin1String("developer");
case MaemoGlobal::Meego:
case MaemoDeviceConfig::Meego:
return QLatin1String("meego");
case MaemoGlobal::GenericLinux:
case MaemoDeviceConfig::GenericLinux:
return QString();
default:
qDebug("%s: Unknown OS Version %d.", Q_FUNC_INFO, osVersion);
......@@ -382,13 +383,13 @@ QString MaemoDeviceConfig::defaultUser(MaemoGlobal::OsVersion osVersion)
}
}
QString MaemoDeviceConfig::defaultQemuPassword(MaemoGlobal::OsVersion osVersion)
QString MaemoDeviceConfig::defaultQemuPassword(MaemoDeviceConfig::OsVersion osVersion)
{
switch (osVersion) {
case MaemoGlobal::Maemo5:
case MaemoGlobal::Maemo6:
case MaemoDeviceConfig::Maemo5:
case MaemoDeviceConfig::Maemo6:
return QString();
case MaemoGlobal::Meego:
case MaemoDeviceConfig::Meego:
return QLatin1String("meego");
default:
qDebug("%s: Unknown OS Version %d.", Q_FUNC_INFO, osVersion);
......@@ -476,7 +477,7 @@ void MaemoDeviceConfigurations::save()
}
void MaemoDeviceConfigurations::addHardwareDeviceConfiguration(const QString &name,
MaemoGlobal::OsVersion osVersion, const QString &hostName,
MaemoDeviceConfig::OsVersion osVersion, const QString &hostName,
const QString &privateKeyFilePath)
{
const MaemoDeviceConfig::Ptr &devConf = MaemoDeviceConfig::createHardwareConfig(name,
......@@ -502,7 +503,7 @@ void MaemoDeviceConfigurations::addGenericLinuxConfigurationUsingKey(const QStri
}
void MaemoDeviceConfigurations::addEmulatorDeviceConfiguration(const QString &name,
MaemoGlobal::OsVersion osVersion)
MaemoDeviceConfig::OsVersion osVersion)
{
const MaemoDeviceConfig::Ptr &devConf
= MaemoDeviceConfig::createEmulatorConfig(name, osVersion, m_nextId);
......@@ -523,7 +524,7 @@ void MaemoDeviceConfigurations::removeConfiguration(int idx)
Q_ASSERT(idx >= 0 && idx < rowCount());
beginRemoveRows(QModelIndex(), idx, idx);
const bool wasDefault = deviceAt(idx)->m_isDefault;
const MaemoGlobal::OsVersion osVersion = deviceAt(idx)->osVersion();
const MaemoDeviceConfig::OsVersion osVersion = deviceAt(idx)->osVersion();
m_devConfigs.removeAt(idx);
endRemoveRows();
if (wasDefault) {
......@@ -603,10 +604,10 @@ void MaemoDeviceConfigurations::load()
}
settings->endArray();
settings->endGroup();
ensureDefaultExists(MaemoGlobal::Maemo5);
ensureDefaultExists(MaemoGlobal::Maemo6);
ensureDefaultExists(MaemoGlobal::Meego);
ensureDefaultExists(MaemoGlobal::GenericLinux);
ensureDefaultExists(MaemoDeviceConfig::Maemo5);
ensureDefaultExists(MaemoDeviceConfig::Maemo6);
ensureDefaultExists(MaemoDeviceConfig::Meego);
ensureDefaultExists(MaemoDeviceConfig::GenericLinux);
}
MaemoDeviceConfig::ConstPtr MaemoDeviceConfigurations::deviceAt(int idx) const
......@@ -629,7 +630,7 @@ MaemoDeviceConfig::ConstPtr MaemoDeviceConfigurations::find(MaemoDeviceConfig::I
return index == -1 ? MaemoDeviceConfig::ConstPtr() : deviceAt(index);
}
MaemoDeviceConfig::ConstPtr MaemoDeviceConfigurations::defaultDeviceConfig(const MaemoGlobal::OsVersion osVersion) const
MaemoDeviceConfig::ConstPtr MaemoDeviceConfigurations::defaultDeviceConfig(const MaemoDeviceConfig::OsVersion osVersion) const
{
foreach (const MaemoDeviceConfig::ConstPtr &devConf, m_devConfigs) {
if (devConf->m_isDefault && devConf->osVersion() == osVersion)
......@@ -652,7 +653,7 @@ MaemoDeviceConfig::Id MaemoDeviceConfigurations::internalId(MaemoDeviceConfig::C
return devConf ? devConf->m_internalId : MaemoDeviceConfig::InvalidId;
}
void MaemoDeviceConfigurations::ensureDefaultExists(MaemoGlobal::OsVersion osVersion)
void MaemoDeviceConfigurations::ensureDefaultExists(MaemoDeviceConfig::OsVersion osVersion)
{
if (!defaultDeviceConfig(osVersion)) {
foreach (const MaemoDeviceConfig::Ptr &devConf, m_devConfigs) {
......
......@@ -33,8 +33,6 @@
#ifndef MAEMODEVICECONFIGURATIONS_H
#define MAEMODEVICECONFIGURATIONS_H
#include "maemoglobal.h"
#include <utils/ssh/sshconnection.h>
#include <QtCore/QAbstractListModel>
......@@ -72,30 +70,31 @@ class MaemoDeviceConfig
public:
typedef QSharedPointer<const MaemoDeviceConfig> ConstPtr;
typedef quint64 Id;
enum OsVersion { Maemo5, Maemo6, Meego, GenericLinux };
enum DeviceType { Physical, Emulator };
MaemoPortList freePorts() const;
Utils::SshConnectionParameters sshParameters() const { return m_sshParameters; }
QString name() const { return m_name; }
MaemoGlobal::OsVersion osVersion() const { return m_osVersion; }
OsVersion osVersion() const { return m_osVersion; }
DeviceType type() const { return m_type; }
QString portsSpec() const { return m_portsSpec; }
Id internalId() const { return m_internalId; }
bool isDefault() const { return m_isDefault; }
static QString portsRegExpr();
static QString defaultHost(DeviceType type, MaemoGlobal::OsVersion osVersion);
static QString defaultHost(DeviceType type, OsVersion osVersion);
static QString defaultPrivateKeyFilePath();
static QString defaultPublicKeyFilePath();
static QString defaultUser(MaemoGlobal::OsVersion osVersion);
static QString defaultUser(OsVersion osVersion);
static int defaultSshPort(DeviceType type);
static QString defaultQemuPassword(MaemoGlobal::OsVersion osVersion);
static QString defaultQemuPassword(OsVersion osVersion);
static const Id InvalidId;
private:
typedef QSharedPointer<MaemoDeviceConfig> Ptr;
MaemoDeviceConfig(const QString &name, MaemoGlobal::OsVersion osVersion,
MaemoDeviceConfig(const QString &name, OsVersion osVersion,
DeviceType type, const Utils::SshConnectionParameters &sshParams,
Id &nextId);
MaemoDeviceConfig(const QSettings &settings, Id &nextId);
......@@ -104,17 +103,16 @@ private:
MaemoDeviceConfig(const MaemoDeviceConfig &);
MaemoDeviceConfig &operator=(const MaemoDeviceConfig &);
static Ptr createHardwareConfig(const QString &name,
MaemoGlobal::OsVersion osVersion, const QString &hostName,
const QString &privateKeyFilePath, Id &nextId);
static Ptr createHardwareConfig(const QString &name, OsVersion osVersion,
const QString &hostName, const QString &privateKeyFilePath, Id &nextId);
static Ptr createGenericLinuxConfigUsingPassword(const QString &name,
const QString &hostName, const QString &userName,
const QString &password, Id &nextId);
static Ptr createGenericLinuxConfigUsingKey(const QString &name,
const QString &hostName, const QString &userName,
const QString &privateKeyFilePath, Id &nextId);
static Ptr createEmulatorConfig(const QString &name,
MaemoGlobal::OsVersion osVersion, Id &nextId);
static Ptr createEmulatorConfig(const QString &name, OsVersion osVersion,
Id &nextId);
static Ptr create(const QSettings &settings, Id &nextId);
static Ptr create(const ConstPtr &other);
......@@ -123,7 +121,7 @@ private:
Utils::SshConnectionParameters m_sshParameters;
QString m_name;
MaemoGlobal::OsVersion m_osVersion;
OsVersion m_osVersion;
DeviceType m_type;
QString m_portsSpec;
bool m_isDefault;
......@@ -143,7 +141,7 @@ public:
MaemoDeviceConfig::ConstPtr deviceAt(int index) const;
MaemoDeviceConfig::ConstPtr find(MaemoDeviceConfig::Id id) const;
MaemoDeviceConfig::ConstPtr defaultDeviceConfig(const MaemoGlobal::OsVersion osVersion) const;
MaemoDeviceConfig::ConstPtr defaultDeviceConfig(const MaemoDeviceConfig::OsVersion osVersion) const;
bool hasConfig(const QString &name) const;
int indexForInternalId(MaemoDeviceConfig::Id internalId) const;
MaemoDeviceConfig::Id internalId(MaemoDeviceConfig::ConstPtr devConf) const;
......@@ -152,7 +150,7 @@ public:
QString defaultSshKeyFilePath() const { return m_defaultSshKeyFilePath; }
void addHardwareDeviceConfiguration(const QString &name,
MaemoGlobal::OsVersion osVersion, const QString &hostName,
MaemoDeviceConfig::OsVersion osVersion, const QString &hostName,
const QString &privateKeyFilePath);
void addGenericLinuxConfigurationUsingPassword(const QString &name,
const QString &hostName, const QString &userName,
......@@ -161,7 +159,7 @@ public:
const QString &hostName, const QString &userName,
const QString &privateKeyFilePath);
void addEmulatorDeviceConfiguration(const QString &name,
MaemoGlobal::OsVersion osVersion);
MaemoDeviceConfig::OsVersion osVersion);
void removeConfiguration(int index);
void setConfigurationName(int i, const QString &name);
void setSshParameters(int i, const Utils::SshConnectionParameters &params);
......@@ -182,7 +180,7 @@ private:
static void copy(const MaemoDeviceConfigurations *source,
MaemoDeviceConfigurations *target, bool deep);
void addConfiguration(const MaemoDeviceConfig::Ptr &devConfig);
void ensureDefaultExists(MaemoGlobal::OsVersion osVersion);
void ensureDefaultExists(MaemoDeviceConfig::OsVersion osVersion);
static MaemoDeviceConfigurations *m_instance;
MaemoDeviceConfig::Id m_nextId;
......
......@@ -36,6 +36,7 @@
#include "maemoconfigtestdialog.h"
#include "maemodeviceconfigwizard.h"
#include "maemodeviceconfigurations.h"
#include "maemoglobal.h"
#include "maemokeydeployer.h"
#include "maemoremoteprocessesdialog.h"
#include "maemosshconfigdialog.h"
......
......@@ -38,6 +38,7 @@
#include "ui_maemodeviceconfigwizardstartpage.h"
#include "maemodeviceconfigurations.h"
#include "maemoglobal.h"
#include "maemokeydeployer.h"
#include <utils/fileutils.h>
......@@ -60,7 +61,7 @@ struct WizardData
{
QString configName;
QString hostName;
MaemoGlobal::OsVersion osVersion;
MaemoDeviceConfig::OsVersion osVersion;
SshConnectionParameters::AuthenticationType authType;
MaemoDeviceConfig::DeviceType deviceType;
QString privateKeyFilePath;
......@@ -84,10 +85,10 @@ public:
m_ui->setupUi(this);
setTitle(tr("General Information"));
setSubTitle(QLatin1String(" ")); // For Qt bug (background color)
m_ui->fremantleButton->setText(MaemoGlobal::osVersionToString(MaemoGlobal::Maemo5));
m_ui->harmattanButton->setText(MaemoGlobal::osVersionToString(MaemoGlobal::Maemo6));
m_ui->meegoButton->setText(MaemoGlobal::osVersionToString(MaemoGlobal::Meego));
m_ui->genericLinuxButton->setText(MaemoGlobal::osVersionToString(MaemoGlobal::GenericLinux));
m_ui->fremantleButton->setText(MaemoGlobal::osVersionToString(MaemoDeviceConfig::Maemo5));
m_ui->harmattanButton->setText(MaemoGlobal::osVersionToString(MaemoDeviceConfig::Maemo6));
m_ui->meegoButton->setText(MaemoGlobal::osVersionToString(MaemoDeviceConfig::Meego));
m_ui->genericLinuxButton->setText(MaemoGlobal::osVersionToString(MaemoDeviceConfig::GenericLinux));
QButtonGroup *buttonGroup = new QButtonGroup(this);
buttonGroup->setExclusive(true);
......@@ -131,12 +132,12 @@ public:
: m_ui->hostNameLineEdit->text().trimmed();
}
MaemoGlobal::OsVersion osVersion() const
MaemoDeviceConfig::OsVersion osVersion() const
{
return m_ui->fremantleButton->isChecked() ? MaemoGlobal::Maemo5
: m_ui->harmattanButton->isChecked() ? MaemoGlobal::Maemo6
: m_ui->meegoButton->isChecked() ? MaemoGlobal::Meego
: MaemoGlobal::GenericLinux;
return m_ui->fremantleButton->isChecked() ? MaemoDeviceConfig::Maemo5
: m_ui->harmattanButton->isChecked() ? MaemoDeviceConfig::Maemo6
: m_ui->meegoButton->isChecked() ? MaemoDeviceConfig::Meego
: MaemoDeviceConfig::GenericLinux;
}
MaemoDeviceConfig::DeviceType deviceType() const
......@@ -155,7 +156,7 @@ private slots:
void handleOsTypeChanged()
{
if (osVersion() == MaemoGlobal::GenericLinux) {
if (osVersion() == MaemoDeviceConfig::GenericLinux) {
m_ui->hwButton->setChecked(true);
m_ui->hwButton->setEnabled(false);
m_ui->qemuButton->setEnabled(false);
......@@ -640,7 +641,7 @@ void MaemoDeviceConfigWizard::createDeviceConfig()
while (d->devConfigs->hasConfig(name));
}
if (d->wizardData.osVersion == MaemoGlobal::GenericLinux) {
if (d->wizardData.osVersion == MaemoDeviceConfig::GenericLinux) {
if (d->wizardData.authType == SshConnectionParameters::AuthenticationByPassword) {
d->devConfigs->addGenericLinuxConfigurationUsingPassword(name,
d->wizardData.hostName, d->wizardData.userName,
......@@ -671,7 +672,7 @@ int MaemoDeviceConfigWizard::nextId() const
if (d->wizardData.deviceType == MaemoDeviceConfig::Emulator) {
return FinalPageId;
} else if (d->wizardData.osVersion == MaemoGlobal::GenericLinux) {
} else if (d->wizardData.osVersion == MaemoDeviceConfig::GenericLinux) {
return LoginDataPageId;
} else {
return PreviousKeySetupCheckPageId;
......
......@@ -32,7 +32,7 @@
#include "maemoglobal.h"
#include "maemoconstants.h"
#include "maemodeviceconfigurations.h"
#include "maemoqemumanager.h"
#include <projectexplorer/projectexplorerconstants.h>
......@@ -78,21 +78,21 @@ bool MaemoGlobal::isMeegoTargetId(const QString &id)
bool MaemoGlobal::isValidMaemo5QtVersion(const QtVersion *version)
{
return isValidMaemoQtVersion(version, Maemo5);
return isValidMaemoQtVersion(version, MaemoDeviceConfig::Maemo5);
}
bool MaemoGlobal::isValidHarmattanQtVersion(const QtVersion *version)
{
return isValidMaemoQtVersion(version, Maemo6);
return isValidMaemoQtVersion(version, MaemoDeviceConfig::Maemo6);
}
bool MaemoGlobal::isValidMeegoQtVersion(const Qt4ProjectManager::QtVersion *version)
{
return isValidMaemoQtVersion(version, Meego);
return isValidMaemoQtVersion(version, MaemoDeviceConfig::Meego);
}
bool MaemoGlobal::isValidMaemoQtVersion(const QtVersion *qtVersion,
OsVersion maemoVersion)
MaemoDeviceConfig::OsVersion maemoVersion)
{
if (version(qtVersion) != maemoVersion)
return false;
......@@ -132,12 +132,12 @@ QString MaemoGlobal::remoteSudo(const QString &uname)
return uname == QLatin1String("root") ? QString() : devrootshPath();
}
QString MaemoGlobal::remoteCommandPrefix(OsVersion osVersion,
QString MaemoGlobal::remoteCommandPrefix(MaemoDeviceConfig::OsVersion osVersion,
const QString &userName, const QString &commandFilePath)
{
QString prefix = QString::fromLocal8Bit("%1 chmod a+x %2; %3; ")
.arg(remoteSudo(userName), commandFilePath, remoteSourceProfilesCommand());
if (osVersion != Maemo5 && osVersion != Maemo6)
if (osVersion != MaemoDeviceConfig::Maemo5 && osVersion != MaemoDeviceConfig::Maemo6)
prefix += QLatin1String("DISPLAY=:0.0 ");
return prefix;
}
......@@ -183,6 +183,20 @@ QString MaemoGlobal::deviceConfigurationName(const MaemoDeviceConfig::ConstPtr &
return devConf ? devConf->name() : tr("(No device)");
}
MaemoPortList MaemoGlobal::freePorts(const MaemoDeviceConfig::ConstPtr &devConf,
const QtVersion *qtVersion)
{
if (!devConf)
return MaemoPortList();
if (devConf->type() == MaemoDeviceConfig::Emulator) {
MaemoQemuRuntime rt;
const int id = qtVersion->uniqueId();
if (MaemoQemuManager::instance().runtimeForQtVersion(id, &rt))
return rt.m_freePorts;
}
return devConf->freePorts();
}
QString MaemoGlobal::maddeRoot(const QtVersion *qtVersion)
{
QDir dir(targetRoot(qtVersion));
......@@ -210,22 +224,22 @@ QString MaemoGlobal::madCommand(const QtVersion *qtVersion)
return maddeRoot(qtVersion) + QLatin1String("/bin/mad");
}
QString MaemoGlobal::madDeveloperUiName(OsVersion osVersion)
QString MaemoGlobal::madDeveloperUiName(MaemoDeviceConfig::OsVersion osVersion)
{
return osVersion == Maemo6
return osVersion == MaemoDeviceConfig::Maemo6
? tr("SDK Connectivity") : tr("Mad Developer");
}
MaemoGlobal::OsVersion MaemoGlobal::version(const QtVersion *qtVersion)
MaemoDeviceConfig::MaemoDeviceConfig::OsVersion MaemoGlobal::version(const QtVersion *qtVersion)
{
const QString &name = targetName(qtVersion);
if (name.startsWith(QLatin1String("fremantle")))
return Maemo5;
return MaemoDeviceConfig::Maemo5;
if (name.startsWith(QLatin1String("harmattan")))
return Maemo6;
return MaemoDeviceConfig::Maemo6;
if (name.startsWith(QLatin1String("meego")))
return Meego;
return static_cast<OsVersion>(-1);
return MaemoDeviceConfig::Meego;
return static_cast<MaemoDeviceConfig::OsVersion>(-1);
}
QString MaemoGlobal::architecture(const QtVersion *qtVersion)
......@@ -374,24 +388,24 @@ QStringList MaemoGlobal::targetArgs(const QtVersion *qtVersion, bool useTarget)
return args;
}
QString MaemoGlobal::osVersionToString(OsVersion version)
QString MaemoGlobal::osVersionToString(MaemoDeviceConfig::OsVersion version)
{
switch (version) {
case Maemo5: return QLatin1String("Maemo5/Fremantle");
case Maemo6: return QLatin1String("Harmattan");
case Meego: return QLatin1String("Meego");
case GenericLinux: return QLatin1String("Other Linux");