RemoteLinux: Expose some currently internal classes.

This is needed in the short term to reverse the direction of
the dependency between this plugin and the analyzer.
It is expected that there'll be more users in the future.

Change-Id: I9603e8dfa70e442394ba5e8671c6353b65c46374
Reviewed-on: http://codereview.qt.nokia.com/266
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
Christian Kandeler
2011-05-31 12:47:53 +02:00
parent e08b797ea5
commit eb1336daac
66 changed files with 1363 additions and 1233 deletions

View File

@@ -31,6 +31,7 @@
**************************************************************************/ **************************************************************************/
#include "abstractlinuxdevicedeploystep.h" #include "abstractlinuxdevicedeploystep.h"
#include "linuxdeviceconfigurations.h"
#include "maemoconstants.h" #include "maemoconstants.h"
#include "maemodeploystepwidget.h" #include "maemodeploystepwidget.h"
#include "maemopertargetdeviceconfigurationlistmodel.h" #include "maemopertargetdeviceconfigurationlistmodel.h"
@@ -77,10 +78,10 @@ LinuxDeviceDeployStepHelper::~LinuxDeviceDeployStepHelper() {}
void LinuxDeviceDeployStepHelper::handleDeviceConfigurationsUpdated() void LinuxDeviceDeployStepHelper::handleDeviceConfigurationsUpdated()
{ {
setDeviceConfig(MaemoDeviceConfigurations::instance()->internalId(m_deviceConfig)); setDeviceConfig(LinuxDeviceConfigurations::instance()->internalId(m_deviceConfig));
} }
void LinuxDeviceDeployStepHelper::setDeviceConfig(MaemoDeviceConfig::Id internalId) void LinuxDeviceDeployStepHelper::setDeviceConfig(LinuxDeviceConfiguration::Id internalId)
{ {
m_deviceConfig = deployConfiguration()->deviceConfigModel()->find(internalId); m_deviceConfig = deployConfiguration()->deviceConfigModel()->find(internalId);
emit deviceConfigChanged(); emit deviceConfigChanged();
@@ -96,13 +97,13 @@ QVariantMap LinuxDeviceDeployStepHelper::toMap() const
{ {
QVariantMap map; QVariantMap map;
map.insert(DeviceIdKey, map.insert(DeviceIdKey,
MaemoDeviceConfigurations::instance()->internalId(m_deviceConfig)); LinuxDeviceConfigurations::instance()->internalId(m_deviceConfig));
return map; return map;
} }
bool LinuxDeviceDeployStepHelper::fromMap(const QVariantMap &map) bool LinuxDeviceDeployStepHelper::fromMap(const QVariantMap &map)
{ {
setDeviceConfig(map.value(DeviceIdKey, MaemoDeviceConfig::InvalidId).toULongLong()); setDeviceConfig(map.value(DeviceIdKey, LinuxDeviceConfiguration::InvalidId).toULongLong());
return true; return true;
} }

View File

@@ -32,7 +32,7 @@
#ifndef ABSTRACTLINUXDEVICEDEPLOYSTEP_H #ifndef ABSTRACTLINUXDEVICEDEPLOYSTEP_H
#define ABSTRACTLINUXDEVICEDEPLOYSTEP_H #define ABSTRACTLINUXDEVICEDEPLOYSTEP_H
#include "maemodeviceconfigurations.h" #include "linuxdeviceconfiguration.h"
#include <QtCore/QCoreApplication> #include <QtCore/QCoreApplication>
#include <QtCore/QSharedPointer> #include <QtCore/QSharedPointer>
@@ -52,8 +52,8 @@ public:
LinuxDeviceDeployStepHelper(Qt4MaemoDeployConfiguration *dc); LinuxDeviceDeployStepHelper(Qt4MaemoDeployConfiguration *dc);
~LinuxDeviceDeployStepHelper(); ~LinuxDeviceDeployStepHelper();
QSharedPointer<const MaemoDeviceConfig> deviceConfig() const { return m_deviceConfig; } QSharedPointer<const LinuxDeviceConfiguration> deviceConfig() const { return m_deviceConfig; }
QSharedPointer<const MaemoDeviceConfig> cachedDeviceConfig() const { return m_cachedDeviceConfig; } QSharedPointer<const LinuxDeviceConfiguration> cachedDeviceConfig() const { return m_cachedDeviceConfig; }
Qt4MaemoDeployConfiguration *deployConfiguration() const { return m_deployConfiguration; } Qt4MaemoDeployConfiguration *deployConfiguration() const { return m_deployConfiguration; }
void setDeviceConfig(int i); void setDeviceConfig(int i);
@@ -66,11 +66,11 @@ signals:
void deviceConfigChanged(); void deviceConfigChanged();
private: private:
void setDeviceConfig(MaemoDeviceConfig::Id internalId); void setDeviceConfig(LinuxDeviceConfiguration::Id internalId);
Q_SLOT void handleDeviceConfigurationsUpdated(); Q_SLOT void handleDeviceConfigurationsUpdated();
QSharedPointer<const MaemoDeviceConfig> m_deviceConfig; QSharedPointer<const LinuxDeviceConfiguration> m_deviceConfig;
QSharedPointer<const MaemoDeviceConfig> m_cachedDeviceConfig; QSharedPointer<const LinuxDeviceConfiguration> m_cachedDeviceConfig;
Qt4MaemoDeployConfiguration * const m_deployConfiguration; Qt4MaemoDeployConfiguration * const m_deployConfiguration;
}; };

View File

