RemoteLinux: Change data type for better extensibility.

Other plugins are expected to build on the RemoteLinux infrastructure
in the future, providing OS types of their own. A string-based
identifier is much better suited for that than the currently used
enum approach.

Change-Id: I702a1ed7628d908d9c68ae0910ad1a6f1b92786f
Reviewed-on: http://codereview.qt.nokia.com/357
Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
Christian Kandeler
2011-06-07 12:12:30 +02:00
parent c062dbe704
commit 9b27d80f67
25 changed files with 211 additions and 222 deletions

View File

@@ -41,7 +41,8 @@ typedef Utils::SshConnectionParameters::AuthenticationType AuthType;
namespace RemoteLinux {
namespace {
const QLatin1String NameKey("Name");
const QLatin1String OsVersionKey("OsVersion");
const QLatin1String OldOsVersionKey("OsVersion"); // Outdated, only use for upgrading.
const QLatin1String OsTypeKey("OsType");
const QLatin1String TypeKey("Type");
const QLatin1String HostKey("Host");
const QLatin1String SshPortKey("SshPort");
@@ -202,15 +203,15 @@ LinuxDeviceConfiguration::Ptr LinuxDeviceConfiguration::create(const ConstPtr &o
}
LinuxDeviceConfiguration::Ptr LinuxDeviceConfiguration::createHardwareConfig(const QString &name,
LinuxDeviceConfiguration::OsVersion osVersion, const QString &hostName,
const QString &osType, const QString &hostName,
const QString &privateKeyFilePath, Id &nextId)
{
Utils::SshConnectionParameters sshParams(Utils::SshConnectionParameters::NoProxy);
sshParams.authenticationType = Utils::SshConnectionParameters::AuthenticationByKey;
sshParams.host = hostName;
sshParams.userName = defaultUser(osVersion);
sshParams.userName = defaultUser(osType);
sshParams.privateKeyFile = privateKeyFilePath;
return Ptr(new LinuxDeviceConfiguration(name, osVersion, Physical, sshParams, nextId));
return Ptr(new LinuxDeviceConfiguration(name, osType, Physical, sshParams, nextId));
}
LinuxDeviceConfiguration::Ptr LinuxDeviceConfiguration::createGenericLinuxConfigUsingPassword(const QString &name,
@@ -223,7 +224,7 @@ LinuxDeviceConfiguration::Ptr LinuxDeviceConfiguration::createGenericLinuxConfig
sshParams.host = hostName;
sshParams.userName = userName;
sshParams.password = password;
return Ptr(new LinuxDeviceConfiguration(name, LinuxDeviceConfiguration::GenericLinux, Physical,
return Ptr(new LinuxDeviceConfiguration(name, LinuxDeviceConfiguration::GenericLinuxOsType, Physical,
sshParams, nextId));
}
@@ -237,27 +238,27 @@ LinuxDeviceConfiguration::Ptr LinuxDeviceConfiguration::createGenericLinuxConfig
sshParams.host = hostName;
sshParams.userName = userName;
sshParams.privateKeyFile = privateKeyFile;
return Ptr(new LinuxDeviceConfiguration(name, LinuxDeviceConfiguration::GenericLinux, Physical,
return Ptr(new LinuxDeviceConfiguration(name, LinuxDeviceConfiguration::GenericLinuxOsType, Physical,
sshParams, nextId));
}
LinuxDeviceConfiguration::Ptr LinuxDeviceConfiguration::createEmulatorConfig(const QString &name,
LinuxDeviceConfiguration::OsVersion osVersion, Id &nextId)
const QString &osType, Id &nextId)
{
Utils::SshConnectionParameters sshParams(Utils::SshConnectionParameters::NoProxy);
sshParams.authenticationType = Utils::SshConnectionParameters::AuthenticationByPassword;
sshParams.host = defaultHost(Emulator, osVersion);
sshParams.userName = defaultUser(osVersion);
sshParams.password = defaultQemuPassword(osVersion);
return Ptr(new LinuxDeviceConfiguration(name, osVersion, Emulator, sshParams, nextId));
sshParams.host = defaultHost(Emulator, osType);
sshParams.userName = defaultUser(osType);
sshParams.password = defaultQemuPassword(osType);
return Ptr(new LinuxDeviceConfiguration(name, osType, Emulator, sshParams, nextId));
}
LinuxDeviceConfiguration::LinuxDeviceConfiguration(const QString &name,
LinuxDeviceConfiguration::OsVersion osVersion, DeviceType devType,
const QString &osType, DeviceType devType,
const Utils::SshConnectionParameters &sshParams, Id &nextId)
: m_sshParameters(sshParams),
m_name(name),
m_osVersion(osVersion),
m_osType(osType),
m_type(devType),
m_portsSpec(defaultPortsSpec(m_type)),
m_isDefault(false),
@@ -271,17 +272,29 @@ LinuxDeviceConfiguration::LinuxDeviceConfiguration(const QSettings &settings,
Id &nextId)
: m_sshParameters(Utils::SshConnectionParameters::NoProxy),
m_name(settings.value(NameKey).toString()),
m_osVersion(static_cast<LinuxDeviceConfiguration::OsVersion>(settings.value(OsVersionKey, LinuxDeviceConfiguration::Maemo5).toInt())),
m_osType(settings.value(OsTypeKey).toString()),
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()),
m_internalId(settings.value(InternalIdKey, nextId).toULongLong())
{
if (m_internalId == nextId)
++nextId;
m_sshParameters.host = settings.value(HostKey, defaultHost(m_type, m_osVersion)).toString();
// Convert from version < 2.3.
if (m_osType.isEmpty()) {
const int oldOsType = settings.value(OldOsVersionKey, -1).toInt();
switch (oldOsType) {
case 0: m_osType = Maemo5OsType; break;
case 1: m_osType = HarmattanOsType; break;
case 2: m_osType = MeeGoOsType; break;
default: m_osType = GenericLinuxOsType;
}
}
m_portsSpec = settings.value(PortsSpecKey, defaultPortsSpec(m_type)).toString();
m_sshParameters.host = settings.value(HostKey, defaultHost(m_type, m_osType)).toString();
m_sshParameters.port = settings.value(SshPortKey, defaultSshPort(m_type)).toInt();
m_sshParameters.userName = settings.value(UserNameKey, defaultUser(m_osVersion)).toString();
m_sshParameters.userName = settings.value(UserNameKey, defaultUser(m_osType)).toString();
m_sshParameters.authenticationType
= static_cast<AuthType>(settings.value(AuthKey, DefaultAuthType).toInt());
m_sshParameters.password = settings.value(PasswordKey).toString();
@@ -293,7 +306,7 @@ LinuxDeviceConfiguration::LinuxDeviceConfiguration(const QSettings &settings,
LinuxDeviceConfiguration::LinuxDeviceConfiguration(const LinuxDeviceConfiguration::ConstPtr &other)
: m_sshParameters(other->m_sshParameters),
m_name(other->m_name),
m_osVersion(other->m_osVersion),
m_osType(other->m_osType),
m_type(other->type()),
m_portsSpec(other->m_portsSpec),
m_isDefault(other->m_isDefault),
@@ -318,19 +331,11 @@ QString LinuxDeviceConfiguration::defaultPortsSpec(DeviceType type) const
return QLatin1String(type == Physical ? "10000-10100" : "13219,14168");
}
QString LinuxDeviceConfiguration::defaultHost(DeviceType type, LinuxDeviceConfiguration::OsVersion osVersion)
QString LinuxDeviceConfiguration::defaultHost(DeviceType type, const QString &osType)
{
switch (osVersion) {
case LinuxDeviceConfiguration::Maemo5:
case LinuxDeviceConfiguration::Maemo6:
case LinuxDeviceConfiguration::Meego:
if (osType == Maemo5OsType || osType == HarmattanOsType || osType == MeeGoOsType)
return QLatin1String(type == Physical ? "192.168.2.15" : "localhost");
case LinuxDeviceConfiguration::GenericLinux:
return QString();
default:
qDebug("%s: Unknown OS version %d.", Q_FUNC_INFO, osVersion);
return QString();
}
return QString();
}
QString LinuxDeviceConfiguration::defaultPrivateKeyFilePath()
@@ -344,34 +349,20 @@ QString LinuxDeviceConfiguration::defaultPublicKeyFilePath()
return defaultPrivateKeyFilePath() + QLatin1String(".pub");
}
QString LinuxDeviceConfiguration::defaultUser(LinuxDeviceConfiguration::OsVersion osVersion)
QString LinuxDeviceConfiguration::defaultUser(const QString &osType)
{
switch (osVersion) {
case LinuxDeviceConfiguration::Maemo5:
case LinuxDeviceConfiguration::Maemo6:
if (osType == Maemo5OsType || osType == HarmattanOsType)
return QLatin1String("developer");
case LinuxDeviceConfiguration::Meego:
if (osType == MeeGoOsType)
return QLatin1String("meego");
case LinuxDeviceConfiguration::GenericLinux:
return QString();
default:
qDebug("%s: Unknown OS Version %d.", Q_FUNC_INFO, osVersion);
return QString();
}
}
QString LinuxDeviceConfiguration::defaultQemuPassword(LinuxDeviceConfiguration::OsVersion osVersion)
QString LinuxDeviceConfiguration::defaultQemuPassword(const QString &osType)
{
switch (osVersion) {
case LinuxDeviceConfiguration::Maemo5:
case LinuxDeviceConfiguration::Maemo6:
return QString();
case LinuxDeviceConfiguration::Meego:
if (osType == MeeGoOsType)
return QLatin1String("meego");
default:
qDebug("%s: Unknown OS Version %d.", Q_FUNC_INFO, osVersion);
return QString();
}
return QString();
}
PortList LinuxDeviceConfiguration::freePorts() const
@@ -382,7 +373,7 @@ PortList LinuxDeviceConfiguration::freePorts() const
void LinuxDeviceConfiguration::save(QSettings &settings) const
{
settings.setValue(NameKey, m_name);
settings.setValue(OsVersionKey, m_osVersion);
settings.setValue(OsTypeKey, m_osType);
settings.setValue(TypeKey, m_type);
settings.setValue(HostKey, m_sshParameters.host);
settings.setValue(SshPortKey, m_sshParameters.port);
@@ -397,5 +388,8 @@ void LinuxDeviceConfiguration::save(QSettings &settings) const
}
const LinuxDeviceConfiguration::Id LinuxDeviceConfiguration::InvalidId = 0;
const QString LinuxDeviceConfiguration::Maemo5OsType = QLatin1String("Maemo5OsType");
const QString LinuxDeviceConfiguration::HarmattanOsType = QLatin1String("HarmattanOsType");
const QString LinuxDeviceConfiguration::MeeGoOsType = QLatin1String("MeeGoOsType");
const QString LinuxDeviceConfiguration::GenericLinuxOsType = QLatin1String("GenericLinuxOsType");
} // namespace RemoteLinux

View File

@@ -72,31 +72,36 @@ class REMOTELINUX_EXPORT LinuxDeviceConfiguration
public:
typedef QSharedPointer<const LinuxDeviceConfiguration> ConstPtr;
typedef quint64 Id;
enum OsVersion { Maemo5, Maemo6, Meego, GenericLinux };
static const QString Maemo5OsType;
static const QString HarmattanOsType;
static const QString MeeGoOsType;
static const QString GenericLinuxOsType;
enum DeviceType { Physical, Emulator };
PortList freePorts() const;
Utils::SshConnectionParameters sshParameters() const { return m_sshParameters; }
QString name() const { return m_name; }
OsVersion osVersion() const { return m_osVersion; }
QString osType() const { return m_osType; }
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, OsVersion osVersion);
static QString defaultHost(DeviceType type, const QString &osType);
static QString defaultPrivateKeyFilePath();
static QString defaultPublicKeyFilePath();
static QString defaultUser(OsVersion osVersion);
static QString defaultUser(const QString &osType);
static int defaultSshPort(DeviceType type);
static QString defaultQemuPassword(OsVersion osVersion);
static QString defaultQemuPassword(const QString &osType);
static const Id InvalidId;
private:
typedef QSharedPointer<LinuxDeviceConfiguration> Ptr;
LinuxDeviceConfiguration(const QString &name, OsVersion osVersion,
LinuxDeviceConfiguration(const QString &name, const QString &osType,
DeviceType type, const Utils::SshConnectionParameters &sshParams,
Id &nextId);
LinuxDeviceConfiguration(const QSettings &settings, Id &nextId);
@@ -105,7 +110,7 @@ private:
LinuxDeviceConfiguration(const LinuxDeviceConfiguration &);
LinuxDeviceConfiguration &operator=(const LinuxDeviceConfiguration &);
static Ptr createHardwareConfig(const QString &name, OsVersion osVersion,
static Ptr createHardwareConfig(const QString &name, const QString &osType,
const QString &hostName, const QString &privateKeyFilePath, Id &nextId);
static Ptr createGenericLinuxConfigUsingPassword(const QString &name,
const QString &hostName, const QString &userName,
@@ -113,7 +118,7 @@ private:
static Ptr createGenericLinuxConfigUsingKey(const QString &name,
const QString &hostName, const QString &userName,
const QString &privateKeyFilePath, Id &nextId);
static Ptr createEmulatorConfig(const QString &name, OsVersion osVersion,
static Ptr createEmulatorConfig(const QString &name, const QString &osType,
Id &nextId);
static Ptr create(const QSettings &settings, Id &nextId);
static Ptr create(const ConstPtr &other);
@@ -123,7 +128,7 @@ private:
Utils::SshConnectionParameters m_sshParameters;
QString m_name;
OsVersion m_osVersion;
QString m_osType;
DeviceType m_type;
QString m_portsSpec;
bool m_isDefault;

View File

@@ -119,11 +119,10 @@ void LinuxDeviceConfigurations::save()
}
void LinuxDeviceConfigurations::addHardwareDeviceConfiguration(const QString &name,
LinuxDeviceConfiguration::OsVersion osVersion, const QString &hostName,
const QString &privateKeyFilePath)
const QString &osType, const QString &hostName, const QString &privateKeyFilePath)
{
const LinuxDeviceConfiguration::Ptr &devConf = LinuxDeviceConfiguration::createHardwareConfig(name,
osVersion, hostName, privateKeyFilePath, m_nextId);
osType, hostName, privateKeyFilePath, m_nextId);
addConfiguration(devConf);
}
@@ -145,17 +144,17 @@ void LinuxDeviceConfigurations::addGenericLinuxConfigurationUsingKey(const QStri
}
void LinuxDeviceConfigurations::addEmulatorDeviceConfiguration(const QString &name,
LinuxDeviceConfiguration::OsVersion osVersion)
const QString &osType)
{
const LinuxDeviceConfiguration::Ptr &devConf
= LinuxDeviceConfiguration::createEmulatorConfig(name, osVersion, m_nextId);
= LinuxDeviceConfiguration::createEmulatorConfig(name, osType, m_nextId);
addConfiguration(devConf);
}
void LinuxDeviceConfigurations::addConfiguration(const LinuxDeviceConfiguration::Ptr &devConfig)
{
beginInsertRows(QModelIndex(), rowCount(), rowCount());
if (!defaultDeviceConfig(devConfig->osVersion()))
if (!defaultDeviceConfig(devConfig->osType()))
devConfig->m_isDefault = true;
m_devConfigs << devConfig;
endInsertRows();
@@ -166,12 +165,12 @@ void LinuxDeviceConfigurations::removeConfiguration(int idx)
Q_ASSERT(idx >= 0 && idx < rowCount());
beginRemoveRows(QModelIndex(), idx, idx);
const bool wasDefault = deviceAt(idx)->m_isDefault;
const LinuxDeviceConfiguration::OsVersion osVersion = deviceAt(idx)->osVersion();
const QString osType = deviceAt(idx)->osType();
m_devConfigs.removeAt(idx);
endRemoveRows();
if (wasDefault) {
for (int i = 0; i < m_devConfigs.count(); ++i) {
if (deviceAt(i)->osVersion() == osVersion) {
if (deviceAt(i)->osType() == osType) {
m_devConfigs.at(i)->m_isDefault = true;
const QModelIndex changedIndex = index(i, 0);
emit dataChanged(changedIndex, changedIndex);
@@ -212,7 +211,7 @@ void LinuxDeviceConfigurations::setDefaultDevice(int idx)
for (int i = 0; i < m_devConfigs.count(); ++i) {
const LinuxDeviceConfiguration::Ptr &oldDefaultDev = m_devConfigs.at(i);
if (oldDefaultDev->m_isDefault
&& oldDefaultDev->osVersion() == devConf->osVersion()) {
&& oldDefaultDev->osType() == devConf->osType()) {
oldDefaultDev->m_isDefault = false;
oldDefaultIndex = index(i, 0);
break;
@@ -246,10 +245,10 @@ void LinuxDeviceConfigurations::load()
}
settings->endArray();
settings->endGroup();
ensureDefaultExists(LinuxDeviceConfiguration::Maemo5);
ensureDefaultExists(LinuxDeviceConfiguration::Maemo6);
ensureDefaultExists(LinuxDeviceConfiguration::Meego);
ensureDefaultExists(LinuxDeviceConfiguration::GenericLinux);
ensureDefaultExists(LinuxDeviceConfiguration::Maemo5OsType);
ensureDefaultExists(LinuxDeviceConfiguration::HarmattanOsType);
ensureDefaultExists(LinuxDeviceConfiguration::MeeGoOsType);
ensureDefaultExists(LinuxDeviceConfiguration::GenericLinuxOsType);
}
LinuxDeviceConfiguration::ConstPtr LinuxDeviceConfigurations::deviceAt(int idx) const
@@ -272,10 +271,10 @@ LinuxDeviceConfiguration::ConstPtr LinuxDeviceConfigurations::find(LinuxDeviceCo
return index == -1 ? LinuxDeviceConfiguration::ConstPtr() : deviceAt(index);
}
LinuxDeviceConfiguration::ConstPtr LinuxDeviceConfigurations::defaultDeviceConfig(const LinuxDeviceConfiguration::OsVersion osVersion) const
LinuxDeviceConfiguration::ConstPtr LinuxDeviceConfigurations::defaultDeviceConfig(const QString &osType) const
{
foreach (const LinuxDeviceConfiguration::ConstPtr &devConf, m_devConfigs) {
if (devConf->m_isDefault && devConf->osVersion() == osVersion)
if (devConf->m_isDefault && devConf->osType() == osType)
return devConf;
}
return LinuxDeviceConfiguration::ConstPtr();
@@ -295,11 +294,11 @@ LinuxDeviceConfiguration::Id LinuxDeviceConfigurations::internalId(LinuxDeviceCo
return devConf ? devConf->m_internalId : LinuxDeviceConfiguration::InvalidId;
}
void LinuxDeviceConfigurations::ensureDefaultExists(LinuxDeviceConfiguration::OsVersion osVersion)
void LinuxDeviceConfigurations::ensureDefaultExists(const QString &osType)
{
if (!defaultDeviceConfig(osVersion)) {
if (!defaultDeviceConfig(osType)) {
foreach (const LinuxDeviceConfiguration::Ptr &devConf, m_devConfigs) {
if (devConf->osVersion() == osVersion) {
if (devConf->osType() == osType) {
devConf->m_isDefault = true;
break;
}
@@ -321,7 +320,7 @@ QVariant LinuxDeviceConfigurations::data(const QModelIndex &index, int role) con
QString name = devConf->name();
if (devConf->m_isDefault) {
name += QLatin1Char(' ') + tr("(default for %1)")
.arg(MaemoGlobal::osVersionToString(devConf->osVersion()));
.arg(MaemoGlobal::osTypeToString(devConf->osType()));
}
return name;
}

View File

@@ -56,7 +56,7 @@ public:
LinuxDeviceConfiguration::ConstPtr deviceAt(int index) const;
LinuxDeviceConfiguration::ConstPtr find(LinuxDeviceConfiguration::Id id) const;
LinuxDeviceConfiguration::ConstPtr defaultDeviceConfig(const LinuxDeviceConfiguration::OsVersion osVersion) const;
LinuxDeviceConfiguration::ConstPtr defaultDeviceConfig(const QString &osType) const;
bool hasConfig(const QString &name) const;
int indexForInternalId(LinuxDeviceConfiguration::Id internalId) const;
LinuxDeviceConfiguration::Id internalId(LinuxDeviceConfiguration::ConstPtr devConf) const;
@@ -64,17 +64,15 @@ public:
void setDefaultSshKeyFilePath(const QString &path) { m_defaultSshKeyFilePath = path; }
QString defaultSshKeyFilePath() const { return m_defaultSshKeyFilePath; }
void addHardwareDeviceConfiguration(const QString &name,
LinuxDeviceConfiguration::OsVersion osVersion, const QString &hostName,
const QString &privateKeyFilePath);
void addHardwareDeviceConfiguration(const QString &name, const QString &osType,
const QString &hostName, const QString &privateKeyFilePath);
void addGenericLinuxConfigurationUsingPassword(const QString &name,
const QString &hostName, const QString &userName,
const QString &password);
void addGenericLinuxConfigurationUsingKey(const QString &name,
const QString &hostName, const QString &userName,
const QString &privateKeyFilePath);
void addEmulatorDeviceConfiguration(const QString &name,
LinuxDeviceConfiguration::OsVersion osVersion);
void addEmulatorDeviceConfiguration(const QString &name, const QString &osType);
void removeConfiguration(int index);
void setConfigurationName(int i, const QString &name);
void setSshParameters(int i, const Utils::SshConnectionParameters &params);
@@ -95,7 +93,7 @@ private:
static void copy(const LinuxDeviceConfigurations *source,
LinuxDeviceConfigurations *target, bool deep);
void addConfiguration(const LinuxDeviceConfiguration::Ptr &devConfig);
void ensureDefaultExists(LinuxDeviceConfiguration::OsVersion osVersion);
void ensureDefaultExists(const QString &osType);
static LinuxDeviceConfigurations *m_instance;
LinuxDeviceConfiguration::Id m_nextId;

View File

@@ -99,7 +99,7 @@ void MaemoConfigTestDialog::startConfigTest()
const QLatin1String sysInfoCmd("uname -rsm");
QString command = sysInfoCmd;
QString qtInfoCmd;
switch (MaemoGlobal::packagingSystem(m_config->osVersion())) {
switch (MaemoGlobal::packagingSystem(m_config->osType())) {
case MaemoGlobal::Rpm:
qtInfoCmd = QLatin1String("rpm -qa 'libqt*' "
"--queryformat '%{NAME} %{VERSION}\\n'");
@@ -158,18 +158,16 @@ void MaemoConfigTestDialog::handleGeneralTestResult(int exitStatus)
m_ui->testResultEdit->setPlainText(output);
}
switch (m_config->osVersion()) {
case LinuxDeviceConfiguration::Maemo5:
case LinuxDeviceConfiguration::Maemo6:
case LinuxDeviceConfiguration::Meego:
if (m_config->osType() == LinuxDeviceConfiguration::Maemo5OsType
|| m_config->osType() == LinuxDeviceConfiguration::HarmattanOsType
|| m_config->osType() == LinuxDeviceConfiguration::MeeGoOsType) {
m_currentTest = MadDeveloperTest;
disconnect(m_testProcessRunner.data(),
SIGNAL(processOutputAvailable(QByteArray)), this,
SLOT(processSshOutput(QByteArray)));
m_testProcessRunner->run("test -x "
+ MaemoGlobal::devrootshPath().toUtf8());
break;
default:
} else {
testPorts();
}
}
@@ -183,8 +181,8 @@ void MaemoConfigTestDialog::handleMadDeveloperTestResult(int exitStatus)
QString errorMsg = m_ui->errorLabel->text() + QLatin1String("<br>")
+ 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() == LinuxDeviceConfiguration::Maemo6) {
.arg(MaemoGlobal::madDeveloperUiName(m_config->osType()));
if (m_config->osType() == LinuxDeviceConfiguration::HarmattanOsType) {
errorMsg += QLatin1String("<br>")
+ tr("Please switch the device to developer mode via Settings -> Security.");
}
@@ -267,7 +265,7 @@ QString MaemoConfigTestDialog::parseTestOutput()
output.append(tr("Kernel version: %1\n").arg(unamePattern.cap(1)));
QString patternString;
switch (MaemoGlobal::packagingSystem(m_config->osVersion())) {
switch (MaemoGlobal::packagingSystem(m_config->osType())) {
case MaemoGlobal::Rpm:
patternString = QLatin1String("(libqt\\S+) ((\\d+)\\.(\\d+)\\.(\\d+))");
break;

View File

@@ -265,7 +265,7 @@ bool MaemoDeployableListModel::addDesktopFile()
const QtSupport::BaseQtVersion * const version = qtVersion();
QTC_ASSERT(version, return false);
QString remoteDir = QLatin1String("/usr/share/applications");
if (MaemoGlobal::version(version->qmakeCommand()) == LinuxDeviceConfiguration::Maemo5)
if (MaemoGlobal::osType(version->qmakeCommand()) == LinuxDeviceConfiguration::Maemo5OsType)
remoteDir += QLatin1String("/hildon");
const QLatin1String filesLine("desktopfile.files = $${TARGET}.desktop");
const QString pathLine = QLatin1String("desktopfile.path = ") + remoteDir;
@@ -340,7 +340,7 @@ QString MaemoDeployableListModel::proFileScope() const
{
const QtSupport::BaseQtVersion *const qv = qtVersion();
QTC_ASSERT(qv, return QString());
return QLatin1String(MaemoGlobal::version(qv->qmakeCommand()) == LinuxDeviceConfiguration::Maemo5
return QLatin1String(MaemoGlobal::osType(qv->qmakeCommand()) == LinuxDeviceConfiguration::Maemo5OsType
? "maemo5" : "unix:!symbian:!maemo5");
}
@@ -354,7 +354,7 @@ QString MaemoDeployableListModel::remoteIconDir() const
const QtSupport::BaseQtVersion *const qv = qtVersion();
QTC_ASSERT(qv, return QString());
return QString::fromLocal8Bit("/usr/share/icons/hicolor/%1x%1/apps")
.arg(MaemoGlobal::applicationIconSize(MaemoGlobal::version(qv->qmakeCommand())));
.arg(MaemoGlobal::applicationIconSize(MaemoGlobal::osType(qv->qmakeCommand())));
}
} // namespace RemoteLinux

View File

@@ -137,7 +137,7 @@ void MaemoDeployConfigurationWidget::addIcon()
MaemoDeployableListModel *const model
= m_deployConfig->deployables()->modelAt(modelRow);
const int iconDim = MaemoGlobal::applicationIconSize(MaemoGlobal::version(model->qtVersion()->qmakeCommand()));
const int iconDim = MaemoGlobal::applicationIconSize(MaemoGlobal::osType(model->qtVersion()->qmakeCommand()));
const QString origFilePath = QFileDialog::getOpenFileName(this,
tr("Choose Icon (will be scaled to %1x%1 pixels, if necessary)").arg(iconDim),
model->projectDir(), QLatin1String("(*.png)"));

View File

@@ -195,7 +195,7 @@ void MaemoDeviceConfigurationsSettingsWidget::displayCurrent()
{
const LinuxDeviceConfiguration::ConstPtr &current = currentConfig();
m_ui->defaultDeviceButton->setEnabled(!current->isDefault());
m_ui->osTypeValueLabel->setText(MaemoGlobal::osVersionToString(current->osVersion()));
m_ui->osTypeValueLabel->setText(MaemoGlobal::osTypeToString(current->osType()));
const SshConnectionParameters &sshParams = current->sshParameters();
if (current->type() == LinuxDeviceConfiguration::Physical) {
m_ui->deviceTypeValueLabel->setText(tr("Physical Device"));

View File

@@ -61,7 +61,7 @@ struct WizardData
{
QString configName;
QString hostName;
LinuxDeviceConfiguration::OsVersion osVersion;
QString osType;
SshConnectionParameters::AuthenticationType authType;
LinuxDeviceConfiguration::DeviceType deviceType;
QString privateKeyFilePath;
@@ -85,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(LinuxDeviceConfiguration::Maemo5));
m_ui->harmattanButton->setText(MaemoGlobal::osVersionToString(LinuxDeviceConfiguration::Maemo6));
m_ui->meegoButton->setText(MaemoGlobal::osVersionToString(LinuxDeviceConfiguration::Meego));
m_ui->genericLinuxButton->setText(MaemoGlobal::osVersionToString(LinuxDeviceConfiguration::GenericLinux));
m_ui->fremantleButton->setText(MaemoGlobal::osTypeToString(LinuxDeviceConfiguration::Maemo5OsType));
m_ui->harmattanButton->setText(MaemoGlobal::osTypeToString(LinuxDeviceConfiguration::HarmattanOsType));
m_ui->meegoButton->setText(MaemoGlobal::osTypeToString(LinuxDeviceConfiguration::MeeGoOsType));
m_ui->genericLinuxButton->setText(MaemoGlobal::osTypeToString(LinuxDeviceConfiguration::GenericLinuxOsType));
QButtonGroup *buttonGroup = new QButtonGroup(this);
buttonGroup->setExclusive(true);
@@ -111,7 +111,7 @@ public:
m_ui->hwButton->setChecked(true);
handleDeviceTypeChanged();
m_ui->hostNameLineEdit->setText(LinuxDeviceConfiguration::defaultHost(deviceType(),
osVersion()));
osType()));
connect(m_ui->nameLineEdit, SIGNAL(textChanged(QString)), this,
SIGNAL(completeChanged()));
connect(m_ui->hostNameLineEdit, SIGNAL(textChanged(QString)), this,
@@ -128,16 +128,16 @@ public:
QString hostName() const
{
return deviceType() == LinuxDeviceConfiguration::Emulator
? LinuxDeviceConfiguration::defaultHost(LinuxDeviceConfiguration::Emulator, osVersion())
? LinuxDeviceConfiguration::defaultHost(LinuxDeviceConfiguration::Emulator, osType())
: m_ui->hostNameLineEdit->text().trimmed();
}
LinuxDeviceConfiguration::OsVersion osVersion() const
QString osType() const
{
return m_ui->fremantleButton->isChecked() ? LinuxDeviceConfiguration::Maemo5
: m_ui->harmattanButton->isChecked() ? LinuxDeviceConfiguration::Maemo6
: m_ui->meegoButton->isChecked() ? LinuxDeviceConfiguration::Meego
: LinuxDeviceConfiguration::GenericLinux;
return m_ui->fremantleButton->isChecked() ? LinuxDeviceConfiguration::Maemo5OsType
: m_ui->harmattanButton->isChecked() ? LinuxDeviceConfiguration::HarmattanOsType
: m_ui->meegoButton->isChecked() ? LinuxDeviceConfiguration::MeeGoOsType
: LinuxDeviceConfiguration::GenericLinuxOsType;
}
LinuxDeviceConfiguration::DeviceType deviceType() const
@@ -156,7 +156,7 @@ private slots:
void handleOsTypeChanged()
{
if (osVersion() == LinuxDeviceConfiguration::GenericLinux) {
if (osType() == LinuxDeviceConfiguration::GenericLinuxOsType) {
m_ui->hwButton->setChecked(true);
m_ui->hwButton->setEnabled(false);
m_ui->qemuButton->setEnabled(false);
@@ -202,7 +202,7 @@ public:
virtual void initializePage()
{
m_ui->userNameLineEdit->setText(LinuxDeviceConfiguration::defaultUser(m_wizardData.osVersion));
m_ui->userNameLineEdit->setText(LinuxDeviceConfiguration::defaultUser(m_wizardData.osType));
m_ui->passwordButton->setChecked(true);
m_ui->passwordLineEdit->clear();
m_ui->privateKeyPathChooser->setPath(LinuxDeviceConfiguration::defaultPrivateKeyFilePath());
@@ -477,7 +477,7 @@ public:
m_ui->deviceAddressLineEdit->setText(m_wizardData.hostName);
m_ui->instructionLabel->setText(QString(m_instructionTextTemplate)
.replace(QLatin1String("%%%maddev%%%"),
MaemoGlobal::madDeveloperUiName(m_wizardData.osVersion)));
MaemoGlobal::madDeveloperUiName(m_wizardData.osType)));
m_ui->passwordLineEdit->clear();
enableInput();
}
@@ -507,7 +507,7 @@ private:
sshParams.port = LinuxDeviceConfiguration::defaultSshPort(LinuxDeviceConfiguration::Physical);
sshParams.password = password();
sshParams.timeout = 30;
sshParams.userName = LinuxDeviceConfiguration::defaultUser(m_wizardData.osVersion);
sshParams.userName = LinuxDeviceConfiguration::defaultUser(m_wizardData.osType);
m_ui->statusLabel->setText(tr("Deploying... "));
m_keyDeployer->deployPublicKey(sshParams, m_wizardData.publicKeyFilePath);
}
@@ -523,7 +523,7 @@ private:
QMessageBox::information(this, tr("Key Deployment Success"),
tr("The key was successfully deployed. You may now close "
"the \"%1\" application and continue.")
.arg(MaemoGlobal::madDeveloperUiName(m_wizardData.osVersion)));
.arg(MaemoGlobal::madDeveloperUiName(m_wizardData.osType)));
m_ui->statusLabel->setText(m_ui->statusLabel->text() + tr("Done."));
m_isComplete = true;
emit completeChanged();
@@ -643,7 +643,7 @@ void MaemoDeviceConfigWizard::createDeviceConfig()
while (d->devConfigs->hasConfig(name));
}
if (d->wizardData.osVersion == LinuxDeviceConfiguration::GenericLinux) {
if (d->wizardData.osType == LinuxDeviceConfiguration::GenericLinuxOsType) {
if (d->wizardData.authType == SshConnectionParameters::AuthenticationByPassword) {
d->devConfigs->addGenericLinuxConfigurationUsingPassword(name,
d->wizardData.hostName, d->wizardData.userName,
@@ -655,11 +655,11 @@ void MaemoDeviceConfigWizard::createDeviceConfig()
}
} else if (d->wizardData.deviceType == LinuxDeviceConfiguration::Physical) {
d->devConfigs->addHardwareDeviceConfiguration(name,
d->wizardData.osVersion, d->wizardData.hostName,
d->wizardData.osType, d->wizardData.hostName,
d->wizardData.privateKeyFilePath);
} else {
d->devConfigs->addEmulatorDeviceConfiguration(name,
d->wizardData.osVersion);
d->wizardData.osType);
}
}
@@ -668,13 +668,13 @@ int MaemoDeviceConfigWizard::nextId() const
switch (currentId()) {
case StartPageId:
d->wizardData.configName = d->startPage.configName();
d->wizardData.osVersion = d->startPage.osVersion();
d->wizardData.osType = d->startPage.osType();
d->wizardData.deviceType = d->startPage.deviceType();
d->wizardData.hostName = d->startPage.hostName();
if (d->wizardData.deviceType == LinuxDeviceConfiguration::Emulator) {
return FinalPageId;
} else if (d->wizardData.osVersion == LinuxDeviceConfiguration::GenericLinux) {
} else if (d->wizardData.osType == LinuxDeviceConfiguration::GenericLinuxOsType) {
return LoginDataPageId;
} else {
return PreviousKeySetupCheckPageId;

View File

@@ -82,17 +82,17 @@ bool MaemoGlobal::isMeegoTargetId(const QString &id)
bool MaemoGlobal::isValidMaemo5QtVersion(const QString &qmakePath)
{
return isValidMaemoQtVersion(qmakePath, LinuxDeviceConfiguration::Maemo5);
return isValidMaemoQtVersion(qmakePath, LinuxDeviceConfiguration::Maemo5OsType);
}
bool MaemoGlobal::isValidHarmattanQtVersion(const QString &qmakePath)
{
return isValidMaemoQtVersion(qmakePath, LinuxDeviceConfiguration::Maemo6);
return isValidMaemoQtVersion(qmakePath, LinuxDeviceConfiguration::HarmattanOsType);
}
bool MaemoGlobal::isValidMeegoQtVersion(const QString &qmakePath)
{
return isValidMaemoQtVersion(qmakePath, LinuxDeviceConfiguration::Meego);
return isValidMaemoQtVersion(qmakePath, LinuxDeviceConfiguration::MeeGoOsType);
}
bool MaemoGlobal::isLinuxQt(const QtSupport::BaseQtVersion *qtVersion)
@@ -118,10 +118,9 @@ bool MaemoGlobal::hasLinuxQt(const ProjectExplorer::Target *target)
return bc && isLinuxQt(bc->qtVersion());
}
bool MaemoGlobal::isValidMaemoQtVersion(const QString &qmakePath,
LinuxDeviceConfiguration::OsVersion maemoVersion)
bool MaemoGlobal::isValidMaemoQtVersion(const QString &qmakePath, const QString &osType)
{
if (version(qmakePath) != maemoVersion)
if (MaemoGlobal::osType(qmakePath) != osType)
return false;
QProcess madAdminProc;
const QStringList arguments(QLatin1String("list"));
@@ -154,33 +153,32 @@ QString MaemoGlobal::devrootshPath()
return QLatin1String("/usr/lib/mad-developer/devrootsh");
}
int MaemoGlobal::applicationIconSize(LinuxDeviceConfiguration::OsVersion osVersion)
int MaemoGlobal::applicationIconSize(const QString &osType)
{
return osVersion == LinuxDeviceConfiguration::Maemo6 ? 80 : 64;
return osType == LinuxDeviceConfiguration::HarmattanOsType ? 80 : 64;
}
QString MaemoGlobal::remoteSudo(LinuxDeviceConfiguration::OsVersion osVersion,
const QString &uname)
QString MaemoGlobal::remoteSudo(const QString &osType, const QString &uname)
{
if (uname == QLatin1String("root"))
return QString();
switch (osVersion) {
case LinuxDeviceConfiguration::Maemo5:
case LinuxDeviceConfiguration::Maemo6:
case LinuxDeviceConfiguration::Meego:
if (osType == LinuxDeviceConfiguration::Maemo5OsType
|| osType == LinuxDeviceConfiguration::HarmattanOsType
|| osType == LinuxDeviceConfiguration::MeeGoOsType) {
return devrootshPath();
default:
return QString(); // Using sudo would open a can of worms.
}
return QString(); // Using sudo would open a can of worms.
}
QString MaemoGlobal::remoteCommandPrefix(LinuxDeviceConfiguration::OsVersion osVersion,
const QString &userName, const QString &commandFilePath)
QString MaemoGlobal::remoteCommandPrefix(const QString &osType, const QString &userName,
const QString &commandFilePath)
{
QString prefix = QString::fromLocal8Bit("%1 chmod a+x %2; %3; ")
.arg(remoteSudo(osVersion, userName), commandFilePath, remoteSourceProfilesCommand());
if (osVersion != LinuxDeviceConfiguration::Maemo5 && osVersion != LinuxDeviceConfiguration::Maemo6)
.arg(remoteSudo(osType, userName), commandFilePath, remoteSourceProfilesCommand());
if (osType != LinuxDeviceConfiguration::Maemo5OsType
&& osType != LinuxDeviceConfiguration::HarmattanOsType) {
prefix += QLatin1String("DISPLAY=:0.0 ");
}
return prefix;
}
@@ -266,22 +264,22 @@ QString MaemoGlobal::madCommand(const QString &qmakePath)
return maddeRoot(qmakePath) + QLatin1String("/bin/mad");
}
QString MaemoGlobal::madDeveloperUiName(LinuxDeviceConfiguration::OsVersion osVersion)
QString MaemoGlobal::madDeveloperUiName(const QString &osType)
{
return osVersion == LinuxDeviceConfiguration::Maemo6
return osType == LinuxDeviceConfiguration::HarmattanOsType
? tr("SDK Connectivity") : tr("Mad Developer");
}
LinuxDeviceConfiguration::OsVersion MaemoGlobal::version(const QString &qmakePath)
QString MaemoGlobal::osType(const QString &qmakePath)
{
const QString &name = targetName(qmakePath);
if (name.startsWith(QLatin1String("fremantle")))
return LinuxDeviceConfiguration::Maemo5;
return LinuxDeviceConfiguration::Maemo5OsType;
if (name.startsWith(QLatin1String("harmattan")))
return LinuxDeviceConfiguration::Maemo6;
return LinuxDeviceConfiguration::HarmattanOsType;
if (name.startsWith(QLatin1String("meego")))
return LinuxDeviceConfiguration::Meego;
return LinuxDeviceConfiguration::GenericLinux;
return LinuxDeviceConfiguration::MeeGoOsType;
return LinuxDeviceConfiguration::GenericLinuxOsType;
}
QString MaemoGlobal::architecture(const QString &qmakePath)
@@ -430,27 +428,26 @@ QStringList MaemoGlobal::targetArgs(const QString &qmakePath, bool useTarget)
return args;
}
QString MaemoGlobal::osVersionToString(LinuxDeviceConfiguration::OsVersion version)
QString MaemoGlobal::osTypeToString(const QString &osType)
{
switch (version) {
case LinuxDeviceConfiguration::Maemo5: return QLatin1String("Maemo5/Fremantle");
case LinuxDeviceConfiguration::Maemo6: return QLatin1String("Harmattan");
case LinuxDeviceConfiguration::Meego: return QLatin1String("Meego");
case LinuxDeviceConfiguration::GenericLinux: return QLatin1String("Other Linux");
}
qDebug("%s: Unknown OS Version %d.", Q_FUNC_INFO, version);
return QString();
if (osType == LinuxDeviceConfiguration::Maemo5OsType)
return QLatin1String("Maemo5/Fremantle");
if (osType == LinuxDeviceConfiguration::HarmattanOsType)
return QLatin1String("Harmattan");
if (osType == LinuxDeviceConfiguration::MeeGoOsType)
return QLatin1String("MeeGo");
return QLatin1String("Other Linux");
}
MaemoGlobal::PackagingSystem MaemoGlobal::packagingSystem(LinuxDeviceConfiguration::OsVersion osVersion)
MaemoGlobal::PackagingSystem MaemoGlobal::packagingSystem(const QString &osType)
{
switch (osVersion) {
case LinuxDeviceConfiguration::Maemo5: case LinuxDeviceConfiguration::Maemo6: return Dpkg;
case LinuxDeviceConfiguration::Meego: return Rpm;
case LinuxDeviceConfiguration::GenericLinux: return Tar;
default: qFatal("%s: Missing case in switch.", Q_FUNC_INFO);
if (osType == LinuxDeviceConfiguration::Maemo5OsType
|| osType == LinuxDeviceConfiguration::HarmattanOsType) {
return Dpkg;
}
return static_cast<PackagingSystem>(-1);
if (osType == LinuxDeviceConfiguration::MeeGoOsType)
return Rpm;
return Tar;
}
} // namespace Internal

View File

@@ -106,10 +106,9 @@ public:
static QString homeDirOnDevice(const QString &uname);
static QString devrootshPath();
static int applicationIconSize(LinuxDeviceConfiguration::OsVersion osVersion);
static QString remoteSudo(LinuxDeviceConfiguration::OsVersion,
const QString &uname);
static QString remoteCommandPrefix(LinuxDeviceConfiguration::OsVersion osVersion,
static int applicationIconSize(const QString &osType);
static QString remoteSudo(const QString &osType, const QString &uname);
static QString remoteCommandPrefix(const QString &osType,
const QString &userName, const QString &commandFilePath);
static QString remoteEnvironment(const QList<Utils::EnvironmentItem> &list);
static QString remoteSourceProfilesCommand();
@@ -123,8 +122,8 @@ public:
static QString targetRoot(const QString &qmakePath);
static QString targetName(const QString &qmakePath);
static QString madCommand(const QString &qmakePath);
static QString madDeveloperUiName(LinuxDeviceConfiguration::OsVersion maemoVersion);
static LinuxDeviceConfiguration::OsVersion version(const QString &qmakePath);
static QString madDeveloperUiName(const QString &osType);
static QString osType(const QString &qmakePath);
// TODO: IS this still needed with Qt Version having an Abi?
static QString architecture(const QString &qmakePath);
@@ -134,9 +133,9 @@ public:
static bool callMadAdmin(QProcess &proc, const QStringList &args,
const QString &qmakePath, bool useTarget);
static QString osVersionToString(LinuxDeviceConfiguration::OsVersion version);
static QString osTypeToString(const QString &osType);
static PackagingSystem packagingSystem(LinuxDeviceConfiguration::OsVersion osVersion);
static PackagingSystem packagingSystem(const QString &osType);
static bool removeRecursively(const QString &filePath, QString &error);
static bool copyRecursively(const QString &srcFilePath,
@@ -176,8 +175,7 @@ public:
}
}
static bool isValidMaemoQtVersion(const QString &qmakePath,
LinuxDeviceConfiguration::OsVersion maemoVersion);
static bool isValidMaemoQtVersion(const QString &qmakePath, const QString &osType);
private:
static QString madAdminCommand(const QString &qmakePath);
static bool callMaddeShellScript(QProcess &proc, const QString &qmakePath,

View File

@@ -70,7 +70,7 @@ void AbstractMaemoPackageInstaller::installPackage(const SshConnection::Ptr &con
const QString space = QLatin1String(" ");
QString cmdLine = QLatin1String("cd ") + workingDirectory()
+ QLatin1String(" && ")
+ MaemoGlobal::remoteSudo(devConf->osVersion(),
+ MaemoGlobal::remoteSudo(devConf->osType(),
m_installer->connection()->connectionParameters().userName)
+ space + installCommand()
+ space + installCommandArguments().join(space) + space

View File

@@ -43,13 +43,13 @@ MaemoPerTargetDeviceConfigurationListModel::MaemoPerTargetDeviceConfigurationLis
const Target *target) : QAbstractListModel(parent)
{
if (qobject_cast<const Qt4Maemo5Target *>(target))
m_targetOsVersion = LinuxDeviceConfiguration::Maemo5;
m_targetOsType = LinuxDeviceConfiguration::Maemo5OsType;
else if (qobject_cast<const Qt4HarmattanTarget *>(target))
m_targetOsVersion = LinuxDeviceConfiguration::Maemo6;
m_targetOsType = LinuxDeviceConfiguration::HarmattanOsType;
else if (qobject_cast<const Qt4MeegoTarget *>(target))
m_targetOsVersion = LinuxDeviceConfiguration::Meego;
m_targetOsType = LinuxDeviceConfiguration::MeeGoOsType;
else
m_targetOsVersion = LinuxDeviceConfiguration::GenericLinux;
m_targetOsType = LinuxDeviceConfiguration::GenericLinuxOsType;
const LinuxDeviceConfigurations * const devConfs
= LinuxDeviceConfigurations::instance();
connect(devConfs, SIGNAL(modelReset()), this, SIGNAL(modelReset()));
@@ -68,10 +68,10 @@ int MaemoPerTargetDeviceConfigurationListModel::rowCount(const QModelIndex &pare
const LinuxDeviceConfigurations * const devConfs
= LinuxDeviceConfigurations::instance();
const int devConfsCount = devConfs->rowCount();
if (m_targetOsVersion == LinuxDeviceConfiguration::GenericLinux)
if (m_targetOsType == LinuxDeviceConfiguration::GenericLinuxOsType)
return devConfsCount;
for (int i = 0; i < devConfsCount; ++i) {
if (devConfs->deviceAt(i)->osVersion() == m_targetOsVersion)
if (devConfs->deviceAt(i)->osType() == m_targetOsType)
++count;
}
return count;
@@ -85,7 +85,7 @@ QVariant MaemoPerTargetDeviceConfigurationListModel::data(const QModelIndex &ind
const LinuxDeviceConfiguration::ConstPtr &devConf = deviceAt(index.row());
Q_ASSERT(devConf);
QString displayedName = devConf->name();
if (devConf->isDefault() && devConf->osVersion() == m_targetOsVersion)
if (devConf->isDefault() && devConf->osType() == m_targetOsType)
displayedName += QLatin1Char(' ') + tr("(default)");
return displayedName;
}
@@ -95,11 +95,11 @@ LinuxDeviceConfiguration::ConstPtr MaemoPerTargetDeviceConfigurationListModel::d
int currentRow = -1;
const LinuxDeviceConfigurations * const devConfs
= LinuxDeviceConfigurations::instance();
if (m_targetOsVersion == LinuxDeviceConfiguration::GenericLinux)
if (m_targetOsType == LinuxDeviceConfiguration::GenericLinuxOsType)
return devConfs->deviceAt(idx);
const int devConfsCount = devConfs->rowCount();
for (int i = 0; i < devConfsCount; ++i) {
if (devConfs->deviceAt(i)->osVersion() == m_targetOsVersion) {
if (devConfs->deviceAt(i)->osType() == m_targetOsType) {
if (++currentRow == idx)
return devConfs->deviceAt(i);
}
@@ -110,15 +110,15 @@ LinuxDeviceConfiguration::ConstPtr MaemoPerTargetDeviceConfigurationListModel::d
LinuxDeviceConfiguration::ConstPtr MaemoPerTargetDeviceConfigurationListModel::defaultDeviceConfig() const
{
return LinuxDeviceConfigurations::instance()->defaultDeviceConfig(m_targetOsVersion);
return LinuxDeviceConfigurations::instance()->defaultDeviceConfig(m_targetOsType);
}
LinuxDeviceConfiguration::ConstPtr MaemoPerTargetDeviceConfigurationListModel::find(LinuxDeviceConfiguration::Id id) const
{
const LinuxDeviceConfiguration::ConstPtr &devConf
= LinuxDeviceConfigurations::instance()->find(id);
return devConf && (devConf->osVersion() == m_targetOsVersion
|| m_targetOsVersion == LinuxDeviceConfiguration::GenericLinux)
return devConf && (devConf->osType() == m_targetOsType
|| m_targetOsType == LinuxDeviceConfiguration::GenericLinuxOsType)
? devConf : defaultDeviceConfig();
}

View File

@@ -64,7 +64,7 @@ signals:
void updated();
private:
LinuxDeviceConfiguration::OsVersion m_targetOsVersion;
QString m_targetOsType;
};
} // namespace Internal

View File

@@ -85,7 +85,7 @@ void MaemoPublishingBuildSettingsPageFremantleFree::collectBuildConfigurations(c
QtSupport::BaseQtVersion *lqt = qt4Bc->qtVersion();
if (!lqt)
continue;
if (MaemoGlobal::version(lqt->qmakeCommand()) == LinuxDeviceConfiguration::Maemo5)
if (MaemoGlobal::osType(lqt->qmakeCommand()) == LinuxDeviceConfiguration::Maemo5OsType)
m_buildConfigs << qt4Bc;
}
break;

View File

@@ -82,7 +82,7 @@ bool MaemoPublishingWizardFactoryFremantleFree::canCreateWizard(const Project *p
QtSupport::BaseQtVersion *qt = qt4Bc->qtVersion();
if (!qt)
continue;
if (MaemoGlobal::version(qt->qmakeCommand()) == LinuxDeviceConfiguration::Maemo5)
if (MaemoGlobal::osType(qt->qmakeCommand()) == LinuxDeviceConfiguration::Maemo5OsType)
return true;
}
break;

View File

@@ -53,8 +53,8 @@ MaemoQtVersion::MaemoQtVersion() : QtSupport::BaseQtVersion()
MaemoQtVersion::MaemoQtVersion(const QString &path, bool isAutodetected, const QString &autodetectionSource)
: QtSupport::BaseQtVersion(path, isAutodetected, autodetectionSource),
m_osVersion(MaemoGlobal::version(path)),
m_isvalidVersion(MaemoGlobal::isValidMaemoQtVersion(path, m_osVersion))
m_osType(MaemoGlobal::osType(path)),
m_isvalidVersion(MaemoGlobal::isValidMaemoQtVersion(path, m_osType))
{
}
@@ -68,8 +68,8 @@ void MaemoQtVersion::fromMap(const QVariantMap &map)
{
QtSupport::BaseQtVersion::fromMap(map);
QString path = qmakeCommand();
m_osVersion = MaemoGlobal::version(path);
m_isvalidVersion = MaemoGlobal::isValidMaemoQtVersion(path, m_osVersion);
m_osType = MaemoGlobal::osType(path);
m_isvalidVersion = MaemoGlobal::isValidMaemoQtVersion(path, m_osType);
}
QString MaemoQtVersion::type() const
@@ -109,16 +109,16 @@ QList<ProjectExplorer::Abi> MaemoQtVersion::qtAbis() const
QList<ProjectExplorer::Abi> result;
if (!m_isvalidVersion)
return result;
if (m_osVersion == LinuxDeviceConfiguration::Maemo5) {
if (m_osType == LinuxDeviceConfiguration::Maemo5OsType) {
result.append(ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture, ProjectExplorer::Abi::LinuxOS,
ProjectExplorer::Abi::MaemoLinuxFlavor, ProjectExplorer::Abi::ElfFormat,
32));
} else if (m_osVersion == LinuxDeviceConfiguration::Maemo6) {
} else if (m_osType == LinuxDeviceConfiguration::HarmattanOsType) {
result.append(ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture, ProjectExplorer::Abi::LinuxOS,
ProjectExplorer::Abi::HarmattanLinuxFlavor,
ProjectExplorer::Abi::ElfFormat,
32));
} else if (m_osVersion == LinuxDeviceConfiguration::Meego) {
} else if (m_osType == LinuxDeviceConfiguration::MeeGoOsType) {
result.append(ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture, ProjectExplorer::Abi::LinuxOS,
ProjectExplorer::Abi::MeegoLinuxFlavor,
ProjectExplorer::Abi::ElfFormat, 32));
@@ -136,11 +136,11 @@ QSet<QString> MaemoQtVersion::supportedTargetIds() const
QSet<QString> result;
if (!m_isvalidVersion)
return result;
if (m_osVersion == LinuxDeviceConfiguration::Maemo5) {
if (m_osType == LinuxDeviceConfiguration::Maemo5OsType) {
result.insert(QLatin1String(Constants::MAEMO5_DEVICE_TARGET_ID));
} else if (m_osVersion == LinuxDeviceConfiguration::Maemo6) {
} else if (m_osType == LinuxDeviceConfiguration::HarmattanOsType) {
result.insert(QLatin1String(Constants::HARMATTAN_DEVICE_TARGET_ID));
} else if (m_osVersion == LinuxDeviceConfiguration::Meego) {
} else if (m_osType == LinuxDeviceConfiguration::MeeGoOsType) {
result.insert(QLatin1String(Constants::MEEGO_DEVICE_TARGET_ID));
}
return result;
@@ -148,11 +148,11 @@ QSet<QString> MaemoQtVersion::supportedTargetIds() const
QString MaemoQtVersion::description() const
{
if (m_osVersion == LinuxDeviceConfiguration::Maemo5)
if (m_osType == LinuxDeviceConfiguration::Maemo5OsType)
return QCoreApplication::translate("QtVersion", "Maemo", "Qt Version is meant for Maemo5");
else if (m_osVersion == LinuxDeviceConfiguration::Maemo6)
else if (m_osType == LinuxDeviceConfiguration::HarmattanOsType)
return QCoreApplication::translate("QtVersion", "Harmattan ", "Qt Version is meant for Harmattan");
else if (m_osVersion == LinuxDeviceConfiguration::Meego)
else if (m_osType == LinuxDeviceConfiguration::MeeGoOsType)
return QCoreApplication::translate("QtVersion", "Meego", "Qt Version is meant for Meego");
return QString();
}
@@ -165,9 +165,9 @@ bool MaemoQtVersion::supportsShadowBuilds() const
return true;
}
LinuxDeviceConfiguration::OsVersion MaemoQtVersion::osVersion() const
QString MaemoQtVersion::osType() const
{
return m_osVersion;
return m_osType;
}
} // namespace Internal

View File

@@ -59,10 +59,10 @@ public:
virtual QString description() const;
virtual bool supportsShadowBuilds() const;
LinuxDeviceConfiguration::OsVersion osVersion() const;
QString osType() const;
private:
mutable QString m_systemRoot;
mutable LinuxDeviceConfiguration::OsVersion m_osVersion;
mutable QString m_osType;
mutable bool m_isvalidVersion;
};

View File

@@ -139,7 +139,7 @@ void MaemoRemoteCopyFacility::copyNextFile()
#endif
QString command = QString::fromLatin1("%1 mkdir -p %3 && %1 cp -r %2 %3")
.arg(MaemoGlobal::remoteSudo(m_devConf->osVersion(),
.arg(MaemoGlobal::remoteSudo(m_devConf->osType(),
m_copyRunner->connection()->connectionParameters().userName),
sourceFilePath, d.remoteDir);
emit progress(tr("Copying file '%1' to directory '%2' on the device...")

View File

@@ -126,7 +126,7 @@ void MaemoRemoteMounter::unmount()
}
QString remoteCall;
const QString remoteSudo = MaemoGlobal::remoteSudo(m_devConf->osVersion(),
const QString remoteSudo = MaemoGlobal::remoteSudo(m_devConf->osType(),
m_connection->connectionParameters().userName);
for (int i = 0; i < m_mountSpecs.count(); ++i) {
remoteCall += QString::fromLocal8Bit("%1 umount %2 && %1 rmdir %2;")
@@ -189,7 +189,7 @@ void MaemoRemoteMounter::stop()
void MaemoRemoteMounter::startUtfsClients()
{
const QString userName = m_connection->connectionParameters().userName;
const QString chmodFuse = MaemoGlobal::remoteSudo(m_devConf->osVersion(),
const QString chmodFuse = MaemoGlobal::remoteSudo(m_devConf->osType(),
userName) + QLatin1String(" chmod a+r+w /dev/fuse");
const QString chmodUtfsClient
= QLatin1String("chmod a+x ") + utfsClientOnDevice();
@@ -206,7 +206,7 @@ void MaemoRemoteMounter::startUtfsClients()
}
const QString remoteSudo
= MaemoGlobal::remoteSudo(m_devConf->osVersion(), userName);
= MaemoGlobal::remoteSudo(m_devConf->osType(), userName);
const MaemoMountSpecification &mountSpec = mountInfo.mountSpec;
const QString mkdir = QString::fromLocal8Bit("%1 mkdir -p %2")
.arg(remoteSudo, mountSpec.remoteMountPoint);
@@ -217,7 +217,7 @@ void MaemoRemoteMounter::startUtfsClients()
.arg(utfsClientOnDevice()).arg(mountInfo.remotePort)
.arg(mountSpec.remoteMountPoint);
if (mountInfo.mountAsRoot) {
utfsClient.prepend(MaemoGlobal::remoteSudo(m_devConf->osVersion(),
utfsClient.prepend(MaemoGlobal::remoteSudo(m_devConf->osType(),
userName) + QLatin1Char(' '));
}
QLatin1String seqOp("; ");

View File

@@ -59,7 +59,7 @@ MaemoRemoteProcessesDialog::MaemoRemoteProcessesDialog(const LinuxDeviceConfigur
// Manually gathered process information is missing the command line for
// some system processes. Dont's show these lines by default.
if (devConfig->osVersion() == LinuxDeviceConfiguration::Maemo5)
if (devConfig->osType() == LinuxDeviceConfiguration::Maemo5OsType)
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() == LinuxDeviceConfiguration::Maemo5) {
if (m_devConfig->osType() == LinuxDeviceConfiguration::Maemo5OsType) {
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() == LinuxDeviceConfiguration::Maemo5;
const bool isFremantle = m_devConfig->osType() == LinuxDeviceConfiguration::Maemo5OsType;
const QString remoteOutput = QString::fromUtf8(m_remoteStdout);
const QByteArray lineSeparator = isFremantle ? LineSeparator : "\n";
QStringList lines = remoteOutput.split(QString::fromUtf8(lineSeparator));

View File

@@ -192,11 +192,11 @@ void MaemoToolChain::setQtVersionId(int id)
MaemoQtVersion *version = dynamic_cast<MaemoQtVersion *>(QtSupport::QtVersionManager::instance()->version(id));
Q_ASSERT(version);
ProjectExplorer::Abi::OSFlavor flavour = ProjectExplorer::Abi::HarmattanLinuxFlavor;
if (version->osVersion() == LinuxDeviceConfiguration::Maemo5)
if (version->osType() == LinuxDeviceConfiguration::Maemo5OsType)
flavour = ProjectExplorer::Abi::MaemoLinuxFlavor;
else if (version->osVersion() == LinuxDeviceConfiguration::Maemo6)
else if (version->osType() == LinuxDeviceConfiguration::HarmattanOsType)
flavour = ProjectExplorer::Abi::HarmattanLinuxFlavor;
else if (version->osVersion() == LinuxDeviceConfiguration::Meego)
else if (version->osType() == LinuxDeviceConfiguration::MeeGoOsType)
flavour = ProjectExplorer::Abi::MeegoLinuxFlavor;
else
return;

View File

@@ -64,7 +64,7 @@ void MaemoUsedPortsGatherer::start(const Utils::SshConnection::Ptr &connection,
SLOT(handleRemoteStdOut(QByteArray)));
connect(m_procRunner.data(), SIGNAL(processErrorOutputAvailable(QByteArray)),
SLOT(handleRemoteStdErr(QByteArray)));
const QString command = MaemoGlobal::remoteSudo(devConf->osVersion(),
const QString command = MaemoGlobal::remoteSudo(devConf->osType(),
m_procRunner->connection()->connectionParameters().userName)
+ QLatin1String(" lsof -nPi4tcp:") + devConf->freePorts().toString()
+ QLatin1String(" -F n |grep '^n' |sed -r 's/[^:]*:([[:digit:]]+).*/\\1/g' |sort -n |uniq");

View File

@@ -310,7 +310,7 @@ QString RemoteLinuxRunConfiguration::commandPrefix() const
return QString();
return QString::fromLocal8Bit("%1 %2")
.arg(MaemoGlobal::remoteCommandPrefix(deviceConfig()->osVersion(),
.arg(MaemoGlobal::remoteCommandPrefix(deviceConfig()->osType(),
deviceConfig()->sshParameters().userName, remoteExecutableFilePath()))
.arg(MaemoGlobal::remoteEnvironment(userEnvironmentChanges()));
}