Commit 9b27d80f authored by Christian Kandeler's avatar Christian Kandeler
Browse files

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: default avatarTobias Hunger <tobias.hunger@nokia.com>
parent c062dbe7
......@@ -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
......@@ -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;
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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;
......
......@@ -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
......
......@@ -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)"));
......
......@@ -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"));
......
......@@ -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: