Maemo: Move OsVersion type from MaemoGlobal to MaemoDeviceConfig.

Also move freePorts() method from AbstractMaemoDeployStep
to MaemoGlobal.
This commit is contained in:
Christian Kandeler
2011-04-21 14:39:57 +02:00
parent 5294db3d16
commit 0ee99ff2b3
19 changed files with 136 additions and 127 deletions

View File

@@ -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

View File

@@ -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;

View File

@@ -32,6 +32,7 @@
**************************************************************************/
#include "maemoanalyzersupport.h"
#include "maemoglobal.h"
#include <analyzerbase/analyzermanager.h>
#include <analyzerbase/analyzerstartparameters.h>

View File

@@ -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;
}

View File

@@ -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");
}

View File

@@ -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) {

View File

@@ -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;

View File

@@ -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"

View File

@@ -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;

View File

@@ -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");
case MaemoDeviceConfig::Maemo5: return QLatin1String("Maemo5/Fremantle");
case MaemoDeviceConfig::Maemo6: return QLatin1String("Harmattan");
case MaemoDeviceConfig::Meego: return QLatin1String("Meego");
case MaemoDeviceConfig::GenericLinux: return QLatin1String("Other Linux");
}
qDebug("%s: Unknown OS Version %d.", Q_FUNC_INFO, version);
return QString();
}
MaemoGlobal::PackagingSystem MaemoGlobal::packagingSystem(OsVersion osVersion)
MaemoGlobal::PackagingSystem MaemoGlobal::packagingSystem(MaemoDeviceConfig::OsVersion osVersion)
{
switch (osVersion) {
case Maemo5: case Maemo6: return Dpkg;
case Meego: return Rpm;
case GenericLinux: return Tar;
case MaemoDeviceConfig::Maemo5: case MaemoDeviceConfig::Maemo6: return Dpkg;
case MaemoDeviceConfig::Meego: return Rpm;
case MaemoDeviceConfig::GenericLinux: return Tar;
default: qFatal("%s: Missing case in switch.", Q_FUNC_INFO);
}
return static_cast<PackagingSystem>(-1);

View File

@@ -33,6 +33,8 @@
#ifndef MAEMOGLOBAL_H
#define MAEMOGLOBAL_H
#include "maemodeviceconfigurations.h"
#include <utils/environment.h>
#include <projectexplorer/buildstep.h>
@@ -56,13 +58,11 @@ namespace Utils { class SshConnection; }
namespace Qt4ProjectManager {
class QtVersion;
namespace Internal {
class MaemoDeviceConfig;
class MaemoGlobal
{
Q_DECLARE_TR_FUNCTIONS(Qt4ProjectManager::Internal::MaemoGlobal)
public:
enum OsVersion { Maemo5, Maemo6, Meego, GenericLinux };
enum PackagingSystem { Dpkg, Rpm, Tar };
class FileUpdate {
@@ -84,20 +84,22 @@ public:
static QString homeDirOnDevice(const QString &uname);
static QString devrootshPath();
static QString remoteSudo(const QString &uname);
static QString remoteCommandPrefix(OsVersion osVersion,
static QString remoteCommandPrefix(MaemoDeviceConfig::OsVersion osVersion,
const QString &userName, const QString &commandFilePath);
static QString remoteEnvironment(const QList<Utils::EnvironmentItem> &list);
static QString remoteSourceProfilesCommand();
static QString failedToConnectToServerMessage(const QSharedPointer<Utils::SshConnection> &connection,
const QSharedPointer<const MaemoDeviceConfig> &deviceConfig);
static QString deviceConfigurationName(const QSharedPointer<const MaemoDeviceConfig> &devConf);
static MaemoPortList freePorts(const QSharedPointer<const MaemoDeviceConfig> &devConf,
const QtVersion *qtVersion);
static QString maddeRoot(const QtVersion *qtVersion);
static QString targetRoot(const QtVersion *qtVersion);
static QString targetName(const QtVersion *qtVersion);
static QString madCommand(const QtVersion *qtVersion);
static QString madDeveloperUiName(OsVersion maemoVersion);
static OsVersion version(const QtVersion *qtVersion);
static QString madDeveloperUiName(MaemoDeviceConfig::OsVersion maemoVersion);
static MaemoDeviceConfig::OsVersion version(const QtVersion *qtVersion);
// TODO: IS this still needed with Qt Version having an Abi?
static QString architecture(const QtVersion *version);
@@ -107,9 +109,9 @@ public:
static bool callMadAdmin(QProcess &proc, const QStringList &args,
const QtVersion *qtVersion, bool useTarget);
static QString osVersionToString(OsVersion version);
static QString osVersionToString(MaemoDeviceConfig::OsVersion version);
static PackagingSystem packagingSystem(OsVersion osVersion);
static PackagingSystem packagingSystem(MaemoDeviceConfig::OsVersion osVersion);
static bool removeRecursively(const QString &filePath, QString &error);
static bool copyRecursively(const QString &srcFilePath,
@@ -151,7 +153,7 @@ public:
private:
static bool isValidMaemoQtVersion(const Qt4ProjectManager::QtVersion *qtVersion,
OsVersion maemoVersion);
MaemoDeviceConfig::OsVersion maemoVersion);
static QString madAdminCommand(const QtVersion *qtVersion);
static bool callMaddeShellScript(QProcess &proc, const QtVersion *qtVersion,
const QString &command, const QStringList &args, bool useTarget);

View File

@@ -504,9 +504,9 @@ bool MaemoDebianPackageCreationStep::adaptRulesFile(
+ QLatin1Char('/') + maemoTarget()->packageName()
+ QLatin1String("/usr/share/applications/");
const Qt4BuildConfiguration * const bc = qt4BuildConfiguration();
const MaemoGlobal::OsVersion version
const MaemoDeviceConfig::OsVersion version
= MaemoGlobal::version(bc->qtVersion());
if (version == MaemoGlobal::Maemo5)
if (version == MaemoDeviceConfig::Maemo5)
desktopFileDir += QLatin1String("hildon/");
#ifdef Q_OS_WIN
desktopFileDir.remove(QLatin1Char(':'));
@@ -518,7 +518,7 @@ bool MaemoDebianPackageCreationStep::adaptRulesFile(
= deployConfig()->deployables()->modelAt(i);
if (!model->hasDesktopFile())
continue;
if (version == MaemoGlobal::Maemo6) {
if (version == MaemoDeviceConfig::Maemo6) {
addWorkaroundForHarmattanBug(content, insertPos,
model, desktopFileDir);
}

View File

@@ -42,13 +42,13 @@ MaemoPerTargetDeviceConfigurationListModel::MaemoPerTargetDeviceConfigurationLis
const Target *target) : QAbstractListModel(parent)
{
if (qobject_cast<const Qt4Maemo5Target *>(target))
m_targetOsVersion = MaemoGlobal::Maemo5;
m_targetOsVersion = MaemoDeviceConfig::Maemo5;
else if (qobject_cast<const Qt4HarmattanTarget *>(target))
m_targetOsVersion = MaemoGlobal::Maemo6;
m_targetOsVersion = MaemoDeviceConfig::Maemo6;
else if (qobject_cast<const Qt4MeegoTarget *>(target))
m_targetOsVersion = MaemoGlobal::Meego;
m_targetOsVersion = MaemoDeviceConfig::Meego;
else
m_targetOsVersion = MaemoGlobal::GenericLinux;
m_targetOsVersion = MaemoDeviceConfig::GenericLinux;
const MaemoDeviceConfigurations * const devConfs
= MaemoDeviceConfigurations::instance();
connect(devConfs, SIGNAL(modelReset()), this, SIGNAL(modelReset()));
@@ -63,7 +63,7 @@ int MaemoPerTargetDeviceConfigurationListModel::rowCount(const QModelIndex &pare
const MaemoDeviceConfigurations * const devConfs
= MaemoDeviceConfigurations::instance();
const int devConfsCount = devConfs->rowCount();
if (m_targetOsVersion == MaemoGlobal::GenericLinux)
if (m_targetOsVersion == MaemoDeviceConfig::GenericLinux)
return devConfsCount;
for (int i = 0; i < devConfsCount; ++i) {
if (devConfs->deviceAt(i)->osVersion() == m_targetOsVersion)
@@ -90,7 +90,7 @@ MaemoDeviceConfig::ConstPtr MaemoPerTargetDeviceConfigurationListModel::deviceAt
int currentRow = -1;
const MaemoDeviceConfigurations * const devConfs
= MaemoDeviceConfigurations::instance();
if (m_targetOsVersion == MaemoGlobal::GenericLinux)
if (m_targetOsVersion == MaemoDeviceConfig::GenericLinux)
return devConfs->deviceAt(idx);
const int devConfsCount = devConfs->rowCount();
for (int i = 0; i < devConfsCount; ++i) {
@@ -113,7 +113,7 @@ MaemoDeviceConfig::ConstPtr MaemoPerTargetDeviceConfigurationListModel::find(Mae
const MaemoDeviceConfig::ConstPtr &devConf
= MaemoDeviceConfigurations::instance()->find(id);
return devConf && (devConf->osVersion() == m_targetOsVersion
|| m_targetOsVersion == MaemoGlobal::GenericLinux)
|| m_targetOsVersion == MaemoDeviceConfig::GenericLinux)
? devConf : defaultDeviceConfig();
}

View File

@@ -63,7 +63,7 @@ signals:
void updated();
private:
MaemoGlobal::OsVersion m_targetOsVersion;
MaemoDeviceConfig::OsVersion m_targetOsVersion;
};
} // namespace Internal

View File

@@ -79,7 +79,7 @@ void MaemoPublishingBuildSettingsPageFremantleFree::collectBuildConfigurations(c
= qobject_cast<Qt4BuildConfiguration *>(bc);
if (!qt4Bc)
continue;
if (MaemoGlobal::version(qt4Bc->qtVersion()) == MaemoGlobal::Maemo5)
if (MaemoGlobal::version(qt4Bc->qtVersion()) == MaemoDeviceConfig::Maemo5)
m_buildConfigs << qt4Bc;
}
break;

View File

@@ -76,7 +76,7 @@ bool MaemoPublishingWizardFactoryFremantleFree::canCreateWizard(const Project *p
= qobject_cast<const Qt4BuildConfiguration *>(bc);
if (!qt4Bc)
continue;
if (MaemoGlobal::version(qt4Bc->qtVersion()) == MaemoGlobal::Maemo5)
if (MaemoGlobal::version(qt4Bc->qtVersion()) == MaemoDeviceConfig::Maemo5)
return true;
}
break;

View File

@@ -59,7 +59,7 @@ MaemoRemoteProcessesDialog::MaemoRemoteProcessesDialog(const MaemoDeviceConfig::
// Manually gathered process information is missing the command line for
// some system processes. Dont's show these lines by default.
if (devConfig->osVersion() == MaemoGlobal::Maemo5)
if (devConfig->osVersion() == MaemoDeviceConfig::Maemo5)
m_ui->processFilterLineEdit->setText(QLatin1String("[^ ]+"));
connect(m_ui->tableView->selectionModel(),

View File

@@ -70,7 +70,7 @@ void MaemoRemoteProcessList::update()
// The ps command on Fremantle ignores all command line options, so
// we have to collect the information in /proc manually.
if (m_devConfig->osVersion() == MaemoGlobal::Maemo5) {
if (m_devConfig->osVersion() == MaemoDeviceConfig::Maemo5) {
command = "sep1=" + LineSeparator1 + '\n'
+ "sep2=" + LineSeparator2 + '\n'
+ "pidlist=`ls /proc |grep -E '^[[:digit:]]+$' |sort -n`; "
@@ -192,7 +192,7 @@ void MaemoRemoteProcessList::stop()
void MaemoRemoteProcessList::buildProcessList()
{
const bool isFremantle = m_devConfig->osVersion() == MaemoGlobal::Maemo5;
const bool isFremantle = m_devConfig->osVersion() == MaemoDeviceConfig::Maemo5;
const QString remoteOutput = QString::fromUtf8(m_remoteStdout);
const QByteArray lineSeparator = isFremantle ? LineSeparator : "\n";
QStringList lines = remoteOutput.split(QString::fromUtf8(lineSeparator));

View File

@@ -302,7 +302,10 @@ QString MaemoRunConfiguration::remoteExecutableFilePath() const
MaemoPortList MaemoRunConfiguration::freePorts() const
{
return deployStep() ? deployStep()->freePorts() : MaemoPortList();
const Qt4BuildConfiguration * const bc = activeQt4BuildConfiguration();
return bc
? MaemoGlobal::freePorts(deployStep()->deviceConfig(), bc->qtVersion())
: MaemoPortList();
}
bool MaemoRunConfiguration::useRemoteGdb() const