@@ -248,7 +248,7 @@ void AbstractMaemoDeployStep::start()
m_hasError = false; m_hasError = false;
if (isDeploymentNeeded(helper().cachedDeviceConfig()->sshParameters().host)) { if (isDeploymentNeeded(helper().cachedDeviceConfig()->sshParameters().host)) {
if (helper().cachedDeviceConfig()->type() == MaemoDeviceConfig::Emulator if (helper().cachedDeviceConfig()->type() == LinuxDeviceConfiguration::Emulator
&& !MaemoQemuManager::instance().qemuIsRunning()) { && !MaemoQemuManager::instance().qemuIsRunning()) {
MaemoQemuManager::instance().startRuntime(); MaemoQemuManager::instance().startRuntime();
raiseError(tr("Cannot deploy: Qemu was not running. " raiseError(tr("Cannot deploy: Qemu was not running. "

View File

@@ -34,9 +34,9 @@
#define ABSTRACTMAEMODEPLOYSTEP_H #define ABSTRACTMAEMODEPLOYSTEP_H
#include "abstractlinuxdevicedeploystep.h" #include "abstractlinuxdevicedeploystep.h"
#include "linuxdeviceconfiguration.h"
#include "maemodeployable.h" #include "maemodeployable.h"
#include "maemodeployables.h" #include "maemodeployables.h"
#include "maemodeviceconfigurations.h"
#include <projectexplorer/buildstep.h> #include <projectexplorer/buildstep.h>
@@ -53,9 +53,10 @@ namespace Qt4ProjectManager { class Qt4BuildConfiguration; }
namespace Utils { class SshConnection; } namespace Utils { class SshConnection; }
namespace RemoteLinux { namespace RemoteLinux {
class LinuxDeviceConfiguration;
namespace Internal { namespace Internal {
class AbstractMaemoPackageCreationStep; class AbstractMaemoPackageCreationStep;
class MaemoDeviceConfig;
class Qt4MaemoDeployConfiguration; class Qt4MaemoDeployConfiguration;
class AbstractMaemoDeployStep class AbstractMaemoDeployStep

View File

@@ -0,0 +1,399 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#include "linuxdeviceconfiguration.h"
#include <QtCore/QSettings>
#include <QtGui/QDesktopServices>
typedef Utils::SshConnectionParameters::AuthenticationType AuthType;
namespace RemoteLinux {
namespace {
const QLatin1String NameKey("Name");
const QLatin1String OsVersionKey("OsVersion");
const QLatin1String TypeKey("Type");
const QLatin1String HostKey("Host");
const QLatin1String SshPortKey("SshPort");
const QLatin1String PortsSpecKey("FreePortsSpec");
const QLatin1String UserNameKey("Uname");
const QLatin1String AuthKey("Authentication");
const QLatin1String KeyFileKey("KeyFile");
const QLatin1String PasswordKey("Password");
const QLatin1String TimeoutKey("Timeout");
const QLatin1String IsDefaultKey("IsDefault");
const QLatin1String InternalIdKey("InternalId");
const int DefaultSshPortHW(22);
const int DefaultSshPortSim(6666);
const int DefaultGdbServerPortHW(10000);
const int DefaultGdbServerPortSim(13219);
const AuthType DefaultAuthType(Utils::SshConnectionParameters::AuthenticationByKey);
const int DefaultTimeout(30);
const LinuxDeviceConfiguration::DeviceType DefaultDeviceType(LinuxDeviceConfiguration::Physical);
class PortsSpecParser
{
struct ParseException {
ParseException(const char *error) : error(error) {}
const char * const error;
};
public:
PortsSpecParser(const QString &portsSpec)
: m_pos(0), m_portsSpec(portsSpec) { }
/*
* Grammar: Spec -> [ ElemList ]
* ElemList -> Elem [ ',' ElemList ]
* Elem -> Port [ '-' Port ]
*/
PortList parse()
{
try {
if (!atEnd())
parseElemList();
} catch (ParseException &e) {
qWarning("Malformed ports specification: %s", e.error);
}
return m_portList;
}
private:
void parseElemList()
{
if (atEnd())
throw ParseException("Element list empty.");
parseElem();
if (atEnd())
return;
if (nextChar() != ',') {
throw ParseException("Element followed by something else "
"than a comma.");
}
++m_pos;
parseElemList();
}
void parseElem()
{
const int startPort = parsePort();
if (atEnd() || nextChar() != '-') {
m_portList.addPort(startPort);
return;
}
++m_pos;
const int endPort = parsePort();
if (endPort < startPort)
throw ParseException("Invalid range (end < start).");
m_portList.addRange(startPort, endPort);
}
int parsePort()
{
if (atEnd())
throw ParseException("Empty port string.");
int port = 0;
do {
const char next = nextChar();
if (!std::isdigit(next))
break;
port = 10*port + next - '0';
++m_pos;
} while (!atEnd());
if (port == 0 || port >= 2 << 16)
throw ParseException("Invalid port value.");
return port;
}
bool atEnd() const { return m_pos == m_portsSpec.length(); }
char nextChar() const { return m_portsSpec.at(m_pos).toAscii(); }
PortList m_portList;
int m_pos;
const QString &m_portsSpec;
};
} // anonymous namespace
void PortList::addPort(int port) { addRange(port, port); }
void PortList::addRange(int startPort, int endPort)
{
m_ranges << Range(startPort, endPort);
}
bool PortList::hasMore() const { return !m_ranges.isEmpty(); }
int PortList::count() const
{
int n = 0;
foreach (const Range &r, m_ranges)
n += r.second - r.first + 1;
return n;
}
int PortList::getNext()
{
Q_ASSERT(!m_ranges.isEmpty());
Range &firstRange = m_ranges.first();
const int next = firstRange.first++;
if (firstRange.first > firstRange.second)
m_ranges.removeFirst();
return next;
}
QString PortList::toString() const
{
QString stringRep;
foreach (const Range &range, m_ranges) {
stringRep += QString::number(range.first);
if (range.second != range.first)
stringRep += QLatin1Char('-') + QString::number(range.second);
stringRep += QLatin1Char(',');
}
if (!stringRep.isEmpty())
stringRep.remove(stringRep.length() - 1, 1); // Trailing comma.
return stringRep;
}
LinuxDeviceConfiguration::Ptr LinuxDeviceConfiguration::create(const QSettings &settings,
Id &nextId)
{
return Ptr(new LinuxDeviceConfiguration(settings, nextId));
}
LinuxDeviceConfiguration::Ptr LinuxDeviceConfiguration::create(const ConstPtr &other)
{
return Ptr(new LinuxDeviceConfiguration(other));
}
LinuxDeviceConfiguration::Ptr LinuxDeviceConfiguration::createHardwareConfig(const QString &name,
LinuxDeviceConfiguration::OsVersion osVersion, 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.privateKeyFile = privateKeyFilePath;
return Ptr(new LinuxDeviceConfiguration(name, osVersion, Physical, sshParams, nextId));
}
LinuxDeviceConfiguration::Ptr LinuxDeviceConfiguration::createGenericLinuxConfigUsingPassword(const QString &name,
const QString &hostName, const QString &userName, const QString &password,
Id &nextId)
{
Utils::SshConnectionParameters sshParams(Utils::SshConnectionParameters::NoProxy);
sshParams.authenticationType
= Utils::SshConnectionParameters::AuthenticationByPassword;
sshParams.host = hostName;
sshParams.userName = userName;
sshParams.password = password;
return Ptr(new LinuxDeviceConfiguration(name, LinuxDeviceConfiguration::GenericLinux, Physical,
sshParams, nextId));
}
LinuxDeviceConfiguration::Ptr LinuxDeviceConfiguration::createGenericLinuxConfigUsingKey(const QString &name,
const QString &hostName, const QString &userName, const QString &privateKeyFile,
Id &nextId)
{
Utils::SshConnectionParameters sshParams(Utils::SshConnectionParameters::NoProxy);
sshParams.authenticationType
= Utils::SshConnectionParameters::AuthenticationByKey;
sshParams.host = hostName;
sshParams.userName = userName;
sshParams.privateKeyFile = privateKeyFile;
return Ptr(new LinuxDeviceConfiguration(name, LinuxDeviceConfiguration::GenericLinux, Physical,
sshParams, nextId));
}
LinuxDeviceConfiguration::Ptr LinuxDeviceConfiguration::createEmulatorConfig(const QString &name,
LinuxDeviceConfiguration::OsVersion osVersion, 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));
}
LinuxDeviceConfiguration::LinuxDeviceConfiguration(const QString &name,
LinuxDeviceConfiguration::OsVersion osVersion, DeviceType devType,
const Utils::SshConnectionParameters &sshParams, Id &nextId)
: m_sshParameters(sshParams),
m_name(name),
m_osVersion(osVersion),
m_type(devType),
m_portsSpec(defaultPortsSpec(m_type)),
m_isDefault(false),
m_internalId(nextId++)
{
m_sshParameters.port = defaultSshPort(m_type);
m_sshParameters.timeout = DefaultTimeout;
}
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_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();
m_sshParameters.port = settings.value(SshPortKey, defaultSshPort(m_type)).toInt();
m_sshParameters.userName = settings.value(UserNameKey, defaultUser(m_osVersion)).toString();
m_sshParameters.authenticationType
= static_cast<AuthType>(settings.value(AuthKey, DefaultAuthType).toInt());
m_sshParameters.password = settings.value(PasswordKey).toString();
m_sshParameters.privateKeyFile
= settings.value(KeyFileKey, defaultPrivateKeyFilePath()).toString();
m_sshParameters.timeout = settings.value(TimeoutKey, DefaultTimeout).toInt();
}
LinuxDeviceConfiguration::LinuxDeviceConfiguration(const LinuxDeviceConfiguration::ConstPtr &other)
: m_sshParameters(other->m_sshParameters),
m_name(other->m_name),
m_osVersion(other->m_osVersion),
m_type(other->type()),
m_portsSpec(other->m_portsSpec),
m_isDefault(other->m_isDefault),
m_internalId(other->m_internalId)
{
}
QString LinuxDeviceConfiguration::portsRegExpr()
{
const QLatin1String portExpr("(\\d)+");
const QString listElemExpr = QString::fromLatin1("%1(-%1)?").arg(portExpr);
return QString::fromLatin1("((%1)(,%1)*)?").arg(listElemExpr);
}
int LinuxDeviceConfiguration::defaultSshPort(DeviceType type)
{
return type == Physical ? DefaultSshPortHW : DefaultSshPortSim;
}
QString LinuxDeviceConfiguration::defaultPortsSpec(DeviceType type) const
{
return QLatin1String(type == Physical ? "10000-10100" : "13219,14168");
}
QString LinuxDeviceConfiguration::defaultHost(DeviceType type, LinuxDeviceConfiguration::OsVersion osVersion)
{
switch (osVersion) {
case LinuxDeviceConfiguration::Maemo5:
case LinuxDeviceConfiguration::Maemo6:
case LinuxDeviceConfiguration::Meego:
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();
}
}
QString LinuxDeviceConfiguration::defaultPrivateKeyFilePath()
{
return QDesktopServices::storageLocation(QDesktopServices::HomeLocation)
+ QLatin1String("/.ssh/id_rsa");
}
QString LinuxDeviceConfiguration::defaultPublicKeyFilePath()
{
return defaultPrivateKeyFilePath() + QLatin1String(".pub");
}
QString LinuxDeviceConfiguration::defaultUser(LinuxDeviceConfiguration::OsVersion osVersion)
{
switch (osVersion) {
case LinuxDeviceConfiguration::Maemo5:
case LinuxDeviceConfiguration::Maemo6:
return QLatin1String("developer");
case LinuxDeviceConfiguration::Meego:
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)
{
switch (osVersion) {
case LinuxDeviceConfiguration::Maemo5:
case LinuxDeviceConfiguration::Maemo6:
return QString();
case LinuxDeviceConfiguration::Meego:
return QLatin1String("meego");
default:
qDebug("%s: Unknown OS Version %d.", Q_FUNC_INFO, osVersion);
return QString();
}
}
PortList LinuxDeviceConfiguration::freePorts() const
{
return PortsSpecParser(m_portsSpec).parse();
}
void LinuxDeviceConfiguration::save(QSettings &settings) const
{
settings.setValue(NameKey, m_name);
settings.setValue(OsVersionKey, m_osVersion);
settings.setValue(TypeKey, m_type);
settings.setValue(HostKey, m_sshParameters.host);
settings.setValue(SshPortKey, m_sshParameters.port);
settings.setValue(PortsSpecKey, m_portsSpec);
settings.setValue(UserNameKey, m_sshParameters.userName);
settings.setValue(AuthKey, m_sshParameters.authenticationType);
settings.setValue(PasswordKey, m_sshParameters.password);
settings.setValue(KeyFileKey, m_sshParameters.privateKeyFile);
settings.setValue(TimeoutKey, m_sshParameters.timeout);
settings.setValue(IsDefaultKey, m_isDefault);
settings.setValue(InternalIdKey, m_internalId);
}
const LinuxDeviceConfiguration::Id LinuxDeviceConfiguration::InvalidId = 0;
} // namespace RemoteLinux

View File

@@ -29,14 +29,13 @@
** Nokia at info@qt.nokia.com. ** Nokia at info@qt.nokia.com.
** **
**************************************************************************/ **************************************************************************/
#ifndef LINUXDEVICECONFIGURATION_H
#define LINUXDEVICECONFIGURATION_H
#ifndef MAEMODEVICECONFIGURATIONS_H #include "remotelinux_export.h"
#define MAEMODEVICECONFIGURATIONS_H
#include <utils/ssh/sshconnection.h> #include <utils/ssh/sshconnection.h>
#include <QtCore/QAbstractListModel>
#include <QtCore/QList>
#include <QtCore/QPair> #include <QtCore/QPair>
#include <QtCore/QSharedPointer> #include <QtCore/QSharedPointer>
#include <QtCore/QString> #include <QtCore/QString>
@@ -45,10 +44,13 @@ QT_BEGIN_NAMESPACE
class QSettings; class QSettings;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal { namespace Internal {
class LinuxDeviceConfigurations;
}
class MaemoPortList class REMOTELINUX_EXPORT PortList
{ {
public: public:
void addPort(int port); void addPort(int port);
@@ -64,16 +66,16 @@ private:
}; };
class MaemoDeviceConfig class REMOTELINUX_EXPORT LinuxDeviceConfiguration
{ {
friend class MaemoDeviceConfigurations; friend class Internal::LinuxDeviceConfigurations;
public: public:
typedef QSharedPointer<const MaemoDeviceConfig> ConstPtr; typedef QSharedPointer<const LinuxDeviceConfiguration> ConstPtr;
typedef quint64 Id; typedef quint64 Id;
enum OsVersion { Maemo5, Maemo6, Meego, GenericLinux }; enum OsVersion { Maemo5, Maemo6, Meego, GenericLinux };
enum DeviceType { Physical, Emulator }; enum DeviceType { Physical, Emulator };
MaemoPortList freePorts() const; PortList freePorts() const;
Utils::SshConnectionParameters sshParameters() const { return m_sshParameters; } Utils::SshConnectionParameters sshParameters() const { return m_sshParameters; }
QString name() const { return m_name; } QString name() const { return m_name; }
OsVersion osVersion() const { return m_osVersion; } OsVersion osVersion() const { return m_osVersion; }
@@ -92,16 +94,16 @@ public:
static const Id InvalidId; static const Id InvalidId;
private: private:
typedef QSharedPointer<MaemoDeviceConfig> Ptr; typedef QSharedPointer<LinuxDeviceConfiguration> Ptr;
MaemoDeviceConfig(const QString &name, OsVersion osVersion, LinuxDeviceConfiguration(const QString &name, OsVersion osVersion,
DeviceType type, const Utils::SshConnectionParameters &sshParams, DeviceType type, const Utils::SshConnectionParameters &sshParams,
Id &nextId); Id &nextId);
MaemoDeviceConfig(const QSettings &settings, Id &nextId); LinuxDeviceConfiguration(const QSettings &settings, Id &nextId);
MaemoDeviceConfig(const ConstPtr &other); LinuxDeviceConfiguration(const ConstPtr &other);
MaemoDeviceConfig(const MaemoDeviceConfig &); LinuxDeviceConfiguration(const LinuxDeviceConfiguration &);
MaemoDeviceConfig &operator=(const MaemoDeviceConfig &); LinuxDeviceConfiguration &operator=(const LinuxDeviceConfiguration &);
static Ptr createHardwareConfig(const QString &name, OsVersion osVersion, static Ptr createHardwareConfig(const QString &name, OsVersion osVersion,
const QString &hostName, const QString &privateKeyFilePath, Id &nextId); const QString &hostName, const QString &privateKeyFilePath, Id &nextId);
@@ -129,66 +131,6 @@ private:
}; };
class MaemoDeviceConfigurations : public QAbstractListModel
{
Q_OBJECT
Q_DISABLE_COPY(MaemoDeviceConfigurations)
public:
static MaemoDeviceConfigurations *instance(QObject *parent = 0);
static void replaceInstance(const MaemoDeviceConfigurations *other);
static MaemoDeviceConfigurations *cloneInstance();
MaemoDeviceConfig::ConstPtr deviceAt(int index) const;
MaemoDeviceConfig::ConstPtr find(MaemoDeviceConfig::Id id) 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;
void setDefaultSshKeyFilePath(const QString &path) { m_defaultSshKeyFilePath = path; }
QString defaultSshKeyFilePath() const { return m_defaultSshKeyFilePath; }
void addHardwareDeviceConfiguration(const QString &name,
MaemoDeviceConfig::OsVersion osVersion, 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,
MaemoDeviceConfig::OsVersion osVersion);
void removeConfiguration(int index);
void setConfigurationName(int i, const QString &name);
void setSshParameters(int i, const Utils::SshConnectionParameters &params);
void setPortsSpec(int i, const QString &portsSpec);
void setDefaultDevice(int index);
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
virtual QVariant data(const QModelIndex &index,
int role = Qt::DisplayRole) const;
signals:
void updated();
private:
MaemoDeviceConfigurations(QObject *parent);
void load();
void save();
static void copy(const MaemoDeviceConfigurations *source,
MaemoDeviceConfigurations *target, bool deep);
void addConfiguration(const MaemoDeviceConfig::Ptr &devConfig);
void ensureDefaultExists(MaemoDeviceConfig::OsVersion osVersion);
static MaemoDeviceConfigurations *m_instance;
MaemoDeviceConfig::Id m_nextId;
QList<MaemoDeviceConfig::Ptr> m_devConfigs;
QString m_defaultSshKeyFilePath;
};
} // namespace Internal
} // namespace RemoteLinux } // namespace RemoteLinux
#endif // MAEMODEVICECONFIGURATIONS_H #endif // LINUXDEVICECONFIGURATION_H

View File

@@ -0,0 +1,333 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#include "linuxdeviceconfigurations.h"
#include "maemoglobal.h"
#include <coreplugin/icore.h>
#include <QtCore/QCoreApplication>
#include <QtCore/QSettings>
#include <QtCore/QStringBuilder>
#include <algorithm>
#include <cctype>
namespace RemoteLinux {
namespace Internal {
namespace {
const QLatin1String SettingsGroup("MaemoDeviceConfigs");
const QLatin1String IdCounterKey("IdCounter");
const QLatin1String ConfigListKey("ConfigList");
const QLatin1String DefaultKeyFilePathKey("DefaultKeyFile");
}
class DevConfNameMatcher
{
public:
DevConfNameMatcher(const QString &name) : m_name(name) {}
bool operator()(const LinuxDeviceConfiguration::ConstPtr &devConfig)
{
return devConfig->name() == m_name;
}
private:
const QString m_name;
};
LinuxDeviceConfigurations *LinuxDeviceConfigurations::instance(QObject *parent)
{
if (m_instance == 0) {
m_instance = new LinuxDeviceConfigurations(parent);
m_instance->load();
}
return m_instance;
}
void LinuxDeviceConfigurations::replaceInstance(const LinuxDeviceConfigurations *other)
{
Q_ASSERT(m_instance);
m_instance->beginResetModel();
copy(other, m_instance, false);
m_instance->save();
m_instance->endResetModel();
emit m_instance->updated();
}
LinuxDeviceConfigurations *LinuxDeviceConfigurations::cloneInstance()
{
LinuxDeviceConfigurations * const other = new LinuxDeviceConfigurations(0);
copy(m_instance, other, true);
return other;
}
void LinuxDeviceConfigurations::copy(const LinuxDeviceConfigurations *source,
LinuxDeviceConfigurations *target, bool deep)
{
if (deep) {
foreach (const LinuxDeviceConfiguration::ConstPtr &devConf, source->m_devConfigs)
target->m_devConfigs << LinuxDeviceConfiguration::create(devConf);
} else {
target->m_devConfigs = source->m_devConfigs;
}
target->m_defaultSshKeyFilePath = source->m_defaultSshKeyFilePath;
target->m_nextId = source->m_nextId;
}
void LinuxDeviceConfigurations::save()
{
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(SettingsGroup);
settings->setValue(IdCounterKey, m_nextId);
settings->setValue(DefaultKeyFilePathKey, m_defaultSshKeyFilePath);
settings->beginWriteArray(ConfigListKey, m_devConfigs.count());
for (int i = 0; i < m_devConfigs.count(); ++i) {
settings->setArrayIndex(i);
m_devConfigs.at(i)->save(*settings);
}
settings->endArray();
settings->endGroup();
}
void LinuxDeviceConfigurations::addHardwareDeviceConfiguration(const QString &name,
LinuxDeviceConfiguration::OsVersion osVersion, const QString &hostName,
const QString &privateKeyFilePath)
{
const LinuxDeviceConfiguration::Ptr &devConf = LinuxDeviceConfiguration::createHardwareConfig(name,
osVersion, hostName, privateKeyFilePath, m_nextId);
addConfiguration(devConf);
}
void LinuxDeviceConfigurations::addGenericLinuxConfigurationUsingPassword(const QString &name,
const QString &hostName, const QString &userName, const QString &password)
{
const LinuxDeviceConfiguration::Ptr &devConf
= LinuxDeviceConfiguration::createGenericLinuxConfigUsingPassword(name,
hostName, userName, password, m_nextId);
addConfiguration(devConf);
}
void LinuxDeviceConfigurations::addGenericLinuxConfigurationUsingKey(const QString &name,
const QString &hostName, const QString &userName, const QString &privateKeyFilePath)
{
const LinuxDeviceConfiguration::Ptr &devConf = LinuxDeviceConfiguration::createGenericLinuxConfigUsingKey(name,
hostName, userName, privateKeyFilePath, m_nextId);
addConfiguration(devConf);
}
void LinuxDeviceConfigurations::addEmulatorDeviceConfiguration(const QString &name,
LinuxDeviceConfiguration::OsVersion osVersion)
{
const LinuxDeviceConfiguration::Ptr &devConf
= LinuxDeviceConfiguration::createEmulatorConfig(name, osVersion, m_nextId);
addConfiguration(devConf);
}
void LinuxDeviceConfigurations::addConfiguration(const LinuxDeviceConfiguration::Ptr &devConfig)
{
beginInsertRows(QModelIndex(), rowCount(), rowCount());
if (!defaultDeviceConfig(devConfig->osVersion()))
devConfig->m_isDefault = true;
m_devConfigs << devConfig;
endInsertRows();
}
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();
m_devConfigs.removeAt(idx);
endRemoveRows();
if (wasDefault) {
for (int i = 0; i < m_devConfigs.count(); ++i) {
if (deviceAt(i)->osVersion() == osVersion) {
m_devConfigs.at(i)->m_isDefault = true;
const QModelIndex changedIndex = index(i, 0);
emit dataChanged(changedIndex, changedIndex);
break;
}
}
}
}
void LinuxDeviceConfigurations::setConfigurationName(int i, const QString &name)
{
Q_ASSERT(i >= 0 && i < rowCount());
m_devConfigs.at(i)->m_name = name;
const QModelIndex changedIndex = index(i, 0);
emit dataChanged(changedIndex, changedIndex);
}
void LinuxDeviceConfigurations::setSshParameters(int i,
const Utils::SshConnectionParameters &params)
{
Q_ASSERT(i >= 0 && i < rowCount());
m_devConfigs.at(i)->m_sshParameters = params;
}
void LinuxDeviceConfigurations::setPortsSpec(int i, const QString &portsSpec)
{
Q_ASSERT(i >= 0 && i < rowCount());
m_devConfigs.at(i)->m_portsSpec = portsSpec;
}
void LinuxDeviceConfigurations::setDefaultDevice(int idx)
{
Q_ASSERT(idx >= 0 && idx < rowCount());
const LinuxDeviceConfiguration::Ptr &devConf = m_devConfigs.at(idx);
if (devConf->m_isDefault)
return;
QModelIndex oldDefaultIndex;
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->m_isDefault = false;
oldDefaultIndex = index(i, 0);
break;
}
}
Q_ASSERT(oldDefaultIndex.isValid());
emit dataChanged(oldDefaultIndex, oldDefaultIndex);
devConf->m_isDefault = true;
const QModelIndex newDefaultIndex = index(idx, 0);
emit dataChanged(newDefaultIndex, newDefaultIndex);
}
LinuxDeviceConfigurations::LinuxDeviceConfigurations(QObject *parent)
: QAbstractListModel(parent)
{
}
void LinuxDeviceConfigurations::load()
{
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(SettingsGroup);
m_nextId = settings->value(IdCounterKey, 1).toULongLong();
m_defaultSshKeyFilePath = settings->value(DefaultKeyFilePathKey,
LinuxDeviceConfiguration::defaultPrivateKeyFilePath()).toString();
int count = settings->beginReadArray(ConfigListKey);
for (int i = 0; i < count; ++i) {
settings->setArrayIndex(i);
LinuxDeviceConfiguration::Ptr devConf
= LinuxDeviceConfiguration::create(*settings, m_nextId);
m_devConfigs << devConf;
}
settings->endArray();
settings->endGroup();
ensureDefaultExists(LinuxDeviceConfiguration::Maemo5);
ensureDefaultExists(LinuxDeviceConfiguration::Maemo6);
ensureDefaultExists(LinuxDeviceConfiguration::Meego);
ensureDefaultExists(LinuxDeviceConfiguration::GenericLinux);
}
LinuxDeviceConfiguration::ConstPtr LinuxDeviceConfigurations::deviceAt(int idx) const
{
Q_ASSERT(idx >= 0 && idx < rowCount());
return m_devConfigs.at(idx);
}
bool LinuxDeviceConfigurations::hasConfig(const QString &name) const
{
QList<LinuxDeviceConfiguration::Ptr>::ConstIterator resultIt =
std::find_if(m_devConfigs.constBegin(), m_devConfigs.constEnd(),
DevConfNameMatcher(name));
return resultIt != m_devConfigs.constEnd();
}
LinuxDeviceConfiguration::ConstPtr LinuxDeviceConfigurations::find(LinuxDeviceConfiguration::Id id) const
{
const int index = indexForInternalId(id);
return index == -1 ? LinuxDeviceConfiguration::ConstPtr() : deviceAt(index);
}
LinuxDeviceConfiguration::ConstPtr LinuxDeviceConfigurations::defaultDeviceConfig(const LinuxDeviceConfiguration::OsVersion osVersion) const
{
foreach (const LinuxDeviceConfiguration::ConstPtr &devConf, m_devConfigs) {
if (devConf->m_isDefault && devConf->osVersion() == osVersion)
return devConf;
}
return LinuxDeviceConfiguration::ConstPtr();
}
int LinuxDeviceConfigurations::indexForInternalId(LinuxDeviceConfiguration::Id internalId) const
{
for (int i = 0; i < m_devConfigs.count(); ++i) {
if (deviceAt(i)->m_internalId == internalId)
return i;
}
return -1;
}
LinuxDeviceConfiguration::Id LinuxDeviceConfigurations::internalId(LinuxDeviceConfiguration::ConstPtr devConf) const
{
return devConf ? devConf->m_internalId : LinuxDeviceConfiguration::InvalidId;
}
void LinuxDeviceConfigurations::ensureDefaultExists(LinuxDeviceConfiguration::OsVersion osVersion)
{
if (!defaultDeviceConfig(osVersion)) {
foreach (const LinuxDeviceConfiguration::Ptr &devConf, m_devConfigs) {
if (devConf->osVersion() == osVersion) {
devConf->m_isDefault = true;
break;
}
}
}
}
int LinuxDeviceConfigurations::rowCount(const QModelIndex &parent) const
{
Q_UNUSED(parent);
return m_devConfigs.count();
}
QVariant LinuxDeviceConfigurations::data(const QModelIndex &index, int role) const
{
if (!index.isValid() || index.row() >= rowCount() || role != Qt::DisplayRole)
return QVariant();
const LinuxDeviceConfiguration::ConstPtr devConf = deviceAt(index.row());
QString name = devConf->name();
if (devConf->m_isDefault) {
name += QLatin1Char(' ') + tr("(default for %1)")
.arg(MaemoGlobal::osVersionToString(devConf->osVersion()));
}
return name;
}
LinuxDeviceConfigurations *LinuxDeviceConfigurations::m_instance = 0;
} // namespace Internal
} // namespace RemoteLinux

View File

@@ -0,0 +1,109 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#ifndef MAEMODEVICECONFIGURATIONS_H
#define MAEMODEVICECONFIGURATIONS_H
#include "linuxdeviceconfiguration.h"
#include <QtCore/QAbstractListModel>
#include <QtCore/QList>
#include <QtCore/QSharedPointer>
#include <QtCore/QString>
namespace RemoteLinux {
namespace Internal {
class LinuxDeviceConfigurations : public QAbstractListModel
{
Q_OBJECT
Q_DISABLE_COPY(LinuxDeviceConfigurations)
public:
static LinuxDeviceConfigurations *instance(QObject *parent = 0);
static void replaceInstance(const LinuxDeviceConfigurations *other);
static LinuxDeviceConfigurations *cloneInstance();
LinuxDeviceConfiguration::ConstPtr deviceAt(int index) const;
LinuxDeviceConfiguration::ConstPtr find(LinuxDeviceConfiguration::Id id) const;
LinuxDeviceConfiguration::ConstPtr defaultDeviceConfig(const LinuxDeviceConfiguration::OsVersion osVersion) const;
bool hasConfig(const QString &name) const;
int indexForInternalId(LinuxDeviceConfiguration::Id internalId) const;
LinuxDeviceConfiguration::Id internalId(LinuxDeviceConfiguration::ConstPtr devConf) const;
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 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 removeConfiguration(int index);
void setConfigurationName(int i, const QString &name);
void setSshParameters(int i, const Utils::SshConnectionParameters &params);
void setPortsSpec(int i, const QString &portsSpec);
void setDefaultDevice(int index);
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
virtual QVariant data(const QModelIndex &index,
int role = Qt::DisplayRole) const;
signals:
void updated();
private:
LinuxDeviceConfigurations(QObject *parent);
void load();
void save();
static void copy(const LinuxDeviceConfigurations *source,
LinuxDeviceConfigurations *target, bool deep);
void addConfiguration(const LinuxDeviceConfiguration::Ptr &devConfig);
void ensureDefaultExists(LinuxDeviceConfiguration::OsVersion osVersion);
static LinuxDeviceConfigurations *m_instance;
LinuxDeviceConfiguration::Id m_nextId;
QList<LinuxDeviceConfiguration::Ptr> m_devConfigs;
QString m_defaultSshKeyFilePath;
};
} // namespace Internal
} // namespace RemoteLinux
#endif // MAEMODEVICECONFIGURATIONS_H

View File

@@ -47,11 +47,11 @@ using namespace ProjectExplorer;
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal { namespace Internal {
RunControl *MaemoAnalyzerSupport::createAnalyzerRunControl(MaemoRunConfiguration *runConfig) RunControl *MaemoAnalyzerSupport::createAnalyzerRunControl(RemoteLinuxRunConfiguration *runConfig)
{ {
AnalyzerStartParameters params; AnalyzerStartParameters params;
const MaemoDeviceConfig::ConstPtr &devConf = runConfig->deviceConfig(); const LinuxDeviceConfiguration::ConstPtr &devConf = runConfig->deviceConfig();
params.debuggee = runConfig->remoteExecutableFilePath(); params.debuggee = runConfig->remoteExecutableFilePath();
params.debuggeeArgs = runConfig->arguments(); params.debuggeeArgs = runConfig->arguments();
params.analyzerCmdPrefix = MaemoGlobal::remoteCommandPrefix(devConf->osVersion(), params.analyzerCmdPrefix = MaemoGlobal::remoteCommandPrefix(devConf->osVersion(),

View File

@@ -33,14 +33,14 @@
#ifndef MAEMOANALYZERSUPPORT_H #ifndef MAEMOANALYZERSUPPORT_H
#define MAEMOANALYZERSUPPORT_H #define MAEMOANALYZERSUPPORT_H
#include "maemorunconfiguration.h" #include "remotelinuxrunconfiguration.h"
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal { namespace Internal {
namespace MaemoAnalyzerSupport { namespace MaemoAnalyzerSupport {
ProjectExplorer::RunControl *createAnalyzerRunControl(MaemoRunConfiguration *runConfig); ProjectExplorer::RunControl *createAnalyzerRunControl(RemoteLinuxRunConfiguration *runConfig);
} }

View File

@@ -32,7 +32,7 @@
#include "maemoconfigtestdialog.h" #include "maemoconfigtestdialog.h"
#include "ui_maemoconfigtestdialog.h" #include "ui_maemoconfigtestdialog.h"
#include "maemodeviceconfigurations.h" #include "linuxdeviceconfiguration.h"
#include "maemoglobal.h" #include "maemoglobal.h"
#include "maemousedportsgatherer.h" #include "maemousedportsgatherer.h"
@@ -46,7 +46,7 @@ using namespace Utils;
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal { namespace Internal {
MaemoConfigTestDialog::MaemoConfigTestDialog(const MaemoDeviceConfig::ConstPtr &config, MaemoConfigTestDialog::MaemoConfigTestDialog(const LinuxDeviceConfiguration::ConstPtr &config,
QWidget *parent) QWidget *parent)
: QDialog(parent) : QDialog(parent)
, m_ui(new Ui_MaemoConfigTestDialog) , m_ui(new Ui_MaemoConfigTestDialog)
@@ -78,7 +78,7 @@ void MaemoConfigTestDialog::startConfigTest()
return; return;
m_currentTest = GeneralTest; m_currentTest = GeneralTest;
const QString testingText = m_config->type() == MaemoDeviceConfig::Emulator const QString testingText = m_config->type() == LinuxDeviceConfiguration::Emulator
? tr("Testing configuration. This may take a while.") ? tr("Testing configuration. This may take a while.")
: tr("Testing configuration..."); : tr("Testing configuration...");
m_ui->testResultEdit->setPlainText(testingText); m_ui->testResultEdit->setPlainText(testingText);
@@ -122,7 +122,7 @@ void MaemoConfigTestDialog::handleConnectionError()
return; return;
QString output = tr("Could not connect to host: %1") QString output = tr("Could not connect to host: %1")
.arg(m_testProcessRunner->connection()->errorString()); .arg(m_testProcessRunner->connection()->errorString());
if (m_config->type() == MaemoDeviceConfig::Emulator) if (m_config->type() == LinuxDeviceConfiguration::Emulator)
output += tr("\nDid you start Qemu?"); output += tr("\nDid you start Qemu?");
m_ui->testResultEdit->setPlainText(output); m_ui->testResultEdit->setPlainText(output);
stopConfigTest(); stopConfigTest();
@@ -159,9 +159,9 @@ void MaemoConfigTestDialog::handleGeneralTestResult(int exitStatus)
} }
switch (m_config->osVersion()) { switch (m_config->osVersion()) {
case MaemoDeviceConfig::Maemo5: case LinuxDeviceConfiguration::Maemo5:
case MaemoDeviceConfig::Maemo6: case LinuxDeviceConfiguration::Maemo6:
case MaemoDeviceConfig::Meego: case LinuxDeviceConfiguration::Meego:
m_currentTest = MadDeveloperTest; m_currentTest = MadDeveloperTest;
disconnect(m_testProcessRunner.data(), disconnect(m_testProcessRunner.data(),
SIGNAL(processOutputAvailable(QByteArray)), this, SIGNAL(processOutputAvailable(QByteArray)), this,
@@ -184,7 +184,7 @@ void MaemoConfigTestDialog::handleMadDeveloperTestResult(int exitStatus)
+ tr("%1 is not installed.<br>You will not be able to deploy " + tr("%1 is not installed.<br>You will not be able to deploy "
"to this device.") "to this device.")
.arg(MaemoGlobal::madDeveloperUiName(m_config->osVersion())); .arg(MaemoGlobal::madDeveloperUiName(m_config->osVersion()));
if (m_config->osVersion() == MaemoDeviceConfig::Maemo6) { if (m_config->osVersion() == LinuxDeviceConfiguration::Maemo6) {
errorMsg += QLatin1String("<br>") errorMsg += QLatin1String("<br>")
+ tr("Please switch the device to developer mode via Settings -> Security."); + tr("Please switch the device to developer mode via Settings -> Security.");
} }

View File

@@ -45,9 +45,9 @@ namespace Utils {
} // namespace Utils } // namespace Utils
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal { class LinuxDeviceConfiguration;
class MaemoDeviceConfig; namespace Internal {
class MaemoUsedPortsGatherer; class MaemoUsedPortsGatherer;
/** /**
@@ -57,7 +57,7 @@ class MaemoConfigTestDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit MaemoConfigTestDialog(const QSharedPointer<const MaemoDeviceConfig> &config, explicit MaemoConfigTestDialog(const QSharedPointer<const LinuxDeviceConfiguration> &config,
QWidget *parent = 0); QWidget *parent = 0);
~MaemoConfigTestDialog(); ~MaemoConfigTestDialog();
@@ -80,7 +80,7 @@ private:
Ui_MaemoConfigTestDialog *m_ui; Ui_MaemoConfigTestDialog *m_ui;
QPushButton *m_closeButton; QPushButton *m_closeButton;
const QSharedPointer<const MaemoDeviceConfig> m_config; const QSharedPointer<const LinuxDeviceConfiguration> m_config;
QSharedPointer<Utils::SshRemoteProcessRunner> m_testProcessRunner; QSharedPointer<Utils::SshRemoteProcessRunner> m_testProcessRunner;
QString m_deviceTestOutput; QString m_deviceTestOutput;
bool m_qtVersionOk; bool m_qtVersionOk;

View File

@@ -65,7 +65,7 @@ static const QLatin1String UseRemoteGdbKey(PREFIX ".UseRemoteGdb");
namespace Constants { namespace Constants {
const char * const MAEMO_SETTINGS_CATEGORY = "X.Maemo"; const char * const MAEMO_SETTINGS_CATEGORY = "X.Maemo";
const char * const MAEMO_SETTINGS_TR_CATEGORY = QT_TRANSLATE_NOOP("Qt4ProjectManager", "Maemo"); const char * const MAEMO_SETTINGS_TR_CATEGORY = QT_TRANSLATE_NOOP("Qt4ProjectManager", "Linux Devices");
const char * const MAEMO_SETTINGS_CATEGORY_ICON = ":/projectexplorer/images/MaemoDevice.png"; const char * const MAEMO_SETTINGS_CATEGORY_ICON = ":/projectexplorer/images/MaemoDevice.png";
} }

View File

@@ -56,18 +56,18 @@ using namespace ProjectExplorer;
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal { namespace Internal {
RunControl *MaemoDebugSupport::createDebugRunControl(MaemoRunConfiguration *runConfig) RunControl *MaemoDebugSupport::createDebugRunControl(RemoteLinuxRunConfiguration *runConfig)
{ {
DebuggerStartParameters params; DebuggerStartParameters params;
const MaemoDeviceConfig::ConstPtr &devConf = runConfig->deviceConfig(); const LinuxDeviceConfiguration::ConstPtr &devConf = runConfig->deviceConfig();
const MaemoRunConfiguration::DebuggingType debuggingType const RemoteLinuxRunConfiguration::DebuggingType debuggingType
= runConfig->debuggingType(); = runConfig->debuggingType();
if (debuggingType != MaemoRunConfiguration::DebugCppOnly) { if (debuggingType != RemoteLinuxRunConfiguration::DebugCppOnly) {
params.qmlServerAddress = runConfig->deviceConfig()->sshParameters().host; params.qmlServerAddress = runConfig->deviceConfig()->sshParameters().host;
params.qmlServerPort = -1; params.qmlServerPort = -1;
} }
if (debuggingType != MaemoRunConfiguration::DebugQmlOnly) { if (debuggingType != RemoteLinuxRunConfiguration::DebugQmlOnly) {
params.processArgs = runConfig->arguments(); params.processArgs = runConfig->arguments();
if (runConfig->activeQt4BuildConfiguration()->qtVersion()) if (runConfig->activeQt4BuildConfiguration()->qtVersion())
params.sysroot = runConfig->activeQt4BuildConfiguration()->qtVersion()->systemRoot(); params.sysroot = runConfig->activeQt4BuildConfiguration()->qtVersion()->systemRoot();
@@ -113,7 +113,7 @@ RunControl *MaemoDebugSupport::createDebugRunControl(MaemoRunConfiguration *runC
DebuggerRunControl * const runControl = DebuggerRunControl * const runControl =
DebuggerPlugin::createDebugger(params, runConfig); DebuggerPlugin::createDebugger(params, runConfig);
bool useGdb = params.startMode == StartRemoteGdb bool useGdb = params.startMode == StartRemoteGdb
&& debuggingType != MaemoRunConfiguration::DebugQmlOnly; && debuggingType != RemoteLinuxRunConfiguration::DebugQmlOnly;
MaemoDebugSupport *debugSupport = MaemoDebugSupport *debugSupport =
new MaemoDebugSupport(runConfig, runControl->engine(), useGdb); new MaemoDebugSupport(runConfig, runControl->engine(), useGdb);
connect(runControl, SIGNAL(finished()), connect(runControl, SIGNAL(finished()),
@@ -121,7 +121,7 @@ RunControl *MaemoDebugSupport::createDebugRunControl(MaemoRunConfiguration *runC
return runControl; return runControl;
} }
MaemoDebugSupport::MaemoDebugSupport(MaemoRunConfiguration *runConfig, MaemoDebugSupport::MaemoDebugSupport(RemoteLinuxRunConfiguration *runConfig,
DebuggerEngine *engine, bool useGdb) DebuggerEngine *engine, bool useGdb)
: QObject(engine), m_engine(engine), m_runConfig(runConfig), : QObject(engine), m_engine(engine), m_runConfig(runConfig),
m_deviceConfig(m_runConfig->deviceConfig()), m_deviceConfig(m_runConfig->deviceConfig()),
@@ -180,11 +180,11 @@ void MaemoDebugSupport::startExecution()
ASSERT_STATE(StartingRunner); ASSERT_STATE(StartingRunner);
if (!useGdb() && m_debuggingType != MaemoRunConfiguration::DebugQmlOnly) { if (!useGdb() && m_debuggingType != RemoteLinuxRunConfiguration::DebugQmlOnly) {
if (!setPort(m_gdbServerPort)) if (!setPort(m_gdbServerPort))
return; return;
} }
if (m_debuggingType != MaemoRunConfiguration::DebugCppOnly) { if (m_debuggingType != RemoteLinuxRunConfiguration::DebugCppOnly) {
if (!setPort(m_qmlPort)) if (!setPort(m_qmlPort))
return; return;
} }
@@ -200,7 +200,7 @@ void MaemoDebugSupport::startExecution()
SLOT(handleRemoteErrorOutput(QByteArray))); SLOT(handleRemoteErrorOutput(QByteArray)));
connect(m_runner, SIGNAL(remoteOutput(QByteArray)), this, connect(m_runner, SIGNAL(remoteOutput(QByteArray)), this,
SLOT(handleRemoteOutput(QByteArray))); SLOT(handleRemoteOutput(QByteArray)));
if (m_debuggingType == MaemoRunConfiguration::DebugQmlOnly) { if (m_debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly) {
connect(m_runner, SIGNAL(remoteProcessStarted()), connect(m_runner, SIGNAL(remoteProcessStarted()),
SLOT(handleRemoteProcessStarted())); SLOT(handleRemoteProcessStarted()));
} }
@@ -209,12 +209,12 @@ void MaemoDebugSupport::startExecution()
m_deviceConfig->sshParameters().userName, remoteExe); m_deviceConfig->sshParameters().userName, remoteExe);
const QString env = MaemoGlobal::remoteEnvironment(m_userEnvChanges); const QString env = MaemoGlobal::remoteEnvironment(m_userEnvChanges);
QString args = m_runner->arguments(); QString args = m_runner->arguments();
if (m_debuggingType != MaemoRunConfiguration::DebugCppOnly) { if (m_debuggingType != RemoteLinuxRunConfiguration::DebugCppOnly) {
args += QString(QLatin1String(" -qmljsdebugger=port:%1,block")) args += QString(QLatin1String(" -qmljsdebugger=port:%1,block"))
.arg(m_qmlPort); .arg(m_qmlPort);
} }
const QString remoteCommandLine = m_debuggingType == MaemoRunConfiguration::DebugQmlOnly const QString remoteCommandLine = m_debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly
? QString::fromLocal8Bit("%1 %2 %3 %4").arg(cmdPrefix).arg(env) ? QString::fromLocal8Bit("%1 %2 %3 %4").arg(cmdPrefix).arg(env)
.arg(remoteExe).arg(args) .arg(remoteExe).arg(args)
: QString::fromLocal8Bit("%1 %2 gdbserver :%3 %4 %5") : QString::fromLocal8Bit("%1 %2 gdbserver :%3 %4 %5")
@@ -231,10 +231,10 @@ void MaemoDebugSupport::handleRemoteProcessFinished(qint64 exitCode)
return; return;
if (m_state == Debugging) { if (m_state == Debugging) {
if (m_debuggingType != MaemoRunConfiguration::DebugQmlOnly) if (m_debuggingType != RemoteLinuxRunConfiguration::DebugQmlOnly)
m_engine->notifyInferiorIll(); m_engine->notifyInferiorIll();
} else { } else {
const QString errorMsg = m_debuggingType == MaemoRunConfiguration::DebugQmlOnly const QString errorMsg = m_debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly
? tr("Remote application failed with exit code %1.").arg(exitCode) ? tr("Remote application failed with exit code %1.").arg(exitCode)
: tr("The gdbserver process closed unexpectedly."); : tr("The gdbserver process closed unexpectedly.");
m_engine->handleRemoteSetupFailed(errorMsg); m_engine->handleRemoteSetupFailed(errorMsg);
@@ -261,7 +261,7 @@ void MaemoDebugSupport::handleRemoteErrorOutput(const QByteArray &output)
showMessage(QString::fromUtf8(output), AppOutput); showMessage(QString::fromUtf8(output), AppOutput);
if (m_state == StartingRemoteProcess if (m_state == StartingRemoteProcess
&& m_debuggingType != MaemoRunConfiguration::DebugQmlOnly) { && m_debuggingType != RemoteLinuxRunConfiguration::DebugQmlOnly) {
m_gdbserverOutput += output; m_gdbserverOutput += output;
if (m_gdbserverOutput.contains("Listening on port")) { if (m_gdbserverOutput.contains("Listening on port")) {
handleAdapterSetupDone(); handleAdapterSetupDone();
@@ -289,7 +289,7 @@ void MaemoDebugSupport::handleAdapterSetupDone()
void MaemoDebugSupport::handleRemoteProcessStarted() void MaemoDebugSupport::handleRemoteProcessStarted()
{ {
Q_ASSERT(m_debuggingType == MaemoRunConfiguration::DebugQmlOnly); Q_ASSERT(m_debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly);
ASSERT_STATE(StartingRemoteProcess); ASSERT_STATE(StartingRemoteProcess);
handleAdapterSetupDone(); handleAdapterSetupDone();
} }

View File

@@ -32,7 +32,7 @@
#ifndef MAEMODEBUGSUPPORT_H #ifndef MAEMODEBUGSUPPORT_H
#define MAEMODEBUGSUPPORT_H #define MAEMODEBUGSUPPORT_H
#include "maemorunconfiguration.h" #include "remotelinuxrunconfiguration.h"
#include <utils/environment.h> #include <utils/environment.h>
@@ -46,19 +46,19 @@ class DebuggerEngine;
namespace ProjectExplorer { class RunControl; } namespace ProjectExplorer { class RunControl; }
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal { class LinuxDeviceConfiguration;
class RemoteLinuxRunConfiguration;
class MaemoDeviceConfig; namespace Internal {
class MaemoRunConfiguration;
class MaemoSshRunner; class MaemoSshRunner;
class MaemoDebugSupport : public QObject class MaemoDebugSupport : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
static ProjectExplorer::RunControl *createDebugRunControl(MaemoRunConfiguration *runConfig); static ProjectExplorer::RunControl *createDebugRunControl(RemoteLinuxRunConfiguration *runConfig);
MaemoDebugSupport(MaemoRunConfiguration *runConfig, MaemoDebugSupport(RemoteLinuxRunConfiguration *runConfig,
Debugger::DebuggerEngine *engine, bool useGdb); Debugger::DebuggerEngine *engine, bool useGdb);
~MaemoDebugSupport(); ~MaemoDebugSupport();
@@ -86,10 +86,10 @@ private:
void showMessage(const QString &msg, int channel); void showMessage(const QString &msg, int channel);
const QPointer<Debugger::DebuggerEngine> m_engine; const QPointer<Debugger::DebuggerEngine> m_engine;
const QPointer<MaemoRunConfiguration> m_runConfig; const QPointer<RemoteLinuxRunConfiguration> m_runConfig;
const QSharedPointer<const MaemoDeviceConfig> m_deviceConfig; const QSharedPointer<const LinuxDeviceConfiguration> m_deviceConfig;
MaemoSshRunner * const m_runner; MaemoSshRunner * const m_runner;
const MaemoRunConfiguration::DebuggingType m_debuggingType; const RemoteLinuxRunConfiguration::DebuggingType m_debuggingType;
const QList<Utils::EnvironmentItem> m_userEnvChanges; const QList<Utils::EnvironmentItem> m_userEnvChanges;
QByteArray m_gdbserverOutput; QByteArray m_gdbserverOutput;

View File

@@ -265,7 +265,7 @@ bool MaemoDeployableListModel::addDesktopFile()
const QtSupport::BaseQtVersion * const version = qtVersion(); const QtSupport::BaseQtVersion * const version = qtVersion();
QTC_ASSERT(version, return false); QTC_ASSERT(version, return false);
QString remoteDir = QLatin1String("/usr/share/applications"); QString remoteDir = QLatin1String("/usr/share/applications");
if (MaemoGlobal::version(version->qmakeCommand()) == MaemoDeviceConfig::Maemo5) if (MaemoGlobal::version(version->qmakeCommand()) == LinuxDeviceConfiguration::Maemo5)
remoteDir += QLatin1String("/hildon"); remoteDir += QLatin1String("/hildon");
const QLatin1String filesLine("desktopfile.files = $${TARGET}.desktop"); const QLatin1String filesLine("desktopfile.files = $${TARGET}.desktop");
const QString pathLine = QLatin1String("desktopfile.path = ") + remoteDir; const QString pathLine = QLatin1String("desktopfile.path = ") + remoteDir;
@@ -340,7 +340,7 @@ QString MaemoDeployableListModel::proFileScope() const
{ {
const QtSupport::BaseQtVersion *const qv = qtVersion(); const QtSupport::BaseQtVersion *const qv = qtVersion();
QTC_ASSERT(qv, return QString()); QTC_ASSERT(qv, return QString());
return QLatin1String(MaemoGlobal::version(qv->qmakeCommand()) == MaemoDeviceConfig::Maemo5 return QLatin1String(MaemoGlobal::version(qv->qmakeCommand()) == LinuxDeviceConfiguration::Maemo5
? "maemo5" : "unix:!symbian:!maemo5"); ? "maemo5" : "unix:!symbian:!maemo5");
} }

View File

@@ -68,7 +68,7 @@ MaemoDeploymentMounter::MaemoDeploymentMounter(QObject *parent)
} }
void MaemoDeploymentMounter::setupMounts(const SshConnection::Ptr &connection, void MaemoDeploymentMounter::setupMounts(const SshConnection::Ptr &connection,
const MaemoDeviceConfig::ConstPtr &devConf, const LinuxDeviceConfiguration::ConstPtr &devConf,
const QList<MaemoMountSpecification> &mountSpecs, const QList<MaemoMountSpecification> &mountSpecs,
const Qt4BuildConfiguration *bc) const Qt4BuildConfiguration *bc)
{ {

View File

@@ -33,7 +33,7 @@
#ifndef MAEMODEPLOYMENTMOUNTER_H #ifndef MAEMODEPLOYMENTMOUNTER_H
#define MAEMODEPLOYMENTMOUNTER_H #define MAEMODEPLOYMENTMOUNTER_H
#include "maemodeviceconfigurations.h" #include "linuxdeviceconfiguration.h"
#include "maemomountspecification.h" #include "maemomountspecification.h"
#include <QtCore/QList> #include <QtCore/QList>
@@ -44,8 +44,9 @@ namespace Utils { class SshConnection; }
namespace Qt4ProjectManager { class Qt4BuildConfiguration; } namespace Qt4ProjectManager { class Qt4BuildConfiguration; }
namespace RemoteLinux { namespace RemoteLinux {
class LinuxDeviceConfiguration;
namespace Internal { namespace Internal {
class MaemoDeviceConfig;
class MaemoRemoteMounter; class MaemoRemoteMounter;
class MaemoUsedPortsGatherer; class MaemoUsedPortsGatherer;
@@ -57,7 +58,7 @@ public:
// Connection must be in connected state. // Connection must be in connected state.
void setupMounts(const QSharedPointer<Utils::SshConnection> &connection, void setupMounts(const QSharedPointer<Utils::SshConnection> &connection,
const QSharedPointer<const MaemoDeviceConfig> &devConf, const QSharedPointer<const LinuxDeviceConfiguration> &devConf,
const QList<MaemoMountSpecification> &mountSpecs, const QList<MaemoMountSpecification> &mountSpecs,
const Qt4ProjectManager::Qt4BuildConfiguration *bc); const Qt4ProjectManager::Qt4BuildConfiguration *bc);
void tearDownMounts(); void tearDownMounts();
@@ -89,10 +90,10 @@ private:
State m_state; State m_state;
QSharedPointer<Utils::SshConnection> m_connection; QSharedPointer<Utils::SshConnection> m_connection;
QSharedPointer<const MaemoDeviceConfig> m_devConf; QSharedPointer<const LinuxDeviceConfiguration> m_devConf;
MaemoRemoteMounter * const m_mounter; MaemoRemoteMounter * const m_mounter;
MaemoUsedPortsGatherer * const m_portsGatherer; MaemoUsedPortsGatherer * const m_portsGatherer;
MaemoPortList m_freePorts; PortList m_freePorts;
QList<MaemoMountSpecification> m_mountSpecs; QList<MaemoMountSpecification> m_mountSpecs;
const Qt4ProjectManager::Qt4BuildConfiguration *m_buildConfig; const Qt4ProjectManager::Qt4BuildConfiguration *m_buildConfig;
}; };

View File

@@ -34,11 +34,11 @@
#include "ui_maemodeploystepwidget.h" #include "ui_maemodeploystepwidget.h"
#include "abstractmaemodeploystep.h" #include "abstractmaemodeploystep.h"
#include "maemodeviceconfigurations.h" #include "linuxdeviceconfigurations.h"
#include "maemosettingspages.h" #include "maemosettingspages.h"
#include "maemoglobal.h" #include "maemoglobal.h"
#include "maemopertargetdeviceconfigurationlistmodel.h" #include "maemopertargetdeviceconfigurationlistmodel.h"
#include "maemorunconfiguration.h" #include "remotelinuxrunconfiguration.h"
#include "qt4maemodeployconfiguration.h" #include "qt4maemodeployconfiguration.h"
#include "qt4maemotarget.h" #include "qt4maemotarget.h"
@@ -81,9 +81,9 @@ MaemoDeployStepBaseWidget::~MaemoDeployStepBaseWidget()
void MaemoDeployStepBaseWidget::handleDeviceUpdate() void MaemoDeployStepBaseWidget::handleDeviceUpdate()
{ {
const MaemoDeviceConfig::ConstPtr &devConf = m_step->helper().deviceConfig(); const LinuxDeviceConfiguration::ConstPtr &devConf = m_step->helper().deviceConfig();
const MaemoDeviceConfig::Id internalId const LinuxDeviceConfiguration::Id internalId
= MaemoDeviceConfigurations::instance()->internalId(devConf); = LinuxDeviceConfigurations::instance()->internalId(devConf);
const int newIndex = m_step->maemoDeployConfig()->deviceConfigModel() const int newIndex = m_step->maemoDeployConfig()->deviceConfigModel()
->indexForInternalId(internalId); ->indexForInternalId(internalId);
ui->deviceConfigComboBox->setCurrentIndex(newIndex); ui->deviceConfigComboBox->setCurrentIndex(newIndex);

View File

@@ -1,690 +0,0 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#include "maemodeviceconfigurations.h"
#include "maemoglobal.h"
#include <coreplugin/icore.h>
#include <QtCore/QCoreApplication>
#include <QtCore/QSettings>
#include <QtCore/QStringBuilder>
#include <QtGui/QDesktopServices>
#include <algorithm>
#include <cctype>
typedef Utils::SshConnectionParameters::AuthenticationType AuthType;
namespace RemoteLinux {
namespace Internal {
namespace {
const QLatin1String SettingsGroup("MaemoDeviceConfigs");
const QLatin1String IdCounterKey("IdCounter");
const QLatin1String ConfigListKey("ConfigList");
const QLatin1String NameKey("Name");
const QLatin1String OsVersionKey("OsVersion");
const QLatin1String TypeKey("Type");
const QLatin1String HostKey("Host");
const QLatin1String SshPortKey("SshPort");
const QLatin1String PortsSpecKey("FreePortsSpec");
const QLatin1String UserNameKey("Uname");
const QLatin1String AuthKey("Authentication");
const QLatin1String KeyFileKey("KeyFile");
const QLatin1String PasswordKey("Password");
const QLatin1String TimeoutKey("Timeout");
const QLatin1String IsDefaultKey("IsDefault");
const QLatin1String InternalIdKey("InternalId");
const QLatin1String DefaultKeyFilePathKey("DefaultKeyFile");
const int DefaultSshPortHW(22);
const int DefaultSshPortSim(6666);
const int DefaultGdbServerPortHW(10000);
const int DefaultGdbServerPortSim(13219);
const AuthType DefaultAuthType(Utils::SshConnectionParameters::AuthenticationByKey);
const int DefaultTimeout(30);
const MaemoDeviceConfig::DeviceType DefaultDeviceType(MaemoDeviceConfig::Physical);
}
class DevConfNameMatcher
{
public:
DevConfNameMatcher(const QString &name) : m_name(name) {}
bool operator()(const MaemoDeviceConfig::ConstPtr &devConfig)
{
return devConfig->name() == m_name;
}
private:
const QString m_name;
};
class PortsSpecParser
{
struct ParseException {
ParseException(const char *error) : error(error) {}
const char * const error;
};
public:
PortsSpecParser(const QString &portsSpec)
: m_pos(0), m_portsSpec(portsSpec) { }
/*
* Grammar: Spec -> [ ElemList ]
* ElemList -> Elem [ ',' ElemList ]
* Elem -> Port [ '-' Port ]
*/
MaemoPortList parse()
{
try {
if (!atEnd())
parseElemList();
} catch (ParseException &e) {
qWarning("Malformed ports specification: %s", e.error);
}
return m_portList;
}
private:
void parseElemList()
{
if (atEnd())
throw ParseException("Element list empty.");
parseElem();
if (atEnd())
return;
if (nextChar() != ',') {
throw ParseException("Element followed by something else "
"than a comma.");
}
++m_pos;
parseElemList();
}
void parseElem()
{
const int startPort = parsePort();
if (atEnd() || nextChar() != '-') {
m_portList.addPort(startPort);
return;
}
++m_pos;
const int endPort = parsePort();
if (endPort < startPort)
throw ParseException("Invalid range (end < start).");
m_portList.addRange(startPort, endPort);
}
int parsePort()
{
if (atEnd())
throw ParseException("Empty port string.");
int port = 0;
do {
const char next = nextChar();
if (!std::isdigit(next))
break;
port = 10*port + next - '0';
++m_pos;
} while (!atEnd());
if (port == 0 || port >= 2 << 16)
throw ParseException("Invalid port value.");
return port;
}
bool atEnd() const { return m_pos == m_portsSpec.length(); }
char nextChar() const { return m_portsSpec.at(m_pos).toAscii(); }
MaemoPortList m_portList;
int m_pos;
const QString &m_portsSpec;
};
void MaemoPortList::addPort(int port) { addRange(port, port); }
void MaemoPortList::addRange(int startPort, int endPort)
{
m_ranges << Range(startPort, endPort);
}
bool MaemoPortList::hasMore() const { return !m_ranges.isEmpty(); }
int MaemoPortList::count() const
{
int n = 0;
foreach (const Range &r, m_ranges)
n += r.second - r.first + 1;
return n;
}
int MaemoPortList::getNext()
{
Q_ASSERT(!m_ranges.isEmpty());
Range &firstRange = m_ranges.first();
const int next = firstRange.first++;
if (firstRange.first > firstRange.second)
m_ranges.removeFirst();
return next;
}
QString MaemoPortList::toString() const
{
QString stringRep;
foreach (const Range &range, m_ranges) {
stringRep += QString::number(range.first);
if (range.second != range.first)
stringRep += QLatin1Char('-') + QString::number(range.second);
stringRep += QLatin1Char(',');
}
if (!stringRep.isEmpty())
stringRep.remove(stringRep.length() - 1, 1); // Trailing comma.
return stringRep;
}
MaemoDeviceConfig::Ptr MaemoDeviceConfig::create(const QSettings &settings,
Id &nextId)
{
return Ptr(new MaemoDeviceConfig(settings, nextId));
}
MaemoDeviceConfig::Ptr MaemoDeviceConfig::create(const ConstPtr &other)
{
return Ptr(new MaemoDeviceConfig(other));
}
MaemoDeviceConfig::Ptr MaemoDeviceConfig::createHardwareConfig(const QString &name,
MaemoDeviceConfig::OsVersion osVersion, 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.privateKeyFile = privateKeyFilePath;
return Ptr(new MaemoDeviceConfig(name, osVersion, Physical, sshParams, nextId));
}
MaemoDeviceConfig::Ptr MaemoDeviceConfig::createGenericLinuxConfigUsingPassword(const QString &name,
const QString &hostName, const QString &userName, const QString &password,
Id &nextId)
{
Utils::SshConnectionParameters sshParams(Utils::SshConnectionParameters::NoProxy);
sshParams.authenticationType
= Utils::SshConnectionParameters::AuthenticationByPassword;
sshParams.host = hostName;
sshParams.userName = userName;
sshParams.password = password;
return Ptr(new MaemoDeviceConfig(name, MaemoDeviceConfig::GenericLinux, Physical,
sshParams, nextId));
}
MaemoDeviceConfig::Ptr MaemoDeviceConfig::createGenericLinuxConfigUsingKey(const QString &name,
const QString &hostName, const QString &userName, const QString &privateKeyFile,
Id &nextId)
{
Utils::SshConnectionParameters sshParams(Utils::SshConnectionParameters::NoProxy);
sshParams.authenticationType
= Utils::SshConnectionParameters::AuthenticationByKey;
sshParams.host = hostName;
sshParams.userName = userName;
sshParams.privateKeyFile = privateKeyFile;
return Ptr(new MaemoDeviceConfig(name, MaemoDeviceConfig::GenericLinux, Physical,
sshParams, nextId));
}
MaemoDeviceConfig::Ptr MaemoDeviceConfig::createEmulatorConfig(const QString &name,
MaemoDeviceConfig::OsVersion osVersion, 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 MaemoDeviceConfig(name, osVersion, Emulator, sshParams, nextId));
}
MaemoDeviceConfig::MaemoDeviceConfig(const QString &name,
MaemoDeviceConfig::OsVersion osVersion, DeviceType devType,
const Utils::SshConnectionParameters &sshParams, Id &nextId)
: m_sshParameters(sshParams),
m_name(name),
m_osVersion(osVersion),
m_type(devType),
m_portsSpec(defaultPortsSpec(m_type)),
m_isDefault(false),
m_internalId(nextId++)
{
m_sshParameters.port = defaultSshPort(m_type);
m_sshParameters.timeout = DefaultTimeout;
}
MaemoDeviceConfig::MaemoDeviceConfig(const QSettings &settings,
Id &nextId)
: m_sshParameters(Utils::SshConnectionParameters::NoProxy),
m_name(settings.value(NameKey).toString()),
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()),
m_internalId(settings.value(InternalIdKey, nextId).toULongLong())
{
if (m_internalId == nextId)
++nextId;
m_sshParameters.host = settings.value(HostKey, defaultHost(m_type, m_osVersion)).toString();
m_sshParameters.port = settings.value(SshPortKey, defaultSshPort(m_type)).toInt();
m_sshParameters.userName = settings.value(UserNameKey, defaultUser(m_osVersion)).toString();
m_sshParameters.authenticationType
= static_cast<AuthType>(settings.value(AuthKey, DefaultAuthType).toInt());
m_sshParameters.password = settings.value(PasswordKey).toString();
m_sshParameters.privateKeyFile
= settings.value(KeyFileKey, defaultPrivateKeyFilePath()).toString();
m_sshParameters.timeout = settings.value(TimeoutKey, DefaultTimeout).toInt();
}
MaemoDeviceConfig::MaemoDeviceConfig(const MaemoDeviceConfig::ConstPtr &other)
: m_sshParameters(other->m_sshParameters),
m_name(other->m_name),
m_osVersion(other->m_osVersion),
m_type(other->type()),
m_portsSpec(other->m_portsSpec),
m_isDefault(other->m_isDefault),
m_internalId(other->m_internalId)
{
}
QString MaemoDeviceConfig::portsRegExpr()
{
const QLatin1String portExpr("(\\d)+");
const QString listElemExpr = QString::fromLatin1("%1(-%1)?").arg(portExpr);
return QString::fromLatin1("((%1)(,%1)*)?").arg(listElemExpr);
}
int MaemoDeviceConfig::defaultSshPort(DeviceType type)
{
return type == Physical ? DefaultSshPortHW : DefaultSshPortSim;
}
QString MaemoDeviceConfig::defaultPortsSpec(DeviceType type) const
{
return QLatin1String(type == Physical ? "10000-10100" : "13219,14168");
}
QString MaemoDeviceConfig::defaultHost(DeviceType type, MaemoDeviceConfig::OsVersion osVersion)
{
switch (osVersion) {
case MaemoDeviceConfig::Maemo5:
case MaemoDeviceConfig::Maemo6:
case MaemoDeviceConfig::Meego:
return QLatin1String(type == Physical ? "192.168.2.15" : "localhost");
case MaemoDeviceConfig::GenericLinux:
return QString();
default:
qDebug("%s: Unknown OS version %d.", Q_FUNC_INFO, osVersion);
return QString();
}
}
QString MaemoDeviceConfig::defaultPrivateKeyFilePath()
{
return QDesktopServices::storageLocation(QDesktopServices::HomeLocation)
+ QLatin1String("/.ssh/id_rsa");
}
QString MaemoDeviceConfig::defaultPublicKeyFilePath()
{
return defaultPrivateKeyFilePath() + QLatin1String(".pub");
}
QString MaemoDeviceConfig::defaultUser(MaemoDeviceConfig::OsVersion osVersion)
{
switch (osVersion) {
case MaemoDeviceConfig::Maemo5:
case MaemoDeviceConfig::Maemo6:
return QLatin1String("developer");
case MaemoDeviceConfig::Meego:
return QLatin1String("meego");
case MaemoDeviceConfig::GenericLinux:
return QString();
default:
qDebug("%s: Unknown OS Version %d.", Q_FUNC_INFO, osVersion);
return QString();
}
}
QString MaemoDeviceConfig::defaultQemuPassword(MaemoDeviceConfig::OsVersion osVersion)
{
switch (osVersion) {
case MaemoDeviceConfig::Maemo5:
case MaemoDeviceConfig::Maemo6:
return QString();
case MaemoDeviceConfig::Meego:
return QLatin1String("meego");
default:
qDebug("%s: Unknown OS Version %d.", Q_FUNC_INFO, osVersion);
return QString();
}
}
MaemoPortList MaemoDeviceConfig::freePorts() const
{
return PortsSpecParser(m_portsSpec).parse();
}
void MaemoDeviceConfig::save(QSettings &settings) const
{
settings.setValue(NameKey, m_name);
settings.setValue(OsVersionKey, m_osVersion);
settings.setValue(TypeKey, m_type);
settings.setValue(HostKey, m_sshParameters.host);
settings.setValue(SshPortKey, m_sshParameters.port);
settings.setValue(PortsSpecKey, m_portsSpec);
settings.setValue(UserNameKey, m_sshParameters.userName);
settings.setValue(AuthKey, m_sshParameters.authenticationType);
settings.setValue(PasswordKey, m_sshParameters.password);
settings.setValue(KeyFileKey, m_sshParameters.privateKeyFile);
settings.setValue(TimeoutKey, m_sshParameters.timeout);
settings.setValue(IsDefaultKey, m_isDefault);
settings.setValue(InternalIdKey, m_internalId);
}
const MaemoDeviceConfig::Id MaemoDeviceConfig::InvalidId = 0;
MaemoDeviceConfigurations *MaemoDeviceConfigurations::instance(QObject *parent)
{
if (m_instance == 0) {
m_instance = new MaemoDeviceConfigurations(parent);
m_instance->load();
}
return m_instance;
}
void MaemoDeviceConfigurations::replaceInstance(const MaemoDeviceConfigurations *other)
{
Q_ASSERT(m_instance);
m_instance->beginResetModel();
copy(other, m_instance, false);
m_instance->save();
m_instance->endResetModel();
emit m_instance->updated();
}
MaemoDeviceConfigurations *MaemoDeviceConfigurations::cloneInstance()
{
MaemoDeviceConfigurations * const other = new MaemoDeviceConfigurations(0);
copy(m_instance, other, true);
return other;
}
void MaemoDeviceConfigurations::copy(const MaemoDeviceConfigurations *source,
MaemoDeviceConfigurations *target, bool deep)
{
if (deep) {
foreach (const MaemoDeviceConfig::ConstPtr &devConf, source->m_devConfigs)
target->m_devConfigs << MaemoDeviceConfig::create(devConf);
} else {
target->m_devConfigs = source->m_devConfigs;
}
target->m_defaultSshKeyFilePath = source->m_defaultSshKeyFilePath;
target->m_nextId = source->m_nextId;
}
void MaemoDeviceConfigurations::save()
{
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(SettingsGroup);
settings->setValue(IdCounterKey, m_nextId);
settings->setValue(DefaultKeyFilePathKey, m_defaultSshKeyFilePath);
settings->beginWriteArray(ConfigListKey, m_devConfigs.count());
for (int i = 0; i < m_devConfigs.count(); ++i) {
settings->setArrayIndex(i);
m_devConfigs.at(i)->save(*settings);
}
settings->endArray();
settings->endGroup();
}
void MaemoDeviceConfigurations::addHardwareDeviceConfiguration(const QString &name,
MaemoDeviceConfig::OsVersion osVersion, const QString &hostName,
const QString &privateKeyFilePath)
{
const MaemoDeviceConfig::Ptr &devConf = MaemoDeviceConfig::createHardwareConfig(name,
osVersion, hostName, privateKeyFilePath, m_nextId);
addConfiguration(devConf);
}
void MaemoDeviceConfigurations::addGenericLinuxConfigurationUsingPassword(const QString &name,
const QString &hostName, const QString &userName, const QString &password)
{
const MaemoDeviceConfig::Ptr &devConf
= MaemoDeviceConfig::createGenericLinuxConfigUsingPassword(name,
hostName, userName, password, m_nextId);
addConfiguration(devConf);
}
void MaemoDeviceConfigurations::addGenericLinuxConfigurationUsingKey(const QString &name,
const QString &hostName, const QString &userName, const QString &privateKeyFilePath)
{
const MaemoDeviceConfig::Ptr &devConf = MaemoDeviceConfig::createGenericLinuxConfigUsingKey(name,
hostName, userName, privateKeyFilePath, m_nextId);
addConfiguration(devConf);
}
void MaemoDeviceConfigurations::addEmulatorDeviceConfiguration(const QString &name,
MaemoDeviceConfig::OsVersion osVersion)
{
const MaemoDeviceConfig::Ptr &devConf
= MaemoDeviceConfig::createEmulatorConfig(name, osVersion, m_nextId);
addConfiguration(devConf);
}
void MaemoDeviceConfigurations::addConfiguration(const MaemoDeviceConfig::Ptr &devConfig)
{
beginInsertRows(QModelIndex(), rowCount(), rowCount());
if (!defaultDeviceConfig(devConfig->osVersion()))
devConfig->m_isDefault = true;
m_devConfigs << devConfig;
endInsertRows();
}
void MaemoDeviceConfigurations::removeConfiguration(int idx)
{
Q_ASSERT(idx >= 0 && idx < rowCount());
beginRemoveRows(QModelIndex(), idx, idx);
const bool wasDefault = deviceAt(idx)->m_isDefault;
const MaemoDeviceConfig::OsVersion osVersion = deviceAt(idx)->osVersion();
m_devConfigs.removeAt(idx);
endRemoveRows();
if (wasDefault) {
for (int i = 0; i < m_devConfigs.count(); ++i) {
if (deviceAt(i)->osVersion() == osVersion) {
m_devConfigs.at(i)->m_isDefault = true;
const QModelIndex changedIndex = index(i, 0);
emit dataChanged(changedIndex, changedIndex);
break;
}
}
}
}
void MaemoDeviceConfigurations::setConfigurationName(int i, const QString &name)
{
Q_ASSERT(i >= 0 && i < rowCount());
m_devConfigs.at(i)->m_name = name;
const QModelIndex changedIndex = index(i, 0);
emit dataChanged(changedIndex, changedIndex);
}
void MaemoDeviceConfigurations::setSshParameters(int i,
const Utils::SshConnectionParameters &params)
{
Q_ASSERT(i >= 0 && i < rowCount());
m_devConfigs.at(i)->m_sshParameters = params;
}
void MaemoDeviceConfigurations::setPortsSpec(int i, const QString &portsSpec)
{
Q_ASSERT(i >= 0 && i < rowCount());
m_devConfigs.at(i)->m_portsSpec = portsSpec;
}
void MaemoDeviceConfigurations::setDefaultDevice(int idx)
{
Q_ASSERT(idx >= 0 && idx < rowCount());
const MaemoDeviceConfig::Ptr &devConf = m_devConfigs.at(idx);
if (devConf->m_isDefault)
return;
QModelIndex oldDefaultIndex;
for (int i = 0; i < m_devConfigs.count(); ++i) {
const MaemoDeviceConfig::Ptr &oldDefaultDev = m_devConfigs.at(i);
if (oldDefaultDev->m_isDefault
&& oldDefaultDev->osVersion() == devConf->osVersion()) {
oldDefaultDev->m_isDefault = false;
oldDefaultIndex = index(i, 0);
break;
}
}
Q_ASSERT(oldDefaultIndex.isValid());
emit dataChanged(oldDefaultIndex, oldDefaultIndex);
devConf->m_isDefault = true;
const QModelIndex newDefaultIndex = index(idx, 0);
emit dataChanged(newDefaultIndex, newDefaultIndex);
}
MaemoDeviceConfigurations::MaemoDeviceConfigurations(QObject *parent)
: QAbstractListModel(parent)
{
}
void MaemoDeviceConfigurations::load()
{
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(SettingsGroup);
m_nextId = settings->value(IdCounterKey, 1).toULongLong();
m_defaultSshKeyFilePath = settings->value(DefaultKeyFilePathKey,
MaemoDeviceConfig::defaultPrivateKeyFilePath()).toString();
int count = settings->beginReadArray(ConfigListKey);
for (int i = 0; i < count; ++i) {
settings->setArrayIndex(i);
MaemoDeviceConfig::Ptr devConf
= MaemoDeviceConfig::create(*settings, m_nextId);
m_devConfigs << devConf;
}
settings->endArray();
settings->endGroup();
ensureDefaultExists(MaemoDeviceConfig::Maemo5);
ensureDefaultExists(MaemoDeviceConfig::Maemo6);
ensureDefaultExists(MaemoDeviceConfig::Meego);
ensureDefaultExists(MaemoDeviceConfig::GenericLinux);
}
MaemoDeviceConfig::ConstPtr MaemoDeviceConfigurations::deviceAt(int idx) const
{
Q_ASSERT(idx >= 0 && idx < rowCount());
return m_devConfigs.at(idx);
}
bool MaemoDeviceConfigurations::hasConfig(const QString &name) const
{
QList<MaemoDeviceConfig::Ptr>::ConstIterator resultIt =
std::find_if(m_devConfigs.constBegin(), m_devConfigs.constEnd(),
DevConfNameMatcher(name));
return resultIt != m_devConfigs.constEnd();
}
MaemoDeviceConfig::ConstPtr MaemoDeviceConfigurations::find(MaemoDeviceConfig::Id id) const
{
const int index = indexForInternalId(id);
return index == -1 ? MaemoDeviceConfig::ConstPtr() : deviceAt(index);
}
MaemoDeviceConfig::ConstPtr MaemoDeviceConfigurations::defaultDeviceConfig(const MaemoDeviceConfig::OsVersion osVersion) const
{
foreach (const MaemoDeviceConfig::ConstPtr &devConf, m_devConfigs) {
if (devConf->m_isDefault && devConf->osVersion() == osVersion)
return devConf;
}
return MaemoDeviceConfig::ConstPtr();
}
int MaemoDeviceConfigurations::indexForInternalId(MaemoDeviceConfig::Id internalId) const
{
for (int i = 0; i < m_devConfigs.count(); ++i) {
if (deviceAt(i)->m_internalId == internalId)
return i;
}
return -1;
}
MaemoDeviceConfig::Id MaemoDeviceConfigurations::internalId(MaemoDeviceConfig::ConstPtr devConf) const
{
return devConf ? devConf->m_internalId : MaemoDeviceConfig::InvalidId;
}
void MaemoDeviceConfigurations::ensureDefaultExists(MaemoDeviceConfig::OsVersion osVersion)
{
if (!defaultDeviceConfig(osVersion)) {
foreach (const MaemoDeviceConfig::Ptr &devConf, m_devConfigs) {
if (devConf->osVersion() == osVersion) {
devConf->m_isDefault = true;
break;
}
}
}
}
int MaemoDeviceConfigurations::rowCount(const QModelIndex &parent) const
{
Q_UNUSED(parent);
return m_devConfigs.count();
}
QVariant MaemoDeviceConfigurations::data(const QModelIndex &index, int role) const
{
if (!index.isValid() || index.row() >= rowCount() || role != Qt::DisplayRole)
return QVariant();
const MaemoDeviceConfig::ConstPtr devConf = deviceAt(index.row());
QString name = devConf->name();
if (devConf->m_isDefault) {
name += QLatin1Char(' ') + tr("(default for %1)")
.arg(MaemoGlobal::osVersionToString(devConf->osVersion()));
}
return name;
}
MaemoDeviceConfigurations *MaemoDeviceConfigurations::m_instance = 0;
} // namespace Internal
} // namespace RemoteLinux

View File

@@ -33,9 +33,9 @@
#include "ui_maemodeviceconfigurationssettingswidget.h" #include "ui_maemodeviceconfigurationssettingswidget.h"
#include "linuxdeviceconfigurations.h"
#include "maemoconfigtestdialog.h" #include "maemoconfigtestdialog.h"
#include "maemodeviceconfigwizard.h" #include "maemodeviceconfigwizard.h"
#include "maemodeviceconfigurations.h"
#include "maemoglobal.h" #include "maemoglobal.h"
#include "maemokeydeployer.h" #include "maemokeydeployer.h"
#include "maemoremoteprocessesdialog.h" #include "maemoremoteprocessesdialog.h"
@@ -68,7 +68,7 @@ const QLatin1String LastDeviceConfigIndexKey("LastDisplayedMaemoDeviceConfig");
class NameValidator : public QValidator class NameValidator : public QValidator
{ {
public: public:
NameValidator(const MaemoDeviceConfigurations *devConfigs, NameValidator(const LinuxDeviceConfigurations *devConfigs,
QWidget *parent = 0) QWidget *parent = 0)
: QValidator(parent), m_devConfigs(devConfigs) : QValidator(parent), m_devConfigs(devConfigs)
{ {
@@ -93,14 +93,14 @@ public:
private: private:
QString m_oldName; QString m_oldName;
const MaemoDeviceConfigurations * const m_devConfigs; const LinuxDeviceConfigurations * const m_devConfigs;
}; };
MaemoDeviceConfigurationsSettingsWidget::MaemoDeviceConfigurationsSettingsWidget(QWidget *parent) MaemoDeviceConfigurationsSettingsWidget::MaemoDeviceConfigurationsSettingsWidget(QWidget *parent)
: QWidget(parent), : QWidget(parent),
m_ui(new Ui_MaemoDeviceConfigurationsSettingsWidget), m_ui(new Ui_MaemoDeviceConfigurationsSettingsWidget),
m_devConfigs(MaemoDeviceConfigurations::cloneInstance()), m_devConfigs(LinuxDeviceConfigurations::cloneInstance()),
m_nameValidator(new NameValidator(m_devConfigs.data(), this)), m_nameValidator(new NameValidator(m_devConfigs.data(), this)),
m_keyDeployer(new MaemoKeyDeployer(this)), m_keyDeployer(new MaemoKeyDeployer(this)),
m_saveSettingsRequested(false) m_saveSettingsRequested(false)
@@ -117,7 +117,7 @@ MaemoDeviceConfigurationsSettingsWidget::~MaemoDeviceConfigurationsSettingsWidge
if (m_saveSettingsRequested) { if (m_saveSettingsRequested) {
Core::ICore::instance()->settings()->setValue(LastDeviceConfigIndexKey, Core::ICore::instance()->settings()->setValue(LastDeviceConfigIndexKey,
currentIndex()); currentIndex());
MaemoDeviceConfigurations::replaceInstance(m_devConfigs.data()); LinuxDeviceConfigurations::replaceInstance(m_devConfigs.data());
} }
delete m_ui; delete m_ui;
} }
@@ -155,7 +155,7 @@ void MaemoDeviceConfigurationsSettingsWidget::initGui()
m_ui->nameLineEdit->setValidator(m_nameValidator); m_ui->nameLineEdit->setValidator(m_nameValidator);
m_ui->keyFileLineEdit->setExpectedKind(Utils::PathChooser::File); m_ui->keyFileLineEdit->setExpectedKind(Utils::PathChooser::File);
QRegExpValidator * const portsValidator QRegExpValidator * const portsValidator
= new QRegExpValidator(QRegExp(MaemoDeviceConfig::portsRegExpr()), this); = new QRegExpValidator(QRegExp(LinuxDeviceConfiguration::portsRegExpr()), this);
m_ui->portsLineEdit->setValidator(portsValidator); m_ui->portsLineEdit->setValidator(portsValidator);
connect(m_ui->makeKeyFileDefaultButton, SIGNAL(clicked()), connect(m_ui->makeKeyFileDefaultButton, SIGNAL(clicked()),
SLOT(setDefaultKeyFilePath())); SLOT(setDefaultKeyFilePath()));
@@ -179,7 +179,7 @@ void MaemoDeviceConfigurationsSettingsWidget::addConfig()
wizard.createDeviceConfig(); wizard.createDeviceConfig();
m_ui->removeConfigButton->setEnabled(true); m_ui->removeConfigButton->setEnabled(true);
m_ui->configurationComboBox->setCurrentIndex(m_ui->configurationComboBox->count()-1); m_ui->configurationComboBox->setCurrentIndex(m_ui->configurationComboBox->count()-1);
if (currentConfig()->type() != MaemoDeviceConfig::Emulator) if (currentConfig()->type() != LinuxDeviceConfiguration::Emulator)
testConfig(); testConfig();
} }
} }
@@ -193,11 +193,11 @@ void MaemoDeviceConfigurationsSettingsWidget::deleteConfig()
void MaemoDeviceConfigurationsSettingsWidget::displayCurrent() void MaemoDeviceConfigurationsSettingsWidget::displayCurrent()
{ {
const MaemoDeviceConfig::ConstPtr &current = currentConfig(); const LinuxDeviceConfiguration::ConstPtr &current = currentConfig();
m_ui->defaultDeviceButton->setEnabled(!current->isDefault()); m_ui->defaultDeviceButton->setEnabled(!current->isDefault());
m_ui->osTypeValueLabel->setText(MaemoGlobal::osVersionToString(current->osVersion())); m_ui->osTypeValueLabel->setText(MaemoGlobal::osVersionToString(current->osVersion()));
const SshConnectionParameters &sshParams = current->sshParameters(); const SshConnectionParameters &sshParams = current->sshParameters();
if (current->type() == MaemoDeviceConfig::Physical) { if (current->type() == LinuxDeviceConfiguration::Physical) {
m_ui->deviceTypeValueLabel->setText(tr("Physical Device")); m_ui->deviceTypeValueLabel->setText(tr("Physical Device"));
m_ui->portsLineEdit->setReadOnly(false); m_ui->portsLineEdit->setReadOnly(false);
} else { } else {
@@ -216,7 +216,7 @@ void MaemoDeviceConfigurationsSettingsWidget::displayCurrent()
void MaemoDeviceConfigurationsSettingsWidget::fillInValues() void MaemoDeviceConfigurationsSettingsWidget::fillInValues()
{ {
const MaemoDeviceConfig::ConstPtr &current = currentConfig(); const LinuxDeviceConfiguration::ConstPtr &current = currentConfig();
m_ui->nameLineEdit->setText(current->name()); m_ui->nameLineEdit->setText(current->name());
const SshConnectionParameters &sshParams = current->sshParameters(); const SshConnectionParameters &sshParams = current->sshParameters();
m_ui->hostLineEdit->setText(sshParams.host); m_ui->hostLineEdit->setText(sshParams.host);
@@ -228,7 +228,7 @@ void MaemoDeviceConfigurationsSettingsWidget::fillInValues()
m_ui->keyFileLineEdit->setPath(sshParams.privateKeyFile); m_ui->keyFileLineEdit->setPath(sshParams.privateKeyFile);
m_ui->showPasswordCheckBox->setChecked(false); m_ui->showPasswordCheckBox->setChecked(false);
updatePortsWarningLabel(); updatePortsWarningLabel();
const bool isSimulator = current->type() == MaemoDeviceConfig::Emulator; const bool isSimulator = current->type() == LinuxDeviceConfiguration::Emulator;
m_ui->hostLineEdit->setReadOnly(isSimulator); m_ui->hostLineEdit->setReadOnly(isSimulator);
m_ui->sshPortSpinBox->setReadOnly(isSimulator); m_ui->sshPortSpinBox->setReadOnly(isSimulator);
} }
@@ -244,7 +244,7 @@ int MaemoDeviceConfigurationsSettingsWidget::currentIndex() const
return m_ui->configurationComboBox->currentIndex(); return m_ui->configurationComboBox->currentIndex();
} }
MaemoDeviceConfig::ConstPtr MaemoDeviceConfigurationsSettingsWidget::currentConfig() const LinuxDeviceConfiguration::ConstPtr MaemoDeviceConfigurationsSettingsWidget::currentConfig() const
{ {
Q_ASSERT(currentIndex() != -1); Q_ASSERT(currentIndex() != -1);
return m_devConfigs->deviceAt(currentIndex()); return m_devConfigs->deviceAt(currentIndex());

View File

@@ -48,11 +48,12 @@ class SshRemoteProcessRunner;
} }
namespace RemoteLinux { namespace RemoteLinux {
class LinuxDeviceConfiguration;
namespace Internal { namespace Internal {
class NameValidator; class NameValidator;
class MaemoDeviceConfig; class LinuxDeviceConfigurations;
class MaemoDeviceConfigurations;
class MaemoKeyDeployer; class MaemoKeyDeployer;
class MaemoDeviceConfigurationsSettingsWidget : public QWidget class MaemoDeviceConfigurationsSettingsWidget : public QWidget
@@ -98,7 +99,7 @@ private slots:
private: private:
void initGui(); void initGui();
void displayCurrent(); void displayCurrent();
QSharedPointer<const MaemoDeviceConfig> currentConfig() const; QSharedPointer<const LinuxDeviceConfiguration> currentConfig() const;
int currentIndex() const; int currentIndex() const;
void clearDetails(); void clearDetails();
QString parseTestOutput(); QString parseTestOutput();
@@ -106,7 +107,7 @@ private:
void updatePortsWarningLabel(); void updatePortsWarningLabel();
Ui_MaemoDeviceConfigurationsSettingsWidget *m_ui; Ui_MaemoDeviceConfigurationsSettingsWidget *m_ui;
const QScopedPointer<MaemoDeviceConfigurations> m_devConfigs; const QScopedPointer<LinuxDeviceConfigurations> m_devConfigs;
NameValidator * const m_nameValidator; NameValidator * const m_nameValidator;
MaemoKeyDeployer *const m_keyDeployer; MaemoKeyDeployer *const m_keyDeployer;
bool m_saveSettingsRequested; bool m_saveSettingsRequested;

View File

@@ -37,7 +37,7 @@
#include "ui_maemodeviceconfigwizardreusekeyscheckpage.h" #include "ui_maemodeviceconfigwizardreusekeyscheckpage.h"
#include "ui_maemodeviceconfigwizardstartpage.h" #include "ui_maemodeviceconfigwizardstartpage.h"
#include "maemodeviceconfigurations.h" #include "linuxdeviceconfigurations.h"
#include "maemoglobal.h" #include "maemoglobal.h"
#include "maemokeydeployer.h" #include "maemokeydeployer.h"
@@ -61,9 +61,9 @@ struct WizardData
{ {
QString configName; QString configName;
QString hostName; QString hostName;
MaemoDeviceConfig::OsVersion osVersion; LinuxDeviceConfiguration::OsVersion osVersion;
SshConnectionParameters::AuthenticationType authType; SshConnectionParameters::AuthenticationType authType;
MaemoDeviceConfig::DeviceType deviceType; LinuxDeviceConfiguration::DeviceType deviceType;
QString privateKeyFilePath; QString privateKeyFilePath;
QString publicKeyFilePath; QString publicKeyFilePath;
QString userName; QString userName;
@@ -85,10 +85,10 @@ public:
m_ui->setupUi(this); m_ui->setupUi(this);
setTitle(tr("General Information")); setTitle(tr("General Information"));
setSubTitle(QLatin1String(" ")); // For Qt bug (background color) setSubTitle(QLatin1String(" ")); // For Qt bug (background color)
m_ui->fremantleButton->setText(MaemoGlobal::osVersionToString(MaemoDeviceConfig::Maemo5)); m_ui->fremantleButton->setText(MaemoGlobal::osVersionToString(LinuxDeviceConfiguration::Maemo5));
m_ui->harmattanButton->setText(MaemoGlobal::osVersionToString(MaemoDeviceConfig::Maemo6)); m_ui->harmattanButton->setText(MaemoGlobal::osVersionToString(LinuxDeviceConfiguration::Maemo6));
m_ui->meegoButton->setText(MaemoGlobal::osVersionToString(MaemoDeviceConfig::Meego)); m_ui->meegoButton->setText(MaemoGlobal::osVersionToString(LinuxDeviceConfiguration::Meego));
m_ui->genericLinuxButton->setText(MaemoGlobal::osVersionToString(MaemoDeviceConfig::GenericLinux)); m_ui->genericLinuxButton->setText(MaemoGlobal::osVersionToString(LinuxDeviceConfiguration::GenericLinux));
QButtonGroup *buttonGroup = new QButtonGroup(this); QButtonGroup *buttonGroup = new QButtonGroup(this);
buttonGroup->setExclusive(true); buttonGroup->setExclusive(true);
@@ -110,7 +110,7 @@ public:
m_ui->harmattanButton->setChecked(true); m_ui->harmattanButton->setChecked(true);
m_ui->hwButton->setChecked(true); m_ui->hwButton->setChecked(true);
handleDeviceTypeChanged(); handleDeviceTypeChanged();
m_ui->hostNameLineEdit->setText(MaemoDeviceConfig::defaultHost(deviceType(), m_ui->hostNameLineEdit->setText(LinuxDeviceConfiguration::defaultHost(deviceType(),
osVersion())); osVersion()));
connect(m_ui->nameLineEdit, SIGNAL(textChanged(QString)), this, connect(m_ui->nameLineEdit, SIGNAL(textChanged(QString)), this,
SIGNAL(completeChanged())); SIGNAL(completeChanged()));
@@ -127,36 +127,36 @@ public:
QString hostName() const QString hostName() const
{ {
return deviceType() == MaemoDeviceConfig::Emulator return deviceType() == LinuxDeviceConfiguration::Emulator
? MaemoDeviceConfig::defaultHost(MaemoDeviceConfig::Emulator, osVersion()) ? LinuxDeviceConfiguration::defaultHost(LinuxDeviceConfiguration::Emulator, osVersion())
: m_ui->hostNameLineEdit->text().trimmed(); : m_ui->hostNameLineEdit->text().trimmed();
} }
MaemoDeviceConfig::OsVersion osVersion() const LinuxDeviceConfiguration::OsVersion osVersion() const
{ {
return m_ui->fremantleButton->isChecked() ? MaemoDeviceConfig::Maemo5 return m_ui->fremantleButton->isChecked() ? LinuxDeviceConfiguration::Maemo5
: m_ui->harmattanButton->isChecked() ? MaemoDeviceConfig::Maemo6 : m_ui->harmattanButton->isChecked() ? LinuxDeviceConfiguration::Maemo6
: m_ui->meegoButton->isChecked() ? MaemoDeviceConfig::Meego : m_ui->meegoButton->isChecked() ? LinuxDeviceConfiguration::Meego
: MaemoDeviceConfig::GenericLinux; : LinuxDeviceConfiguration::GenericLinux;
} }
MaemoDeviceConfig::DeviceType deviceType() const LinuxDeviceConfiguration::DeviceType deviceType() const
{ {
return m_ui->hwButton->isChecked() return m_ui->hwButton->isChecked()
? MaemoDeviceConfig::Physical : MaemoDeviceConfig::Emulator; ? LinuxDeviceConfiguration::Physical : LinuxDeviceConfiguration::Emulator;
} }
private slots: private slots:
void handleDeviceTypeChanged() void handleDeviceTypeChanged()
{ {
const bool enable = deviceType() == MaemoDeviceConfig::Physical; const bool enable = deviceType() == LinuxDeviceConfiguration::Physical;
m_ui->hostNameLabel->setEnabled(enable); m_ui->hostNameLabel->setEnabled(enable);
m_ui->hostNameLineEdit->setEnabled(enable); m_ui->hostNameLineEdit->setEnabled(enable);
} }
void handleOsTypeChanged() void handleOsTypeChanged()
{ {
if (osVersion() == MaemoDeviceConfig::GenericLinux) { if (osVersion() == LinuxDeviceConfiguration::GenericLinux) {
m_ui->hwButton->setChecked(true); m_ui->hwButton->setChecked(true);
m_ui->hwButton->setEnabled(false); m_ui->hwButton->setEnabled(false);
m_ui->qemuButton->setEnabled(false); m_ui->qemuButton->setEnabled(false);
@@ -202,10 +202,10 @@ public:
virtual void initializePage() virtual void initializePage()
{ {
m_ui->userNameLineEdit->setText(MaemoDeviceConfig::defaultUser(m_wizardData.osVersion)); m_ui->userNameLineEdit->setText(LinuxDeviceConfiguration::defaultUser(m_wizardData.osVersion));
m_ui->passwordButton->setChecked(true); m_ui->passwordButton->setChecked(true);
m_ui->passwordLineEdit->clear(); m_ui->passwordLineEdit->clear();
m_ui->privateKeyPathChooser->setPath(MaemoDeviceConfig::defaultPrivateKeyFilePath()); m_ui->privateKeyPathChooser->setPath(LinuxDeviceConfiguration::defaultPrivateKeyFilePath());
handleAuthTypeChanged(); handleAuthTypeChanged();
} }
@@ -263,7 +263,7 @@ public:
virtual void initializePage() virtual void initializePage()
{ {
m_ui->keyWasNotSetUpButton->setChecked(true); m_ui->keyWasNotSetUpButton->setChecked(true);
m_ui->privateKeyFilePathChooser->setPath(MaemoDeviceConfig::defaultPrivateKeyFilePath()); m_ui->privateKeyFilePathChooser->setPath(LinuxDeviceConfiguration::defaultPrivateKeyFilePath());
handleSelectionChanged(); handleSelectionChanged();
} }
@@ -319,8 +319,8 @@ public:
virtual void initializePage() virtual void initializePage()
{ {
m_ui->dontReuseButton->setChecked(true); m_ui->dontReuseButton->setChecked(true);
m_ui->privateKeyFilePathChooser->setPath(MaemoDeviceConfig::defaultPrivateKeyFilePath()); m_ui->privateKeyFilePathChooser->setPath(LinuxDeviceConfiguration::defaultPrivateKeyFilePath());
m_ui->publicKeyFilePathChooser->setPath(MaemoDeviceConfig::defaultPublicKeyFilePath()); m_ui->publicKeyFilePathChooser->setPath(LinuxDeviceConfiguration::defaultPublicKeyFilePath());
handleSelectionChanged(); handleSelectionChanged();
} }
@@ -504,10 +504,10 @@ private:
SshConnectionParameters sshParams(SshConnectionParameters::NoProxy); SshConnectionParameters sshParams(SshConnectionParameters::NoProxy);
sshParams.authenticationType = SshConnectionParameters::AuthenticationByPassword; sshParams.authenticationType = SshConnectionParameters::AuthenticationByPassword;
sshParams.host = hostAddress(); sshParams.host = hostAddress();
sshParams.port = MaemoDeviceConfig::defaultSshPort(MaemoDeviceConfig::Physical); sshParams.port = LinuxDeviceConfiguration::defaultSshPort(LinuxDeviceConfiguration::Physical);
sshParams.password = password(); sshParams.password = password();
sshParams.timeout = 30; sshParams.timeout = 30;
sshParams.userName = MaemoDeviceConfig::defaultUser(m_wizardData.osVersion); sshParams.userName = LinuxDeviceConfiguration::defaultUser(m_wizardData.osVersion);
m_ui->statusLabel->setText(tr("Deploying... ")); m_ui->statusLabel->setText(tr("Deploying... "));
m_keyDeployer->deployPublicKey(sshParams, m_wizardData.publicKeyFilePath); m_keyDeployer->deployPublicKey(sshParams, m_wizardData.publicKeyFilePath);
} }
@@ -569,7 +569,7 @@ public:
virtual void initializePage() virtual void initializePage()
{ {
QString infoText; QString infoText;
if (m_wizardData.deviceType == MaemoDeviceConfig::Physical) { if (m_wizardData.deviceType == LinuxDeviceConfiguration::Physical) {
infoText = tr("The new device configuration will now be " infoText = tr("The new device configuration will now be "
"created and a test procedure will be run to check whether " "created and a test procedure will be run to check whether "
"Qt Creator can connect to the device and to provide some " "Qt Creator can connect to the device and to provide some "
@@ -589,7 +589,7 @@ private:
struct MaemoDeviceConfigWizardPrivate struct MaemoDeviceConfigWizardPrivate
{ {
MaemoDeviceConfigWizardPrivate(MaemoDeviceConfigurations *devConfigs, MaemoDeviceConfigWizardPrivate(LinuxDeviceConfigurations *devConfigs,
QWidget *parent) QWidget *parent)
: devConfigs(devConfigs), : devConfigs(devConfigs),
startPage(parent), startPage(parent),
@@ -603,7 +603,7 @@ struct MaemoDeviceConfigWizardPrivate
} }
WizardData wizardData; WizardData wizardData;
MaemoDeviceConfigurations * const devConfigs; LinuxDeviceConfigurations * const devConfigs;
MaemoDeviceConfigWizardStartPage startPage; MaemoDeviceConfigWizardStartPage startPage;
MaemoDeviceConfigWizardLoginDataPage loginDataPage; MaemoDeviceConfigWizardLoginDataPage loginDataPage;
MaemoDeviceConfigWizardPreviousKeySetupCheckPage previousKeySetupPage; MaemoDeviceConfigWizardPreviousKeySetupCheckPage previousKeySetupPage;
@@ -614,7 +614,7 @@ struct MaemoDeviceConfigWizardPrivate
}; };
MaemoDeviceConfigWizard::MaemoDeviceConfigWizard(MaemoDeviceConfigurations *devConfigs, MaemoDeviceConfigWizard::MaemoDeviceConfigWizard(LinuxDeviceConfigurations *devConfigs,
QWidget *parent) QWidget *parent)
: QWizard(parent), : QWizard(parent),
d(new MaemoDeviceConfigWizardPrivate(devConfigs, this)) d(new MaemoDeviceConfigWizardPrivate(devConfigs, this))
@@ -643,7 +643,7 @@ void MaemoDeviceConfigWizard::createDeviceConfig()
while (d->devConfigs->hasConfig(name)); while (d->devConfigs->hasConfig(name));
} }
if (d->wizardData.osVersion == MaemoDeviceConfig::GenericLinux) { if (d->wizardData.osVersion == LinuxDeviceConfiguration::GenericLinux) {
if (d->wizardData.authType == SshConnectionParameters::AuthenticationByPassword) { if (d->wizardData.authType == SshConnectionParameters::AuthenticationByPassword) {
d->devConfigs->addGenericLinuxConfigurationUsingPassword(name, d->devConfigs->addGenericLinuxConfigurationUsingPassword(name,
d->wizardData.hostName, d->wizardData.userName, d->wizardData.hostName, d->wizardData.userName,
@@ -653,7 +653,7 @@ void MaemoDeviceConfigWizard::createDeviceConfig()
d->wizardData.hostName, d->wizardData.userName, d->wizardData.hostName, d->wizardData.userName,
d->wizardData.privateKeyFilePath); d->wizardData.privateKeyFilePath);
} }
} else if (d->wizardData.deviceType == MaemoDeviceConfig::Physical) { } else if (d->wizardData.deviceType == LinuxDeviceConfiguration::Physical) {
d->devConfigs->addHardwareDeviceConfiguration(name, d->devConfigs->addHardwareDeviceConfiguration(name,
d->wizardData.osVersion, d->wizardData.hostName, d->wizardData.osVersion, d->wizardData.hostName,
d->wizardData.privateKeyFilePath); d->wizardData.privateKeyFilePath);
@@ -672,9 +672,9 @@ int MaemoDeviceConfigWizard::nextId() const
d->wizardData.deviceType = d->startPage.deviceType(); d->wizardData.deviceType = d->startPage.deviceType();
d->wizardData.hostName = d->startPage.hostName(); d->wizardData.hostName = d->startPage.hostName();
if (d->wizardData.deviceType == MaemoDeviceConfig::Emulator) { if (d->wizardData.deviceType == LinuxDeviceConfiguration::Emulator) {
return FinalPageId; return FinalPageId;
} else if (d->wizardData.osVersion == MaemoDeviceConfig::GenericLinux) { } else if (d->wizardData.osVersion == LinuxDeviceConfiguration::GenericLinux) {
return LoginDataPageId; return LoginDataPageId;
} else { } else {
return PreviousKeySetupCheckPageId; return PreviousKeySetupCheckPageId;

View File

@@ -37,15 +37,14 @@
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal { namespace Internal {
class MaemoDeviceConfig; class LinuxDeviceConfigurations;
class MaemoDeviceConfigurations;
struct MaemoDeviceConfigWizardPrivate; struct MaemoDeviceConfigWizardPrivate;
class MaemoDeviceConfigWizard : public QWizard class MaemoDeviceConfigWizard : public QWizard
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit MaemoDeviceConfigWizard(MaemoDeviceConfigurations *devConfigs, explicit MaemoDeviceConfigWizard(LinuxDeviceConfigurations *devConfigs,
QWidget *parent = 0); QWidget *parent = 0);
~MaemoDeviceConfigWizard(); ~MaemoDeviceConfigWizard();
void createDeviceConfig(); void createDeviceConfig();

View File

@@ -31,16 +31,16 @@
#include "maemodeviceenvreader.h" #include "maemodeviceenvreader.h"
#include "maemodeviceconfigurations.h" #include "linuxdeviceconfiguration.h"
#include "maemoglobal.h" #include "maemoglobal.h"
#include "maemorunconfiguration.h" #include "remotelinuxrunconfiguration.h"
#include <utils/ssh/sshremoteprocessrunner.h> #include <utils/ssh/sshremoteprocessrunner.h>
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal { namespace Internal {
MaemoDeviceEnvReader::MaemoDeviceEnvReader(QObject *parent, MaemoRunConfiguration *config) MaemoDeviceEnvReader::MaemoDeviceEnvReader(QObject *parent, RemoteLinuxRunConfiguration *config)
: QObject(parent) : QObject(parent)
, m_stop(false) , m_stop(false)
, m_devConfig(config->deviceConfig()) , m_devConfig(config->deviceConfig())

View File

@@ -42,16 +42,16 @@ namespace Utils {
} }
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal { class LinuxDeviceConfiguration;
class RemoteLinuxRunConfiguration;
class MaemoDeviceConfig; namespace Internal {
class MaemoRunConfiguration;
class MaemoDeviceEnvReader : public QObject class MaemoDeviceEnvReader : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
MaemoDeviceEnvReader(QObject *parent, MaemoRunConfiguration *config); MaemoDeviceEnvReader(QObject *parent, RemoteLinuxRunConfiguration *config);
~MaemoDeviceEnvReader(); ~MaemoDeviceEnvReader();
void start(); void start();
@@ -78,8 +78,8 @@ private:
QString m_remoteOutput; QString m_remoteOutput;
QByteArray m_remoteErrorOutput; QByteArray m_remoteErrorOutput;
Utils::Environment m_env; Utils::Environment m_env;
QSharedPointer<const MaemoDeviceConfig> m_devConfig; QSharedPointer<const LinuxDeviceConfiguration> m_devConfig;
MaemoRunConfiguration *m_runConfig; RemoteLinuxRunConfiguration *m_runConfig;
QSharedPointer<Utils::SshRemoteProcessRunner> m_remoteProcessRunner; QSharedPointer<Utils::SshRemoteProcessRunner> m_remoteProcessRunner;
}; };

View File

@@ -82,17 +82,17 @@ bool MaemoGlobal::isMeegoTargetId(const QString &id)
bool MaemoGlobal::isValidMaemo5QtVersion(const QString &qmakePath) bool MaemoGlobal::isValidMaemo5QtVersion(const QString &qmakePath)
{ {
return isValidMaemoQtVersion(qmakePath, MaemoDeviceConfig::Maemo5); return isValidMaemoQtVersion(qmakePath, LinuxDeviceConfiguration::Maemo5);
} }
bool MaemoGlobal::isValidHarmattanQtVersion(const QString &qmakePath) bool MaemoGlobal::isValidHarmattanQtVersion(const QString &qmakePath)
{ {
return isValidMaemoQtVersion(qmakePath, MaemoDeviceConfig::Maemo6); return isValidMaemoQtVersion(qmakePath, LinuxDeviceConfiguration::Maemo6);
} }
bool MaemoGlobal::isValidMeegoQtVersion(const QString &qmakePath) bool MaemoGlobal::isValidMeegoQtVersion(const QString &qmakePath)
{ {
return isValidMaemoQtVersion(qmakePath, MaemoDeviceConfig::Meego); return isValidMaemoQtVersion(qmakePath, LinuxDeviceConfiguration::Meego);
} }
bool MaemoGlobal::isLinuxQt(const QtSupport::BaseQtVersion *qtVersion) bool MaemoGlobal::isLinuxQt(const QtSupport::BaseQtVersion *qtVersion)
@@ -119,7 +119,7 @@ bool MaemoGlobal::hasLinuxQt(const ProjectExplorer::Target *target)
} }
bool MaemoGlobal::isValidMaemoQtVersion(const QString &qmakePath, bool MaemoGlobal::isValidMaemoQtVersion(const QString &qmakePath,
MaemoDeviceConfig::OsVersion maemoVersion) LinuxDeviceConfiguration::OsVersion maemoVersion)
{ {
if (version(qmakePath) != maemoVersion) if (version(qmakePath) != maemoVersion)
return false; return false;
@@ -154,32 +154,32 @@ QString MaemoGlobal::devrootshPath()
return QLatin1String("/usr/lib/mad-developer/devrootsh"); return QLatin1String("/usr/lib/mad-developer/devrootsh");
} }
int MaemoGlobal::applicationIconSize(MaemoDeviceConfig::OsVersion osVersion) int MaemoGlobal::applicationIconSize(LinuxDeviceConfiguration::OsVersion osVersion)
{ {
return osVersion == MaemoDeviceConfig::Maemo6 ? 80 : 64; return osVersion == LinuxDeviceConfiguration::Maemo6 ? 80 : 64;
} }
QString MaemoGlobal::remoteSudo(MaemoDeviceConfig::OsVersion osVersion, QString MaemoGlobal::remoteSudo(LinuxDeviceConfiguration::OsVersion osVersion,
const QString &uname) const QString &uname)
{ {
if (uname == QLatin1String("root")) if (uname == QLatin1String("root"))
return QString(); return QString();
switch (osVersion) { switch (osVersion) {
case MaemoDeviceConfig::Maemo5: case LinuxDeviceConfiguration::Maemo5:
case MaemoDeviceConfig::Maemo6: case LinuxDeviceConfiguration::Maemo6:
case MaemoDeviceConfig::Meego: case LinuxDeviceConfiguration::Meego:
return devrootshPath(); return devrootshPath();
default: default:
return QString(); // Using sudo would open a can of worms. return QString(); // Using sudo would open a can of worms.
} }
} }
QString MaemoGlobal::remoteCommandPrefix(MaemoDeviceConfig::OsVersion osVersion, QString MaemoGlobal::remoteCommandPrefix(LinuxDeviceConfiguration::OsVersion osVersion,
const QString &userName, const QString &commandFilePath) const QString &userName, const QString &commandFilePath)
{ {
QString prefix = QString::fromLocal8Bit("%1 chmod a+x %2; %3; ") QString prefix = QString::fromLocal8Bit("%1 chmod a+x %2; %3; ")
.arg(remoteSudo(osVersion, userName), commandFilePath, remoteSourceProfilesCommand()); .arg(remoteSudo(osVersion, userName), commandFilePath, remoteSourceProfilesCommand());
if (osVersion != MaemoDeviceConfig::Maemo5 && osVersion != MaemoDeviceConfig::Maemo6) if (osVersion != LinuxDeviceConfiguration::Maemo5 && osVersion != LinuxDeviceConfiguration::Maemo6)
prefix += QLatin1String("DISPLAY=:0.0 "); prefix += QLatin1String("DISPLAY=:0.0 ");
return prefix; return prefix;
} }
@@ -204,12 +204,12 @@ QString MaemoGlobal::remoteEnvironment(const QList<Utils::EnvironmentItem> &list
} }
QString MaemoGlobal::failedToConnectToServerMessage(const Utils::SshConnection::Ptr &connection, QString MaemoGlobal::failedToConnectToServerMessage(const Utils::SshConnection::Ptr &connection,
const MaemoDeviceConfig::ConstPtr &deviceConfig) const LinuxDeviceConfiguration::ConstPtr &deviceConfig)
{ {
QString errorMsg = tr("Could not connect to host: %1") QString errorMsg = tr("Could not connect to host: %1")
.arg(connection->errorString()); .arg(connection->errorString());
if (deviceConfig->type() == MaemoDeviceConfig::Emulator) { if (deviceConfig->type() == LinuxDeviceConfiguration::Emulator) {
if (connection->errorState() == Utils::SshTimeoutError if (connection->errorState() == Utils::SshTimeoutError
|| connection->errorState() == Utils::SshSocketError) { || connection->errorState() == Utils::SshSocketError) {
errorMsg += tr("\nDid you start Qemu?"); errorMsg += tr("\nDid you start Qemu?");
@@ -220,17 +220,17 @@ QString MaemoGlobal::failedToConnectToServerMessage(const Utils::SshConnection::
return errorMsg; return errorMsg;
} }
QString MaemoGlobal::deviceConfigurationName(const MaemoDeviceConfig::ConstPtr &devConf) QString MaemoGlobal::deviceConfigurationName(const LinuxDeviceConfiguration::ConstPtr &devConf)
{ {
return devConf ? devConf->name() : tr("(No device)"); return devConf ? devConf->name() : tr("(No device)");
} }
MaemoPortList MaemoGlobal::freePorts(const MaemoDeviceConfig::ConstPtr &devConf, PortList MaemoGlobal::freePorts(const LinuxDeviceConfiguration::ConstPtr &devConf,
const QtSupport::BaseQtVersion *qtVersion) const QtSupport::BaseQtVersion *qtVersion)
{ {
if (!devConf || !qtVersion) if (!devConf || !qtVersion)
return MaemoPortList(); return PortList();
if (devConf->type() == MaemoDeviceConfig::Emulator) { if (devConf->type() == LinuxDeviceConfiguration::Emulator) {
MaemoQemuRuntime rt; MaemoQemuRuntime rt;
const int id = qtVersion->uniqueId(); const int id = qtVersion->uniqueId();
if (MaemoQemuManager::instance().runtimeForQtVersion(id, &rt)) if (MaemoQemuManager::instance().runtimeForQtVersion(id, &rt))
@@ -266,22 +266,22 @@ QString MaemoGlobal::madCommand(const QString &qmakePath)
return maddeRoot(qmakePath) + QLatin1String("/bin/mad"); return maddeRoot(qmakePath) + QLatin1String("/bin/mad");
} }
QString MaemoGlobal::madDeveloperUiName(MaemoDeviceConfig::OsVersion osVersion) QString MaemoGlobal::madDeveloperUiName(LinuxDeviceConfiguration::OsVersion osVersion)
{ {
return osVersion == MaemoDeviceConfig::Maemo6 return osVersion == LinuxDeviceConfiguration::Maemo6
? tr("SDK Connectivity") : tr("Mad Developer"); ? tr("SDK Connectivity") : tr("Mad Developer");
} }
MaemoDeviceConfig::OsVersion MaemoGlobal::version(const QString &qmakePath) LinuxDeviceConfiguration::OsVersion MaemoGlobal::version(const QString &qmakePath)
{ {
const QString &name = targetName(qmakePath); const QString &name = targetName(qmakePath);
if (name.startsWith(QLatin1String("fremantle"))) if (name.startsWith(QLatin1String("fremantle")))
return MaemoDeviceConfig::Maemo5; return LinuxDeviceConfiguration::Maemo5;
if (name.startsWith(QLatin1String("harmattan"))) if (name.startsWith(QLatin1String("harmattan")))
return MaemoDeviceConfig::Maemo6; return LinuxDeviceConfiguration::Maemo6;
if (name.startsWith(QLatin1String("meego"))) if (name.startsWith(QLatin1String("meego")))
return MaemoDeviceConfig::Meego; return LinuxDeviceConfiguration::Meego;
return MaemoDeviceConfig::GenericLinux; return LinuxDeviceConfiguration::GenericLinux;
} }
QString MaemoGlobal::architecture(const QString &qmakePath) QString MaemoGlobal::architecture(const QString &qmakePath)
@@ -430,24 +430,24 @@ QStringList MaemoGlobal::targetArgs(const QString &qmakePath, bool useTarget)
return args; return args;
} }
QString MaemoGlobal::osVersionToString(MaemoDeviceConfig::OsVersion version) QString MaemoGlobal::osVersionToString(LinuxDeviceConfiguration::OsVersion version)
{ {
switch (version) { switch (version) {
case MaemoDeviceConfig::Maemo5: return QLatin1String("Maemo5/Fremantle"); case LinuxDeviceConfiguration::Maemo5: return QLatin1String("Maemo5/Fremantle");
case MaemoDeviceConfig::Maemo6: return QLatin1String("Harmattan"); case LinuxDeviceConfiguration::Maemo6: return QLatin1String("Harmattan");
case MaemoDeviceConfig::Meego: return QLatin1String("Meego"); case LinuxDeviceConfiguration::Meego: return QLatin1String("Meego");
case MaemoDeviceConfig::GenericLinux: return QLatin1String("Other Linux"); case LinuxDeviceConfiguration::GenericLinux: return QLatin1String("Other Linux");
} }
qDebug("%s: Unknown OS Version %d.", Q_FUNC_INFO, version); qDebug("%s: Unknown OS Version %d.", Q_FUNC_INFO, version);
return QString(); return QString();
} }
MaemoGlobal::PackagingSystem MaemoGlobal::packagingSystem(MaemoDeviceConfig::OsVersion osVersion) MaemoGlobal::PackagingSystem MaemoGlobal::packagingSystem(LinuxDeviceConfiguration::OsVersion osVersion)
{ {
switch (osVersion) { switch (osVersion) {
case MaemoDeviceConfig::Maemo5: case MaemoDeviceConfig::Maemo6: return Dpkg; case LinuxDeviceConfiguration::Maemo5: case LinuxDeviceConfiguration::Maemo6: return Dpkg;
case MaemoDeviceConfig::Meego: return Rpm; case LinuxDeviceConfiguration::Meego: return Rpm;
case MaemoDeviceConfig::GenericLinux: return Tar; case LinuxDeviceConfiguration::GenericLinux: return Tar;
default: qFatal("%s: Missing case in switch.", Q_FUNC_INFO); default: qFatal("%s: Missing case in switch.", Q_FUNC_INFO);
} }
return static_cast<PackagingSystem>(-1); return static_cast<PackagingSystem>(-1);

View File

@@ -33,7 +33,7 @@
#ifndef MAEMOGLOBAL_H #ifndef MAEMOGLOBAL_H
#define MAEMOGLOBAL_H #define MAEMOGLOBAL_H
#include "maemodeviceconfigurations.h" #include "linuxdeviceconfiguration.h"
#include <coreplugin/ifile.h> #include <coreplugin/ifile.h>
#include <utils/environment.h> #include <utils/environment.h>
@@ -106,25 +106,25 @@ public:
static QString homeDirOnDevice(const QString &uname); static QString homeDirOnDevice(const QString &uname);
static QString devrootshPath(); static QString devrootshPath();
static int applicationIconSize(MaemoDeviceConfig::OsVersion osVersion); static int applicationIconSize(LinuxDeviceConfiguration::OsVersion osVersion);
static QString remoteSudo(MaemoDeviceConfig::OsVersion, static QString remoteSudo(LinuxDeviceConfiguration::OsVersion,
const QString &uname); const QString &uname);
static QString remoteCommandPrefix(MaemoDeviceConfig::OsVersion osVersion, static QString remoteCommandPrefix(LinuxDeviceConfiguration::OsVersion osVersion,
const QString &userName, const QString &commandFilePath); const QString &userName, const QString &commandFilePath);
static QString remoteEnvironment(const QList<Utils::EnvironmentItem> &list); static QString remoteEnvironment(const QList<Utils::EnvironmentItem> &list);
static QString remoteSourceProfilesCommand(); static QString remoteSourceProfilesCommand();
static QString failedToConnectToServerMessage(const QSharedPointer<Utils::SshConnection> &connection, static QString failedToConnectToServerMessage(const QSharedPointer<Utils::SshConnection> &connection,
const QSharedPointer<const MaemoDeviceConfig> &deviceConfig); const QSharedPointer<const LinuxDeviceConfiguration> &deviceConfig);
static QString deviceConfigurationName(const QSharedPointer<const MaemoDeviceConfig> &devConf); static QString deviceConfigurationName(const QSharedPointer<const LinuxDeviceConfiguration> &devConf);
static MaemoPortList freePorts(const QSharedPointer<const MaemoDeviceConfig> &devConf, static PortList freePorts(const QSharedPointer<const LinuxDeviceConfiguration> &devConf,
const QtSupport::BaseQtVersion *qtVersion); const QtSupport::BaseQtVersion *qtVersion);
static QString maddeRoot(const QString &qmakePath); static QString maddeRoot(const QString &qmakePath);
static QString targetRoot(const QString &qmakePath); static QString targetRoot(const QString &qmakePath);
static QString targetName(const QString &qmakePath); static QString targetName(const QString &qmakePath);
static QString madCommand(const QString &qmakePath); static QString madCommand(const QString &qmakePath);
static QString madDeveloperUiName(MaemoDeviceConfig::OsVersion maemoVersion); static QString madDeveloperUiName(LinuxDeviceConfiguration::OsVersion maemoVersion);
static MaemoDeviceConfig::OsVersion version(const QString &qmakePath); static LinuxDeviceConfiguration::OsVersion version(const QString &qmakePath);
// TODO: IS this still needed with Qt Version having an Abi? // TODO: IS this still needed with Qt Version having an Abi?
static QString architecture(const QString &qmakePath); static QString architecture(const QString &qmakePath);
@@ -134,9 +134,9 @@ public:
static bool callMadAdmin(QProcess &proc, const QStringList &args, static bool callMadAdmin(QProcess &proc, const QStringList &args,
const QString &qmakePath, bool useTarget); const QString &qmakePath, bool useTarget);
static QString osVersionToString(MaemoDeviceConfig::OsVersion version); static QString osVersionToString(LinuxDeviceConfiguration::OsVersion version);
static PackagingSystem packagingSystem(MaemoDeviceConfig::OsVersion osVersion); static PackagingSystem packagingSystem(LinuxDeviceConfiguration::OsVersion osVersion);
static bool removeRecursively(const QString &filePath, QString &error); static bool removeRecursively(const QString &filePath, QString &error);
static bool copyRecursively(const QString &srcFilePath, static bool copyRecursively(const QString &srcFilePath,
@@ -177,7 +177,7 @@ public:
} }
static bool isValidMaemoQtVersion(const QString &qmakePath, static bool isValidMaemoQtVersion(const QString &qmakePath,
MaemoDeviceConfig::OsVersion maemoVersion); LinuxDeviceConfiguration::OsVersion maemoVersion);
private: private:
static QString madAdminCommand(const QString &qmakePath); static QString madAdminCommand(const QString &qmakePath);
static bool callMaddeShellScript(QProcess &proc, const QString &qmakePath, static bool callMaddeShellScript(QProcess &proc, const QString &qmakePath,

View File

@@ -50,7 +50,7 @@ AbstractMaemoPackageInstaller::AbstractMaemoPackageInstaller(QObject *parent)
AbstractMaemoPackageInstaller::~AbstractMaemoPackageInstaller() {} AbstractMaemoPackageInstaller::~AbstractMaemoPackageInstaller() {}
void AbstractMaemoPackageInstaller::installPackage(const SshConnection::Ptr &connection, void AbstractMaemoPackageInstaller::installPackage(const SshConnection::Ptr &connection,
const MaemoDeviceConfig::ConstPtr &devConf, const QString &packageFilePath, const LinuxDeviceConfiguration::ConstPtr &devConf, const QString &packageFilePath,
bool removePackageFile) bool removePackageFile)
{ {
Q_ASSERT(connection && connection->state() == SshConnection::Connected); Q_ASSERT(connection && connection->state() == SshConnection::Connected);

View File

@@ -44,8 +44,9 @@ class SshRemoteProcessRunner;
#include <QtCore/QStringList> #include <QtCore/QStringList>
namespace RemoteLinux { namespace RemoteLinux {
class LinuxDeviceConfiguration;
namespace Internal { namespace Internal {
class MaemoDeviceConfig;
class AbstractMaemoPackageInstaller : public QObject class AbstractMaemoPackageInstaller : public QObject
{ {
@@ -54,7 +55,7 @@ public:
~AbstractMaemoPackageInstaller(); ~AbstractMaemoPackageInstaller();
void installPackage(const QSharedPointer<Utils::SshConnection> &connection, void installPackage(const QSharedPointer<Utils::SshConnection> &connection,
const QSharedPointer<const MaemoDeviceConfig> &devConfig, const QSharedPointer<const LinuxDeviceConfiguration> &devConfig,
const QString &packageFilePath, bool removePackageFile); const QString &packageFilePath, bool removePackageFile);
void cancelInstallation(); void cancelInstallation();

View File

@@ -31,6 +31,7 @@
**************************************************************************/ **************************************************************************/
#include "maemopertargetdeviceconfigurationlistmodel.h" #include "maemopertargetdeviceconfigurationlistmodel.h"
#include "linuxdeviceconfigurations.h"
#include "qt4maemotarget.h" #include "qt4maemotarget.h"
using namespace ProjectExplorer; using namespace ProjectExplorer;
@@ -42,15 +43,15 @@ MaemoPerTargetDeviceConfigurationListModel::MaemoPerTargetDeviceConfigurationLis
const Target *target) : QAbstractListModel(parent) const Target *target) : QAbstractListModel(parent)
{ {
if (qobject_cast<const Qt4Maemo5Target *>(target)) if (qobject_cast<const Qt4Maemo5Target *>(target))
m_targetOsVersion = MaemoDeviceConfig::Maemo5; m_targetOsVersion = LinuxDeviceConfiguration::Maemo5;
else if (qobject_cast<const Qt4HarmattanTarget *>(target)) else if (qobject_cast<const Qt4HarmattanTarget *>(target))
m_targetOsVersion = MaemoDeviceConfig::Maemo6; m_targetOsVersion = LinuxDeviceConfiguration::Maemo6;
else if (qobject_cast<const Qt4MeegoTarget *>(target)) else if (qobject_cast<const Qt4MeegoTarget *>(target))
m_targetOsVersion = MaemoDeviceConfig::Meego; m_targetOsVersion = LinuxDeviceConfiguration::Meego;
else else
m_targetOsVersion = MaemoDeviceConfig::GenericLinux; m_targetOsVersion = LinuxDeviceConfiguration::GenericLinux;
const MaemoDeviceConfigurations * const devConfs const LinuxDeviceConfigurations * const devConfs
= MaemoDeviceConfigurations::instance(); = LinuxDeviceConfigurations::instance();
connect(devConfs, SIGNAL(modelReset()), this, SIGNAL(modelReset())); connect(devConfs, SIGNAL(modelReset()), this, SIGNAL(modelReset()));
connect(devConfs, SIGNAL(updated()), this, SIGNAL(updated())); connect(devConfs, SIGNAL(updated()), this, SIGNAL(updated()));
} }
@@ -64,10 +65,10 @@ int MaemoPerTargetDeviceConfigurationListModel::rowCount(const QModelIndex &pare
if (parent.isValid()) if (parent.isValid())
return 0; return 0;
int count = 0; int count = 0;
const MaemoDeviceConfigurations * const devConfs const LinuxDeviceConfigurations * const devConfs
= MaemoDeviceConfigurations::instance(); = LinuxDeviceConfigurations::instance();
const int devConfsCount = devConfs->rowCount(); const int devConfsCount = devConfs->rowCount();
if (m_targetOsVersion == MaemoDeviceConfig::GenericLinux) if (m_targetOsVersion == LinuxDeviceConfiguration::GenericLinux)
return devConfsCount; return devConfsCount;
for (int i = 0; i < devConfsCount; ++i) { for (int i = 0; i < devConfsCount; ++i) {
if (devConfs->deviceAt(i)->osVersion() == m_targetOsVersion) if (devConfs->deviceAt(i)->osVersion() == m_targetOsVersion)
@@ -81,7 +82,7 @@ QVariant MaemoPerTargetDeviceConfigurationListModel::data(const QModelIndex &ind
{ {
if (!index.isValid() || index.row() >= rowCount() || role != Qt::DisplayRole) if (!index.isValid() || index.row() >= rowCount() || role != Qt::DisplayRole)
return QVariant(); return QVariant();
const MaemoDeviceConfig::ConstPtr &devConf = deviceAt(index.row()); const LinuxDeviceConfiguration::ConstPtr &devConf = deviceAt(index.row());
Q_ASSERT(devConf); Q_ASSERT(devConf);
QString displayedName = devConf->name(); QString displayedName = devConf->name();
if (devConf->isDefault() && devConf->osVersion() == m_targetOsVersion) if (devConf->isDefault() && devConf->osVersion() == m_targetOsVersion)
@@ -89,12 +90,12 @@ QVariant MaemoPerTargetDeviceConfigurationListModel::data(const QModelIndex &ind
return displayedName; return displayedName;
} }
MaemoDeviceConfig::ConstPtr MaemoPerTargetDeviceConfigurationListModel::deviceAt(int idx) const LinuxDeviceConfiguration::ConstPtr MaemoPerTargetDeviceConfigurationListModel::deviceAt(int idx) const
{ {
int currentRow = -1; int currentRow = -1;
const MaemoDeviceConfigurations * const devConfs const LinuxDeviceConfigurations * const devConfs
= MaemoDeviceConfigurations::instance(); = LinuxDeviceConfigurations::instance();
if (m_targetOsVersion == MaemoDeviceConfig::GenericLinux) if (m_targetOsVersion == LinuxDeviceConfiguration::GenericLinux)
return devConfs->deviceAt(idx); return devConfs->deviceAt(idx);
const int devConfsCount = devConfs->rowCount(); const int devConfsCount = devConfs->rowCount();
for (int i = 0; i < devConfsCount; ++i) { for (int i = 0; i < devConfsCount; ++i) {
@@ -104,24 +105,24 @@ MaemoDeviceConfig::ConstPtr MaemoPerTargetDeviceConfigurationListModel::deviceAt
} }
} }
Q_ASSERT(false); Q_ASSERT(false);
return MaemoDeviceConfig::ConstPtr(); return LinuxDeviceConfiguration::ConstPtr();
} }
MaemoDeviceConfig::ConstPtr MaemoPerTargetDeviceConfigurationListModel::defaultDeviceConfig() const LinuxDeviceConfiguration::ConstPtr MaemoPerTargetDeviceConfigurationListModel::defaultDeviceConfig() const
{ {
return MaemoDeviceConfigurations::instance()->defaultDeviceConfig(m_targetOsVersion); return LinuxDeviceConfigurations::instance()->defaultDeviceConfig(m_targetOsVersion);
} }
MaemoDeviceConfig::ConstPtr MaemoPerTargetDeviceConfigurationListModel::find(MaemoDeviceConfig::Id id) const LinuxDeviceConfiguration::ConstPtr MaemoPerTargetDeviceConfigurationListModel::find(LinuxDeviceConfiguration::Id id) const
{ {
const MaemoDeviceConfig::ConstPtr &devConf const LinuxDeviceConfiguration::ConstPtr &devConf
= MaemoDeviceConfigurations::instance()->find(id); = LinuxDeviceConfigurations::instance()->find(id);
return devConf && (devConf->osVersion() == m_targetOsVersion return devConf && (devConf->osVersion() == m_targetOsVersion
|| m_targetOsVersion == MaemoDeviceConfig::GenericLinux) || m_targetOsVersion == LinuxDeviceConfiguration::GenericLinux)
? devConf : defaultDeviceConfig(); ? devConf : defaultDeviceConfig();
} }
int MaemoPerTargetDeviceConfigurationListModel::indexForInternalId(MaemoDeviceConfig::Id id) const int MaemoPerTargetDeviceConfigurationListModel::indexForInternalId(LinuxDeviceConfiguration::Id id) const
{ {
const int count = rowCount(); const int count = rowCount();
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {

View File

@@ -32,7 +32,7 @@
#ifndef MAEMOPERTARGETDEVICECONFIGURATIONLISTMODEL_H #ifndef MAEMOPERTARGETDEVICECONFIGURATIONLISTMODEL_H
#define MAEMOPERTARGETDEVICECONFIGURATIONLISTMODEL_H #define MAEMOPERTARGETDEVICECONFIGURATIONLISTMODEL_H
#include "maemodeviceconfigurations.h" #include "linuxdeviceconfiguration.h"
#include "maemoglobal.h" #include "maemoglobal.h"
#include <QtCore/QAbstractListModel> #include <QtCore/QAbstractListModel>
@@ -55,16 +55,16 @@ public:
virtual QVariant data(const QModelIndex &index, virtual QVariant data(const QModelIndex &index,
int role = Qt::DisplayRole) const; int role = Qt::DisplayRole) const;
QSharedPointer<const MaemoDeviceConfig> deviceAt(int idx) const; QSharedPointer<const LinuxDeviceConfiguration> deviceAt(int idx) const;
QSharedPointer<const MaemoDeviceConfig> defaultDeviceConfig() const; QSharedPointer<const LinuxDeviceConfiguration> defaultDeviceConfig() const;
QSharedPointer<const MaemoDeviceConfig> find(MaemoDeviceConfig::Id id) const; QSharedPointer<const LinuxDeviceConfiguration> find(LinuxDeviceConfiguration::Id id) const;
int indexForInternalId(MaemoDeviceConfig::Id id) const; int indexForInternalId(LinuxDeviceConfiguration::Id id) const;
signals: signals:
void updated(); void updated();
private: private:
MaemoDeviceConfig::OsVersion m_targetOsVersion; LinuxDeviceConfiguration::OsVersion m_targetOsVersion;
}; };
} // namespace Internal } // namespace Internal

View File

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

View File

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

View File

@@ -35,7 +35,7 @@
#include "maemoglobal.h" #include "maemoglobal.h"
#include "maemoqemuruntimeparser.h" #include "maemoqemuruntimeparser.h"
#include "maemosettingspages.h" #include "maemosettingspages.h"
#include "maemorunconfiguration.h" #include "remotelinuxrunconfiguration.h"
#include "qt4maemotarget.h" #include "qt4maemotarget.h"
#include "maemoqtversion.h" #include "maemoqtversion.h"
@@ -269,7 +269,7 @@ void MaemoQemuManager::targetAdded(ProjectExplorer::Target *target)
connect(target, SIGNAL(environmentChanged()), this, SLOT(environmentChanged())); connect(target, SIGNAL(environmentChanged()), this, SLOT(environmentChanged()));
foreach (RunConfiguration *rc, target->runConfigurations()) foreach (RunConfiguration *rc, target->runConfigurations())
toggleDeviceConnections(qobject_cast<MaemoRunConfiguration*> (rc), true); toggleDeviceConnections(qobject_cast<RemoteLinuxRunConfiguration*> (rc), true);
toggleStarterButton(target); toggleStarterButton(target);
} }
@@ -295,7 +295,7 @@ void MaemoQemuManager::targetRemoved(ProjectExplorer::Target *target)
disconnect(target, SIGNAL(environmentChanged()), this, SLOT(environmentChanged())); disconnect(target, SIGNAL(environmentChanged()), this, SLOT(environmentChanged()));
foreach (RunConfiguration *rc, target->runConfigurations()) foreach (RunConfiguration *rc, target->runConfigurations())
toggleDeviceConnections(qobject_cast<MaemoRunConfiguration*> (rc), false); toggleDeviceConnections(qobject_cast<RemoteLinuxRunConfiguration*> (rc), false);
showOrHideQemuButton(); showOrHideQemuButton();
} }
@@ -311,14 +311,14 @@ void MaemoQemuManager::runConfigurationAdded(ProjectExplorer::RunConfiguration *
{ {
if (!rc || !MaemoGlobal::isMaemoTargetId(rc->target()->id())) if (!rc || !MaemoGlobal::isMaemoTargetId(rc->target()->id()))
return; return;
toggleDeviceConnections(qobject_cast<MaemoRunConfiguration*> (rc), true); toggleDeviceConnections(qobject_cast<RemoteLinuxRunConfiguration*> (rc), true);
} }
void MaemoQemuManager::runConfigurationRemoved(ProjectExplorer::RunConfiguration *rc) void MaemoQemuManager::runConfigurationRemoved(ProjectExplorer::RunConfiguration *rc)
{ {
if (!rc || !MaemoGlobal::isMaemoTargetId(rc->target()->id())) if (!rc || !MaemoGlobal::isMaemoTargetId(rc->target()->id()))
return; return;
toggleDeviceConnections(qobject_cast<MaemoRunConfiguration*> (rc), false); toggleDeviceConnections(qobject_cast<RemoteLinuxRunConfiguration*> (rc), false);
} }
void MaemoQemuManager::runConfigurationChanged(ProjectExplorer::RunConfiguration *rc) void MaemoQemuManager::runConfigurationChanged(ProjectExplorer::RunConfiguration *rc)
@@ -573,8 +573,8 @@ bool MaemoQemuManager::targetUsesMatchingRuntimeConfig(Target *target,
if (target != target->project()->activeTarget()) if (target != target->project()->activeTarget())
return false; return false;
MaemoRunConfiguration *mrc = RemoteLinuxRunConfiguration *mrc =
qobject_cast<MaemoRunConfiguration *> (target->activeRunConfiguration()); qobject_cast<RemoteLinuxRunConfiguration *> (target->activeRunConfiguration());
if (!mrc) if (!mrc)
return false; return false;
Qt4BuildConfiguration *bc Qt4BuildConfiguration *bc
@@ -587,8 +587,8 @@ bool MaemoQemuManager::targetUsesMatchingRuntimeConfig(Target *target,
if (qtVersion) if (qtVersion)
*qtVersion = version; *qtVersion = version;
const MaemoDeviceConfig::ConstPtr &config = mrc->deviceConfig(); const LinuxDeviceConfiguration::ConstPtr &config = mrc->deviceConfig();
return config && config->type() == MaemoDeviceConfig::Emulator; return config && config->type() == LinuxDeviceConfiguration::Emulator;
} }
void MaemoQemuManager::notify(const QList<int> uniqueIds) void MaemoQemuManager::notify(const QList<int> uniqueIds)
@@ -597,7 +597,7 @@ void MaemoQemuManager::notify(const QList<int> uniqueIds)
environmentChanged(); // to toggle the start button environmentChanged(); // to toggle the start button
} }
void MaemoQemuManager::toggleDeviceConnections(MaemoRunConfiguration *mrc, void MaemoQemuManager::toggleDeviceConnections(RemoteLinuxRunConfiguration *mrc,
bool _connect) bool _connect)
{ {
if (!mrc) if (!mrc)

View File

@@ -61,8 +61,9 @@ class BaseQtVersion;
} }
namespace RemoteLinux { namespace RemoteLinux {
class RemoteLinuxRunConfiguration;
namespace Internal { namespace Internal {
class MaemoRunConfiguration;
class MaemoQemuManager : public QObject class MaemoQemuManager : public QObject
{ {
@@ -122,7 +123,7 @@ private:
QtSupport::BaseQtVersion **qtVersion = 0); QtSupport::BaseQtVersion **qtVersion = 0);
void notify(const QList<int> uniqueIds); void notify(const QList<int> uniqueIds);
void toggleDeviceConnections(MaemoRunConfiguration *mrc, bool connect); void toggleDeviceConnections(RemoteLinuxRunConfiguration *mrc, bool connect);
void showOrHideQemuButton(); void showOrHideQemuButton();
private: private:

View File

@@ -32,7 +32,7 @@
#ifndef MAEMOQEMURUNTIME_H #ifndef MAEMOQEMURUNTIME_H
#define MAEMOQEMURUNTIME_H #define MAEMOQEMURUNTIME_H
#include "maemodeviceconfigurations.h" #include "linuxdeviceconfiguration.h"
#include "maemoqemusettings.h" #include "maemoqemusettings.h"
#include <QtCore/QHash> #include <QtCore/QHash>
@@ -78,7 +78,7 @@ struct MaemoQemuRuntime
QString m_args; QString m_args;
QString m_sshPort; QString m_sshPort;
QString m_watchPath; QString m_watchPath;
MaemoPortList m_freePorts; PortList m_freePorts;
QList<Variable> m_normalVars; QList<Variable> m_normalVars;
QString m_openGlBackendVarName; QString m_openGlBackendVarName;
QHash<MaemoQemuSettings::OpenGlMode, QString> m_openGlBackendVarValues; QHash<MaemoQemuSettings::OpenGlMode, QString> m_openGlBackendVarValues;

View File

@@ -188,7 +188,7 @@ void MaemoQemuRuntimeParserV1::fillRuntimeInformation(MaemoQemuRuntime *runtime)
runtime->m_args = map.value(QLatin1String("qemu_args")); runtime->m_args = map.value(QLatin1String("qemu_args"));
setEnvironment(runtime, map.value(QLatin1String("libpath"))); setEnvironment(runtime, map.value(QLatin1String("libpath")));
runtime->m_sshPort = map.value(QLatin1String("sshport")); runtime->m_sshPort = map.value(QLatin1String("sshport"));
runtime->m_freePorts = MaemoPortList(); runtime->m_freePorts = PortList();
int i = 2; int i = 2;
while (true) { while (true) {
const QString port = map.value(QLatin1String("redirport") const QString port = map.value(QLatin1String("redirport")

View File

@@ -109,16 +109,16 @@ QList<ProjectExplorer::Abi> MaemoQtVersion::qtAbis() const
QList<ProjectExplorer::Abi> result; QList<ProjectExplorer::Abi> result;
if (!m_isvalidVersion) if (!m_isvalidVersion)
return result; return result;
if (m_osVersion == MaemoDeviceConfig::Maemo5) { if (m_osVersion == LinuxDeviceConfiguration::Maemo5) {
result.append(ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture, ProjectExplorer::Abi::LinuxOS, result.append(ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture, ProjectExplorer::Abi::LinuxOS,
ProjectExplorer::Abi::MaemoLinuxFlavor, ProjectExplorer::Abi::ElfFormat, ProjectExplorer::Abi::MaemoLinuxFlavor, ProjectExplorer::Abi::ElfFormat,
32)); 32));
} else if (m_osVersion == MaemoDeviceConfig::Maemo6) { } else if (m_osVersion == LinuxDeviceConfiguration::Maemo6) {
result.append(ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture, ProjectExplorer::Abi::LinuxOS, result.append(ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture, ProjectExplorer::Abi::LinuxOS,
ProjectExplorer::Abi::HarmattanLinuxFlavor, ProjectExplorer::Abi::HarmattanLinuxFlavor,
ProjectExplorer::Abi::ElfFormat, ProjectExplorer::Abi::ElfFormat,
32)); 32));
} else if (m_osVersion == MaemoDeviceConfig::Meego) { } else if (m_osVersion == LinuxDeviceConfiguration::Meego) {
result.append(ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture, ProjectExplorer::Abi::LinuxOS, result.append(ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture, ProjectExplorer::Abi::LinuxOS,
ProjectExplorer::Abi::MeegoLinuxFlavor, ProjectExplorer::Abi::MeegoLinuxFlavor,
ProjectExplorer::Abi::ElfFormat, 32)); ProjectExplorer::Abi::ElfFormat, 32));
@@ -136,11 +136,11 @@ QSet<QString> MaemoQtVersion::supportedTargetIds() const
QSet<QString> result; QSet<QString> result;
if (!m_isvalidVersion) if (!m_isvalidVersion)
return result; return result;
if (m_osVersion == MaemoDeviceConfig::Maemo5) { if (m_osVersion == LinuxDeviceConfiguration::Maemo5) {
result.insert(QLatin1String(Constants::MAEMO5_DEVICE_TARGET_ID)); result.insert(QLatin1String(Constants::MAEMO5_DEVICE_TARGET_ID));
} else if (m_osVersion == MaemoDeviceConfig::Maemo6) { } else if (m_osVersion == LinuxDeviceConfiguration::Maemo6) {
result.insert(QLatin1String(Constants::HARMATTAN_DEVICE_TARGET_ID)); result.insert(QLatin1String(Constants::HARMATTAN_DEVICE_TARGET_ID));
} else if (m_osVersion == MaemoDeviceConfig::Meego) { } else if (m_osVersion == LinuxDeviceConfiguration::Meego) {
result.insert(QLatin1String(Constants::MEEGO_DEVICE_TARGET_ID)); result.insert(QLatin1String(Constants::MEEGO_DEVICE_TARGET_ID));
} }
return result; return result;
@@ -148,11 +148,11 @@ QSet<QString> MaemoQtVersion::supportedTargetIds() const
QString MaemoQtVersion::description() const QString MaemoQtVersion::description() const
{ {
if (m_osVersion == MaemoDeviceConfig::Maemo5) if (m_osVersion == LinuxDeviceConfiguration::Maemo5)
return QCoreApplication::translate("QtVersion", "Maemo", "Qt Version is meant for Maemo5"); return QCoreApplication::translate("QtVersion", "Maemo", "Qt Version is meant for Maemo5");
else if (m_osVersion == MaemoDeviceConfig::Maemo6) else if (m_osVersion == LinuxDeviceConfiguration::Maemo6)
return QCoreApplication::translate("QtVersion", "Harmattan ", "Qt Version is meant for Harmattan"); return QCoreApplication::translate("QtVersion", "Harmattan ", "Qt Version is meant for Harmattan");
else if (m_osVersion == MaemoDeviceConfig::Meego) else if (m_osVersion == LinuxDeviceConfiguration::Meego)
return QCoreApplication::translate("QtVersion", "Meego", "Qt Version is meant for Meego"); return QCoreApplication::translate("QtVersion", "Meego", "Qt Version is meant for Meego");
return QString(); return QString();
} }
@@ -165,7 +165,7 @@ bool MaemoQtVersion::supportsShadowBuilds() const
return true; return true;
} }
MaemoDeviceConfig::OsVersion MaemoQtVersion::osVersion() const LinuxDeviceConfiguration::OsVersion MaemoQtVersion::osVersion() const
{ {
return m_osVersion; return m_osVersion;
} }

View File

@@ -32,7 +32,7 @@
#ifndef MAEMOQTVERSION_H #ifndef MAEMOQTVERSION_H
#define MAEMOQTVERSION_H #define MAEMOQTVERSION_H
#include "maemodeviceconfigurations.h" #include "linuxdeviceconfiguration.h"
#include <qtsupport/baseqtversion.h> #include <qtsupport/baseqtversion.h>
namespace RemoteLinux { namespace RemoteLinux {
@@ -59,10 +59,10 @@ public:
virtual QString description() const; virtual QString description() const;
virtual bool supportsShadowBuilds() const; virtual bool supportsShadowBuilds() const;
MaemoDeviceConfig::OsVersion osVersion() const; LinuxDeviceConfiguration::OsVersion osVersion() const;
private: private:
mutable QString m_systemRoot; mutable QString m_systemRoot;
mutable MaemoDeviceConfig::OsVersion m_osVersion; mutable LinuxDeviceConfiguration::OsVersion m_osVersion;
mutable bool m_isvalidVersion; mutable bool m_isvalidVersion;
}; };

View File

@@ -51,7 +51,7 @@ MaemoRemoteCopyFacility::MaemoRemoteCopyFacility(QObject *parent) :
MaemoRemoteCopyFacility::~MaemoRemoteCopyFacility() {} MaemoRemoteCopyFacility::~MaemoRemoteCopyFacility() {}
void MaemoRemoteCopyFacility::copyFiles(const SshConnection::Ptr &connection, void MaemoRemoteCopyFacility::copyFiles(const SshConnection::Ptr &connection,
const MaemoDeviceConfig::ConstPtr &devConf, const LinuxDeviceConfiguration::ConstPtr &devConf,
const QList<MaemoDeployable> &deployables, const QString &mountPoint) const QList<MaemoDeployable> &deployables, const QString &mountPoint)
{ {
Q_ASSERT(connection->state() == SshConnection::Connected); Q_ASSERT(connection->state() == SshConnection::Connected);

View File

@@ -46,8 +46,9 @@ class SshRemoteProcessRunner;
} }
namespace RemoteLinux { namespace RemoteLinux {
class LinuxDeviceConfiguration;
namespace Internal { namespace Internal {
class MaemoDeviceConfig;
class MaemoRemoteCopyFacility : public QObject class MaemoRemoteCopyFacility : public QObject
{ {
@@ -57,7 +58,7 @@ public:
~MaemoRemoteCopyFacility(); ~MaemoRemoteCopyFacility();
void copyFiles(const QSharedPointer<Utils::SshConnection> &connection, void copyFiles(const QSharedPointer<Utils::SshConnection> &connection,
const QSharedPointer<const MaemoDeviceConfig> &devConf, const QSharedPointer<const LinuxDeviceConfiguration> &devConf,
const QList<MaemoDeployable> &deployables, const QString &mountPoint); const QList<MaemoDeployable> &deployables, const QString &mountPoint);
void cancel(); void cancel();
@@ -79,7 +80,7 @@ private:
void setFinished(); void setFinished();
QSharedPointer<Utils::SshRemoteProcessRunner> m_copyRunner; QSharedPointer<Utils::SshRemoteProcessRunner> m_copyRunner;
QSharedPointer<const MaemoDeviceConfig> m_devConf; QSharedPointer<const LinuxDeviceConfiguration> m_devConf;
QList<MaemoDeployable> m_deployables; QList<MaemoDeployable> m_deployables;
QString m_mountPoint; QString m_mountPoint;
bool m_isCopying; bool m_isCopying;

View File

@@ -66,7 +66,7 @@ MaemoRemoteMounter::~MaemoRemoteMounter()
} }
void MaemoRemoteMounter::setConnection(const SshConnection::Ptr &connection, void MaemoRemoteMounter::setConnection(const SshConnection::Ptr &connection,
const MaemoDeviceConfig::ConstPtr &devConf) const LinuxDeviceConfiguration::ConstPtr &devConf)
{ {
ASSERT_STATE(Inactive); ASSERT_STATE(Inactive);
m_connection = connection; m_connection = connection;
@@ -97,7 +97,7 @@ bool MaemoRemoteMounter::hasValidMountSpecifications() const
return !m_mountSpecs.isEmpty(); return !m_mountSpecs.isEmpty();
} }
void MaemoRemoteMounter::mount(MaemoPortList *freePorts, void MaemoRemoteMounter::mount(PortList *freePorts,
const MaemoUsedPortsGatherer *portsGatherer) const MaemoUsedPortsGatherer *portsGatherer)
{ {
ASSERT_STATE(Inactive); ASSERT_STATE(Inactive);

View File

@@ -33,7 +33,7 @@
#ifndef MAEMOREMOTEMOUNTER_H #ifndef MAEMOREMOTEMOUNTER_H
#define MAEMOREMOTEMOUNTER_H #define MAEMOREMOTEMOUNTER_H
#include "maemodeviceconfigurations.h" #include "linuxdeviceconfiguration.h"
#include "maemomountspecification.h" #include "maemomountspecification.h"
#include <QtCore/QList> #include <QtCore/QList>
@@ -53,8 +53,9 @@ class SshRemoteProcess;
namespace Qt4ProjectManager { class Qt4BuildConfiguration; } namespace Qt4ProjectManager { class Qt4BuildConfiguration; }
namespace RemoteLinux { namespace RemoteLinux {
class LinuxDeviceConfiguration;
namespace Internal { namespace Internal {
class MaemoDeviceConfig;
class MaemoUsedPortsGatherer; class MaemoUsedPortsGatherer;
class MaemoRemoteMounter : public QObject class MaemoRemoteMounter : public QObject
@@ -66,14 +67,14 @@ public:
// Must already be connected. // Must already be connected.
void setConnection(const QSharedPointer<Utils::SshConnection> &connection, void setConnection(const QSharedPointer<Utils::SshConnection> &connection,
const QSharedPointer<const MaemoDeviceConfig> &devConf); const QSharedPointer<const LinuxDeviceConfiguration> &devConf);
void setBuildConfiguration(const Qt4ProjectManager::Qt4BuildConfiguration *bc); void setBuildConfiguration(const Qt4ProjectManager::Qt4BuildConfiguration *bc);
void addMountSpecification(const MaemoMountSpecification &mountSpec, void addMountSpecification(const MaemoMountSpecification &mountSpec,
bool mountAsRoot); bool mountAsRoot);
bool hasValidMountSpecifications() const; bool hasValidMountSpecifications() const;
void resetMountSpecifications() { m_mountSpecs.clear(); } void resetMountSpecifications() { m_mountSpecs.clear(); }
void mount(MaemoPortList *freePorts, void mount(PortList *freePorts,
const MaemoUsedPortsGatherer *portsGatherer); const MaemoUsedPortsGatherer *portsGatherer);
void unmount(); void unmount();
void stop(); void stop();
@@ -123,7 +124,7 @@ private:
}; };
QSharedPointer<Utils::SshConnection> m_connection; QSharedPointer<Utils::SshConnection> m_connection;
QSharedPointer<const MaemoDeviceConfig> m_devConf; QSharedPointer<const LinuxDeviceConfiguration> m_devConf;
QList<MountInfo> m_mountSpecs; QList<MountInfo> m_mountSpecs;
QSharedPointer<Utils::SshRemoteProcess> m_mountProcess; QSharedPointer<Utils::SshRemoteProcess> m_mountProcess;
QSharedPointer<Utils::SshRemoteProcess> m_unmountProcess; QSharedPointer<Utils::SshRemoteProcess> m_unmountProcess;
@@ -133,7 +134,7 @@ private:
QByteArray m_utfsClientStderr; QByteArray m_utfsClientStderr;
QByteArray m_umountStderr; QByteArray m_umountStderr;
MaemoPortList *m_freePorts; PortList *m_freePorts;
const MaemoUsedPortsGatherer *m_portsGatherer; const MaemoUsedPortsGatherer *m_portsGatherer;
bool m_remoteMountsAllowed; bool m_remoteMountsAllowed;
QString m_maddeRoot; QString m_maddeRoot;

View File

@@ -32,7 +32,7 @@
#include "maemoremoteprocessesdialog.h" #include "maemoremoteprocessesdialog.h"
#include "ui_maemoremoteprocessesdialog.h" #include "ui_maemoremoteprocessesdialog.h"
#include "maemodeviceconfigurations.h" #include "linuxdeviceconfiguration.h"
#include "maemoremoteprocesslist.h" #include "maemoremoteprocesslist.h"
#include <QtGui/QMessageBox> #include <QtGui/QMessageBox>
@@ -41,7 +41,7 @@
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal { namespace Internal {
MaemoRemoteProcessesDialog::MaemoRemoteProcessesDialog(const MaemoDeviceConfig::ConstPtr &devConfig, MaemoRemoteProcessesDialog::MaemoRemoteProcessesDialog(const LinuxDeviceConfiguration::ConstPtr &devConfig,
QWidget *parent): QWidget *parent):
QDialog(parent), QDialog(parent),
m_ui(new Ui::MaemoRemoteProcessesDialog), m_ui(new Ui::MaemoRemoteProcessesDialog),
@@ -59,7 +59,7 @@ MaemoRemoteProcessesDialog::MaemoRemoteProcessesDialog(const MaemoDeviceConfig::
// Manually gathered process information is missing the command line for // Manually gathered process information is missing the command line for
// some system processes. Dont's show these lines by default. // some system processes. Dont's show these lines by default.
if (devConfig->osVersion() == MaemoDeviceConfig::Maemo5) if (devConfig->osVersion() == LinuxDeviceConfiguration::Maemo5)
m_ui->processFilterLineEdit->setText(QLatin1String("[^ ]+")); m_ui->processFilterLineEdit->setText(QLatin1String("[^ ]+"));
connect(m_ui->tableView->selectionModel(), connect(m_ui->tableView->selectionModel(),

View File

@@ -43,8 +43,9 @@ class QSortFilterProxyModel;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace RemoteLinux { namespace RemoteLinux {
class LinuxDeviceConfiguration;
namespace Internal { namespace Internal {
class MaemoDeviceConfig;
class MaemoRemoteProcessList; class MaemoRemoteProcessList;
class MaemoRemoteProcessesDialog : public QDialog class MaemoRemoteProcessesDialog : public QDialog
@@ -52,7 +53,7 @@ class MaemoRemoteProcessesDialog : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit MaemoRemoteProcessesDialog(const QSharedPointer<const MaemoDeviceConfig> &devConfig, explicit MaemoRemoteProcessesDialog(const QSharedPointer<const LinuxDeviceConfiguration> &devConfig,
QWidget *parent = 0); QWidget *parent = 0);
~MaemoRemoteProcessesDialog(); ~MaemoRemoteProcessesDialog();

View File

@@ -31,7 +31,7 @@
#include "maemoremoteprocesslist.h" #include "maemoremoteprocesslist.h"
#include "maemodeviceconfigurations.h" #include "linuxdeviceconfiguration.h"
#include <utils/ssh/sshremoteprocessrunner.h> #include <utils/ssh/sshremoteprocessrunner.h>
@@ -47,7 +47,7 @@ const QByteArray LineSeparator2("QTCENDOFLINE---");
const QByteArray LineSeparator = LineSeparator1 + LineSeparator2; const QByteArray LineSeparator = LineSeparator1 + LineSeparator2;
} // anonymous namespace } // anonymous namespace
MaemoRemoteProcessList::MaemoRemoteProcessList(const MaemoDeviceConfig::ConstPtr &devConfig, MaemoRemoteProcessList::MaemoRemoteProcessList(const LinuxDeviceConfiguration::ConstPtr &devConfig,
QObject *parent) QObject *parent)
: QAbstractTableModel(parent), : QAbstractTableModel(parent),
m_process(SshRemoteProcessRunner::create(devConfig->sshParameters())), m_process(SshRemoteProcessRunner::create(devConfig->sshParameters())),
@@ -70,7 +70,7 @@ void MaemoRemoteProcessList::update()
// The ps command on Fremantle ignores all command line options, so // The ps command on Fremantle ignores all command line options, so
// we have to collect the information in /proc manually. // we have to collect the information in /proc manually.
if (m_devConfig->osVersion() == MaemoDeviceConfig::Maemo5) { if (m_devConfig->osVersion() == LinuxDeviceConfiguration::Maemo5) {
command = "sep1=" + LineSeparator1 + '\n' command = "sep1=" + LineSeparator1 + '\n'
+ "sep2=" + LineSeparator2 + '\n' + "sep2=" + LineSeparator2 + '\n'
+ "pidlist=`ls /proc |grep -E '^[[:digit:]]+$' |sort -n`; " + "pidlist=`ls /proc |grep -E '^[[:digit:]]+$' |sort -n`; "
@@ -192,7 +192,7 @@ void MaemoRemoteProcessList::stop()
void MaemoRemoteProcessList::buildProcessList() void MaemoRemoteProcessList::buildProcessList()
{ {
const bool isFremantle = m_devConfig->osVersion() == MaemoDeviceConfig::Maemo5; const bool isFremantle = m_devConfig->osVersion() == LinuxDeviceConfiguration::Maemo5;
const QString remoteOutput = QString::fromUtf8(m_remoteStdout); const QString remoteOutput = QString::fromUtf8(m_remoteStdout);
const QByteArray lineSeparator = isFremantle ? LineSeparator : "\n"; const QByteArray lineSeparator = isFremantle ? LineSeparator : "\n";
QStringList lines = remoteOutput.split(QString::fromUtf8(lineSeparator)); QStringList lines = remoteOutput.split(QString::fromUtf8(lineSeparator));

View File

@@ -40,14 +40,15 @@
#include <utils/ssh/sshremoteprocessrunner.h> #include <utils/ssh/sshremoteprocessrunner.h>
namespace RemoteLinux { namespace RemoteLinux {
class LinuxDeviceConfiguration;
namespace Internal { namespace Internal {
class MaemoDeviceConfig;
class MaemoRemoteProcessList : public QAbstractTableModel class MaemoRemoteProcessList : public QAbstractTableModel
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit MaemoRemoteProcessList(const QSharedPointer<const MaemoDeviceConfig> &devConfig, explicit MaemoRemoteProcessList(const QSharedPointer<const LinuxDeviceConfiguration> &devConfig,
QObject *parent = 0); QObject *parent = 0);
~MaemoRemoteProcessList(); ~MaemoRemoteProcessList();
void update(); void update();
@@ -90,7 +91,7 @@ private:
QString cmdLine; QString cmdLine;
}; };
QList<RemoteProc> m_remoteProcs; QList<RemoteProc> m_remoteProcs;
const QSharedPointer<const MaemoDeviceConfig> m_devConfig; const QSharedPointer<const LinuxDeviceConfiguration> m_devConfig;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -35,7 +35,7 @@
#include "maemodeviceenvreader.h" #include "maemodeviceenvreader.h"
#include "maemoglobal.h" #include "maemoglobal.h"
#include "maemoremotemountsmodel.h" #include "maemoremotemountsmodel.h"
#include "maemorunconfiguration.h" #include "remotelinuxrunconfiguration.h"
#include "maemosettingspages.h" #include "maemosettingspages.h"
#include "qt4maemodeployconfiguration.h" #include "qt4maemodeployconfiguration.h"
#include "qt4maemotarget.h" #include "qt4maemotarget.h"
@@ -74,7 +74,7 @@ const QString FetchEnvButtonText
} // anonymous namespace } // anonymous namespace
MaemoRunConfigurationWidget::MaemoRunConfigurationWidget( MaemoRunConfigurationWidget::MaemoRunConfigurationWidget(
MaemoRunConfiguration *runConfiguration, QWidget *parent) RemoteLinuxRunConfiguration *runConfiguration, QWidget *parent)
: QWidget(parent), : QWidget(parent),
m_runConfiguration(runConfiguration), m_runConfiguration(runConfiguration),
m_ignoreChange(false), m_ignoreChange(false),
@@ -273,7 +273,7 @@ void MaemoRunConfigurationWidget::addEnvironmentWidgets(QVBoxLayout *mainLayout)
m_baseEnvironmentComboBox = new QComboBox(this); m_baseEnvironmentComboBox = new QComboBox(this);
m_baseEnvironmentComboBox->addItems(QStringList() << tr("Clean Environment") m_baseEnvironmentComboBox->addItems(QStringList() << tr("Clean Environment")
<< tr("System Environment")); << tr("System Environment"));
m_baseEnvironmentComboBox->setCurrentIndex(m_runConfiguration->baseEnvironmentBase()); m_baseEnvironmentComboBox->setCurrentIndex(m_runConfiguration->baseEnvironmentType());
baseEnvironmentLayout->addWidget(m_baseEnvironmentComboBox); baseEnvironmentLayout->addWidget(m_baseEnvironmentComboBox);
m_fetchEnv = new QPushButton(FetchEnvButtonText); m_fetchEnv = new QPushButton(FetchEnvButtonText);
@@ -444,7 +444,7 @@ void MaemoRunConfigurationWidget::userChangesEdited()
void MaemoRunConfigurationWidget::baseEnvironmentSelected(int index) void MaemoRunConfigurationWidget::baseEnvironmentSelected(int index)
{ {
m_ignoreChange = true; m_ignoreChange = true;
m_runConfiguration->setBaseEnvironmentBase(MaemoRunConfiguration::BaseEnvironmentBase(index)); m_runConfiguration->setBaseEnvironmentType(RemoteLinuxRunConfiguration::BaseEnvironmentType(index));
m_environmentWidget->setBaseEnvironment(m_runConfiguration->baseEnvironment()); m_environmentWidget->setBaseEnvironment(m_runConfiguration->baseEnvironment());
m_environmentWidget->setBaseEnvironmentText(m_runConfiguration->baseEnvironmentText()); m_environmentWidget->setBaseEnvironmentText(m_runConfiguration->baseEnvironmentText());
@@ -456,7 +456,7 @@ void MaemoRunConfigurationWidget::baseEnvironmentChanged()
if (m_ignoreChange) if (m_ignoreChange)
return; return;
m_baseEnvironmentComboBox->setCurrentIndex(m_runConfiguration->baseEnvironmentBase()); m_baseEnvironmentComboBox->setCurrentIndex(m_runConfiguration->baseEnvironmentType());
m_environmentWidget->setBaseEnvironment(m_runConfiguration->baseEnvironment()); m_environmentWidget->setBaseEnvironment(m_runConfiguration->baseEnvironment());
m_environmentWidget->setBaseEnvironmentText(m_runConfiguration->baseEnvironmentText()); m_environmentWidget->setBaseEnvironmentText(m_runConfiguration->baseEnvironmentText());
} }
@@ -507,7 +507,7 @@ void MaemoRunConfigurationWidget::handleDebuggingTypeChanged()
void MaemoRunConfigurationWidget::updateMountWarning() void MaemoRunConfigurationWidget::updateMountWarning()
{ {
QString mountWarning; QString mountWarning;
const MaemoPortList &portList = m_runConfiguration->freePorts(); const PortList &portList = m_runConfiguration->freePorts();
const int availablePortCount = portList.count(); const int availablePortCount = portList.count();
const int mountDirCount const int mountDirCount
= m_runConfiguration->remoteMounts()->validMountSpecificationCount(); = m_runConfiguration->remoteMounts()->validMountSpecificationCount();

View File

@@ -60,15 +60,16 @@ class Qt4BuildConfiguration;
} }
namespace RemoteLinux { namespace RemoteLinux {
class RemoteLinuxRunConfiguration;
namespace Internal { namespace Internal {
class MaemoDeviceEnvReader; class MaemoDeviceEnvReader;
class MaemoRunConfiguration;
class MaemoRunConfigurationWidget : public QWidget class MaemoRunConfigurationWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit MaemoRunConfigurationWidget(MaemoRunConfiguration *runConfiguration, explicit MaemoRunConfigurationWidget(RemoteLinuxRunConfiguration *runConfiguration,
QWidget *parent = 0); QWidget *parent = 0);
private slots: private slots:
@@ -116,7 +117,7 @@ private:
QToolButton *m_removeMountButton; QToolButton *m_removeMountButton;
Utils::DetailsWidget *m_mountDetailsContainer; Utils::DetailsWidget *m_mountDetailsContainer;
Utils::DetailsWidget *m_debugDetailsContainer; Utils::DetailsWidget *m_debugDetailsContainer;
MaemoRunConfiguration *m_runConfiguration; RemoteLinuxRunConfiguration *m_runConfiguration;
bool m_ignoreChange; bool m_ignoreChange;
QPushButton *m_fetchEnv; QPushButton *m_fetchEnv;

View File

@@ -32,7 +32,7 @@
#include "maemoruncontrol.h" #include "maemoruncontrol.h"
#include "maemoglobal.h" #include "maemoglobal.h"
#include "maemorunconfiguration.h" #include "remotelinuxrunconfiguration.h"
#include "maemosshrunner.h" #include "maemosshrunner.h"
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
@@ -49,7 +49,7 @@ using ProjectExplorer::RunConfiguration;
MaemoRunControl::MaemoRunControl(RunConfiguration *rc) MaemoRunControl::MaemoRunControl(RunConfiguration *rc)
: RunControl(rc, ProjectExplorer::Constants::RUNMODE) : RunControl(rc, ProjectExplorer::Constants::RUNMODE)
, m_runner(new MaemoSshRunner(this, qobject_cast<MaemoRunConfiguration *>(rc), false)) , m_runner(new MaemoSshRunner(this, qobject_cast<RemoteLinuxRunConfiguration *>(rc), false))
, m_running(false) , m_running(false)
{ {
} }

View File

@@ -37,9 +37,10 @@
#include <QtCore/QString> #include <QtCore/QString>
namespace RemoteLinux { namespace RemoteLinux {
class RemoteLinuxRunConfiguration;
namespace Internal { namespace Internal {
class MaemoRunConfiguration;
class MaemoSshRunner; class MaemoSshRunner;
class MaemoRunControl : public ProjectExplorer::RunControl class MaemoRunControl : public ProjectExplorer::RunControl

View File

@@ -36,7 +36,7 @@
#include "maemoanalyzersupport.h" #include "maemoanalyzersupport.h"
#include "maemoglobal.h" #include "maemoglobal.h"
#include "maemoremotemountsmodel.h" #include "maemoremotemountsmodel.h"
#include "maemorunconfiguration.h" #include "remotelinuxrunconfiguration.h"
#include "maemoruncontrol.h" #include "maemoruncontrol.h"
#include "maemotoolchain.h" #include "maemotoolchain.h"
#include "qt4maemotarget.h" #include "qt4maemotarget.h"
@@ -118,7 +118,7 @@ RunConfiguration *MaemoRunConfigurationFactory::create(Target *parent,
{ {
if (!canCreate(parent, id)) if (!canCreate(parent, id))
return 0; return 0;
return new MaemoRunConfiguration(qobject_cast<Qt4BaseTarget *>(parent), return new RemoteLinuxRunConfiguration(qobject_cast<Qt4BaseTarget *>(parent),
pathFromId(id)); pathFromId(id));
} }
@@ -127,8 +127,8 @@ RunConfiguration *MaemoRunConfigurationFactory::restore(Target *parent,
{ {
if (!canRestore(parent, map)) if (!canRestore(parent, map))
return 0; return 0;
MaemoRunConfiguration *rc RemoteLinuxRunConfiguration *rc
= new MaemoRunConfiguration(qobject_cast<Qt4BaseTarget *>(parent), QString()); = new RemoteLinuxRunConfiguration(qobject_cast<Qt4BaseTarget *>(parent), QString());
if (rc->fromMap(map)) if (rc->fromMap(map))
return rc; return rc;
@@ -142,8 +142,8 @@ RunConfiguration *MaemoRunConfigurationFactory::clone(Target *parent,
if (!canClone(parent, source)) if (!canClone(parent, source))
return 0; return 0;
MaemoRunConfiguration *old = static_cast<MaemoRunConfiguration *>(source); RemoteLinuxRunConfiguration *old = static_cast<RemoteLinuxRunConfiguration *>(source);
return new MaemoRunConfiguration(static_cast<Qt4BaseTarget *>(parent), old); return new RemoteLinuxRunConfiguration(static_cast<Qt4BaseTarget *>(parent), old);
} }
// #pragma mark -- MaemoRunControlFactory // #pragma mark -- MaemoRunControlFactory
@@ -160,8 +160,8 @@ MaemoRunControlFactory::~MaemoRunControlFactory()
bool MaemoRunControlFactory::canRun(RunConfiguration *runConfiguration, bool MaemoRunControlFactory::canRun(RunConfiguration *runConfiguration,
const QString &mode) const const QString &mode) const
{ {
const MaemoRunConfiguration * const maemoRunConfig const RemoteLinuxRunConfiguration * const maemoRunConfig
= qobject_cast<MaemoRunConfiguration *>(runConfiguration); = qobject_cast<RemoteLinuxRunConfiguration *>(runConfiguration);
if (!maemoRunConfig || !maemoRunConfig->isEnabled()) if (!maemoRunConfig || !maemoRunConfig->isEnabled())
return false; return false;
return maemoRunConfig->hasEnoughFreePorts(mode); return maemoRunConfig->hasEnoughFreePorts(mode);
@@ -174,7 +174,7 @@ RunControl* MaemoRunControlFactory::create(RunConfiguration *runConfig,
|| mode == Debugger::Constants::DEBUGMODE || mode == Debugger::Constants::DEBUGMODE
|| mode == Analyzer::Constants::MODE_ANALYZE); || mode == Analyzer::Constants::MODE_ANALYZE);
Q_ASSERT(canRun(runConfig, mode)); Q_ASSERT(canRun(runConfig, mode));
MaemoRunConfiguration *rc = qobject_cast<MaemoRunConfiguration *>(runConfig); RemoteLinuxRunConfiguration *rc = qobject_cast<RemoteLinuxRunConfiguration *>(runConfig);
Q_ASSERT(rc); Q_ASSERT(rc);
if (mode == ProjectExplorer::Constants::RUNMODE) if (mode == ProjectExplorer::Constants::RUNMODE)
return new MaemoRunControl(rc); return new MaemoRunControl(rc);

View File

@@ -118,7 +118,7 @@ QString MaemoDeviceConfigurationsSettingsPage::id() const
QString MaemoDeviceConfigurationsSettingsPage::displayName() const QString MaemoDeviceConfigurationsSettingsPage::displayName() const
{ {
return tr("Maemo Device Configurations"); return tr("Device Configurations");
} }
QString MaemoDeviceConfigurationsSettingsPage::category() const QString MaemoDeviceConfigurationsSettingsPage::category() const
@@ -181,7 +181,7 @@ QString MaemoQemuSettingsPage::id() const
QString MaemoQemuSettingsPage::displayName() const QString MaemoQemuSettingsPage::displayName() const
{ {
return tr("Qemu Settings"); return tr("Maemo Qemu Settings");
} }
QString MaemoQemuSettingsPage::category() const QString MaemoQemuSettingsPage::category() const

View File

@@ -31,7 +31,7 @@
#include "maemosshconfigdialog.h" #include "maemosshconfigdialog.h"
#include "maemodeviceconfigurations.h" #include "linuxdeviceconfiguration.h"
#include <utils/ssh/sshkeygenerator.h> #include <utils/ssh/sshkeygenerator.h>
#include <utils/fileutils.h> #include <utils/fileutils.h>

View File

@@ -35,7 +35,7 @@
#include "maemoqemumanager.h" #include "maemoqemumanager.h"
#include "maemoremotemounter.h" #include "maemoremotemounter.h"
#include "maemoremotemountsmodel.h" #include "maemoremotemountsmodel.h"
#include "maemorunconfiguration.h" #include "remotelinuxrunconfiguration.h"
#include "maemousedportsgatherer.h" #include "maemousedportsgatherer.h"
#include <utils/ssh/sshconnection.h> #include <utils/ssh/sshconnection.h>
@@ -55,7 +55,7 @@ namespace RemoteLinux {
namespace Internal { namespace Internal {
MaemoSshRunner::MaemoSshRunner(QObject *parent, MaemoSshRunner::MaemoSshRunner(QObject *parent,
MaemoRunConfiguration *runConfig, bool debugging) RemoteLinuxRunConfiguration *runConfig, bool debugging)
: QObject(parent), : QObject(parent),
m_mounter(new MaemoRemoteMounter(this)), m_mounter(new MaemoRemoteMounter(this)),
m_portsGatherer(new MaemoUsedPortsGatherer(this)), m_portsGatherer(new MaemoUsedPortsGatherer(this)),
@@ -103,7 +103,7 @@ void MaemoSshRunner::start()
return; return;
} }
if (m_devConfig->type() == MaemoDeviceConfig::Emulator if (m_devConfig->type() == LinuxDeviceConfiguration::Emulator
&& !MaemoQemuManager::instance().qemuIsRunning()) { && !MaemoQemuManager::instance().qemuIsRunning()) {
MaemoQemuManager::instance().startRuntime(); MaemoQemuManager::instance().startRuntime();
emitError(tr("Cannot run: Qemu was not running. " emitError(tr("Cannot run: Qemu was not running. "

View File

@@ -32,7 +32,7 @@
#ifndef MAEMOSSHRUNNER_H #ifndef MAEMOSSHRUNNER_H
#define MAEMOSSHRUNNER_H #define MAEMOSSHRUNNER_H
#include "maemodeviceconfigurations.h" #include "linuxdeviceconfiguration.h"
#include "maemomountspecification.h" #include "maemomountspecification.h"
#include <utils/environment.h> #include <utils/environment.h>
@@ -47,16 +47,17 @@ namespace Utils {
} }
namespace RemoteLinux { namespace RemoteLinux {
class RemoteLinuxRunConfiguration;
namespace Internal { namespace Internal {
class MaemoRemoteMounter; class MaemoRemoteMounter;
class MaemoRunConfiguration;
class MaemoUsedPortsGatherer; class MaemoUsedPortsGatherer;
class MaemoSshRunner : public QObject class MaemoSshRunner : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
MaemoSshRunner(QObject *parent, MaemoRunConfiguration *runConfig, MaemoSshRunner(QObject *parent, RemoteLinuxRunConfiguration *runConfig,
bool debugging); bool debugging);
~MaemoSshRunner(); ~MaemoSshRunner();
@@ -67,11 +68,11 @@ public:
QSharedPointer<Utils::SshConnection> connection() const { return m_connection; } QSharedPointer<Utils::SshConnection> connection() const { return m_connection; }
const MaemoUsedPortsGatherer *usedPortsGatherer() const { return m_portsGatherer; } const MaemoUsedPortsGatherer *usedPortsGatherer() const { return m_portsGatherer; }
MaemoPortList *freePorts() { return &m_freePorts; } PortList *freePorts() { return &m_freePorts; }
QString remoteExecutable() const { return m_remoteExecutable; } QString remoteExecutable() const { return m_remoteExecutable; }
QString arguments() const { return m_appArguments; } QString arguments() const { return m_appArguments; }
QList<Utils::EnvironmentItem> userEnvChanges() const { return m_userEnvChanges; } QList<Utils::EnvironmentItem> userEnvChanges() const { return m_userEnvChanges; }
const QSharedPointer<const MaemoDeviceConfig> devConfig() const { return m_devConfig; } const QSharedPointer<const LinuxDeviceConfiguration> devConfig() const { return m_devConfig; }
static const qint64 InvalidExitCode; static const qint64 InvalidExitCode;
@@ -112,18 +113,18 @@ private:
MaemoRemoteMounter * const m_mounter; MaemoRemoteMounter * const m_mounter;
MaemoUsedPortsGatherer * const m_portsGatherer; MaemoUsedPortsGatherer * const m_portsGatherer;
const QSharedPointer<const MaemoDeviceConfig> m_devConfig; const QSharedPointer<const LinuxDeviceConfiguration> m_devConfig;
const QString m_remoteExecutable; const QString m_remoteExecutable;
const QString m_appArguments; const QString m_appArguments;
const QList<Utils::EnvironmentItem> m_userEnvChanges; const QList<Utils::EnvironmentItem> m_userEnvChanges;
const MaemoPortList m_initialFreePorts; const PortList m_initialFreePorts;
QList<MaemoMountSpecification> m_mountSpecs; QList<MaemoMountSpecification> m_mountSpecs;
QSharedPointer<Utils::SshConnection> m_connection; QSharedPointer<Utils::SshConnection> m_connection;
QSharedPointer<Utils::SshRemoteProcess> m_runner; QSharedPointer<Utils::SshRemoteProcess> m_runner;
QSharedPointer<Utils::SshRemoteProcess> m_cleaner; QSharedPointer<Utils::SshRemoteProcess> m_cleaner;
QStringList m_procsToKill; QStringList m_procsToKill;
MaemoPortList m_freePorts; PortList m_freePorts;
int m_exitStatus; int m_exitStatus;
State m_state; State m_state;

View File

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

View File

@@ -48,7 +48,7 @@ MaemoUsedPortsGatherer::MaemoUsedPortsGatherer(QObject *parent) :
MaemoUsedPortsGatherer::~MaemoUsedPortsGatherer() {} MaemoUsedPortsGatherer::~MaemoUsedPortsGatherer() {}
void MaemoUsedPortsGatherer::start(const Utils::SshConnection::Ptr &connection, void MaemoUsedPortsGatherer::start(const Utils::SshConnection::Ptr &connection,
const MaemoDeviceConfig::ConstPtr &devConf) const LinuxDeviceConfiguration::ConstPtr &devConf)
{ {
if (m_running) if (m_running)
qWarning("Unexpected call of %s in running state", Q_FUNC_INFO); qWarning("Unexpected call of %s in running state", Q_FUNC_INFO);
@@ -82,7 +82,7 @@ void MaemoUsedPortsGatherer::stop()
m_procRunner->process()->closeChannel(); m_procRunner->process()->closeChannel();
} }
int MaemoUsedPortsGatherer::getNextFreePort(MaemoPortList *freePorts) const int MaemoUsedPortsGatherer::getNextFreePort(PortList *freePorts) const
{ {
while (freePorts->hasMore()) { while (freePorts->hasMore()) {
const int port = freePorts->getNext(); const int port = freePorts->getNext();

View File

@@ -32,7 +32,7 @@
#ifndef MAEMOUSEDPORTSGATHERER_H #ifndef MAEMOUSEDPORTSGATHERER_H
#define MAEMOUSEDPORTSGATHERER_H #define MAEMOUSEDPORTSGATHERER_H
#include "maemodeviceconfigurations.h" #include "linuxdeviceconfiguration.h"
#include <QtCore/QList> #include <QtCore/QList>
#include <QtCore/QObject> #include <QtCore/QObject>
@@ -45,8 +45,9 @@ class SshRemoteProcessRunner;
} }
namespace RemoteLinux { namespace RemoteLinux {
class LinuxDeviceConfiguration;
namespace Internal { namespace Internal {
class MaemoDeviceConfig;
class MaemoUsedPortsGatherer : public QObject class MaemoUsedPortsGatherer : public QObject
{ {
@@ -55,9 +56,9 @@ public:
explicit MaemoUsedPortsGatherer(QObject *parent = 0); explicit MaemoUsedPortsGatherer(QObject *parent = 0);
~MaemoUsedPortsGatherer(); ~MaemoUsedPortsGatherer();
void start(const QSharedPointer<Utils::SshConnection> &connection, void start(const QSharedPointer<Utils::SshConnection> &connection,
const QSharedPointer<const MaemoDeviceConfig> &devConf); const QSharedPointer<const LinuxDeviceConfiguration> &devConf);
void stop(); void stop();
int getNextFreePort(MaemoPortList *freePorts) const; // returns -1 if no more are left int getNextFreePort(PortList *freePorts) const; // returns -1 if no more are left
QList<int> usedPorts() const { return m_usedPorts; } QList<int> usedPorts() const { return m_usedPorts; }
signals: signals:

View File

@@ -34,7 +34,7 @@
#include "maemoglobal.h" #include "maemoglobal.h"
#include "maemopackagecreationstep.h" #include "maemopackagecreationstep.h"
#include "maemorunconfiguration.h" #include "remotelinuxrunconfiguration.h"
#include "maemotoolchain.h" #include "maemotoolchain.h"
#include "qt4maemodeployconfiguration.h" #include "qt4maemodeployconfiguration.h"
@@ -166,12 +166,12 @@ void AbstractQt4MaemoTarget::createApplicationProFiles()
paths << pro->path(); paths << pro->path();
foreach (ProjectExplorer::RunConfiguration *rc, runConfigurations()) foreach (ProjectExplorer::RunConfiguration *rc, runConfigurations())
if (MaemoRunConfiguration *qt4rc = qobject_cast<MaemoRunConfiguration *>(rc)) if (RemoteLinuxRunConfiguration *qt4rc = qobject_cast<RemoteLinuxRunConfiguration *>(rc))
paths.remove(qt4rc->proFilePath()); paths.remove(qt4rc->proFilePath());
// Only add new runconfigurations if there are none. // Only add new runconfigurations if there are none.
foreach (const QString &path, paths) foreach (const QString &path, paths)
addRunConfiguration(new MaemoRunConfiguration(this, path)); addRunConfiguration(new RemoteLinuxRunConfiguration(this, path));
// Oh still none? Add a custom executable runconfiguration // Oh still none? Add a custom executable runconfiguration
if (runConfigurations().isEmpty()) { if (runConfigurations().isEmpty()) {
@@ -183,7 +183,7 @@ QList<ProjectExplorer::RunConfiguration *> AbstractQt4MaemoTarget::runConfigurat
{ {
QList<ProjectExplorer::RunConfiguration *> result; QList<ProjectExplorer::RunConfiguration *> result;
foreach (ProjectExplorer::RunConfiguration *rc, runConfigurations()) foreach (ProjectExplorer::RunConfiguration *rc, runConfigurations())
if (MaemoRunConfiguration *mrc = qobject_cast<MaemoRunConfiguration *>(rc)) if (RemoteLinuxRunConfiguration *mrc = qobject_cast<RemoteLinuxRunConfiguration *>(rc))
if (mrc->proFilePath() == n->path()) if (mrc->proFilePath() == n->path())
result << rc; result << rc;
return result; return result;

View File

@@ -33,7 +33,7 @@
#include "qt4maemotargetfactory.h" #include "qt4maemotargetfactory.h"
#include "maemoglobal.h" #include "maemoglobal.h"
#include "maemopackagecreationstep.h" #include "maemopackagecreationstep.h"
#include "maemorunconfiguration.h" #include "remotelinuxrunconfiguration.h"
#include "qt4maemodeployconfiguration.h" #include "qt4maemodeployconfiguration.h"
#include "qt4maemotarget.h" #include "qt4maemotarget.h"

View File

@@ -11,8 +11,6 @@ HEADERS += \
remotelinux_export.h \ remotelinux_export.h \
maemoconfigtestdialog.h \ maemoconfigtestdialog.h \
maemoconstants.h \ maemoconstants.h \
maemodeviceconfigurations.h \
maemorunconfiguration.h \
maemorunconfigurationwidget.h \ maemorunconfigurationwidget.h \
maemoruncontrol.h \ maemoruncontrol.h \
maemorunfactories.h \ maemorunfactories.h \
@@ -71,13 +69,14 @@ HEADERS += \
maemodirectdeviceuploadstep.h \ maemodirectdeviceuploadstep.h \
abstractlinuxdevicedeploystep.h \ abstractlinuxdevicedeploystep.h \
maemoqtversionfactory.h \ maemoqtversionfactory.h \
maemoqtversion.h maemoqtversion.h \
linuxdeviceconfiguration.h \
linuxdeviceconfigurations.h \
remotelinuxrunconfiguration.h
SOURCES += \ SOURCES += \
remotelinuxplugin.cpp \ remotelinuxplugin.cpp \
maemoconfigtestdialog.cpp \ maemoconfigtestdialog.cpp \
maemodeviceconfigurations.cpp \
maemorunconfiguration.cpp \
maemorunconfigurationwidget.cpp \ maemorunconfigurationwidget.cpp \
maemoruncontrol.cpp \ maemoruncontrol.cpp \
maemorunfactories.cpp \ maemorunfactories.cpp \
@@ -134,7 +133,10 @@ SOURCES += \
maemodirectdeviceuploadstep.cpp \ maemodirectdeviceuploadstep.cpp \
abstractlinuxdevicedeploystep.cpp \ abstractlinuxdevicedeploystep.cpp \
maemoqtversionfactory.cpp \ maemoqtversionfactory.cpp \
maemoqtversion.cpp maemoqtversion.cpp \
linuxdeviceconfiguration.cpp \
linuxdeviceconfigurations.cpp \
remotelinuxrunconfiguration.cpp
FORMS += \ FORMS += \
maemoconfigtestdialog.ui \ maemoconfigtestdialog.ui \

View File

@@ -35,7 +35,7 @@
#include "maemoconstants.h" #include "maemoconstants.h"
#include "maemodeployable.h" #include "maemodeployable.h"
#include "maemodeploystepfactory.h" #include "maemodeploystepfactory.h"
#include "maemodeviceconfigurations.h" #include "linuxdeviceconfigurations.h"
#include "maemoglobal.h" #include "maemoglobal.h"
#include "maemopackagecreationfactory.h" #include "maemopackagecreationfactory.h"
#include "maemopublishingwizardfactories.h" #include "maemopublishingwizardfactories.h"
@@ -68,7 +68,7 @@ bool RemoteLinuxPlugin::initialize(const QStringList &arguments,
Q_UNUSED(error_message) Q_UNUSED(error_message)
MaemoQemuManager::instance(this); MaemoQemuManager::instance(this);
MaemoDeviceConfigurations::instance(this); LinuxDeviceConfigurations::instance(this);
addAutoReleasedObject(new MaemoRunControlFactory); addAutoReleasedObject(new MaemoRunControlFactory);
addAutoReleasedObject(new MaemoRunConfigurationFactory); addAutoReleasedObject(new MaemoRunConfigurationFactory);

View File

@@ -30,7 +30,7 @@
** **
**************************************************************************/ **************************************************************************/
#include "maemorunconfiguration.h" #include "remotelinuxrunconfiguration.h"
#include "abstractlinuxdevicedeploystep.h" #include "abstractlinuxdevicedeploystep.h"
#include "maemodeployables.h" #include "maemodeployables.h"
@@ -69,44 +69,66 @@ using namespace ProjectExplorer;
using namespace Qt4ProjectManager; using namespace Qt4ProjectManager;
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal {
namespace { namespace {
const bool DefaultUseRemoteGdbValue = false; const bool DefaultUseRemoteGdbValue = false;
} // anonymous namespace } // anonymous namespace
MaemoRunConfiguration::MaemoRunConfiguration(Qt4BaseTarget *parent, namespace Internal {
class RemoteLinuxRunConfigurationPrivate {
public:
RemoteLinuxRunConfigurationPrivate(const QString &proFilePath, const Qt4BaseTarget *target)
: proFilePath(proFilePath), useRemoteGdb(DefaultUseRemoteGdbValue),
baseEnvironmentType(RemoteLinuxRunConfiguration::SystemBaseEnvironment),
validParse(target->qt4Project()->validParse(proFilePath))
{
}
RemoteLinuxRunConfigurationPrivate(const RemoteLinuxRunConfigurationPrivate *other)
: proFilePath(other->proFilePath), gdbPath(other->gdbPath), arguments(other->arguments),
useRemoteGdb(other->useRemoteGdb), baseEnvironmentType(other->baseEnvironmentType),
systemEnvironment(other->systemEnvironment),
userEnvironmentChanges(other->userEnvironmentChanges), validParse(other->validParse)
{
}
QString proFilePath;
QString gdbPath;
MaemoRemoteMountsModel *remoteMounts;
QString arguments;
bool useRemoteGdb;
RemoteLinuxRunConfiguration::BaseEnvironmentType baseEnvironmentType;
Utils::Environment systemEnvironment;
QList<Utils::EnvironmentItem> userEnvironmentChanges;
bool validParse;
QString disabledReason;
};
} // namespace Internal
using namespace Internal;
RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Qt4BaseTarget *parent,
const QString &proFilePath) const QString &proFilePath)
: RunConfiguration(parent, QLatin1String(MAEMO_RC_ID)) : RunConfiguration(parent, QLatin1String(MAEMO_RC_ID)),
, m_proFilePath(proFilePath) m_d(new RemoteLinuxRunConfigurationPrivate(proFilePath, parent))
, m_useRemoteGdb(DefaultUseRemoteGdbValue)
, m_baseEnvironmentBase(SystemEnvironmentBase)
, m_validParse(parent->qt4Project()->validParse(m_proFilePath))
{ {
init(); init();
} }
MaemoRunConfiguration::MaemoRunConfiguration(Qt4BaseTarget *parent, RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Qt4BaseTarget *parent,
MaemoRunConfiguration *source) RemoteLinuxRunConfiguration *source)
: RunConfiguration(parent, source) : RunConfiguration(parent, source),
, m_proFilePath(source->m_proFilePath) m_d(new RemoteLinuxRunConfigurationPrivate(source->m_d))
, m_gdbPath(source->m_gdbPath)
, m_arguments(source->m_arguments)
, m_useRemoteGdb(source->useRemoteGdb())
, m_baseEnvironmentBase(source->m_baseEnvironmentBase)
, m_systemEnvironment(source->m_systemEnvironment)
, m_userEnvironmentChanges(source->m_userEnvironmentChanges)
, m_validParse(source->m_validParse)
{ {
init(); init();
} }
void MaemoRunConfiguration::init() void RemoteLinuxRunConfiguration::init()
{ {
setDefaultDisplayName(defaultDisplayName()); setDefaultDisplayName(defaultDisplayName());
setUseCppDebugger(true); setUseCppDebugger(true);
setUseQmlDebugger(false); setUseQmlDebugger(false);
m_remoteMounts = new MaemoRemoteMountsModel(this); m_d->remoteMounts = new MaemoRemoteMountsModel(this);
connect(target(), connect(target(),
SIGNAL(activeDeployConfigurationChanged(ProjectExplorer::DeployConfiguration*)), SIGNAL(activeDeployConfigurationChanged(ProjectExplorer::DeployConfiguration*)),
@@ -120,152 +142,157 @@ void MaemoRunConfiguration::init()
this, SLOT(proFileInvalidated(Qt4ProjectManager::Qt4ProFileNode*))); this, SLOT(proFileInvalidated(Qt4ProjectManager::Qt4ProFileNode*)));
} }
MaemoRunConfiguration::~MaemoRunConfiguration() RemoteLinuxRunConfiguration::~RemoteLinuxRunConfiguration()
{ {
} }
Qt4BaseTarget *MaemoRunConfiguration::qt4Target() const Qt4BaseTarget *RemoteLinuxRunConfiguration::qt4Target() const
{ {
return static_cast<Qt4BaseTarget *>(target()); return static_cast<Qt4BaseTarget *>(target());
} }
Qt4BuildConfiguration *MaemoRunConfiguration::activeQt4BuildConfiguration() const Qt4BuildConfiguration *RemoteLinuxRunConfiguration::activeQt4BuildConfiguration() const
{ {
return static_cast<Qt4BuildConfiguration *>(activeBuildConfiguration()); return static_cast<Qt4BuildConfiguration *>(activeBuildConfiguration());
} }
bool MaemoRunConfiguration::isEnabled() const bool RemoteLinuxRunConfiguration::isEnabled() const
{ {
if (!m_validParse) { if (!m_d->validParse) {
m_disabledReason = tr("The .pro file could not be parsed/"); m_d->disabledReason = tr("The .pro file could not be parsed/");
return false; return false;
} }
if (!deviceConfig()) { if (!deviceConfig()) {
m_disabledReason = tr("No device configuration set."); m_d->disabledReason = tr("No device configuration set.");
return false; return false;
} }
if (!activeQt4BuildConfiguration()) { if (!activeQt4BuildConfiguration()) {
m_disabledReason = tr("No active build configuration."); m_d->disabledReason = tr("No active build configuration.");
return false; return false;
} }
if (remoteExecutableFilePath().isEmpty()) { if (remoteExecutableFilePath().isEmpty()) {
m_disabledReason = tr("Don't know what to run."); m_d->disabledReason = tr("Don't know what to run.");
return false; return false;
} }
if (!hasEnoughFreePorts(ProjectExplorer::Constants::RUNMODE)) { if (!hasEnoughFreePorts(ProjectExplorer::Constants::RUNMODE)) {
m_disabledReason = tr("Not enough free ports on the device."); m_d->disabledReason = tr("Not enough free ports on the device.");
return false; return false;
} }
m_disabledReason.clear(); m_d->disabledReason.clear();
return true; return true;
} }
QString MaemoRunConfiguration::disabledReason() const QString RemoteLinuxRunConfiguration::disabledReason() const
{ {
return m_disabledReason; return m_d->disabledReason;
} }
QWidget *MaemoRunConfiguration::createConfigurationWidget() QWidget *RemoteLinuxRunConfiguration::createConfigurationWidget()
{ {
return new MaemoRunConfigurationWidget(this); return new MaemoRunConfigurationWidget(this);
} }
Utils::OutputFormatter *MaemoRunConfiguration::createOutputFormatter() const Utils::OutputFormatter *RemoteLinuxRunConfiguration::createOutputFormatter() const
{ {
return new QtSupport::QtOutputFormatter(qt4Target()->qt4Project()); return new QtSupport::QtOutputFormatter(qt4Target()->qt4Project());
} }
void MaemoRunConfiguration::handleParseState(bool success) void RemoteLinuxRunConfiguration::handleParseState(bool success)
{ {
bool enabled = isEnabled(); bool enabled = isEnabled();
m_validParse = success; m_d->validParse = success;
if (enabled != isEnabled()) { if (enabled != isEnabled()) {
emit isEnabledChanged(!enabled); emit isEnabledChanged(!enabled);
} }
} }
void MaemoRunConfiguration::proFileInvalidated(Qt4ProjectManager::Qt4ProFileNode *pro) void RemoteLinuxRunConfiguration::proFileInvalidated(Qt4ProjectManager::Qt4ProFileNode *pro)
{ {
if (m_proFilePath != pro->path()) if (m_d->proFilePath != pro->path())
return; return;
handleParseState(false); handleParseState(false);
} }
void MaemoRunConfiguration::proFileUpdate(Qt4ProjectManager::Qt4ProFileNode *pro, bool success) void RemoteLinuxRunConfiguration::proFileUpdate(Qt4ProjectManager::Qt4ProFileNode *pro, bool success)
{ {
if (m_proFilePath == pro->path()) { if (m_d->proFilePath == pro->path()) {
handleParseState(success); handleParseState(success);
emit targetInformationChanged(); emit targetInformationChanged();
} }
} }
QVariantMap MaemoRunConfiguration::toMap() const QVariantMap RemoteLinuxRunConfiguration::toMap() const
{ {
QVariantMap map(RunConfiguration::toMap()); QVariantMap map(RunConfiguration::toMap());
map.insert(ArgumentsKey, m_arguments); map.insert(ArgumentsKey, m_d->arguments);
const QDir dir = QDir(target()->project()->projectDirectory()); const QDir dir = QDir(target()->project()->projectDirectory());
map.insert(ProFileKey, dir.relativeFilePath(m_proFilePath)); map.insert(ProFileKey, dir.relativeFilePath(m_d->proFilePath));
map.insert(UseRemoteGdbKey, useRemoteGdb()); map.insert(UseRemoteGdbKey, useRemoteGdb());
map.insert(BaseEnvironmentBaseKey, m_baseEnvironmentBase); map.insert(BaseEnvironmentBaseKey, m_d->baseEnvironmentType);
map.insert(UserEnvironmentChangesKey, map.insert(UserEnvironmentChangesKey,
Utils::EnvironmentItem::toStringList(m_userEnvironmentChanges)); Utils::EnvironmentItem::toStringList(m_d->userEnvironmentChanges));
map.unite(m_remoteMounts->toMap()); map.unite(m_d->remoteMounts->toMap());
return map; return map;
} }
bool MaemoRunConfiguration::fromMap(const QVariantMap &map) bool RemoteLinuxRunConfiguration::fromMap(const QVariantMap &map)
{ {
if (!RunConfiguration::fromMap(map)) if (!RunConfiguration::fromMap(map))
return false; return false;
m_arguments = map.value(ArgumentsKey).toString(); m_d->arguments = map.value(ArgumentsKey).toString();
const QDir dir = QDir(target()->project()->projectDirectory()); const QDir dir = QDir(target()->project()->projectDirectory());
m_proFilePath = dir.filePath(map.value(ProFileKey).toString()); m_d->proFilePath = dir.filePath(map.value(ProFileKey).toString());
m_useRemoteGdb = map.value(UseRemoteGdbKey, DefaultUseRemoteGdbValue).toBool(); m_d->useRemoteGdb = map.value(UseRemoteGdbKey, DefaultUseRemoteGdbValue).toBool();
m_userEnvironmentChanges = m_d->userEnvironmentChanges =
Utils::EnvironmentItem::fromStringList(map.value(UserEnvironmentChangesKey) Utils::EnvironmentItem::fromStringList(map.value(UserEnvironmentChangesKey)
.toStringList()); .toStringList());
m_baseEnvironmentBase = static_cast<BaseEnvironmentBase> (map.value(BaseEnvironmentBaseKey, m_d->baseEnvironmentType = static_cast<BaseEnvironmentType> (map.value(BaseEnvironmentBaseKey,
SystemEnvironmentBase).toInt()); SystemBaseEnvironment).toInt());
m_remoteMounts->fromMap(map); m_d->remoteMounts->fromMap(map);
m_validParse = qt4Target()->qt4Project()->validParse(m_proFilePath); m_d->validParse = qt4Target()->qt4Project()->validParse(m_d->proFilePath);
setDefaultDisplayName(defaultDisplayName()); setDefaultDisplayName(defaultDisplayName());
return true; return true;
} }
QString MaemoRunConfiguration::defaultDisplayName() QString RemoteLinuxRunConfiguration::defaultDisplayName()
{ {
if (!m_proFilePath.isEmpty()) if (!m_d->proFilePath.isEmpty())
return (QFileInfo(m_proFilePath).completeBaseName()) + QLatin1String(" (remote)"); return (QFileInfo(m_d->proFilePath).completeBaseName()) + QLatin1String(" (remote)");
//: Maemo run configuration default display name //: Remote Linux run configuration default display name
return tr("Run on remote device"); return tr("Run on remote device");
} }
MaemoDeviceConfig::ConstPtr MaemoRunConfiguration::deviceConfig() const LinuxDeviceConfiguration::ConstPtr RemoteLinuxRunConfiguration::deviceConfig() const
{ {
const AbstractLinuxDeviceDeployStep * const step = deployStep(); const AbstractLinuxDeviceDeployStep * const step = deployStep();
return step ? step->helper().deviceConfig() : MaemoDeviceConfig::ConstPtr(); return step ? step->helper().deviceConfig() : LinuxDeviceConfiguration::ConstPtr();
} }
const QString MaemoRunConfiguration::gdbCmd() const QString RemoteLinuxRunConfiguration::gdbCmd() const
{ {
return QDir::toNativeSeparators(activeBuildConfiguration()->toolChain()->debuggerCommand()); return QDir::toNativeSeparators(activeBuildConfiguration()->toolChain()->debuggerCommand());
} }
Qt4MaemoDeployConfiguration *MaemoRunConfiguration::deployConfig() const Qt4MaemoDeployConfiguration *RemoteLinuxRunConfiguration::deployConfig() const
{ {
return qobject_cast<Qt4MaemoDeployConfiguration *>(target()->activeDeployConfiguration()); return qobject_cast<Qt4MaemoDeployConfiguration *>(target()->activeDeployConfiguration());
} }
AbstractLinuxDeviceDeployStep *MaemoRunConfiguration::deployStep() const MaemoRemoteMountsModel *RemoteLinuxRunConfiguration::remoteMounts() const
{
return m_d->remoteMounts;
}
AbstractLinuxDeviceDeployStep *RemoteLinuxRunConfiguration::deployStep() const
{ {
return MaemoGlobal::earlierBuildStep<AbstractLinuxDeviceDeployStep>(deployConfig(), 0); return MaemoGlobal::earlierBuildStep<AbstractLinuxDeviceDeployStep>(deployConfig(), 0);
} }
const QString MaemoRunConfiguration::targetRoot() const QString RemoteLinuxRunConfiguration::targetRoot() const
{ {
QTC_ASSERT(activeQt4BuildConfiguration(), return QString()); QTC_ASSERT(activeQt4BuildConfiguration(), return QString());
QtSupport::BaseQtVersion *v = activeQt4BuildConfiguration()->qtVersion(); QtSupport::BaseQtVersion *v = activeQt4BuildConfiguration()->qtVersion();
@@ -274,12 +301,12 @@ const QString MaemoRunConfiguration::targetRoot() const
return MaemoGlobal::targetRoot(v->qmakeCommand()); return MaemoGlobal::targetRoot(v->qmakeCommand());
} }
const QString MaemoRunConfiguration::arguments() const QString RemoteLinuxRunConfiguration::arguments() const
{ {
return m_arguments; return m_d->arguments;
} }
QString MaemoRunConfiguration::localDirToMountForRemoteGdb() const QString RemoteLinuxRunConfiguration::localDirToMountForRemoteGdb() const
{ {
const QString projectDir const QString projectDir
= QDir::fromNativeSeparators(QDir::cleanPath(activeBuildConfiguration() = QDir::fromNativeSeparators(QDir::cleanPath(activeBuildConfiguration()
@@ -298,52 +325,57 @@ QString MaemoRunConfiguration::localDirToMountForRemoteGdb() const
? projectDir : projectDir.left(lastSeparatorPos); ? projectDir : projectDir.left(lastSeparatorPos);
} }
QString MaemoRunConfiguration::remoteProjectSourcesMountPoint() const QString RemoteLinuxRunConfiguration::remoteProjectSourcesMountPoint() const
{ {
return MaemoGlobal::homeDirOnDevice(deviceConfig()->sshParameters().userName) return MaemoGlobal::homeDirOnDevice(deviceConfig()->sshParameters().userName)
+ QLatin1String("/gdbSourcesDir_") + QLatin1String("/gdbSourcesDir_")
+ QFileInfo(localExecutableFilePath()).fileName(); + QFileInfo(localExecutableFilePath()).fileName();
} }
QString MaemoRunConfiguration::localExecutableFilePath() const QString RemoteLinuxRunConfiguration::localExecutableFilePath() const
{ {
TargetInformation ti = qt4Target()->qt4Project()->rootProjectNode() TargetInformation ti = qt4Target()->qt4Project()->rootProjectNode()
->targetInformation(m_proFilePath); ->targetInformation(m_d->proFilePath);
if (!ti.valid) if (!ti.valid)
return QString(); return QString();
return QDir::cleanPath(ti.workingDir + QLatin1Char('/') + ti.target); return QDir::cleanPath(ti.workingDir + QLatin1Char('/') + ti.target);
} }
QString MaemoRunConfiguration::remoteExecutableFilePath() const QString RemoteLinuxRunConfiguration::remoteExecutableFilePath() const
{ {
return deployConfig()->deployables()->remoteExecutableFilePath(localExecutableFilePath()); return deployConfig()->deployables()->remoteExecutableFilePath(localExecutableFilePath());
} }
MaemoPortList MaemoRunConfiguration::freePorts() const PortList RemoteLinuxRunConfiguration::freePorts() const
{ {
const Qt4BuildConfiguration * const bc = activeQt4BuildConfiguration(); const Qt4BuildConfiguration * const bc = activeQt4BuildConfiguration();
const AbstractLinuxDeviceDeployStep * const step = deployStep(); const AbstractLinuxDeviceDeployStep * const step = deployStep();
return bc && step return bc && step
? MaemoGlobal::freePorts(deployStep()->helper().deviceConfig(), bc->qtVersion()) ? MaemoGlobal::freePorts(deployStep()->helper().deviceConfig(), bc->qtVersion())
: MaemoPortList(); : PortList();
} }
bool MaemoRunConfiguration::useRemoteGdb() const bool RemoteLinuxRunConfiguration::useRemoteGdb() const
{ {
if (!m_useRemoteGdb) if (!m_d->useRemoteGdb)
return false; return false;
const AbstractQt4MaemoTarget * const maemoTarget const AbstractQt4MaemoTarget * const maemoTarget
= qobject_cast<AbstractQt4MaemoTarget *>(target()); = qobject_cast<AbstractQt4MaemoTarget *>(target());
return maemoTarget && maemoTarget->allowsRemoteMounts(); return maemoTarget && maemoTarget->allowsRemoteMounts();
} }
void MaemoRunConfiguration::setArguments(const QString &args) void RemoteLinuxRunConfiguration::setUseRemoteGdb(bool useRemoteGdb)
{ {
m_arguments = args; m_d->useRemoteGdb = useRemoteGdb;
} }
MaemoRunConfiguration::DebuggingType MaemoRunConfiguration::debuggingType() const void RemoteLinuxRunConfiguration::setArguments(const QString &args)
{
m_d->arguments = args;
}
RemoteLinuxRunConfiguration::DebuggingType RemoteLinuxRunConfiguration::debuggingType() const
{ {
const AbstractQt4MaemoTarget * const maemoTarget const AbstractQt4MaemoTarget * const maemoTarget
= qobject_cast<AbstractQt4MaemoTarget *>(target()); = qobject_cast<AbstractQt4MaemoTarget *>(target());
@@ -357,7 +389,7 @@ MaemoRunConfiguration::DebuggingType MaemoRunConfiguration::debuggingType() cons
return DebugQmlOnly; return DebugQmlOnly;
} }
int MaemoRunConfiguration::portsUsedByDebuggers() const int RemoteLinuxRunConfiguration::portsUsedByDebuggers() const
{ {
switch (debuggingType()) { switch (debuggingType()) {
case DebugCppOnly: case DebugCppOnly:
@@ -369,7 +401,7 @@ int MaemoRunConfiguration::portsUsedByDebuggers() const
} }
} }
bool MaemoRunConfiguration::hasEnoughFreePorts(const QString &mode) const bool RemoteLinuxRunConfiguration::hasEnoughFreePorts(const QString &mode) const
{ {
const int freePortCount = freePorts().count(); const int freePortCount = freePorts().count();
const AbstractQt4MaemoTarget * const maemoTarget const AbstractQt4MaemoTarget * const maemoTarget
@@ -386,12 +418,12 @@ bool MaemoRunConfiguration::hasEnoughFreePorts(const QString &mode) const
return false; return false;
} }
void MaemoRunConfiguration::updateDeviceConfigurations() void RemoteLinuxRunConfiguration::updateDeviceConfigurations()
{ {
emit deviceConfigurationChanged(target()); emit deviceConfigurationChanged(target());
} }
void MaemoRunConfiguration::handleDeployConfigChanged() void RemoteLinuxRunConfiguration::handleDeployConfigChanged()
{ {
DeployConfiguration * const activeDeployConf DeployConfiguration * const activeDeployConf
= target()->activeDeployConfiguration(); = target()->activeDeployConfiguration();
@@ -416,72 +448,71 @@ void MaemoRunConfiguration::handleDeployConfigChanged()
updateFactoryState(); updateFactoryState();
} }
QString MaemoRunConfiguration::baseEnvironmentText() const QString RemoteLinuxRunConfiguration::baseEnvironmentText() const
{ {
if (m_baseEnvironmentBase == CleanEnvironmentBase) if (m_d->baseEnvironmentType == CleanBaseEnvironment)
return tr("Clean Environment"); return tr("Clean Environment");
else if (m_baseEnvironmentBase == SystemEnvironmentBase) else if (m_d->baseEnvironmentType == SystemBaseEnvironment)
return tr("System Environment"); return tr("System Environment");
return QString(); return QString();
} }
MaemoRunConfiguration::BaseEnvironmentBase MaemoRunConfiguration::baseEnvironmentBase() const RemoteLinuxRunConfiguration::BaseEnvironmentType RemoteLinuxRunConfiguration::baseEnvironmentType() const
{ {
return m_baseEnvironmentBase; return m_d->baseEnvironmentType;
} }
void MaemoRunConfiguration::setBaseEnvironmentBase(BaseEnvironmentBase env) void RemoteLinuxRunConfiguration::setBaseEnvironmentType(BaseEnvironmentType env)
{ {
if (m_baseEnvironmentBase != env) { if (m_d->baseEnvironmentType != env) {
m_baseEnvironmentBase = env; m_d->baseEnvironmentType = env;
emit baseEnvironmentChanged(); emit baseEnvironmentChanged();
} }
} }
Utils::Environment MaemoRunConfiguration::environment() const Utils::Environment RemoteLinuxRunConfiguration::environment() const
{ {
Utils::Environment env = baseEnvironment(); Utils::Environment env = baseEnvironment();
env.modify(userEnvironmentChanges()); env.modify(userEnvironmentChanges());
return env; return env;
} }
Utils::Environment MaemoRunConfiguration::baseEnvironment() const Utils::Environment RemoteLinuxRunConfiguration::baseEnvironment() const
{ {
return (m_baseEnvironmentBase == SystemEnvironmentBase ? systemEnvironment() return (m_d->baseEnvironmentType == SystemBaseEnvironment ? systemEnvironment()
: Utils::Environment()); : Utils::Environment());
} }
QList<Utils::EnvironmentItem> MaemoRunConfiguration::userEnvironmentChanges() const QList<Utils::EnvironmentItem> RemoteLinuxRunConfiguration::userEnvironmentChanges() const
{ {
return m_userEnvironmentChanges; return m_d->userEnvironmentChanges;
} }
void MaemoRunConfiguration::setUserEnvironmentChanges( void RemoteLinuxRunConfiguration::setUserEnvironmentChanges(
const QList<Utils::EnvironmentItem> &diff) const QList<Utils::EnvironmentItem> &diff)
{ {
if (m_userEnvironmentChanges != diff) { if (m_d->userEnvironmentChanges != diff) {
m_userEnvironmentChanges = diff; m_d->userEnvironmentChanges = diff;
emit userEnvironmentChangesChanged(diff); emit userEnvironmentChangesChanged(diff);
} }
} }
Utils::Environment MaemoRunConfiguration::systemEnvironment() const Utils::Environment RemoteLinuxRunConfiguration::systemEnvironment() const
{ {
return m_systemEnvironment; return m_d->systemEnvironment;
} }
void MaemoRunConfiguration::setSystemEnvironment(const Utils::Environment &environment) void RemoteLinuxRunConfiguration::setSystemEnvironment(const Utils::Environment &environment)
{ {
if (m_systemEnvironment.size() == 0 || m_systemEnvironment != environment) { if (m_d->systemEnvironment.size() == 0 || m_d->systemEnvironment != environment) {
m_systemEnvironment = environment; m_d->systemEnvironment = environment;
emit systemEnvironmentChanged(); emit systemEnvironmentChanged();
} }
} }
QString MaemoRunConfiguration::proFilePath() const QString RemoteLinuxRunConfiguration::proFilePath() const
{ {
return m_proFilePath; return m_d->proFilePath;
} }
} // namespace Internal
} // namespace RemoteLinux } // namespace RemoteLinux

View File

@@ -33,9 +33,10 @@
#ifndef MAEMORUNCONFIGURATION_H #ifndef MAEMORUNCONFIGURATION_H
#define MAEMORUNCONFIGURATION_H #define MAEMORUNCONFIGURATION_H
#include "linuxdeviceconfiguration.h"
#include "maemoconstants.h" #include "maemoconstants.h"
#include "maemodeviceconfigurations.h"
#include "maemodeployable.h" #include "maemodeployable.h"
#include "remotelinux_export.h"
#include <utils/environment.h> #include <utils/environment.h>
@@ -55,30 +56,33 @@ class Qt4ProFileNode;
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal { namespace Internal {
class AbstractLinuxDeviceDeployStep; class AbstractLinuxDeviceDeployStep;
class MaemoDeviceConfigListModel; class MaemoDeviceConfigListModel;
class MaemoRemoteMountsModel; class MaemoRemoteMountsModel;
class MaemoRunConfigurationFactory; class MaemoRunConfigurationFactory;
class MaemoRunConfigurationWidget;
class MaemoToolChain; class MaemoToolChain;
class Qt4MaemoDeployConfiguration; class Qt4MaemoDeployConfiguration;
class RemoteLinuxRunConfigurationPrivate;
} // namespace Internal
class MaemoRunConfiguration : public ProjectExplorer::RunConfiguration class REMOTELINUX_EXPORT RemoteLinuxRunConfiguration : public ProjectExplorer::RunConfiguration
{ {
Q_OBJECT Q_OBJECT
friend class MaemoRunConfigurationFactory; friend class Internal::MaemoRunConfigurationFactory;
friend class Internal::MaemoRunConfigurationWidget;
public: public:
enum BaseEnvironmentBase { enum BaseEnvironmentType {
CleanEnvironmentBase = 0, CleanBaseEnvironment = 0,
SystemEnvironmentBase = 1 SystemBaseEnvironment = 1
}; };
enum DebuggingType { DebugCppOnly, DebugQmlOnly, DebugCppAndQml }; enum DebuggingType { DebugCppOnly, DebugQmlOnly, DebugCppAndQml };
MaemoRunConfiguration(Qt4ProjectManager::Qt4BaseTarget *parent, RemoteLinuxRunConfiguration(Qt4ProjectManager::Qt4BaseTarget *parent,
const QString &proFilePath); const QString &proFilePath);
virtual ~MaemoRunConfiguration(); virtual ~RemoteLinuxRunConfiguration();
bool isEnabled() const; bool isEnabled() const;
QString disabledReason() const; QString disabledReason() const;
@@ -87,39 +91,31 @@ public:
Qt4ProjectManager::Qt4BaseTarget *qt4Target() const; Qt4ProjectManager::Qt4BaseTarget *qt4Target() const;
Qt4ProjectManager::Qt4BuildConfiguration *activeQt4BuildConfiguration() const; Qt4ProjectManager::Qt4BuildConfiguration *activeQt4BuildConfiguration() const;
Qt4MaemoDeployConfiguration *deployConfig() const; Internal::Qt4MaemoDeployConfiguration *deployConfig() const;
MaemoRemoteMountsModel *remoteMounts() const { return m_remoteMounts; } Internal::MaemoRemoteMountsModel *remoteMounts() const;
QString localExecutableFilePath() const; QString localExecutableFilePath() const;
QString remoteExecutableFilePath() const; QString remoteExecutableFilePath() const;
const QString targetRoot() const; QString targetRoot() const;
const QString arguments() const; QString arguments() const;
void setArguments(const QString &args); QSharedPointer<const LinuxDeviceConfiguration> deviceConfig() const;
QSharedPointer<const MaemoDeviceConfig> deviceConfig() const; PortList freePorts() const;
MaemoPortList freePorts() const;
bool useRemoteGdb() const; bool useRemoteGdb() const;
void setUseRemoteGdb(bool useRemoteGdb) { m_useRemoteGdb = useRemoteGdb; }
void updateFactoryState() { emit isEnabledChanged(isEnabled()); } void updateFactoryState() { emit isEnabledChanged(isEnabled()); }
DebuggingType debuggingType() const; DebuggingType debuggingType() const;
const QString gdbCmd() const; QString gdbCmd() const;
QString localDirToMountForRemoteGdb() const; QString localDirToMountForRemoteGdb() const;
QString remoteProjectSourcesMountPoint() const; QString remoteProjectSourcesMountPoint() const;
virtual QVariantMap toMap() const; virtual QVariantMap toMap() const;
QString baseEnvironmentText() const; QString baseEnvironmentText() const;
BaseEnvironmentBase baseEnvironmentBase() const; BaseEnvironmentType baseEnvironmentType() const;
void setBaseEnvironmentBase(BaseEnvironmentBase env);
Utils::Environment environment() const; Utils::Environment environment() const;
Utils::Environment baseEnvironment() const; Utils::Environment baseEnvironment() const;
QList<Utils::EnvironmentItem> userEnvironmentChanges() const; QList<Utils::EnvironmentItem> userEnvironmentChanges() const;
void setUserEnvironmentChanges(const QList<Utils::EnvironmentItem> &diff);
Utils::Environment systemEnvironment() const; Utils::Environment systemEnvironment() const;
void setSystemEnvironment(const Utils::Environment &environment);
int portsUsedByDebuggers() const; int portsUsedByDebuggers() const;
bool hasEnoughFreePorts(const QString &mode) const; bool hasEnoughFreePorts(const QString &mode) const;
@@ -129,14 +125,13 @@ public:
signals: signals:
void deviceConfigurationChanged(ProjectExplorer::Target *target); void deviceConfigurationChanged(ProjectExplorer::Target *target);
void targetInformationChanged() const; void targetInformationChanged() const;
void baseEnvironmentChanged(); void baseEnvironmentChanged();
void systemEnvironmentChanged(); void systemEnvironmentChanged();
void userEnvironmentChangesChanged(const QList<Utils::EnvironmentItem> &diff); void userEnvironmentChangesChanged(const QList<Utils::EnvironmentItem> &diff);
protected: protected:
MaemoRunConfiguration(Qt4ProjectManager::Qt4BaseTarget *parent, RemoteLinuxRunConfiguration(Qt4ProjectManager::Qt4BaseTarget *parent,
MaemoRunConfiguration *source); RemoteLinuxRunConfiguration *source);
virtual bool fromMap(const QVariantMap &map); virtual bool fromMap(const QVariantMap &map);
QString defaultDisplayName(); QString defaultDisplayName();
@@ -149,22 +144,17 @@ private slots:
private: private:
void init(); void init();
void handleParseState(bool success); void handleParseState(bool success);
AbstractLinuxDeviceDeployStep *deployStep() const; Internal::AbstractLinuxDeviceDeployStep *deployStep() const;
QString m_proFilePath; void setArguments(const QString &args);
mutable QString m_gdbPath; void setUseRemoteGdb(bool useRemoteGdb);
MaemoRemoteMountsModel *m_remoteMounts; void setBaseEnvironmentType(BaseEnvironmentType env);
QString m_arguments; void setUserEnvironmentChanges(const QList<Utils::EnvironmentItem> &diff);
bool m_useRemoteGdb; void setSystemEnvironment(const Utils::Environment &environment);
BaseEnvironmentBase m_baseEnvironmentBase; Internal::RemoteLinuxRunConfigurationPrivate * const m_d;
Utils::Environment m_systemEnvironment;
QList<Utils::EnvironmentItem> m_userEnvironmentChanges;
bool m_validParse;
mutable QString m_disabledReason;
}; };
} // namespace Internal
} // namespace RemoteLinux } // namespace RemoteLinux
#endif // MAEMORUNCONFIGURATION_H #endif // MAEMORUNCONFIGURATION_H