diff --git a/src/plugins/remotelinux/abstractlinuxdevicedeploystep.cpp b/src/plugins/remotelinux/abstractlinuxdevicedeploystep.cpp index 3b80a8dac6b..c236f5a1cf3 100644 --- a/src/plugins/remotelinux/abstractlinuxdevicedeploystep.cpp +++ b/src/plugins/remotelinux/abstractlinuxdevicedeploystep.cpp @@ -31,6 +31,7 @@ **************************************************************************/ #include "abstractlinuxdevicedeploystep.h" +#include "linuxdeviceconfigurations.h" #include "maemoconstants.h" #include "maemodeploystepwidget.h" #include "maemopertargetdeviceconfigurationlistmodel.h" @@ -77,10 +78,10 @@ LinuxDeviceDeployStepHelper::~LinuxDeviceDeployStepHelper() {} 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); emit deviceConfigChanged(); @@ -96,13 +97,13 @@ QVariantMap LinuxDeviceDeployStepHelper::toMap() const { QVariantMap map; map.insert(DeviceIdKey, - MaemoDeviceConfigurations::instance()->internalId(m_deviceConfig)); + LinuxDeviceConfigurations::instance()->internalId(m_deviceConfig)); return map; } bool LinuxDeviceDeployStepHelper::fromMap(const QVariantMap &map) { - setDeviceConfig(map.value(DeviceIdKey, MaemoDeviceConfig::InvalidId).toULongLong()); + setDeviceConfig(map.value(DeviceIdKey, LinuxDeviceConfiguration::InvalidId).toULongLong()); return true; } diff --git a/src/plugins/remotelinux/abstractlinuxdevicedeploystep.h b/src/plugins/remotelinux/abstractlinuxdevicedeploystep.h index 7c0dcff96e5..5edb9c82bb1 100644 --- a/src/plugins/remotelinux/abstractlinuxdevicedeploystep.h +++ b/src/plugins/remotelinux/abstractlinuxdevicedeploystep.h @@ -32,7 +32,7 @@ #ifndef ABSTRACTLINUXDEVICEDEPLOYSTEP_H #define ABSTRACTLINUXDEVICEDEPLOYSTEP_H -#include "maemodeviceconfigurations.h" +#include "linuxdeviceconfiguration.h" #include #include @@ -52,8 +52,8 @@ public: LinuxDeviceDeployStepHelper(Qt4MaemoDeployConfiguration *dc); ~LinuxDeviceDeployStepHelper(); - QSharedPointer deviceConfig() const { return m_deviceConfig; } - QSharedPointer cachedDeviceConfig() const { return m_cachedDeviceConfig; } + QSharedPointer deviceConfig() const { return m_deviceConfig; } + QSharedPointer cachedDeviceConfig() const { return m_cachedDeviceConfig; } Qt4MaemoDeployConfiguration *deployConfiguration() const { return m_deployConfiguration; } void setDeviceConfig(int i); @@ -66,11 +66,11 @@ signals: void deviceConfigChanged(); private: - void setDeviceConfig(MaemoDeviceConfig::Id internalId); + void setDeviceConfig(LinuxDeviceConfiguration::Id internalId); Q_SLOT void handleDeviceConfigurationsUpdated(); - QSharedPointer m_deviceConfig; - QSharedPointer m_cachedDeviceConfig; + QSharedPointer m_deviceConfig; + QSharedPointer m_cachedDeviceConfig; Qt4MaemoDeployConfiguration * const m_deployConfiguration; }; diff --git a/src/plugins/remotelinux/abstractmaemodeploystep.cpp b/src/plugins/remotelinux/abstractmaemodeploystep.cpp index b73d717661e..5ba37f7540b 100644 --- a/src/plugins/remotelinux/abstractmaemodeploystep.cpp +++ b/src/plugins/remotelinux/abstractmaemodeploystep.cpp @@ -248,7 +248,7 @@ void AbstractMaemoDeployStep::start() m_hasError = false; if (isDeploymentNeeded(helper().cachedDeviceConfig()->sshParameters().host)) { - if (helper().cachedDeviceConfig()->type() == MaemoDeviceConfig::Emulator + if (helper().cachedDeviceConfig()->type() == LinuxDeviceConfiguration::Emulator && !MaemoQemuManager::instance().qemuIsRunning()) { MaemoQemuManager::instance().startRuntime(); raiseError(tr("Cannot deploy: Qemu was not running. " diff --git a/src/plugins/remotelinux/abstractmaemodeploystep.h b/src/plugins/remotelinux/abstractmaemodeploystep.h index aa490db4203..a26520283fb 100644 --- a/src/plugins/remotelinux/abstractmaemodeploystep.h +++ b/src/plugins/remotelinux/abstractmaemodeploystep.h @@ -34,9 +34,9 @@ #define ABSTRACTMAEMODEPLOYSTEP_H #include "abstractlinuxdevicedeploystep.h" +#include "linuxdeviceconfiguration.h" #include "maemodeployable.h" #include "maemodeployables.h" -#include "maemodeviceconfigurations.h" #include @@ -53,9 +53,10 @@ namespace Qt4ProjectManager { class Qt4BuildConfiguration; } namespace Utils { class SshConnection; } namespace RemoteLinux { +class LinuxDeviceConfiguration; + namespace Internal { class AbstractMaemoPackageCreationStep; -class MaemoDeviceConfig; class Qt4MaemoDeployConfiguration; class AbstractMaemoDeployStep diff --git a/src/plugins/remotelinux/linuxdeviceconfiguration.cpp b/src/plugins/remotelinux/linuxdeviceconfiguration.cpp new file mode 100644 index 00000000000..0a4f4a55150 --- /dev/null +++ b/src/plugins/remotelinux/linuxdeviceconfiguration.cpp @@ -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 +#include + +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(settings.value(OsVersionKey, LinuxDeviceConfiguration::Maemo5).toInt())), + m_type(static_cast(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(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 diff --git a/src/plugins/remotelinux/maemodeviceconfigurations.h b/src/plugins/remotelinux/linuxdeviceconfiguration.h similarity index 54% rename from src/plugins/remotelinux/maemodeviceconfigurations.h rename to src/plugins/remotelinux/linuxdeviceconfiguration.h index 76e1611cb46..d604ca88f35 100644 --- a/src/plugins/remotelinux/maemodeviceconfigurations.h +++ b/src/plugins/remotelinux/linuxdeviceconfiguration.h @@ -29,14 +29,13 @@ ** Nokia at info@qt.nokia.com. ** **************************************************************************/ +#ifndef LINUXDEVICECONFIGURATION_H +#define LINUXDEVICECONFIGURATION_H -#ifndef MAEMODEVICECONFIGURATIONS_H -#define MAEMODEVICECONFIGURATIONS_H +#include "remotelinux_export.h" #include -#include -#include #include #include #include @@ -45,10 +44,13 @@ QT_BEGIN_NAMESPACE class QSettings; QT_END_NAMESPACE + namespace RemoteLinux { namespace Internal { +class LinuxDeviceConfigurations; +} -class MaemoPortList +class REMOTELINUX_EXPORT PortList { public: void addPort(int port); @@ -64,16 +66,16 @@ private: }; -class MaemoDeviceConfig +class REMOTELINUX_EXPORT LinuxDeviceConfiguration { - friend class MaemoDeviceConfigurations; + friend class Internal::LinuxDeviceConfigurations; public: - typedef QSharedPointer ConstPtr; + typedef QSharedPointer ConstPtr; typedef quint64 Id; enum OsVersion { Maemo5, Maemo6, Meego, GenericLinux }; enum DeviceType { Physical, Emulator }; - MaemoPortList freePorts() const; + PortList freePorts() const; Utils::SshConnectionParameters sshParameters() const { return m_sshParameters; } QString name() const { return m_name; } OsVersion osVersion() const { return m_osVersion; } @@ -92,16 +94,16 @@ public: static const Id InvalidId; private: - typedef QSharedPointer Ptr; + typedef QSharedPointer Ptr; - MaemoDeviceConfig(const QString &name, OsVersion osVersion, + LinuxDeviceConfiguration(const QString &name, OsVersion osVersion, DeviceType type, const Utils::SshConnectionParameters &sshParams, Id &nextId); - MaemoDeviceConfig(const QSettings &settings, Id &nextId); - MaemoDeviceConfig(const ConstPtr &other); + LinuxDeviceConfiguration(const QSettings &settings, Id &nextId); + LinuxDeviceConfiguration(const ConstPtr &other); - MaemoDeviceConfig(const MaemoDeviceConfig &); - MaemoDeviceConfig &operator=(const MaemoDeviceConfig &); + LinuxDeviceConfiguration(const LinuxDeviceConfiguration &); + LinuxDeviceConfiguration &operator=(const LinuxDeviceConfiguration &); static Ptr createHardwareConfig(const QString &name, OsVersion osVersion, 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 ¶ms); - 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 m_devConfigs; - QString m_defaultSshKeyFilePath; -}; - -} // namespace Internal } // namespace RemoteLinux -#endif // MAEMODEVICECONFIGURATIONS_H +#endif // LINUXDEVICECONFIGURATION_H diff --git a/src/plugins/remotelinux/linuxdeviceconfigurations.cpp b/src/plugins/remotelinux/linuxdeviceconfigurations.cpp new file mode 100644 index 00000000000..5f600873904 --- /dev/null +++ b/src/plugins/remotelinux/linuxdeviceconfigurations.cpp @@ -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 + +#include +#include +#include + +#include +#include + +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 ¶ms) +{ + 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::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 diff --git a/src/plugins/remotelinux/linuxdeviceconfigurations.h b/src/plugins/remotelinux/linuxdeviceconfigurations.h new file mode 100644 index 00000000000..7aacfcdc948 --- /dev/null +++ b/src/plugins/remotelinux/linuxdeviceconfigurations.h @@ -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 +#include +#include +#include + + +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 ¶ms); + 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 m_devConfigs; + QString m_defaultSshKeyFilePath; +}; + +} // namespace Internal +} // namespace RemoteLinux + +#endif // MAEMODEVICECONFIGURATIONS_H diff --git a/src/plugins/remotelinux/maemoanalyzersupport.cpp b/src/plugins/remotelinux/maemoanalyzersupport.cpp index 4eeb87505d6..c0c04705add 100644 --- a/src/plugins/remotelinux/maemoanalyzersupport.cpp +++ b/src/plugins/remotelinux/maemoanalyzersupport.cpp @@ -47,11 +47,11 @@ using namespace ProjectExplorer; namespace RemoteLinux { namespace Internal { -RunControl *MaemoAnalyzerSupport::createAnalyzerRunControl(MaemoRunConfiguration *runConfig) +RunControl *MaemoAnalyzerSupport::createAnalyzerRunControl(RemoteLinuxRunConfiguration *runConfig) { AnalyzerStartParameters params; - const MaemoDeviceConfig::ConstPtr &devConf = runConfig->deviceConfig(); + const LinuxDeviceConfiguration::ConstPtr &devConf = runConfig->deviceConfig(); params.debuggee = runConfig->remoteExecutableFilePath(); params.debuggeeArgs = runConfig->arguments(); params.analyzerCmdPrefix = MaemoGlobal::remoteCommandPrefix(devConf->osVersion(), diff --git a/src/plugins/remotelinux/maemoanalyzersupport.h b/src/plugins/remotelinux/maemoanalyzersupport.h index 0cd6a515ab5..271ed0743fc 100644 --- a/src/plugins/remotelinux/maemoanalyzersupport.h +++ b/src/plugins/remotelinux/maemoanalyzersupport.h @@ -33,14 +33,14 @@ #ifndef MAEMOANALYZERSUPPORT_H #define MAEMOANALYZERSUPPORT_H -#include "maemorunconfiguration.h" +#include "remotelinuxrunconfiguration.h" namespace RemoteLinux { namespace Internal { namespace MaemoAnalyzerSupport { -ProjectExplorer::RunControl *createAnalyzerRunControl(MaemoRunConfiguration *runConfig); +ProjectExplorer::RunControl *createAnalyzerRunControl(RemoteLinuxRunConfiguration *runConfig); } diff --git a/src/plugins/remotelinux/maemoconfigtestdialog.cpp b/src/plugins/remotelinux/maemoconfigtestdialog.cpp index dbe6af8f3c5..ab4502b9f5e 100644 --- a/src/plugins/remotelinux/maemoconfigtestdialog.cpp +++ b/src/plugins/remotelinux/maemoconfigtestdialog.cpp @@ -32,7 +32,7 @@ #include "maemoconfigtestdialog.h" #include "ui_maemoconfigtestdialog.h" -#include "maemodeviceconfigurations.h" +#include "linuxdeviceconfiguration.h" #include "maemoglobal.h" #include "maemousedportsgatherer.h" @@ -46,7 +46,7 @@ using namespace Utils; namespace RemoteLinux { namespace Internal { -MaemoConfigTestDialog::MaemoConfigTestDialog(const MaemoDeviceConfig::ConstPtr &config, +MaemoConfigTestDialog::MaemoConfigTestDialog(const LinuxDeviceConfiguration::ConstPtr &config, QWidget *parent) : QDialog(parent) , m_ui(new Ui_MaemoConfigTestDialog) @@ -78,7 +78,7 @@ void MaemoConfigTestDialog::startConfigTest() return; 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..."); m_ui->testResultEdit->setPlainText(testingText); @@ -122,7 +122,7 @@ void MaemoConfigTestDialog::handleConnectionError() return; QString output = tr("Could not connect to host: %1") .arg(m_testProcessRunner->connection()->errorString()); - if (m_config->type() == MaemoDeviceConfig::Emulator) + if (m_config->type() == LinuxDeviceConfiguration::Emulator) output += tr("\nDid you start Qemu?"); m_ui->testResultEdit->setPlainText(output); stopConfigTest(); @@ -159,9 +159,9 @@ void MaemoConfigTestDialog::handleGeneralTestResult(int exitStatus) } switch (m_config->osVersion()) { - case MaemoDeviceConfig::Maemo5: - case MaemoDeviceConfig::Maemo6: - case MaemoDeviceConfig::Meego: + case LinuxDeviceConfiguration::Maemo5: + case LinuxDeviceConfiguration::Maemo6: + case LinuxDeviceConfiguration::Meego: m_currentTest = MadDeveloperTest; disconnect(m_testProcessRunner.data(), SIGNAL(processOutputAvailable(QByteArray)), this, @@ -184,7 +184,7 @@ void MaemoConfigTestDialog::handleMadDeveloperTestResult(int exitStatus) + tr("%1 is not installed.
You will not be able to deploy " "to this device.") .arg(MaemoGlobal::madDeveloperUiName(m_config->osVersion())); - if (m_config->osVersion() == MaemoDeviceConfig::Maemo6) { + if (m_config->osVersion() == LinuxDeviceConfiguration::Maemo6) { errorMsg += QLatin1String("
") + tr("Please switch the device to developer mode via Settings -> Security."); } diff --git a/src/plugins/remotelinux/maemoconfigtestdialog.h b/src/plugins/remotelinux/maemoconfigtestdialog.h index 9a4a3586ac5..98af1b77557 100644 --- a/src/plugins/remotelinux/maemoconfigtestdialog.h +++ b/src/plugins/remotelinux/maemoconfigtestdialog.h @@ -45,9 +45,9 @@ namespace Utils { } // namespace Utils namespace RemoteLinux { -namespace Internal { +class LinuxDeviceConfiguration; -class MaemoDeviceConfig; +namespace Internal { class MaemoUsedPortsGatherer; /** @@ -57,7 +57,7 @@ class MaemoConfigTestDialog : public QDialog { Q_OBJECT public: - explicit MaemoConfigTestDialog(const QSharedPointer &config, + explicit MaemoConfigTestDialog(const QSharedPointer &config, QWidget *parent = 0); ~MaemoConfigTestDialog(); @@ -80,7 +80,7 @@ private: Ui_MaemoConfigTestDialog *m_ui; QPushButton *m_closeButton; - const QSharedPointer m_config; + const QSharedPointer m_config; QSharedPointer m_testProcessRunner; QString m_deviceTestOutput; bool m_qtVersionOk; diff --git a/src/plugins/remotelinux/maemoconstants.h b/src/plugins/remotelinux/maemoconstants.h index 422b039b232..acada157ed6 100644 --- a/src/plugins/remotelinux/maemoconstants.h +++ b/src/plugins/remotelinux/maemoconstants.h @@ -65,7 +65,7 @@ static const QLatin1String UseRemoteGdbKey(PREFIX ".UseRemoteGdb"); namespace Constants { 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"; } diff --git a/src/plugins/remotelinux/maemodebugsupport.cpp b/src/plugins/remotelinux/maemodebugsupport.cpp index 2719e0659e0..d8e78578195 100644 --- a/src/plugins/remotelinux/maemodebugsupport.cpp +++ b/src/plugins/remotelinux/maemodebugsupport.cpp @@ -56,18 +56,18 @@ using namespace ProjectExplorer; namespace RemoteLinux { namespace Internal { -RunControl *MaemoDebugSupport::createDebugRunControl(MaemoRunConfiguration *runConfig) +RunControl *MaemoDebugSupport::createDebugRunControl(RemoteLinuxRunConfiguration *runConfig) { DebuggerStartParameters params; - const MaemoDeviceConfig::ConstPtr &devConf = runConfig->deviceConfig(); + const LinuxDeviceConfiguration::ConstPtr &devConf = runConfig->deviceConfig(); - const MaemoRunConfiguration::DebuggingType debuggingType + const RemoteLinuxRunConfiguration::DebuggingType debuggingType = runConfig->debuggingType(); - if (debuggingType != MaemoRunConfiguration::DebugCppOnly) { + if (debuggingType != RemoteLinuxRunConfiguration::DebugCppOnly) { params.qmlServerAddress = runConfig->deviceConfig()->sshParameters().host; params.qmlServerPort = -1; } - if (debuggingType != MaemoRunConfiguration::DebugQmlOnly) { + if (debuggingType != RemoteLinuxRunConfiguration::DebugQmlOnly) { params.processArgs = runConfig->arguments(); if (runConfig->activeQt4BuildConfiguration()->qtVersion()) params.sysroot = runConfig->activeQt4BuildConfiguration()->qtVersion()->systemRoot(); @@ -113,7 +113,7 @@ RunControl *MaemoDebugSupport::createDebugRunControl(MaemoRunConfiguration *runC DebuggerRunControl * const runControl = DebuggerPlugin::createDebugger(params, runConfig); bool useGdb = params.startMode == StartRemoteGdb - && debuggingType != MaemoRunConfiguration::DebugQmlOnly; + && debuggingType != RemoteLinuxRunConfiguration::DebugQmlOnly; MaemoDebugSupport *debugSupport = new MaemoDebugSupport(runConfig, runControl->engine(), useGdb); connect(runControl, SIGNAL(finished()), @@ -121,7 +121,7 @@ RunControl *MaemoDebugSupport::createDebugRunControl(MaemoRunConfiguration *runC return runControl; } -MaemoDebugSupport::MaemoDebugSupport(MaemoRunConfiguration *runConfig, +MaemoDebugSupport::MaemoDebugSupport(RemoteLinuxRunConfiguration *runConfig, DebuggerEngine *engine, bool useGdb) : QObject(engine), m_engine(engine), m_runConfig(runConfig), m_deviceConfig(m_runConfig->deviceConfig()), @@ -180,11 +180,11 @@ void MaemoDebugSupport::startExecution() ASSERT_STATE(StartingRunner); - if (!useGdb() && m_debuggingType != MaemoRunConfiguration::DebugQmlOnly) { + if (!useGdb() && m_debuggingType != RemoteLinuxRunConfiguration::DebugQmlOnly) { if (!setPort(m_gdbServerPort)) return; } - if (m_debuggingType != MaemoRunConfiguration::DebugCppOnly) { + if (m_debuggingType != RemoteLinuxRunConfiguration::DebugCppOnly) { if (!setPort(m_qmlPort)) return; } @@ -200,7 +200,7 @@ void MaemoDebugSupport::startExecution() SLOT(handleRemoteErrorOutput(QByteArray))); connect(m_runner, SIGNAL(remoteOutput(QByteArray)), this, SLOT(handleRemoteOutput(QByteArray))); - if (m_debuggingType == MaemoRunConfiguration::DebugQmlOnly) { + if (m_debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly) { connect(m_runner, SIGNAL(remoteProcessStarted()), SLOT(handleRemoteProcessStarted())); } @@ -209,12 +209,12 @@ void MaemoDebugSupport::startExecution() m_deviceConfig->sshParameters().userName, remoteExe); const QString env = MaemoGlobal::remoteEnvironment(m_userEnvChanges); QString args = m_runner->arguments(); - if (m_debuggingType != MaemoRunConfiguration::DebugCppOnly) { + if (m_debuggingType != RemoteLinuxRunConfiguration::DebugCppOnly) { args += QString(QLatin1String(" -qmljsdebugger=port:%1,block")) .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) .arg(remoteExe).arg(args) : QString::fromLocal8Bit("%1 %2 gdbserver :%3 %4 %5") @@ -231,10 +231,10 @@ void MaemoDebugSupport::handleRemoteProcessFinished(qint64 exitCode) return; if (m_state == Debugging) { - if (m_debuggingType != MaemoRunConfiguration::DebugQmlOnly) + if (m_debuggingType != RemoteLinuxRunConfiguration::DebugQmlOnly) m_engine->notifyInferiorIll(); } 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("The gdbserver process closed unexpectedly."); m_engine->handleRemoteSetupFailed(errorMsg); @@ -261,7 +261,7 @@ void MaemoDebugSupport::handleRemoteErrorOutput(const QByteArray &output) showMessage(QString::fromUtf8(output), AppOutput); if (m_state == StartingRemoteProcess - && m_debuggingType != MaemoRunConfiguration::DebugQmlOnly) { + && m_debuggingType != RemoteLinuxRunConfiguration::DebugQmlOnly) { m_gdbserverOutput += output; if (m_gdbserverOutput.contains("Listening on port")) { handleAdapterSetupDone(); @@ -289,7 +289,7 @@ void MaemoDebugSupport::handleAdapterSetupDone() void MaemoDebugSupport::handleRemoteProcessStarted() { - Q_ASSERT(m_debuggingType == MaemoRunConfiguration::DebugQmlOnly); + Q_ASSERT(m_debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly); ASSERT_STATE(StartingRemoteProcess); handleAdapterSetupDone(); } diff --git a/src/plugins/remotelinux/maemodebugsupport.h b/src/plugins/remotelinux/maemodebugsupport.h index acadec8663c..a899207de53 100644 --- a/src/plugins/remotelinux/maemodebugsupport.h +++ b/src/plugins/remotelinux/maemodebugsupport.h @@ -32,7 +32,7 @@ #ifndef MAEMODEBUGSUPPORT_H #define MAEMODEBUGSUPPORT_H -#include "maemorunconfiguration.h" +#include "remotelinuxrunconfiguration.h" #include @@ -46,19 +46,19 @@ class DebuggerEngine; namespace ProjectExplorer { class RunControl; } namespace RemoteLinux { -namespace Internal { +class LinuxDeviceConfiguration; +class RemoteLinuxRunConfiguration; -class MaemoDeviceConfig; -class MaemoRunConfiguration; +namespace Internal { class MaemoSshRunner; class MaemoDebugSupport : public QObject { Q_OBJECT public: - static ProjectExplorer::RunControl *createDebugRunControl(MaemoRunConfiguration *runConfig); + static ProjectExplorer::RunControl *createDebugRunControl(RemoteLinuxRunConfiguration *runConfig); - MaemoDebugSupport(MaemoRunConfiguration *runConfig, + MaemoDebugSupport(RemoteLinuxRunConfiguration *runConfig, Debugger::DebuggerEngine *engine, bool useGdb); ~MaemoDebugSupport(); @@ -86,10 +86,10 @@ private: void showMessage(const QString &msg, int channel); const QPointer m_engine; - const QPointer m_runConfig; - const QSharedPointer m_deviceConfig; + const QPointer m_runConfig; + const QSharedPointer m_deviceConfig; MaemoSshRunner * const m_runner; - const MaemoRunConfiguration::DebuggingType m_debuggingType; + const RemoteLinuxRunConfiguration::DebuggingType m_debuggingType; const QList m_userEnvChanges; QByteArray m_gdbserverOutput; diff --git a/src/plugins/remotelinux/maemodeployablelistmodel.cpp b/src/plugins/remotelinux/maemodeployablelistmodel.cpp index 01e0de3af94..a83ea28df86 100644 --- a/src/plugins/remotelinux/maemodeployablelistmodel.cpp +++ b/src/plugins/remotelinux/maemodeployablelistmodel.cpp @@ -265,7 +265,7 @@ bool MaemoDeployableListModel::addDesktopFile() const QtSupport::BaseQtVersion * const version = qtVersion(); QTC_ASSERT(version, return false); QString remoteDir = QLatin1String("/usr/share/applications"); - if (MaemoGlobal::version(version->qmakeCommand()) == MaemoDeviceConfig::Maemo5) + if (MaemoGlobal::version(version->qmakeCommand()) == LinuxDeviceConfiguration::Maemo5) remoteDir += QLatin1String("/hildon"); const QLatin1String filesLine("desktopfile.files = $${TARGET}.desktop"); const QString pathLine = QLatin1String("desktopfile.path = ") + remoteDir; @@ -340,7 +340,7 @@ QString MaemoDeployableListModel::proFileScope() const { const QtSupport::BaseQtVersion *const qv = qtVersion(); QTC_ASSERT(qv, return QString()); - return QLatin1String(MaemoGlobal::version(qv->qmakeCommand()) == MaemoDeviceConfig::Maemo5 + return QLatin1String(MaemoGlobal::version(qv->qmakeCommand()) == LinuxDeviceConfiguration::Maemo5 ? "maemo5" : "unix:!symbian:!maemo5"); } diff --git a/src/plugins/remotelinux/maemodeploymentmounter.cpp b/src/plugins/remotelinux/maemodeploymentmounter.cpp index 06c1de8980d..1cfd7bc872c 100644 --- a/src/plugins/remotelinux/maemodeploymentmounter.cpp +++ b/src/plugins/remotelinux/maemodeploymentmounter.cpp @@ -68,7 +68,7 @@ MaemoDeploymentMounter::MaemoDeploymentMounter(QObject *parent) } void MaemoDeploymentMounter::setupMounts(const SshConnection::Ptr &connection, - const MaemoDeviceConfig::ConstPtr &devConf, + const LinuxDeviceConfiguration::ConstPtr &devConf, const QList &mountSpecs, const Qt4BuildConfiguration *bc) { diff --git a/src/plugins/remotelinux/maemodeploymentmounter.h b/src/plugins/remotelinux/maemodeploymentmounter.h index 10698e4d812..0ccf09f3dee 100644 --- a/src/plugins/remotelinux/maemodeploymentmounter.h +++ b/src/plugins/remotelinux/maemodeploymentmounter.h @@ -33,7 +33,7 @@ #ifndef MAEMODEPLOYMENTMOUNTER_H #define MAEMODEPLOYMENTMOUNTER_H -#include "maemodeviceconfigurations.h" +#include "linuxdeviceconfiguration.h" #include "maemomountspecification.h" #include @@ -44,8 +44,9 @@ namespace Utils { class SshConnection; } namespace Qt4ProjectManager { class Qt4BuildConfiguration; } namespace RemoteLinux { +class LinuxDeviceConfiguration; + namespace Internal { -class MaemoDeviceConfig; class MaemoRemoteMounter; class MaemoUsedPortsGatherer; @@ -57,7 +58,7 @@ public: // Connection must be in connected state. void setupMounts(const QSharedPointer &connection, - const QSharedPointer &devConf, + const QSharedPointer &devConf, const QList &mountSpecs, const Qt4ProjectManager::Qt4BuildConfiguration *bc); void tearDownMounts(); @@ -89,10 +90,10 @@ private: State m_state; QSharedPointer m_connection; - QSharedPointer m_devConf; + QSharedPointer m_devConf; MaemoRemoteMounter * const m_mounter; MaemoUsedPortsGatherer * const m_portsGatherer; - MaemoPortList m_freePorts; + PortList m_freePorts; QList m_mountSpecs; const Qt4ProjectManager::Qt4BuildConfiguration *m_buildConfig; }; diff --git a/src/plugins/remotelinux/maemodeploystepwidget.cpp b/src/plugins/remotelinux/maemodeploystepwidget.cpp index 54e31d7baf6..ed7308077bc 100644 --- a/src/plugins/remotelinux/maemodeploystepwidget.cpp +++ b/src/plugins/remotelinux/maemodeploystepwidget.cpp @@ -34,11 +34,11 @@ #include "ui_maemodeploystepwidget.h" #include "abstractmaemodeploystep.h" -#include "maemodeviceconfigurations.h" +#include "linuxdeviceconfigurations.h" #include "maemosettingspages.h" #include "maemoglobal.h" #include "maemopertargetdeviceconfigurationlistmodel.h" -#include "maemorunconfiguration.h" +#include "remotelinuxrunconfiguration.h" #include "qt4maemodeployconfiguration.h" #include "qt4maemotarget.h" @@ -81,9 +81,9 @@ MaemoDeployStepBaseWidget::~MaemoDeployStepBaseWidget() void MaemoDeployStepBaseWidget::handleDeviceUpdate() { - const MaemoDeviceConfig::ConstPtr &devConf = m_step->helper().deviceConfig(); - const MaemoDeviceConfig::Id internalId - = MaemoDeviceConfigurations::instance()->internalId(devConf); + const LinuxDeviceConfiguration::ConstPtr &devConf = m_step->helper().deviceConfig(); + const LinuxDeviceConfiguration::Id internalId + = LinuxDeviceConfigurations::instance()->internalId(devConf); const int newIndex = m_step->maemoDeployConfig()->deviceConfigModel() ->indexForInternalId(internalId); ui->deviceConfigComboBox->setCurrentIndex(newIndex); diff --git a/src/plugins/remotelinux/maemodeviceconfigurations.cpp b/src/plugins/remotelinux/maemodeviceconfigurations.cpp deleted file mode 100644 index 741fc1932bf..00000000000 --- a/src/plugins/remotelinux/maemodeviceconfigurations.cpp +++ /dev/null @@ -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 - -#include -#include -#include -#include - -#include -#include - -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(settings.value(OsVersionKey, MaemoDeviceConfig::Maemo5).toInt())), - m_type(static_cast(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(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 ¶ms) -{ - 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::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 diff --git a/src/plugins/remotelinux/maemodeviceconfigurationssettingswidget.cpp b/src/plugins/remotelinux/maemodeviceconfigurationssettingswidget.cpp index 2bf018a7cff..2f7d392ffad 100644 --- a/src/plugins/remotelinux/maemodeviceconfigurationssettingswidget.cpp +++ b/src/plugins/remotelinux/maemodeviceconfigurationssettingswidget.cpp @@ -33,9 +33,9 @@ #include "ui_maemodeviceconfigurationssettingswidget.h" +#include "linuxdeviceconfigurations.h" #include "maemoconfigtestdialog.h" #include "maemodeviceconfigwizard.h" -#include "maemodeviceconfigurations.h" #include "maemoglobal.h" #include "maemokeydeployer.h" #include "maemoremoteprocessesdialog.h" @@ -68,7 +68,7 @@ const QLatin1String LastDeviceConfigIndexKey("LastDisplayedMaemoDeviceConfig"); class NameValidator : public QValidator { public: - NameValidator(const MaemoDeviceConfigurations *devConfigs, + NameValidator(const LinuxDeviceConfigurations *devConfigs, QWidget *parent = 0) : QValidator(parent), m_devConfigs(devConfigs) { @@ -93,14 +93,14 @@ public: private: QString m_oldName; - const MaemoDeviceConfigurations * const m_devConfigs; + const LinuxDeviceConfigurations * const m_devConfigs; }; MaemoDeviceConfigurationsSettingsWidget::MaemoDeviceConfigurationsSettingsWidget(QWidget *parent) : QWidget(parent), m_ui(new Ui_MaemoDeviceConfigurationsSettingsWidget), - m_devConfigs(MaemoDeviceConfigurations::cloneInstance()), + m_devConfigs(LinuxDeviceConfigurations::cloneInstance()), m_nameValidator(new NameValidator(m_devConfigs.data(), this)), m_keyDeployer(new MaemoKeyDeployer(this)), m_saveSettingsRequested(false) @@ -117,7 +117,7 @@ MaemoDeviceConfigurationsSettingsWidget::~MaemoDeviceConfigurationsSettingsWidge if (m_saveSettingsRequested) { Core::ICore::instance()->settings()->setValue(LastDeviceConfigIndexKey, currentIndex()); - MaemoDeviceConfigurations::replaceInstance(m_devConfigs.data()); + LinuxDeviceConfigurations::replaceInstance(m_devConfigs.data()); } delete m_ui; } @@ -155,7 +155,7 @@ void MaemoDeviceConfigurationsSettingsWidget::initGui() m_ui->nameLineEdit->setValidator(m_nameValidator); m_ui->keyFileLineEdit->setExpectedKind(Utils::PathChooser::File); QRegExpValidator * const portsValidator - = new QRegExpValidator(QRegExp(MaemoDeviceConfig::portsRegExpr()), this); + = new QRegExpValidator(QRegExp(LinuxDeviceConfiguration::portsRegExpr()), this); m_ui->portsLineEdit->setValidator(portsValidator); connect(m_ui->makeKeyFileDefaultButton, SIGNAL(clicked()), SLOT(setDefaultKeyFilePath())); @@ -179,7 +179,7 @@ void MaemoDeviceConfigurationsSettingsWidget::addConfig() wizard.createDeviceConfig(); m_ui->removeConfigButton->setEnabled(true); m_ui->configurationComboBox->setCurrentIndex(m_ui->configurationComboBox->count()-1); - if (currentConfig()->type() != MaemoDeviceConfig::Emulator) + if (currentConfig()->type() != LinuxDeviceConfiguration::Emulator) testConfig(); } } @@ -193,11 +193,11 @@ void MaemoDeviceConfigurationsSettingsWidget::deleteConfig() void MaemoDeviceConfigurationsSettingsWidget::displayCurrent() { - const MaemoDeviceConfig::ConstPtr ¤t = currentConfig(); + const LinuxDeviceConfiguration::ConstPtr ¤t = currentConfig(); m_ui->defaultDeviceButton->setEnabled(!current->isDefault()); m_ui->osTypeValueLabel->setText(MaemoGlobal::osVersionToString(current->osVersion())); const SshConnectionParameters &sshParams = current->sshParameters(); - if (current->type() == MaemoDeviceConfig::Physical) { + if (current->type() == LinuxDeviceConfiguration::Physical) { m_ui->deviceTypeValueLabel->setText(tr("Physical Device")); m_ui->portsLineEdit->setReadOnly(false); } else { @@ -216,7 +216,7 @@ void MaemoDeviceConfigurationsSettingsWidget::displayCurrent() void MaemoDeviceConfigurationsSettingsWidget::fillInValues() { - const MaemoDeviceConfig::ConstPtr ¤t = currentConfig(); + const LinuxDeviceConfiguration::ConstPtr ¤t = currentConfig(); m_ui->nameLineEdit->setText(current->name()); const SshConnectionParameters &sshParams = current->sshParameters(); m_ui->hostLineEdit->setText(sshParams.host); @@ -228,7 +228,7 @@ void MaemoDeviceConfigurationsSettingsWidget::fillInValues() m_ui->keyFileLineEdit->setPath(sshParams.privateKeyFile); m_ui->showPasswordCheckBox->setChecked(false); updatePortsWarningLabel(); - const bool isSimulator = current->type() == MaemoDeviceConfig::Emulator; + const bool isSimulator = current->type() == LinuxDeviceConfiguration::Emulator; m_ui->hostLineEdit->setReadOnly(isSimulator); m_ui->sshPortSpinBox->setReadOnly(isSimulator); } @@ -244,7 +244,7 @@ int MaemoDeviceConfigurationsSettingsWidget::currentIndex() const return m_ui->configurationComboBox->currentIndex(); } -MaemoDeviceConfig::ConstPtr MaemoDeviceConfigurationsSettingsWidget::currentConfig() const +LinuxDeviceConfiguration::ConstPtr MaemoDeviceConfigurationsSettingsWidget::currentConfig() const { Q_ASSERT(currentIndex() != -1); return m_devConfigs->deviceAt(currentIndex()); diff --git a/src/plugins/remotelinux/maemodeviceconfigurationssettingswidget.h b/src/plugins/remotelinux/maemodeviceconfigurationssettingswidget.h index 2c1d95a018b..68acb55e968 100644 --- a/src/plugins/remotelinux/maemodeviceconfigurationssettingswidget.h +++ b/src/plugins/remotelinux/maemodeviceconfigurationssettingswidget.h @@ -48,11 +48,12 @@ class SshRemoteProcessRunner; } namespace RemoteLinux { +class LinuxDeviceConfiguration; + namespace Internal { class NameValidator; -class MaemoDeviceConfig; -class MaemoDeviceConfigurations; +class LinuxDeviceConfigurations; class MaemoKeyDeployer; class MaemoDeviceConfigurationsSettingsWidget : public QWidget @@ -98,7 +99,7 @@ private slots: private: void initGui(); void displayCurrent(); - QSharedPointer currentConfig() const; + QSharedPointer currentConfig() const; int currentIndex() const; void clearDetails(); QString parseTestOutput(); @@ -106,7 +107,7 @@ private: void updatePortsWarningLabel(); Ui_MaemoDeviceConfigurationsSettingsWidget *m_ui; - const QScopedPointer m_devConfigs; + const QScopedPointer m_devConfigs; NameValidator * const m_nameValidator; MaemoKeyDeployer *const m_keyDeployer; bool m_saveSettingsRequested; diff --git a/src/plugins/remotelinux/maemodeviceconfigwizard.cpp b/src/plugins/remotelinux/maemodeviceconfigwizard.cpp index 4a422ed1f4b..1de1898b55f 100644 --- a/src/plugins/remotelinux/maemodeviceconfigwizard.cpp +++ b/src/plugins/remotelinux/maemodeviceconfigwizard.cpp @@ -37,7 +37,7 @@ #include "ui_maemodeviceconfigwizardreusekeyscheckpage.h" #include "ui_maemodeviceconfigwizardstartpage.h" -#include "maemodeviceconfigurations.h" +#include "linuxdeviceconfigurations.h" #include "maemoglobal.h" #include "maemokeydeployer.h" @@ -61,9 +61,9 @@ struct WizardData { QString configName; QString hostName; - MaemoDeviceConfig::OsVersion osVersion; + LinuxDeviceConfiguration::OsVersion osVersion; SshConnectionParameters::AuthenticationType authType; - MaemoDeviceConfig::DeviceType deviceType; + LinuxDeviceConfiguration::DeviceType deviceType; QString privateKeyFilePath; QString publicKeyFilePath; QString userName; @@ -85,10 +85,10 @@ public: m_ui->setupUi(this); setTitle(tr("General Information")); setSubTitle(QLatin1String(" ")); // For Qt bug (background color) - m_ui->fremantleButton->setText(MaemoGlobal::osVersionToString(MaemoDeviceConfig::Maemo5)); - m_ui->harmattanButton->setText(MaemoGlobal::osVersionToString(MaemoDeviceConfig::Maemo6)); - m_ui->meegoButton->setText(MaemoGlobal::osVersionToString(MaemoDeviceConfig::Meego)); - m_ui->genericLinuxButton->setText(MaemoGlobal::osVersionToString(MaemoDeviceConfig::GenericLinux)); + m_ui->fremantleButton->setText(MaemoGlobal::osVersionToString(LinuxDeviceConfiguration::Maemo5)); + m_ui->harmattanButton->setText(MaemoGlobal::osVersionToString(LinuxDeviceConfiguration::Maemo6)); + m_ui->meegoButton->setText(MaemoGlobal::osVersionToString(LinuxDeviceConfiguration::Meego)); + m_ui->genericLinuxButton->setText(MaemoGlobal::osVersionToString(LinuxDeviceConfiguration::GenericLinux)); QButtonGroup *buttonGroup = new QButtonGroup(this); buttonGroup->setExclusive(true); @@ -110,7 +110,7 @@ public: m_ui->harmattanButton->setChecked(true); m_ui->hwButton->setChecked(true); handleDeviceTypeChanged(); - m_ui->hostNameLineEdit->setText(MaemoDeviceConfig::defaultHost(deviceType(), + m_ui->hostNameLineEdit->setText(LinuxDeviceConfiguration::defaultHost(deviceType(), osVersion())); connect(m_ui->nameLineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(completeChanged())); @@ -127,36 +127,36 @@ public: QString hostName() const { - return deviceType() == MaemoDeviceConfig::Emulator - ? MaemoDeviceConfig::defaultHost(MaemoDeviceConfig::Emulator, osVersion()) + return deviceType() == LinuxDeviceConfiguration::Emulator + ? LinuxDeviceConfiguration::defaultHost(LinuxDeviceConfiguration::Emulator, osVersion()) : m_ui->hostNameLineEdit->text().trimmed(); } - MaemoDeviceConfig::OsVersion osVersion() const + LinuxDeviceConfiguration::OsVersion osVersion() const { - return m_ui->fremantleButton->isChecked() ? MaemoDeviceConfig::Maemo5 - : m_ui->harmattanButton->isChecked() ? MaemoDeviceConfig::Maemo6 - : m_ui->meegoButton->isChecked() ? MaemoDeviceConfig::Meego - : MaemoDeviceConfig::GenericLinux; + return m_ui->fremantleButton->isChecked() ? LinuxDeviceConfiguration::Maemo5 + : m_ui->harmattanButton->isChecked() ? LinuxDeviceConfiguration::Maemo6 + : m_ui->meegoButton->isChecked() ? LinuxDeviceConfiguration::Meego + : LinuxDeviceConfiguration::GenericLinux; } - MaemoDeviceConfig::DeviceType deviceType() const + LinuxDeviceConfiguration::DeviceType deviceType() const { return m_ui->hwButton->isChecked() - ? MaemoDeviceConfig::Physical : MaemoDeviceConfig::Emulator; + ? LinuxDeviceConfiguration::Physical : LinuxDeviceConfiguration::Emulator; } private slots: void handleDeviceTypeChanged() { - const bool enable = deviceType() == MaemoDeviceConfig::Physical; + const bool enable = deviceType() == LinuxDeviceConfiguration::Physical; m_ui->hostNameLabel->setEnabled(enable); m_ui->hostNameLineEdit->setEnabled(enable); } void handleOsTypeChanged() { - if (osVersion() == MaemoDeviceConfig::GenericLinux) { + if (osVersion() == LinuxDeviceConfiguration::GenericLinux) { m_ui->hwButton->setChecked(true); m_ui->hwButton->setEnabled(false); m_ui->qemuButton->setEnabled(false); @@ -202,10 +202,10 @@ public: 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->passwordLineEdit->clear(); - m_ui->privateKeyPathChooser->setPath(MaemoDeviceConfig::defaultPrivateKeyFilePath()); + m_ui->privateKeyPathChooser->setPath(LinuxDeviceConfiguration::defaultPrivateKeyFilePath()); handleAuthTypeChanged(); } @@ -263,7 +263,7 @@ public: virtual void initializePage() { m_ui->keyWasNotSetUpButton->setChecked(true); - m_ui->privateKeyFilePathChooser->setPath(MaemoDeviceConfig::defaultPrivateKeyFilePath()); + m_ui->privateKeyFilePathChooser->setPath(LinuxDeviceConfiguration::defaultPrivateKeyFilePath()); handleSelectionChanged(); } @@ -319,8 +319,8 @@ public: virtual void initializePage() { m_ui->dontReuseButton->setChecked(true); - m_ui->privateKeyFilePathChooser->setPath(MaemoDeviceConfig::defaultPrivateKeyFilePath()); - m_ui->publicKeyFilePathChooser->setPath(MaemoDeviceConfig::defaultPublicKeyFilePath()); + m_ui->privateKeyFilePathChooser->setPath(LinuxDeviceConfiguration::defaultPrivateKeyFilePath()); + m_ui->publicKeyFilePathChooser->setPath(LinuxDeviceConfiguration::defaultPublicKeyFilePath()); handleSelectionChanged(); } @@ -504,10 +504,10 @@ private: SshConnectionParameters sshParams(SshConnectionParameters::NoProxy); sshParams.authenticationType = SshConnectionParameters::AuthenticationByPassword; sshParams.host = hostAddress(); - sshParams.port = MaemoDeviceConfig::defaultSshPort(MaemoDeviceConfig::Physical); + sshParams.port = LinuxDeviceConfiguration::defaultSshPort(LinuxDeviceConfiguration::Physical); sshParams.password = password(); sshParams.timeout = 30; - sshParams.userName = MaemoDeviceConfig::defaultUser(m_wizardData.osVersion); + sshParams.userName = LinuxDeviceConfiguration::defaultUser(m_wizardData.osVersion); m_ui->statusLabel->setText(tr("Deploying... ")); m_keyDeployer->deployPublicKey(sshParams, m_wizardData.publicKeyFilePath); } @@ -569,7 +569,7 @@ public: virtual void initializePage() { QString infoText; - if (m_wizardData.deviceType == MaemoDeviceConfig::Physical) { + if (m_wizardData.deviceType == LinuxDeviceConfiguration::Physical) { infoText = tr("The new device configuration will now be " "created and a test procedure will be run to check whether " "Qt Creator can connect to the device and to provide some " @@ -589,7 +589,7 @@ private: struct MaemoDeviceConfigWizardPrivate { - MaemoDeviceConfigWizardPrivate(MaemoDeviceConfigurations *devConfigs, + MaemoDeviceConfigWizardPrivate(LinuxDeviceConfigurations *devConfigs, QWidget *parent) : devConfigs(devConfigs), startPage(parent), @@ -603,7 +603,7 @@ struct MaemoDeviceConfigWizardPrivate } WizardData wizardData; - MaemoDeviceConfigurations * const devConfigs; + LinuxDeviceConfigurations * const devConfigs; MaemoDeviceConfigWizardStartPage startPage; MaemoDeviceConfigWizardLoginDataPage loginDataPage; MaemoDeviceConfigWizardPreviousKeySetupCheckPage previousKeySetupPage; @@ -614,7 +614,7 @@ struct MaemoDeviceConfigWizardPrivate }; -MaemoDeviceConfigWizard::MaemoDeviceConfigWizard(MaemoDeviceConfigurations *devConfigs, +MaemoDeviceConfigWizard::MaemoDeviceConfigWizard(LinuxDeviceConfigurations *devConfigs, QWidget *parent) : QWizard(parent), d(new MaemoDeviceConfigWizardPrivate(devConfigs, this)) @@ -643,7 +643,7 @@ void MaemoDeviceConfigWizard::createDeviceConfig() while (d->devConfigs->hasConfig(name)); } - if (d->wizardData.osVersion == MaemoDeviceConfig::GenericLinux) { + if (d->wizardData.osVersion == LinuxDeviceConfiguration::GenericLinux) { if (d->wizardData.authType == SshConnectionParameters::AuthenticationByPassword) { d->devConfigs->addGenericLinuxConfigurationUsingPassword(name, d->wizardData.hostName, d->wizardData.userName, @@ -653,7 +653,7 @@ void MaemoDeviceConfigWizard::createDeviceConfig() d->wizardData.hostName, d->wizardData.userName, d->wizardData.privateKeyFilePath); } - } else if (d->wizardData.deviceType == MaemoDeviceConfig::Physical) { + } else if (d->wizardData.deviceType == LinuxDeviceConfiguration::Physical) { d->devConfigs->addHardwareDeviceConfiguration(name, d->wizardData.osVersion, d->wizardData.hostName, d->wizardData.privateKeyFilePath); @@ -672,9 +672,9 @@ int MaemoDeviceConfigWizard::nextId() const d->wizardData.deviceType = d->startPage.deviceType(); d->wizardData.hostName = d->startPage.hostName(); - if (d->wizardData.deviceType == MaemoDeviceConfig::Emulator) { + if (d->wizardData.deviceType == LinuxDeviceConfiguration::Emulator) { return FinalPageId; - } else if (d->wizardData.osVersion == MaemoDeviceConfig::GenericLinux) { + } else if (d->wizardData.osVersion == LinuxDeviceConfiguration::GenericLinux) { return LoginDataPageId; } else { return PreviousKeySetupCheckPageId; diff --git a/src/plugins/remotelinux/maemodeviceconfigwizard.h b/src/plugins/remotelinux/maemodeviceconfigwizard.h index 51f70d2ab07..7420bd23cd9 100644 --- a/src/plugins/remotelinux/maemodeviceconfigwizard.h +++ b/src/plugins/remotelinux/maemodeviceconfigwizard.h @@ -37,15 +37,14 @@ namespace RemoteLinux { namespace Internal { -class MaemoDeviceConfig; -class MaemoDeviceConfigurations; +class LinuxDeviceConfigurations; struct MaemoDeviceConfigWizardPrivate; class MaemoDeviceConfigWizard : public QWizard { Q_OBJECT public: - explicit MaemoDeviceConfigWizard(MaemoDeviceConfigurations *devConfigs, + explicit MaemoDeviceConfigWizard(LinuxDeviceConfigurations *devConfigs, QWidget *parent = 0); ~MaemoDeviceConfigWizard(); void createDeviceConfig(); diff --git a/src/plugins/remotelinux/maemodeviceenvreader.cpp b/src/plugins/remotelinux/maemodeviceenvreader.cpp index e0bcebdd3a0..c1adec59bf4 100644 --- a/src/plugins/remotelinux/maemodeviceenvreader.cpp +++ b/src/plugins/remotelinux/maemodeviceenvreader.cpp @@ -31,16 +31,16 @@ #include "maemodeviceenvreader.h" -#include "maemodeviceconfigurations.h" +#include "linuxdeviceconfiguration.h" #include "maemoglobal.h" -#include "maemorunconfiguration.h" +#include "remotelinuxrunconfiguration.h" #include namespace RemoteLinux { namespace Internal { -MaemoDeviceEnvReader::MaemoDeviceEnvReader(QObject *parent, MaemoRunConfiguration *config) +MaemoDeviceEnvReader::MaemoDeviceEnvReader(QObject *parent, RemoteLinuxRunConfiguration *config) : QObject(parent) , m_stop(false) , m_devConfig(config->deviceConfig()) diff --git a/src/plugins/remotelinux/maemodeviceenvreader.h b/src/plugins/remotelinux/maemodeviceenvreader.h index bf8a7936538..a6efb3f9bb1 100644 --- a/src/plugins/remotelinux/maemodeviceenvreader.h +++ b/src/plugins/remotelinux/maemodeviceenvreader.h @@ -42,16 +42,16 @@ namespace Utils { } namespace RemoteLinux { -namespace Internal { +class LinuxDeviceConfiguration; +class RemoteLinuxRunConfiguration; -class MaemoDeviceConfig; -class MaemoRunConfiguration; +namespace Internal { class MaemoDeviceEnvReader : public QObject { Q_OBJECT public: - MaemoDeviceEnvReader(QObject *parent, MaemoRunConfiguration *config); + MaemoDeviceEnvReader(QObject *parent, RemoteLinuxRunConfiguration *config); ~MaemoDeviceEnvReader(); void start(); @@ -78,8 +78,8 @@ private: QString m_remoteOutput; QByteArray m_remoteErrorOutput; Utils::Environment m_env; - QSharedPointer m_devConfig; - MaemoRunConfiguration *m_runConfig; + QSharedPointer m_devConfig; + RemoteLinuxRunConfiguration *m_runConfig; QSharedPointer m_remoteProcessRunner; }; diff --git a/src/plugins/remotelinux/maemoglobal.cpp b/src/plugins/remotelinux/maemoglobal.cpp index 05ccb0d4d36..c2d3466cefc 100644 --- a/src/plugins/remotelinux/maemoglobal.cpp +++ b/src/plugins/remotelinux/maemoglobal.cpp @@ -82,17 +82,17 @@ bool MaemoGlobal::isMeegoTargetId(const QString &id) bool MaemoGlobal::isValidMaemo5QtVersion(const QString &qmakePath) { - return isValidMaemoQtVersion(qmakePath, MaemoDeviceConfig::Maemo5); + return isValidMaemoQtVersion(qmakePath, LinuxDeviceConfiguration::Maemo5); } bool MaemoGlobal::isValidHarmattanQtVersion(const QString &qmakePath) { - return isValidMaemoQtVersion(qmakePath, MaemoDeviceConfig::Maemo6); + return isValidMaemoQtVersion(qmakePath, LinuxDeviceConfiguration::Maemo6); } bool MaemoGlobal::isValidMeegoQtVersion(const QString &qmakePath) { - return isValidMaemoQtVersion(qmakePath, MaemoDeviceConfig::Meego); + return isValidMaemoQtVersion(qmakePath, LinuxDeviceConfiguration::Meego); } bool MaemoGlobal::isLinuxQt(const QtSupport::BaseQtVersion *qtVersion) @@ -119,7 +119,7 @@ bool MaemoGlobal::hasLinuxQt(const ProjectExplorer::Target *target) } bool MaemoGlobal::isValidMaemoQtVersion(const QString &qmakePath, - MaemoDeviceConfig::OsVersion maemoVersion) + LinuxDeviceConfiguration::OsVersion maemoVersion) { if (version(qmakePath) != maemoVersion) return false; @@ -154,32 +154,32 @@ QString MaemoGlobal::devrootshPath() 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) { if (uname == QLatin1String("root")) return QString(); switch (osVersion) { - case MaemoDeviceConfig::Maemo5: - case MaemoDeviceConfig::Maemo6: - case MaemoDeviceConfig::Meego: + case LinuxDeviceConfiguration::Maemo5: + case LinuxDeviceConfiguration::Maemo6: + case LinuxDeviceConfiguration::Meego: return devrootshPath(); default: 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) { QString prefix = QString::fromLocal8Bit("%1 chmod a+x %2; %3; ") .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 "); return prefix; } @@ -204,12 +204,12 @@ QString MaemoGlobal::remoteEnvironment(const QList &list } 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") .arg(connection->errorString()); - if (deviceConfig->type() == MaemoDeviceConfig::Emulator) { + if (deviceConfig->type() == LinuxDeviceConfiguration::Emulator) { if (connection->errorState() == Utils::SshTimeoutError || connection->errorState() == Utils::SshSocketError) { errorMsg += tr("\nDid you start Qemu?"); @@ -220,17 +220,17 @@ QString MaemoGlobal::failedToConnectToServerMessage(const Utils::SshConnection:: return errorMsg; } -QString MaemoGlobal::deviceConfigurationName(const MaemoDeviceConfig::ConstPtr &devConf) +QString MaemoGlobal::deviceConfigurationName(const LinuxDeviceConfiguration::ConstPtr &devConf) { 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) { if (!devConf || !qtVersion) - return MaemoPortList(); - if (devConf->type() == MaemoDeviceConfig::Emulator) { + return PortList(); + if (devConf->type() == LinuxDeviceConfiguration::Emulator) { MaemoQemuRuntime rt; const int id = qtVersion->uniqueId(); if (MaemoQemuManager::instance().runtimeForQtVersion(id, &rt)) @@ -266,22 +266,22 @@ QString MaemoGlobal::madCommand(const QString &qmakePath) 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"); } -MaemoDeviceConfig::OsVersion MaemoGlobal::version(const QString &qmakePath) +LinuxDeviceConfiguration::OsVersion MaemoGlobal::version(const QString &qmakePath) { const QString &name = targetName(qmakePath); if (name.startsWith(QLatin1String("fremantle"))) - return MaemoDeviceConfig::Maemo5; + return LinuxDeviceConfiguration::Maemo5; if (name.startsWith(QLatin1String("harmattan"))) - return MaemoDeviceConfig::Maemo6; + return LinuxDeviceConfiguration::Maemo6; if (name.startsWith(QLatin1String("meego"))) - return MaemoDeviceConfig::Meego; - return MaemoDeviceConfig::GenericLinux; + return LinuxDeviceConfiguration::Meego; + return LinuxDeviceConfiguration::GenericLinux; } QString MaemoGlobal::architecture(const QString &qmakePath) @@ -430,24 +430,24 @@ QStringList MaemoGlobal::targetArgs(const QString &qmakePath, bool useTarget) return args; } -QString MaemoGlobal::osVersionToString(MaemoDeviceConfig::OsVersion version) +QString MaemoGlobal::osVersionToString(LinuxDeviceConfiguration::OsVersion version) { switch (version) { - case MaemoDeviceConfig::Maemo5: return QLatin1String("Maemo5/Fremantle"); - case MaemoDeviceConfig::Maemo6: return QLatin1String("Harmattan"); - case MaemoDeviceConfig::Meego: return QLatin1String("Meego"); - case MaemoDeviceConfig::GenericLinux: return QLatin1String("Other Linux"); + case LinuxDeviceConfiguration::Maemo5: return QLatin1String("Maemo5/Fremantle"); + case LinuxDeviceConfiguration::Maemo6: return QLatin1String("Harmattan"); + case LinuxDeviceConfiguration::Meego: return QLatin1String("Meego"); + case LinuxDeviceConfiguration::GenericLinux: return QLatin1String("Other Linux"); } qDebug("%s: Unknown OS Version %d.", Q_FUNC_INFO, version); return QString(); } -MaemoGlobal::PackagingSystem MaemoGlobal::packagingSystem(MaemoDeviceConfig::OsVersion osVersion) +MaemoGlobal::PackagingSystem MaemoGlobal::packagingSystem(LinuxDeviceConfiguration::OsVersion osVersion) { switch (osVersion) { - case MaemoDeviceConfig::Maemo5: case MaemoDeviceConfig::Maemo6: return Dpkg; - case MaemoDeviceConfig::Meego: return Rpm; - case MaemoDeviceConfig::GenericLinux: return Tar; + case LinuxDeviceConfiguration::Maemo5: case LinuxDeviceConfiguration::Maemo6: return Dpkg; + case LinuxDeviceConfiguration::Meego: return Rpm; + case LinuxDeviceConfiguration::GenericLinux: return Tar; default: qFatal("%s: Missing case in switch.", Q_FUNC_INFO); } return static_cast(-1); diff --git a/src/plugins/remotelinux/maemoglobal.h b/src/plugins/remotelinux/maemoglobal.h index 4f9d9d957aa..33a29fc83a7 100644 --- a/src/plugins/remotelinux/maemoglobal.h +++ b/src/plugins/remotelinux/maemoglobal.h @@ -33,7 +33,7 @@ #ifndef MAEMOGLOBAL_H #define MAEMOGLOBAL_H -#include "maemodeviceconfigurations.h" +#include "linuxdeviceconfiguration.h" #include #include @@ -106,25 +106,25 @@ public: static QString homeDirOnDevice(const QString &uname); static QString devrootshPath(); - static int applicationIconSize(MaemoDeviceConfig::OsVersion osVersion); - static QString remoteSudo(MaemoDeviceConfig::OsVersion, + static int applicationIconSize(LinuxDeviceConfiguration::OsVersion osVersion); + static QString remoteSudo(LinuxDeviceConfiguration::OsVersion, const QString &uname); - static QString remoteCommandPrefix(MaemoDeviceConfig::OsVersion osVersion, + static QString remoteCommandPrefix(LinuxDeviceConfiguration::OsVersion osVersion, const QString &userName, const QString &commandFilePath); static QString remoteEnvironment(const QList &list); static QString remoteSourceProfilesCommand(); static QString failedToConnectToServerMessage(const QSharedPointer &connection, - const QSharedPointer &deviceConfig); - static QString deviceConfigurationName(const QSharedPointer &devConf); - static MaemoPortList freePorts(const QSharedPointer &devConf, + const QSharedPointer &deviceConfig); + static QString deviceConfigurationName(const QSharedPointer &devConf); + static PortList freePorts(const QSharedPointer &devConf, const QtSupport::BaseQtVersion *qtVersion); static QString maddeRoot(const QString &qmakePath); static QString targetRoot(const QString &qmakePath); static QString targetName(const QString &qmakePath); static QString madCommand(const QString &qmakePath); - static QString madDeveloperUiName(MaemoDeviceConfig::OsVersion maemoVersion); - static MaemoDeviceConfig::OsVersion version(const QString &qmakePath); + static QString madDeveloperUiName(LinuxDeviceConfiguration::OsVersion maemoVersion); + static LinuxDeviceConfiguration::OsVersion version(const QString &qmakePath); // TODO: IS this still needed with Qt Version having an Abi? static QString architecture(const QString &qmakePath); @@ -134,9 +134,9 @@ public: static bool callMadAdmin(QProcess &proc, const QStringList &args, 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 copyRecursively(const QString &srcFilePath, @@ -177,7 +177,7 @@ public: } static bool isValidMaemoQtVersion(const QString &qmakePath, - MaemoDeviceConfig::OsVersion maemoVersion); + LinuxDeviceConfiguration::OsVersion maemoVersion); private: static QString madAdminCommand(const QString &qmakePath); static bool callMaddeShellScript(QProcess &proc, const QString &qmakePath, diff --git a/src/plugins/remotelinux/maemopackageinstaller.cpp b/src/plugins/remotelinux/maemopackageinstaller.cpp index 6408c1c1755..0065cadbc7b 100644 --- a/src/plugins/remotelinux/maemopackageinstaller.cpp +++ b/src/plugins/remotelinux/maemopackageinstaller.cpp @@ -50,7 +50,7 @@ AbstractMaemoPackageInstaller::AbstractMaemoPackageInstaller(QObject *parent) AbstractMaemoPackageInstaller::~AbstractMaemoPackageInstaller() {} void AbstractMaemoPackageInstaller::installPackage(const SshConnection::Ptr &connection, - const MaemoDeviceConfig::ConstPtr &devConf, const QString &packageFilePath, + const LinuxDeviceConfiguration::ConstPtr &devConf, const QString &packageFilePath, bool removePackageFile) { Q_ASSERT(connection && connection->state() == SshConnection::Connected); diff --git a/src/plugins/remotelinux/maemopackageinstaller.h b/src/plugins/remotelinux/maemopackageinstaller.h index 978a6fda0d4..a83d98a536b 100644 --- a/src/plugins/remotelinux/maemopackageinstaller.h +++ b/src/plugins/remotelinux/maemopackageinstaller.h @@ -44,8 +44,9 @@ class SshRemoteProcessRunner; #include namespace RemoteLinux { +class LinuxDeviceConfiguration; + namespace Internal { -class MaemoDeviceConfig; class AbstractMaemoPackageInstaller : public QObject { @@ -54,7 +55,7 @@ public: ~AbstractMaemoPackageInstaller(); void installPackage(const QSharedPointer &connection, - const QSharedPointer &devConfig, + const QSharedPointer &devConfig, const QString &packageFilePath, bool removePackageFile); void cancelInstallation(); diff --git a/src/plugins/remotelinux/maemopertargetdeviceconfigurationlistmodel.cpp b/src/plugins/remotelinux/maemopertargetdeviceconfigurationlistmodel.cpp index fa1810e2766..0da73ab7c7c 100644 --- a/src/plugins/remotelinux/maemopertargetdeviceconfigurationlistmodel.cpp +++ b/src/plugins/remotelinux/maemopertargetdeviceconfigurationlistmodel.cpp @@ -31,6 +31,7 @@ **************************************************************************/ #include "maemopertargetdeviceconfigurationlistmodel.h" +#include "linuxdeviceconfigurations.h" #include "qt4maemotarget.h" using namespace ProjectExplorer; @@ -42,15 +43,15 @@ MaemoPerTargetDeviceConfigurationListModel::MaemoPerTargetDeviceConfigurationLis const Target *target) : QAbstractListModel(parent) { if (qobject_cast(target)) - m_targetOsVersion = MaemoDeviceConfig::Maemo5; + m_targetOsVersion = LinuxDeviceConfiguration::Maemo5; else if (qobject_cast(target)) - m_targetOsVersion = MaemoDeviceConfig::Maemo6; + m_targetOsVersion = LinuxDeviceConfiguration::Maemo6; else if (qobject_cast(target)) - m_targetOsVersion = MaemoDeviceConfig::Meego; + m_targetOsVersion = LinuxDeviceConfiguration::Meego; else - m_targetOsVersion = MaemoDeviceConfig::GenericLinux; - const MaemoDeviceConfigurations * const devConfs - = MaemoDeviceConfigurations::instance(); + m_targetOsVersion = LinuxDeviceConfiguration::GenericLinux; + const LinuxDeviceConfigurations * const devConfs + = LinuxDeviceConfigurations::instance(); connect(devConfs, SIGNAL(modelReset()), this, SIGNAL(modelReset())); connect(devConfs, SIGNAL(updated()), this, SIGNAL(updated())); } @@ -64,10 +65,10 @@ int MaemoPerTargetDeviceConfigurationListModel::rowCount(const QModelIndex &pare if (parent.isValid()) return 0; int count = 0; - const MaemoDeviceConfigurations * const devConfs - = MaemoDeviceConfigurations::instance(); + const LinuxDeviceConfigurations * const devConfs + = LinuxDeviceConfigurations::instance(); const int devConfsCount = devConfs->rowCount(); - if (m_targetOsVersion == MaemoDeviceConfig::GenericLinux) + if (m_targetOsVersion == LinuxDeviceConfiguration::GenericLinux) return devConfsCount; for (int i = 0; i < devConfsCount; ++i) { 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) return QVariant(); - const MaemoDeviceConfig::ConstPtr &devConf = deviceAt(index.row()); + const LinuxDeviceConfiguration::ConstPtr &devConf = deviceAt(index.row()); Q_ASSERT(devConf); QString displayedName = devConf->name(); if (devConf->isDefault() && devConf->osVersion() == m_targetOsVersion) @@ -89,12 +90,12 @@ QVariant MaemoPerTargetDeviceConfigurationListModel::data(const QModelIndex &ind return displayedName; } -MaemoDeviceConfig::ConstPtr MaemoPerTargetDeviceConfigurationListModel::deviceAt(int idx) const +LinuxDeviceConfiguration::ConstPtr MaemoPerTargetDeviceConfigurationListModel::deviceAt(int idx) const { int currentRow = -1; - const MaemoDeviceConfigurations * const devConfs - = MaemoDeviceConfigurations::instance(); - if (m_targetOsVersion == MaemoDeviceConfig::GenericLinux) + const LinuxDeviceConfigurations * const devConfs + = LinuxDeviceConfigurations::instance(); + if (m_targetOsVersion == LinuxDeviceConfiguration::GenericLinux) return devConfs->deviceAt(idx); const int devConfsCount = devConfs->rowCount(); for (int i = 0; i < devConfsCount; ++i) { @@ -104,24 +105,24 @@ MaemoDeviceConfig::ConstPtr MaemoPerTargetDeviceConfigurationListModel::deviceAt } } 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 - = MaemoDeviceConfigurations::instance()->find(id); + const LinuxDeviceConfiguration::ConstPtr &devConf + = LinuxDeviceConfigurations::instance()->find(id); return devConf && (devConf->osVersion() == m_targetOsVersion - || m_targetOsVersion == MaemoDeviceConfig::GenericLinux) + || m_targetOsVersion == LinuxDeviceConfiguration::GenericLinux) ? devConf : defaultDeviceConfig(); } -int MaemoPerTargetDeviceConfigurationListModel::indexForInternalId(MaemoDeviceConfig::Id id) const +int MaemoPerTargetDeviceConfigurationListModel::indexForInternalId(LinuxDeviceConfiguration::Id id) const { const int count = rowCount(); for (int i = 0; i < count; ++i) { diff --git a/src/plugins/remotelinux/maemopertargetdeviceconfigurationlistmodel.h b/src/plugins/remotelinux/maemopertargetdeviceconfigurationlistmodel.h index dfe6a823a49..2b110ff26ec 100644 --- a/src/plugins/remotelinux/maemopertargetdeviceconfigurationlistmodel.h +++ b/src/plugins/remotelinux/maemopertargetdeviceconfigurationlistmodel.h @@ -32,7 +32,7 @@ #ifndef MAEMOPERTARGETDEVICECONFIGURATIONLISTMODEL_H #define MAEMOPERTARGETDEVICECONFIGURATIONLISTMODEL_H -#include "maemodeviceconfigurations.h" +#include "linuxdeviceconfiguration.h" #include "maemoglobal.h" #include @@ -55,16 +55,16 @@ public: virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - QSharedPointer deviceAt(int idx) const; - QSharedPointer defaultDeviceConfig() const; - QSharedPointer find(MaemoDeviceConfig::Id id) const; - int indexForInternalId(MaemoDeviceConfig::Id id) const; + QSharedPointer deviceAt(int idx) const; + QSharedPointer defaultDeviceConfig() const; + QSharedPointer find(LinuxDeviceConfiguration::Id id) const; + int indexForInternalId(LinuxDeviceConfiguration::Id id) const; signals: void updated(); private: - MaemoDeviceConfig::OsVersion m_targetOsVersion; + LinuxDeviceConfiguration::OsVersion m_targetOsVersion; }; } // namespace Internal diff --git a/src/plugins/remotelinux/maemopublishingbuildsettingspagefremantlefree.cpp b/src/plugins/remotelinux/maemopublishingbuildsettingspagefremantlefree.cpp index e62b840065c..6e6cec91baf 100644 --- a/src/plugins/remotelinux/maemopublishingbuildsettingspagefremantlefree.cpp +++ b/src/plugins/remotelinux/maemopublishingbuildsettingspagefremantlefree.cpp @@ -85,7 +85,7 @@ void MaemoPublishingBuildSettingsPageFremantleFree::collectBuildConfigurations(c QtSupport::BaseQtVersion *lqt = qt4Bc->qtVersion(); if (!lqt) continue; - if (MaemoGlobal::version(lqt->qmakeCommand()) == MaemoDeviceConfig::Maemo5) + if (MaemoGlobal::version(lqt->qmakeCommand()) == LinuxDeviceConfiguration::Maemo5) m_buildConfigs << qt4Bc; } break; diff --git a/src/plugins/remotelinux/maemopublishingwizardfactories.cpp b/src/plugins/remotelinux/maemopublishingwizardfactories.cpp index 519abb580a3..d78f7d034cc 100644 --- a/src/plugins/remotelinux/maemopublishingwizardfactories.cpp +++ b/src/plugins/remotelinux/maemopublishingwizardfactories.cpp @@ -82,7 +82,7 @@ bool MaemoPublishingWizardFactoryFremantleFree::canCreateWizard(const Project *p QtSupport::BaseQtVersion *qt = qt4Bc->qtVersion(); if (!qt) continue; - if (MaemoGlobal::version(qt->qmakeCommand()) == MaemoDeviceConfig::Maemo5) + if (MaemoGlobal::version(qt->qmakeCommand()) == LinuxDeviceConfiguration::Maemo5) return true; } break; diff --git a/src/plugins/remotelinux/maemoqemumanager.cpp b/src/plugins/remotelinux/maemoqemumanager.cpp index dbb21582915..862f55a2403 100644 --- a/src/plugins/remotelinux/maemoqemumanager.cpp +++ b/src/plugins/remotelinux/maemoqemumanager.cpp @@ -35,7 +35,7 @@ #include "maemoglobal.h" #include "maemoqemuruntimeparser.h" #include "maemosettingspages.h" -#include "maemorunconfiguration.h" +#include "remotelinuxrunconfiguration.h" #include "qt4maemotarget.h" #include "maemoqtversion.h" @@ -269,7 +269,7 @@ void MaemoQemuManager::targetAdded(ProjectExplorer::Target *target) connect(target, SIGNAL(environmentChanged()), this, SLOT(environmentChanged())); foreach (RunConfiguration *rc, target->runConfigurations()) - toggleDeviceConnections(qobject_cast (rc), true); + toggleDeviceConnections(qobject_cast (rc), true); toggleStarterButton(target); } @@ -295,7 +295,7 @@ void MaemoQemuManager::targetRemoved(ProjectExplorer::Target *target) disconnect(target, SIGNAL(environmentChanged()), this, SLOT(environmentChanged())); foreach (RunConfiguration *rc, target->runConfigurations()) - toggleDeviceConnections(qobject_cast (rc), false); + toggleDeviceConnections(qobject_cast (rc), false); showOrHideQemuButton(); } @@ -311,14 +311,14 @@ void MaemoQemuManager::runConfigurationAdded(ProjectExplorer::RunConfiguration * { if (!rc || !MaemoGlobal::isMaemoTargetId(rc->target()->id())) return; - toggleDeviceConnections(qobject_cast (rc), true); + toggleDeviceConnections(qobject_cast (rc), true); } void MaemoQemuManager::runConfigurationRemoved(ProjectExplorer::RunConfiguration *rc) { if (!rc || !MaemoGlobal::isMaemoTargetId(rc->target()->id())) return; - toggleDeviceConnections(qobject_cast (rc), false); + toggleDeviceConnections(qobject_cast (rc), false); } void MaemoQemuManager::runConfigurationChanged(ProjectExplorer::RunConfiguration *rc) @@ -573,8 +573,8 @@ bool MaemoQemuManager::targetUsesMatchingRuntimeConfig(Target *target, if (target != target->project()->activeTarget()) return false; - MaemoRunConfiguration *mrc = - qobject_cast (target->activeRunConfiguration()); + RemoteLinuxRunConfiguration *mrc = + qobject_cast (target->activeRunConfiguration()); if (!mrc) return false; Qt4BuildConfiguration *bc @@ -587,8 +587,8 @@ bool MaemoQemuManager::targetUsesMatchingRuntimeConfig(Target *target, if (qtVersion) *qtVersion = version; - const MaemoDeviceConfig::ConstPtr &config = mrc->deviceConfig(); - return config && config->type() == MaemoDeviceConfig::Emulator; + const LinuxDeviceConfiguration::ConstPtr &config = mrc->deviceConfig(); + return config && config->type() == LinuxDeviceConfiguration::Emulator; } void MaemoQemuManager::notify(const QList uniqueIds) @@ -597,7 +597,7 @@ void MaemoQemuManager::notify(const QList uniqueIds) environmentChanged(); // to toggle the start button } -void MaemoQemuManager::toggleDeviceConnections(MaemoRunConfiguration *mrc, +void MaemoQemuManager::toggleDeviceConnections(RemoteLinuxRunConfiguration *mrc, bool _connect) { if (!mrc) diff --git a/src/plugins/remotelinux/maemoqemumanager.h b/src/plugins/remotelinux/maemoqemumanager.h index 4b285c62db6..91c6c5cb5c7 100644 --- a/src/plugins/remotelinux/maemoqemumanager.h +++ b/src/plugins/remotelinux/maemoqemumanager.h @@ -61,8 +61,9 @@ class BaseQtVersion; } namespace RemoteLinux { +class RemoteLinuxRunConfiguration; + namespace Internal { -class MaemoRunConfiguration; class MaemoQemuManager : public QObject { @@ -122,7 +123,7 @@ private: QtSupport::BaseQtVersion **qtVersion = 0); void notify(const QList uniqueIds); - void toggleDeviceConnections(MaemoRunConfiguration *mrc, bool connect); + void toggleDeviceConnections(RemoteLinuxRunConfiguration *mrc, bool connect); void showOrHideQemuButton(); private: diff --git a/src/plugins/remotelinux/maemoqemuruntime.h b/src/plugins/remotelinux/maemoqemuruntime.h index b0e10336b59..4fd30394df4 100644 --- a/src/plugins/remotelinux/maemoqemuruntime.h +++ b/src/plugins/remotelinux/maemoqemuruntime.h @@ -32,7 +32,7 @@ #ifndef MAEMOQEMURUNTIME_H #define MAEMOQEMURUNTIME_H -#include "maemodeviceconfigurations.h" +#include "linuxdeviceconfiguration.h" #include "maemoqemusettings.h" #include @@ -78,7 +78,7 @@ struct MaemoQemuRuntime QString m_args; QString m_sshPort; QString m_watchPath; - MaemoPortList m_freePorts; + PortList m_freePorts; QList m_normalVars; QString m_openGlBackendVarName; QHash m_openGlBackendVarValues; diff --git a/src/plugins/remotelinux/maemoqemuruntimeparser.cpp b/src/plugins/remotelinux/maemoqemuruntimeparser.cpp index e00c26bb4de..1b3620ac403 100644 --- a/src/plugins/remotelinux/maemoqemuruntimeparser.cpp +++ b/src/plugins/remotelinux/maemoqemuruntimeparser.cpp @@ -188,7 +188,7 @@ void MaemoQemuRuntimeParserV1::fillRuntimeInformation(MaemoQemuRuntime *runtime) runtime->m_args = map.value(QLatin1String("qemu_args")); setEnvironment(runtime, map.value(QLatin1String("libpath"))); runtime->m_sshPort = map.value(QLatin1String("sshport")); - runtime->m_freePorts = MaemoPortList(); + runtime->m_freePorts = PortList(); int i = 2; while (true) { const QString port = map.value(QLatin1String("redirport") diff --git a/src/plugins/remotelinux/maemoqtversion.cpp b/src/plugins/remotelinux/maemoqtversion.cpp index 2ef5cdae35e..b13a4029456 100644 --- a/src/plugins/remotelinux/maemoqtversion.cpp +++ b/src/plugins/remotelinux/maemoqtversion.cpp @@ -109,16 +109,16 @@ QList MaemoQtVersion::qtAbis() const QList result; if (!m_isvalidVersion) return result; - if (m_osVersion == MaemoDeviceConfig::Maemo5) { + if (m_osVersion == LinuxDeviceConfiguration::Maemo5) { result.append(ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture, ProjectExplorer::Abi::LinuxOS, ProjectExplorer::Abi::MaemoLinuxFlavor, ProjectExplorer::Abi::ElfFormat, 32)); - } else if (m_osVersion == MaemoDeviceConfig::Maemo6) { + } else if (m_osVersion == LinuxDeviceConfiguration::Maemo6) { result.append(ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture, ProjectExplorer::Abi::LinuxOS, ProjectExplorer::Abi::HarmattanLinuxFlavor, ProjectExplorer::Abi::ElfFormat, 32)); - } else if (m_osVersion == MaemoDeviceConfig::Meego) { + } else if (m_osVersion == LinuxDeviceConfiguration::Meego) { result.append(ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture, ProjectExplorer::Abi::LinuxOS, ProjectExplorer::Abi::MeegoLinuxFlavor, ProjectExplorer::Abi::ElfFormat, 32)); @@ -136,11 +136,11 @@ QSet MaemoQtVersion::supportedTargetIds() const QSet result; if (!m_isvalidVersion) return result; - if (m_osVersion == MaemoDeviceConfig::Maemo5) { + if (m_osVersion == LinuxDeviceConfiguration::Maemo5) { 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)); - } else if (m_osVersion == MaemoDeviceConfig::Meego) { + } else if (m_osVersion == LinuxDeviceConfiguration::Meego) { result.insert(QLatin1String(Constants::MEEGO_DEVICE_TARGET_ID)); } return result; @@ -148,11 +148,11 @@ QSet MaemoQtVersion::supportedTargetIds() 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"); - else if (m_osVersion == MaemoDeviceConfig::Maemo6) + else if (m_osVersion == LinuxDeviceConfiguration::Maemo6) 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 QString(); } @@ -165,7 +165,7 @@ bool MaemoQtVersion::supportsShadowBuilds() const return true; } -MaemoDeviceConfig::OsVersion MaemoQtVersion::osVersion() const +LinuxDeviceConfiguration::OsVersion MaemoQtVersion::osVersion() const { return m_osVersion; } diff --git a/src/plugins/remotelinux/maemoqtversion.h b/src/plugins/remotelinux/maemoqtversion.h index fc27bf16164..0186ce9be23 100644 --- a/src/plugins/remotelinux/maemoqtversion.h +++ b/src/plugins/remotelinux/maemoqtversion.h @@ -32,7 +32,7 @@ #ifndef MAEMOQTVERSION_H #define MAEMOQTVERSION_H -#include "maemodeviceconfigurations.h" +#include "linuxdeviceconfiguration.h" #include namespace RemoteLinux { @@ -59,10 +59,10 @@ public: virtual QString description() const; virtual bool supportsShadowBuilds() const; - MaemoDeviceConfig::OsVersion osVersion() const; + LinuxDeviceConfiguration::OsVersion osVersion() const; private: mutable QString m_systemRoot; - mutable MaemoDeviceConfig::OsVersion m_osVersion; + mutable LinuxDeviceConfiguration::OsVersion m_osVersion; mutable bool m_isvalidVersion; }; diff --git a/src/plugins/remotelinux/maemoremotecopyfacility.cpp b/src/plugins/remotelinux/maemoremotecopyfacility.cpp index 5898b94deba..8e06d20f45f 100644 --- a/src/plugins/remotelinux/maemoremotecopyfacility.cpp +++ b/src/plugins/remotelinux/maemoremotecopyfacility.cpp @@ -51,7 +51,7 @@ MaemoRemoteCopyFacility::MaemoRemoteCopyFacility(QObject *parent) : MaemoRemoteCopyFacility::~MaemoRemoteCopyFacility() {} void MaemoRemoteCopyFacility::copyFiles(const SshConnection::Ptr &connection, - const MaemoDeviceConfig::ConstPtr &devConf, + const LinuxDeviceConfiguration::ConstPtr &devConf, const QList &deployables, const QString &mountPoint) { Q_ASSERT(connection->state() == SshConnection::Connected); diff --git a/src/plugins/remotelinux/maemoremotecopyfacility.h b/src/plugins/remotelinux/maemoremotecopyfacility.h index 484b813d183..4b6bdda2500 100644 --- a/src/plugins/remotelinux/maemoremotecopyfacility.h +++ b/src/plugins/remotelinux/maemoremotecopyfacility.h @@ -46,8 +46,9 @@ class SshRemoteProcessRunner; } namespace RemoteLinux { +class LinuxDeviceConfiguration; + namespace Internal { -class MaemoDeviceConfig; class MaemoRemoteCopyFacility : public QObject { @@ -57,7 +58,7 @@ public: ~MaemoRemoteCopyFacility(); void copyFiles(const QSharedPointer &connection, - const QSharedPointer &devConf, + const QSharedPointer &devConf, const QList &deployables, const QString &mountPoint); void cancel(); @@ -79,7 +80,7 @@ private: void setFinished(); QSharedPointer m_copyRunner; - QSharedPointer m_devConf; + QSharedPointer m_devConf; QList m_deployables; QString m_mountPoint; bool m_isCopying; diff --git a/src/plugins/remotelinux/maemoremotemounter.cpp b/src/plugins/remotelinux/maemoremotemounter.cpp index 8b11b7f975f..0f16a9fa16d 100644 --- a/src/plugins/remotelinux/maemoremotemounter.cpp +++ b/src/plugins/remotelinux/maemoremotemounter.cpp @@ -66,7 +66,7 @@ MaemoRemoteMounter::~MaemoRemoteMounter() } void MaemoRemoteMounter::setConnection(const SshConnection::Ptr &connection, - const MaemoDeviceConfig::ConstPtr &devConf) + const LinuxDeviceConfiguration::ConstPtr &devConf) { ASSERT_STATE(Inactive); m_connection = connection; @@ -97,7 +97,7 @@ bool MaemoRemoteMounter::hasValidMountSpecifications() const return !m_mountSpecs.isEmpty(); } -void MaemoRemoteMounter::mount(MaemoPortList *freePorts, +void MaemoRemoteMounter::mount(PortList *freePorts, const MaemoUsedPortsGatherer *portsGatherer) { ASSERT_STATE(Inactive); diff --git a/src/plugins/remotelinux/maemoremotemounter.h b/src/plugins/remotelinux/maemoremotemounter.h index 25c8e08f675..bb9e33cdc68 100644 --- a/src/plugins/remotelinux/maemoremotemounter.h +++ b/src/plugins/remotelinux/maemoremotemounter.h @@ -33,7 +33,7 @@ #ifndef MAEMOREMOTEMOUNTER_H #define MAEMOREMOTEMOUNTER_H -#include "maemodeviceconfigurations.h" +#include "linuxdeviceconfiguration.h" #include "maemomountspecification.h" #include @@ -53,8 +53,9 @@ class SshRemoteProcess; namespace Qt4ProjectManager { class Qt4BuildConfiguration; } namespace RemoteLinux { +class LinuxDeviceConfiguration; + namespace Internal { -class MaemoDeviceConfig; class MaemoUsedPortsGatherer; class MaemoRemoteMounter : public QObject @@ -66,14 +67,14 @@ public: // Must already be connected. void setConnection(const QSharedPointer &connection, - const QSharedPointer &devConf); + const QSharedPointer &devConf); void setBuildConfiguration(const Qt4ProjectManager::Qt4BuildConfiguration *bc); void addMountSpecification(const MaemoMountSpecification &mountSpec, bool mountAsRoot); bool hasValidMountSpecifications() const; void resetMountSpecifications() { m_mountSpecs.clear(); } - void mount(MaemoPortList *freePorts, + void mount(PortList *freePorts, const MaemoUsedPortsGatherer *portsGatherer); void unmount(); void stop(); @@ -123,7 +124,7 @@ private: }; QSharedPointer m_connection; - QSharedPointer m_devConf; + QSharedPointer m_devConf; QList m_mountSpecs; QSharedPointer m_mountProcess; QSharedPointer m_unmountProcess; @@ -133,7 +134,7 @@ private: QByteArray m_utfsClientStderr; QByteArray m_umountStderr; - MaemoPortList *m_freePorts; + PortList *m_freePorts; const MaemoUsedPortsGatherer *m_portsGatherer; bool m_remoteMountsAllowed; QString m_maddeRoot; diff --git a/src/plugins/remotelinux/maemoremoteprocessesdialog.cpp b/src/plugins/remotelinux/maemoremoteprocessesdialog.cpp index bd104d2674d..809e5105ef5 100644 --- a/src/plugins/remotelinux/maemoremoteprocessesdialog.cpp +++ b/src/plugins/remotelinux/maemoremoteprocessesdialog.cpp @@ -32,7 +32,7 @@ #include "maemoremoteprocessesdialog.h" #include "ui_maemoremoteprocessesdialog.h" -#include "maemodeviceconfigurations.h" +#include "linuxdeviceconfiguration.h" #include "maemoremoteprocesslist.h" #include @@ -41,7 +41,7 @@ namespace RemoteLinux { namespace Internal { -MaemoRemoteProcessesDialog::MaemoRemoteProcessesDialog(const MaemoDeviceConfig::ConstPtr &devConfig, +MaemoRemoteProcessesDialog::MaemoRemoteProcessesDialog(const LinuxDeviceConfiguration::ConstPtr &devConfig, QWidget *parent): QDialog(parent), m_ui(new Ui::MaemoRemoteProcessesDialog), @@ -59,7 +59,7 @@ MaemoRemoteProcessesDialog::MaemoRemoteProcessesDialog(const MaemoDeviceConfig:: // Manually gathered process information is missing the command line for // some system processes. Dont's show these lines by default. - if (devConfig->osVersion() == MaemoDeviceConfig::Maemo5) + if (devConfig->osVersion() == LinuxDeviceConfiguration::Maemo5) m_ui->processFilterLineEdit->setText(QLatin1String("[^ ]+")); connect(m_ui->tableView->selectionModel(), diff --git a/src/plugins/remotelinux/maemoremoteprocessesdialog.h b/src/plugins/remotelinux/maemoremoteprocessesdialog.h index 38e01dfbf63..0042a617534 100644 --- a/src/plugins/remotelinux/maemoremoteprocessesdialog.h +++ b/src/plugins/remotelinux/maemoremoteprocessesdialog.h @@ -43,8 +43,9 @@ class QSortFilterProxyModel; QT_END_NAMESPACE namespace RemoteLinux { +class LinuxDeviceConfiguration; + namespace Internal { -class MaemoDeviceConfig; class MaemoRemoteProcessList; class MaemoRemoteProcessesDialog : public QDialog @@ -52,7 +53,7 @@ class MaemoRemoteProcessesDialog : public QDialog Q_OBJECT public: - explicit MaemoRemoteProcessesDialog(const QSharedPointer &devConfig, + explicit MaemoRemoteProcessesDialog(const QSharedPointer &devConfig, QWidget *parent = 0); ~MaemoRemoteProcessesDialog(); diff --git a/src/plugins/remotelinux/maemoremoteprocesslist.cpp b/src/plugins/remotelinux/maemoremoteprocesslist.cpp index 4160e578600..a2bd0683f12 100644 --- a/src/plugins/remotelinux/maemoremoteprocesslist.cpp +++ b/src/plugins/remotelinux/maemoremoteprocesslist.cpp @@ -31,7 +31,7 @@ #include "maemoremoteprocesslist.h" -#include "maemodeviceconfigurations.h" +#include "linuxdeviceconfiguration.h" #include @@ -47,7 +47,7 @@ const QByteArray LineSeparator2("QTCENDOFLINE---"); const QByteArray LineSeparator = LineSeparator1 + LineSeparator2; } // anonymous namespace -MaemoRemoteProcessList::MaemoRemoteProcessList(const MaemoDeviceConfig::ConstPtr &devConfig, +MaemoRemoteProcessList::MaemoRemoteProcessList(const LinuxDeviceConfiguration::ConstPtr &devConfig, QObject *parent) : QAbstractTableModel(parent), m_process(SshRemoteProcessRunner::create(devConfig->sshParameters())), @@ -70,7 +70,7 @@ void MaemoRemoteProcessList::update() // The ps command on Fremantle ignores all command line options, so // we have to collect the information in /proc manually. - if (m_devConfig->osVersion() == MaemoDeviceConfig::Maemo5) { + if (m_devConfig->osVersion() == LinuxDeviceConfiguration::Maemo5) { command = "sep1=" + LineSeparator1 + '\n' + "sep2=" + LineSeparator2 + '\n' + "pidlist=`ls /proc |grep -E '^[[:digit:]]+$' |sort -n`; " @@ -192,7 +192,7 @@ void MaemoRemoteProcessList::stop() void MaemoRemoteProcessList::buildProcessList() { - const bool isFremantle = m_devConfig->osVersion() == MaemoDeviceConfig::Maemo5; + const bool isFremantle = m_devConfig->osVersion() == LinuxDeviceConfiguration::Maemo5; const QString remoteOutput = QString::fromUtf8(m_remoteStdout); const QByteArray lineSeparator = isFremantle ? LineSeparator : "\n"; QStringList lines = remoteOutput.split(QString::fromUtf8(lineSeparator)); diff --git a/src/plugins/remotelinux/maemoremoteprocesslist.h b/src/plugins/remotelinux/maemoremoteprocesslist.h index 053785ecd5f..4fa9565f000 100644 --- a/src/plugins/remotelinux/maemoremoteprocesslist.h +++ b/src/plugins/remotelinux/maemoremoteprocesslist.h @@ -40,14 +40,15 @@ #include namespace RemoteLinux { +class LinuxDeviceConfiguration; + namespace Internal { -class MaemoDeviceConfig; class MaemoRemoteProcessList : public QAbstractTableModel { Q_OBJECT public: - explicit MaemoRemoteProcessList(const QSharedPointer &devConfig, + explicit MaemoRemoteProcessList(const QSharedPointer &devConfig, QObject *parent = 0); ~MaemoRemoteProcessList(); void update(); @@ -90,7 +91,7 @@ private: QString cmdLine; }; QList m_remoteProcs; - const QSharedPointer m_devConfig; + const QSharedPointer m_devConfig; }; } // namespace Internal diff --git a/src/plugins/remotelinux/maemorunconfigurationwidget.cpp b/src/plugins/remotelinux/maemorunconfigurationwidget.cpp index 76c6210bff1..5ece3807250 100644 --- a/src/plugins/remotelinux/maemorunconfigurationwidget.cpp +++ b/src/plugins/remotelinux/maemorunconfigurationwidget.cpp @@ -35,7 +35,7 @@ #include "maemodeviceenvreader.h" #include "maemoglobal.h" #include "maemoremotemountsmodel.h" -#include "maemorunconfiguration.h" +#include "remotelinuxrunconfiguration.h" #include "maemosettingspages.h" #include "qt4maemodeployconfiguration.h" #include "qt4maemotarget.h" @@ -74,7 +74,7 @@ const QString FetchEnvButtonText } // anonymous namespace MaemoRunConfigurationWidget::MaemoRunConfigurationWidget( - MaemoRunConfiguration *runConfiguration, QWidget *parent) + RemoteLinuxRunConfiguration *runConfiguration, QWidget *parent) : QWidget(parent), m_runConfiguration(runConfiguration), m_ignoreChange(false), @@ -273,7 +273,7 @@ void MaemoRunConfigurationWidget::addEnvironmentWidgets(QVBoxLayout *mainLayout) m_baseEnvironmentComboBox = new QComboBox(this); m_baseEnvironmentComboBox->addItems(QStringList() << tr("Clean Environment") << tr("System Environment")); - m_baseEnvironmentComboBox->setCurrentIndex(m_runConfiguration->baseEnvironmentBase()); + m_baseEnvironmentComboBox->setCurrentIndex(m_runConfiguration->baseEnvironmentType()); baseEnvironmentLayout->addWidget(m_baseEnvironmentComboBox); m_fetchEnv = new QPushButton(FetchEnvButtonText); @@ -444,7 +444,7 @@ void MaemoRunConfigurationWidget::userChangesEdited() void MaemoRunConfigurationWidget::baseEnvironmentSelected(int index) { m_ignoreChange = true; - m_runConfiguration->setBaseEnvironmentBase(MaemoRunConfiguration::BaseEnvironmentBase(index)); + m_runConfiguration->setBaseEnvironmentType(RemoteLinuxRunConfiguration::BaseEnvironmentType(index)); m_environmentWidget->setBaseEnvironment(m_runConfiguration->baseEnvironment()); m_environmentWidget->setBaseEnvironmentText(m_runConfiguration->baseEnvironmentText()); @@ -456,7 +456,7 @@ void MaemoRunConfigurationWidget::baseEnvironmentChanged() if (m_ignoreChange) return; - m_baseEnvironmentComboBox->setCurrentIndex(m_runConfiguration->baseEnvironmentBase()); + m_baseEnvironmentComboBox->setCurrentIndex(m_runConfiguration->baseEnvironmentType()); m_environmentWidget->setBaseEnvironment(m_runConfiguration->baseEnvironment()); m_environmentWidget->setBaseEnvironmentText(m_runConfiguration->baseEnvironmentText()); } @@ -507,7 +507,7 @@ void MaemoRunConfigurationWidget::handleDebuggingTypeChanged() void MaemoRunConfigurationWidget::updateMountWarning() { QString mountWarning; - const MaemoPortList &portList = m_runConfiguration->freePorts(); + const PortList &portList = m_runConfiguration->freePorts(); const int availablePortCount = portList.count(); const int mountDirCount = m_runConfiguration->remoteMounts()->validMountSpecificationCount(); diff --git a/src/plugins/remotelinux/maemorunconfigurationwidget.h b/src/plugins/remotelinux/maemorunconfigurationwidget.h index 059ce204d51..62007060a0b 100644 --- a/src/plugins/remotelinux/maemorunconfigurationwidget.h +++ b/src/plugins/remotelinux/maemorunconfigurationwidget.h @@ -60,15 +60,16 @@ class Qt4BuildConfiguration; } namespace RemoteLinux { +class RemoteLinuxRunConfiguration; + namespace Internal { class MaemoDeviceEnvReader; -class MaemoRunConfiguration; class MaemoRunConfigurationWidget : public QWidget { Q_OBJECT public: - explicit MaemoRunConfigurationWidget(MaemoRunConfiguration *runConfiguration, + explicit MaemoRunConfigurationWidget(RemoteLinuxRunConfiguration *runConfiguration, QWidget *parent = 0); private slots: @@ -116,7 +117,7 @@ private: QToolButton *m_removeMountButton; Utils::DetailsWidget *m_mountDetailsContainer; Utils::DetailsWidget *m_debugDetailsContainer; - MaemoRunConfiguration *m_runConfiguration; + RemoteLinuxRunConfiguration *m_runConfiguration; bool m_ignoreChange; QPushButton *m_fetchEnv; diff --git a/src/plugins/remotelinux/maemoruncontrol.cpp b/src/plugins/remotelinux/maemoruncontrol.cpp index c07eb041962..c469bee9a80 100644 --- a/src/plugins/remotelinux/maemoruncontrol.cpp +++ b/src/plugins/remotelinux/maemoruncontrol.cpp @@ -32,7 +32,7 @@ #include "maemoruncontrol.h" #include "maemoglobal.h" -#include "maemorunconfiguration.h" +#include "remotelinuxrunconfiguration.h" #include "maemosshrunner.h" #include @@ -49,7 +49,7 @@ using ProjectExplorer::RunConfiguration; MaemoRunControl::MaemoRunControl(RunConfiguration *rc) : RunControl(rc, ProjectExplorer::Constants::RUNMODE) - , m_runner(new MaemoSshRunner(this, qobject_cast(rc), false)) + , m_runner(new MaemoSshRunner(this, qobject_cast(rc), false)) , m_running(false) { } diff --git a/src/plugins/remotelinux/maemoruncontrol.h b/src/plugins/remotelinux/maemoruncontrol.h index 774ca2973f0..27e57f66fd5 100644 --- a/src/plugins/remotelinux/maemoruncontrol.h +++ b/src/plugins/remotelinux/maemoruncontrol.h @@ -37,9 +37,10 @@ #include namespace RemoteLinux { +class RemoteLinuxRunConfiguration; + namespace Internal { -class MaemoRunConfiguration; class MaemoSshRunner; class MaemoRunControl : public ProjectExplorer::RunControl diff --git a/src/plugins/remotelinux/maemorunfactories.cpp b/src/plugins/remotelinux/maemorunfactories.cpp index 3de2e2937f5..697aeaace42 100644 --- a/src/plugins/remotelinux/maemorunfactories.cpp +++ b/src/plugins/remotelinux/maemorunfactories.cpp @@ -36,7 +36,7 @@ #include "maemoanalyzersupport.h" #include "maemoglobal.h" #include "maemoremotemountsmodel.h" -#include "maemorunconfiguration.h" +#include "remotelinuxrunconfiguration.h" #include "maemoruncontrol.h" #include "maemotoolchain.h" #include "qt4maemotarget.h" @@ -118,7 +118,7 @@ RunConfiguration *MaemoRunConfigurationFactory::create(Target *parent, { if (!canCreate(parent, id)) return 0; - return new MaemoRunConfiguration(qobject_cast(parent), + return new RemoteLinuxRunConfiguration(qobject_cast(parent), pathFromId(id)); } @@ -127,8 +127,8 @@ RunConfiguration *MaemoRunConfigurationFactory::restore(Target *parent, { if (!canRestore(parent, map)) return 0; - MaemoRunConfiguration *rc - = new MaemoRunConfiguration(qobject_cast(parent), QString()); + RemoteLinuxRunConfiguration *rc + = new RemoteLinuxRunConfiguration(qobject_cast(parent), QString()); if (rc->fromMap(map)) return rc; @@ -142,8 +142,8 @@ RunConfiguration *MaemoRunConfigurationFactory::clone(Target *parent, if (!canClone(parent, source)) return 0; - MaemoRunConfiguration *old = static_cast(source); - return new MaemoRunConfiguration(static_cast(parent), old); + RemoteLinuxRunConfiguration *old = static_cast(source); + return new RemoteLinuxRunConfiguration(static_cast(parent), old); } // #pragma mark -- MaemoRunControlFactory @@ -160,8 +160,8 @@ MaemoRunControlFactory::~MaemoRunControlFactory() bool MaemoRunControlFactory::canRun(RunConfiguration *runConfiguration, const QString &mode) const { - const MaemoRunConfiguration * const maemoRunConfig - = qobject_cast(runConfiguration); + const RemoteLinuxRunConfiguration * const maemoRunConfig + = qobject_cast(runConfiguration); if (!maemoRunConfig || !maemoRunConfig->isEnabled()) return false; return maemoRunConfig->hasEnoughFreePorts(mode); @@ -174,7 +174,7 @@ RunControl* MaemoRunControlFactory::create(RunConfiguration *runConfig, || mode == Debugger::Constants::DEBUGMODE || mode == Analyzer::Constants::MODE_ANALYZE); Q_ASSERT(canRun(runConfig, mode)); - MaemoRunConfiguration *rc = qobject_cast(runConfig); + RemoteLinuxRunConfiguration *rc = qobject_cast(runConfig); Q_ASSERT(rc); if (mode == ProjectExplorer::Constants::RUNMODE) return new MaemoRunControl(rc); diff --git a/src/plugins/remotelinux/maemosettingspages.cpp b/src/plugins/remotelinux/maemosettingspages.cpp index 635e59b762f..b1380ff8ada 100644 --- a/src/plugins/remotelinux/maemosettingspages.cpp +++ b/src/plugins/remotelinux/maemosettingspages.cpp @@ -118,7 +118,7 @@ QString MaemoDeviceConfigurationsSettingsPage::id() const QString MaemoDeviceConfigurationsSettingsPage::displayName() const { - return tr("Maemo Device Configurations"); + return tr("Device Configurations"); } QString MaemoDeviceConfigurationsSettingsPage::category() const @@ -181,7 +181,7 @@ QString MaemoQemuSettingsPage::id() const QString MaemoQemuSettingsPage::displayName() const { - return tr("Qemu Settings"); + return tr("Maemo Qemu Settings"); } QString MaemoQemuSettingsPage::category() const diff --git a/src/plugins/remotelinux/maemosshconfigdialog.cpp b/src/plugins/remotelinux/maemosshconfigdialog.cpp index ce2b6deff13..6b21fb6d701 100644 --- a/src/plugins/remotelinux/maemosshconfigdialog.cpp +++ b/src/plugins/remotelinux/maemosshconfigdialog.cpp @@ -31,7 +31,7 @@ #include "maemosshconfigdialog.h" -#include "maemodeviceconfigurations.h" +#include "linuxdeviceconfiguration.h" #include #include diff --git a/src/plugins/remotelinux/maemosshrunner.cpp b/src/plugins/remotelinux/maemosshrunner.cpp index 7d47d6268b5..c2aa0a0810c 100644 --- a/src/plugins/remotelinux/maemosshrunner.cpp +++ b/src/plugins/remotelinux/maemosshrunner.cpp @@ -35,7 +35,7 @@ #include "maemoqemumanager.h" #include "maemoremotemounter.h" #include "maemoremotemountsmodel.h" -#include "maemorunconfiguration.h" +#include "remotelinuxrunconfiguration.h" #include "maemousedportsgatherer.h" #include @@ -55,7 +55,7 @@ namespace RemoteLinux { namespace Internal { MaemoSshRunner::MaemoSshRunner(QObject *parent, - MaemoRunConfiguration *runConfig, bool debugging) + RemoteLinuxRunConfiguration *runConfig, bool debugging) : QObject(parent), m_mounter(new MaemoRemoteMounter(this)), m_portsGatherer(new MaemoUsedPortsGatherer(this)), @@ -103,7 +103,7 @@ void MaemoSshRunner::start() return; } - if (m_devConfig->type() == MaemoDeviceConfig::Emulator + if (m_devConfig->type() == LinuxDeviceConfiguration::Emulator && !MaemoQemuManager::instance().qemuIsRunning()) { MaemoQemuManager::instance().startRuntime(); emitError(tr("Cannot run: Qemu was not running. " diff --git a/src/plugins/remotelinux/maemosshrunner.h b/src/plugins/remotelinux/maemosshrunner.h index 8446bc02b0e..687e6073cac 100644 --- a/src/plugins/remotelinux/maemosshrunner.h +++ b/src/plugins/remotelinux/maemosshrunner.h @@ -32,7 +32,7 @@ #ifndef MAEMOSSHRUNNER_H #define MAEMOSSHRUNNER_H -#include "maemodeviceconfigurations.h" +#include "linuxdeviceconfiguration.h" #include "maemomountspecification.h" #include @@ -47,16 +47,17 @@ namespace Utils { } namespace RemoteLinux { +class RemoteLinuxRunConfiguration; + namespace Internal { class MaemoRemoteMounter; -class MaemoRunConfiguration; class MaemoUsedPortsGatherer; class MaemoSshRunner : public QObject { Q_OBJECT public: - MaemoSshRunner(QObject *parent, MaemoRunConfiguration *runConfig, + MaemoSshRunner(QObject *parent, RemoteLinuxRunConfiguration *runConfig, bool debugging); ~MaemoSshRunner(); @@ -67,11 +68,11 @@ public: QSharedPointer connection() const { return m_connection; } const MaemoUsedPortsGatherer *usedPortsGatherer() const { return m_portsGatherer; } - MaemoPortList *freePorts() { return &m_freePorts; } + PortList *freePorts() { return &m_freePorts; } QString remoteExecutable() const { return m_remoteExecutable; } QString arguments() const { return m_appArguments; } QList userEnvChanges() const { return m_userEnvChanges; } - const QSharedPointer devConfig() const { return m_devConfig; } + const QSharedPointer devConfig() const { return m_devConfig; } static const qint64 InvalidExitCode; @@ -112,18 +113,18 @@ private: MaemoRemoteMounter * const m_mounter; MaemoUsedPortsGatherer * const m_portsGatherer; - const QSharedPointer m_devConfig; + const QSharedPointer m_devConfig; const QString m_remoteExecutable; const QString m_appArguments; const QList m_userEnvChanges; - const MaemoPortList m_initialFreePorts; + const PortList m_initialFreePorts; QList m_mountSpecs; QSharedPointer m_connection; QSharedPointer m_runner; QSharedPointer m_cleaner; QStringList m_procsToKill; - MaemoPortList m_freePorts; + PortList m_freePorts; int m_exitStatus; State m_state; diff --git a/src/plugins/remotelinux/maemotoolchain.cpp b/src/plugins/remotelinux/maemotoolchain.cpp index dd6da92fd7e..55d9f58ecfa 100644 --- a/src/plugins/remotelinux/maemotoolchain.cpp +++ b/src/plugins/remotelinux/maemotoolchain.cpp @@ -192,11 +192,11 @@ void MaemoToolChain::setQtVersionId(int id) MaemoQtVersion *version = dynamic_cast(QtSupport::QtVersionManager::instance()->version(id)); Q_ASSERT(version); ProjectExplorer::Abi::OSFlavor flavour = ProjectExplorer::Abi::HarmattanLinuxFlavor; - if (version->osVersion() == MaemoDeviceConfig::Maemo5) + if (version->osVersion() == LinuxDeviceConfiguration::Maemo5) flavour = ProjectExplorer::Abi::MaemoLinuxFlavor; - else if (version->osVersion() == MaemoDeviceConfig::Maemo6) + else if (version->osVersion() == LinuxDeviceConfiguration::Maemo6) flavour = ProjectExplorer::Abi::HarmattanLinuxFlavor; - else if (version->osVersion() == MaemoDeviceConfig::Meego) + else if (version->osVersion() == LinuxDeviceConfiguration::Meego) flavour = ProjectExplorer::Abi::MeegoLinuxFlavor; else return; diff --git a/src/plugins/remotelinux/maemousedportsgatherer.cpp b/src/plugins/remotelinux/maemousedportsgatherer.cpp index 3043b4bbd47..074693ed367 100644 --- a/src/plugins/remotelinux/maemousedportsgatherer.cpp +++ b/src/plugins/remotelinux/maemousedportsgatherer.cpp @@ -48,7 +48,7 @@ MaemoUsedPortsGatherer::MaemoUsedPortsGatherer(QObject *parent) : MaemoUsedPortsGatherer::~MaemoUsedPortsGatherer() {} void MaemoUsedPortsGatherer::start(const Utils::SshConnection::Ptr &connection, - const MaemoDeviceConfig::ConstPtr &devConf) + const LinuxDeviceConfiguration::ConstPtr &devConf) { if (m_running) qWarning("Unexpected call of %s in running state", Q_FUNC_INFO); @@ -82,7 +82,7 @@ void MaemoUsedPortsGatherer::stop() m_procRunner->process()->closeChannel(); } -int MaemoUsedPortsGatherer::getNextFreePort(MaemoPortList *freePorts) const +int MaemoUsedPortsGatherer::getNextFreePort(PortList *freePorts) const { while (freePorts->hasMore()) { const int port = freePorts->getNext(); diff --git a/src/plugins/remotelinux/maemousedportsgatherer.h b/src/plugins/remotelinux/maemousedportsgatherer.h index fd856185f5e..6850317cf14 100644 --- a/src/plugins/remotelinux/maemousedportsgatherer.h +++ b/src/plugins/remotelinux/maemousedportsgatherer.h @@ -32,7 +32,7 @@ #ifndef MAEMOUSEDPORTSGATHERER_H #define MAEMOUSEDPORTSGATHERER_H -#include "maemodeviceconfigurations.h" +#include "linuxdeviceconfiguration.h" #include #include @@ -45,8 +45,9 @@ class SshRemoteProcessRunner; } namespace RemoteLinux { +class LinuxDeviceConfiguration; + namespace Internal { -class MaemoDeviceConfig; class MaemoUsedPortsGatherer : public QObject { @@ -55,9 +56,9 @@ public: explicit MaemoUsedPortsGatherer(QObject *parent = 0); ~MaemoUsedPortsGatherer(); void start(const QSharedPointer &connection, - const QSharedPointer &devConf); + const QSharedPointer &devConf); 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 usedPorts() const { return m_usedPorts; } signals: diff --git a/src/plugins/remotelinux/qt4maemotarget.cpp b/src/plugins/remotelinux/qt4maemotarget.cpp index 1074335e203..c630f117fda 100644 --- a/src/plugins/remotelinux/qt4maemotarget.cpp +++ b/src/plugins/remotelinux/qt4maemotarget.cpp @@ -34,7 +34,7 @@ #include "maemoglobal.h" #include "maemopackagecreationstep.h" -#include "maemorunconfiguration.h" +#include "remotelinuxrunconfiguration.h" #include "maemotoolchain.h" #include "qt4maemodeployconfiguration.h" @@ -166,12 +166,12 @@ void AbstractQt4MaemoTarget::createApplicationProFiles() paths << pro->path(); foreach (ProjectExplorer::RunConfiguration *rc, runConfigurations()) - if (MaemoRunConfiguration *qt4rc = qobject_cast(rc)) + if (RemoteLinuxRunConfiguration *qt4rc = qobject_cast(rc)) paths.remove(qt4rc->proFilePath()); // Only add new runconfigurations if there are none. foreach (const QString &path, paths) - addRunConfiguration(new MaemoRunConfiguration(this, path)); + addRunConfiguration(new RemoteLinuxRunConfiguration(this, path)); // Oh still none? Add a custom executable runconfiguration if (runConfigurations().isEmpty()) { @@ -183,7 +183,7 @@ QList AbstractQt4MaemoTarget::runConfigurat { QList result; foreach (ProjectExplorer::RunConfiguration *rc, runConfigurations()) - if (MaemoRunConfiguration *mrc = qobject_cast(rc)) + if (RemoteLinuxRunConfiguration *mrc = qobject_cast(rc)) if (mrc->proFilePath() == n->path()) result << rc; return result; diff --git a/src/plugins/remotelinux/qt4maemotargetfactory.cpp b/src/plugins/remotelinux/qt4maemotargetfactory.cpp index a185f1855cd..969ca8fd33c 100644 --- a/src/plugins/remotelinux/qt4maemotargetfactory.cpp +++ b/src/plugins/remotelinux/qt4maemotargetfactory.cpp @@ -33,7 +33,7 @@ #include "qt4maemotargetfactory.h" #include "maemoglobal.h" #include "maemopackagecreationstep.h" -#include "maemorunconfiguration.h" +#include "remotelinuxrunconfiguration.h" #include "qt4maemodeployconfiguration.h" #include "qt4maemotarget.h" diff --git a/src/plugins/remotelinux/remotelinux.pro b/src/plugins/remotelinux/remotelinux.pro index ee92913df6f..08252c2e318 100644 --- a/src/plugins/remotelinux/remotelinux.pro +++ b/src/plugins/remotelinux/remotelinux.pro @@ -11,8 +11,6 @@ HEADERS += \ remotelinux_export.h \ maemoconfigtestdialog.h \ maemoconstants.h \ - maemodeviceconfigurations.h \ - maemorunconfiguration.h \ maemorunconfigurationwidget.h \ maemoruncontrol.h \ maemorunfactories.h \ @@ -71,13 +69,14 @@ HEADERS += \ maemodirectdeviceuploadstep.h \ abstractlinuxdevicedeploystep.h \ maemoqtversionfactory.h \ - maemoqtversion.h + maemoqtversion.h \ + linuxdeviceconfiguration.h \ + linuxdeviceconfigurations.h \ + remotelinuxrunconfiguration.h SOURCES += \ remotelinuxplugin.cpp \ maemoconfigtestdialog.cpp \ - maemodeviceconfigurations.cpp \ - maemorunconfiguration.cpp \ maemorunconfigurationwidget.cpp \ maemoruncontrol.cpp \ maemorunfactories.cpp \ @@ -134,7 +133,10 @@ SOURCES += \ maemodirectdeviceuploadstep.cpp \ abstractlinuxdevicedeploystep.cpp \ maemoqtversionfactory.cpp \ - maemoqtversion.cpp + maemoqtversion.cpp \ + linuxdeviceconfiguration.cpp \ + linuxdeviceconfigurations.cpp \ + remotelinuxrunconfiguration.cpp FORMS += \ maemoconfigtestdialog.ui \ diff --git a/src/plugins/remotelinux/remotelinuxplugin.cpp b/src/plugins/remotelinux/remotelinuxplugin.cpp index a759ae82579..0ae45eeba0a 100644 --- a/src/plugins/remotelinux/remotelinuxplugin.cpp +++ b/src/plugins/remotelinux/remotelinuxplugin.cpp @@ -35,7 +35,7 @@ #include "maemoconstants.h" #include "maemodeployable.h" #include "maemodeploystepfactory.h" -#include "maemodeviceconfigurations.h" +#include "linuxdeviceconfigurations.h" #include "maemoglobal.h" #include "maemopackagecreationfactory.h" #include "maemopublishingwizardfactories.h" @@ -68,7 +68,7 @@ bool RemoteLinuxPlugin::initialize(const QStringList &arguments, Q_UNUSED(error_message) MaemoQemuManager::instance(this); - MaemoDeviceConfigurations::instance(this); + LinuxDeviceConfigurations::instance(this); addAutoReleasedObject(new MaemoRunControlFactory); addAutoReleasedObject(new MaemoRunConfigurationFactory); diff --git a/src/plugins/remotelinux/maemorunconfiguration.cpp b/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp similarity index 57% rename from src/plugins/remotelinux/maemorunconfiguration.cpp rename to src/plugins/remotelinux/remotelinuxrunconfiguration.cpp index 2a57cf71679..839aa588c8e 100644 --- a/src/plugins/remotelinux/maemorunconfiguration.cpp +++ b/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp @@ -30,7 +30,7 @@ ** **************************************************************************/ -#include "maemorunconfiguration.h" +#include "remotelinuxrunconfiguration.h" #include "abstractlinuxdevicedeploystep.h" #include "maemodeployables.h" @@ -69,44 +69,66 @@ using namespace ProjectExplorer; using namespace Qt4ProjectManager; namespace RemoteLinux { -namespace Internal { namespace { const bool DefaultUseRemoteGdbValue = false; } // 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 userEnvironmentChanges; + bool validParse; + QString disabledReason; +}; +} // namespace Internal + +using namespace Internal; + +RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Qt4BaseTarget *parent, const QString &proFilePath) - : RunConfiguration(parent, QLatin1String(MAEMO_RC_ID)) - , m_proFilePath(proFilePath) - , m_useRemoteGdb(DefaultUseRemoteGdbValue) - , m_baseEnvironmentBase(SystemEnvironmentBase) - , m_validParse(parent->qt4Project()->validParse(m_proFilePath)) + : RunConfiguration(parent, QLatin1String(MAEMO_RC_ID)), + m_d(new RemoteLinuxRunConfigurationPrivate(proFilePath, parent)) { init(); } -MaemoRunConfiguration::MaemoRunConfiguration(Qt4BaseTarget *parent, - MaemoRunConfiguration *source) - : RunConfiguration(parent, source) - , m_proFilePath(source->m_proFilePath) - , 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) +RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Qt4BaseTarget *parent, + RemoteLinuxRunConfiguration *source) + : RunConfiguration(parent, source), + m_d(new RemoteLinuxRunConfigurationPrivate(source->m_d)) { init(); } -void MaemoRunConfiguration::init() +void RemoteLinuxRunConfiguration::init() { setDefaultDisplayName(defaultDisplayName()); setUseCppDebugger(true); setUseQmlDebugger(false); - m_remoteMounts = new MaemoRemoteMountsModel(this); + m_d->remoteMounts = new MaemoRemoteMountsModel(this); connect(target(), SIGNAL(activeDeployConfigurationChanged(ProjectExplorer::DeployConfiguration*)), @@ -120,152 +142,157 @@ void MaemoRunConfiguration::init() this, SLOT(proFileInvalidated(Qt4ProjectManager::Qt4ProFileNode*))); } -MaemoRunConfiguration::~MaemoRunConfiguration() +RemoteLinuxRunConfiguration::~RemoteLinuxRunConfiguration() { } -Qt4BaseTarget *MaemoRunConfiguration::qt4Target() const +Qt4BaseTarget *RemoteLinuxRunConfiguration::qt4Target() const { return static_cast(target()); } -Qt4BuildConfiguration *MaemoRunConfiguration::activeQt4BuildConfiguration() const +Qt4BuildConfiguration *RemoteLinuxRunConfiguration::activeQt4BuildConfiguration() const { return static_cast(activeBuildConfiguration()); } -bool MaemoRunConfiguration::isEnabled() const +bool RemoteLinuxRunConfiguration::isEnabled() const { - if (!m_validParse) { - m_disabledReason = tr("The .pro file could not be parsed/"); + if (!m_d->validParse) { + m_d->disabledReason = tr("The .pro file could not be parsed/"); return false; } if (!deviceConfig()) { - m_disabledReason = tr("No device configuration set."); + m_d->disabledReason = tr("No device configuration set."); return false; } if (!activeQt4BuildConfiguration()) { - m_disabledReason = tr("No active build configuration."); + m_d->disabledReason = tr("No active build configuration."); return false; } if (remoteExecutableFilePath().isEmpty()) { - m_disabledReason = tr("Don't know what to run."); + m_d->disabledReason = tr("Don't know what to run."); return false; } 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; } - m_disabledReason.clear(); + m_d->disabledReason.clear(); 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); } -Utils::OutputFormatter *MaemoRunConfiguration::createOutputFormatter() const +Utils::OutputFormatter *RemoteLinuxRunConfiguration::createOutputFormatter() const { return new QtSupport::QtOutputFormatter(qt4Target()->qt4Project()); } -void MaemoRunConfiguration::handleParseState(bool success) +void RemoteLinuxRunConfiguration::handleParseState(bool success) { bool enabled = isEnabled(); - m_validParse = success; + m_d->validParse = success; if (enabled != isEnabled()) { 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; 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); emit targetInformationChanged(); } } -QVariantMap MaemoRunConfiguration::toMap() const +QVariantMap RemoteLinuxRunConfiguration::toMap() const { QVariantMap map(RunConfiguration::toMap()); - map.insert(ArgumentsKey, m_arguments); + map.insert(ArgumentsKey, m_d->arguments); 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(BaseEnvironmentBaseKey, m_baseEnvironmentBase); + map.insert(BaseEnvironmentBaseKey, m_d->baseEnvironmentType); map.insert(UserEnvironmentChangesKey, - Utils::EnvironmentItem::toStringList(m_userEnvironmentChanges)); - map.unite(m_remoteMounts->toMap()); + Utils::EnvironmentItem::toStringList(m_d->userEnvironmentChanges)); + map.unite(m_d->remoteMounts->toMap()); return map; } -bool MaemoRunConfiguration::fromMap(const QVariantMap &map) +bool RemoteLinuxRunConfiguration::fromMap(const QVariantMap &map) { if (!RunConfiguration::fromMap(map)) return false; - m_arguments = map.value(ArgumentsKey).toString(); + m_d->arguments = map.value(ArgumentsKey).toString(); const QDir dir = QDir(target()->project()->projectDirectory()); - m_proFilePath = dir.filePath(map.value(ProFileKey).toString()); - m_useRemoteGdb = map.value(UseRemoteGdbKey, DefaultUseRemoteGdbValue).toBool(); - m_userEnvironmentChanges = + m_d->proFilePath = dir.filePath(map.value(ProFileKey).toString()); + m_d->useRemoteGdb = map.value(UseRemoteGdbKey, DefaultUseRemoteGdbValue).toBool(); + m_d->userEnvironmentChanges = Utils::EnvironmentItem::fromStringList(map.value(UserEnvironmentChangesKey) .toStringList()); - m_baseEnvironmentBase = static_cast (map.value(BaseEnvironmentBaseKey, - SystemEnvironmentBase).toInt()); - m_remoteMounts->fromMap(map); + m_d->baseEnvironmentType = static_cast (map.value(BaseEnvironmentBaseKey, + SystemBaseEnvironment).toInt()); + m_d->remoteMounts->fromMap(map); - m_validParse = qt4Target()->qt4Project()->validParse(m_proFilePath); + m_d->validParse = qt4Target()->qt4Project()->validParse(m_d->proFilePath); setDefaultDisplayName(defaultDisplayName()); return true; } -QString MaemoRunConfiguration::defaultDisplayName() +QString RemoteLinuxRunConfiguration::defaultDisplayName() { - if (!m_proFilePath.isEmpty()) - return (QFileInfo(m_proFilePath).completeBaseName()) + QLatin1String(" (remote)"); - //: Maemo run configuration default display name + if (!m_d->proFilePath.isEmpty()) + return (QFileInfo(m_d->proFilePath).completeBaseName()) + QLatin1String(" (remote)"); + //: Remote Linux run configuration default display name return tr("Run on remote device"); } -MaemoDeviceConfig::ConstPtr MaemoRunConfiguration::deviceConfig() const +LinuxDeviceConfiguration::ConstPtr RemoteLinuxRunConfiguration::deviceConfig() const { 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()); } -Qt4MaemoDeployConfiguration *MaemoRunConfiguration::deployConfig() const +Qt4MaemoDeployConfiguration *RemoteLinuxRunConfiguration::deployConfig() const { return qobject_cast(target()->activeDeployConfiguration()); } -AbstractLinuxDeviceDeployStep *MaemoRunConfiguration::deployStep() const +MaemoRemoteMountsModel *RemoteLinuxRunConfiguration::remoteMounts() const +{ + return m_d->remoteMounts; +} + +AbstractLinuxDeviceDeployStep *RemoteLinuxRunConfiguration::deployStep() const { return MaemoGlobal::earlierBuildStep(deployConfig(), 0); } -const QString MaemoRunConfiguration::targetRoot() const +QString RemoteLinuxRunConfiguration::targetRoot() const { QTC_ASSERT(activeQt4BuildConfiguration(), return QString()); QtSupport::BaseQtVersion *v = activeQt4BuildConfiguration()->qtVersion(); @@ -274,12 +301,12 @@ const QString MaemoRunConfiguration::targetRoot() const 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 = QDir::fromNativeSeparators(QDir::cleanPath(activeBuildConfiguration() @@ -298,52 +325,57 @@ QString MaemoRunConfiguration::localDirToMountForRemoteGdb() const ? projectDir : projectDir.left(lastSeparatorPos); } -QString MaemoRunConfiguration::remoteProjectSourcesMountPoint() const +QString RemoteLinuxRunConfiguration::remoteProjectSourcesMountPoint() const { return MaemoGlobal::homeDirOnDevice(deviceConfig()->sshParameters().userName) + QLatin1String("/gdbSourcesDir_") + QFileInfo(localExecutableFilePath()).fileName(); } -QString MaemoRunConfiguration::localExecutableFilePath() const +QString RemoteLinuxRunConfiguration::localExecutableFilePath() const { TargetInformation ti = qt4Target()->qt4Project()->rootProjectNode() - ->targetInformation(m_proFilePath); + ->targetInformation(m_d->proFilePath); if (!ti.valid) return QString(); return QDir::cleanPath(ti.workingDir + QLatin1Char('/') + ti.target); } -QString MaemoRunConfiguration::remoteExecutableFilePath() const +QString RemoteLinuxRunConfiguration::remoteExecutableFilePath() const { return deployConfig()->deployables()->remoteExecutableFilePath(localExecutableFilePath()); } -MaemoPortList MaemoRunConfiguration::freePorts() const +PortList RemoteLinuxRunConfiguration::freePorts() const { const Qt4BuildConfiguration * const bc = activeQt4BuildConfiguration(); const AbstractLinuxDeviceDeployStep * const step = deployStep(); return bc && step ? 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; const AbstractQt4MaemoTarget * const maemoTarget = qobject_cast(target()); 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 = qobject_cast(target()); @@ -357,7 +389,7 @@ MaemoRunConfiguration::DebuggingType MaemoRunConfiguration::debuggingType() cons return DebugQmlOnly; } -int MaemoRunConfiguration::portsUsedByDebuggers() const +int RemoteLinuxRunConfiguration::portsUsedByDebuggers() const { switch (debuggingType()) { 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 AbstractQt4MaemoTarget * const maemoTarget @@ -386,12 +418,12 @@ bool MaemoRunConfiguration::hasEnoughFreePorts(const QString &mode) const return false; } -void MaemoRunConfiguration::updateDeviceConfigurations() +void RemoteLinuxRunConfiguration::updateDeviceConfigurations() { emit deviceConfigurationChanged(target()); } -void MaemoRunConfiguration::handleDeployConfigChanged() +void RemoteLinuxRunConfiguration::handleDeployConfigChanged() { DeployConfiguration * const activeDeployConf = target()->activeDeployConfiguration(); @@ -416,72 +448,71 @@ void MaemoRunConfiguration::handleDeployConfigChanged() updateFactoryState(); } -QString MaemoRunConfiguration::baseEnvironmentText() const +QString RemoteLinuxRunConfiguration::baseEnvironmentText() const { - if (m_baseEnvironmentBase == CleanEnvironmentBase) + if (m_d->baseEnvironmentType == CleanBaseEnvironment) return tr("Clean Environment"); - else if (m_baseEnvironmentBase == SystemEnvironmentBase) + else if (m_d->baseEnvironmentType == SystemBaseEnvironment) return tr("System Environment"); 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) { - m_baseEnvironmentBase = env; + if (m_d->baseEnvironmentType != env) { + m_d->baseEnvironmentType = env; emit baseEnvironmentChanged(); } } -Utils::Environment MaemoRunConfiguration::environment() const +Utils::Environment RemoteLinuxRunConfiguration::environment() const { Utils::Environment env = baseEnvironment(); env.modify(userEnvironmentChanges()); 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()); } -QList MaemoRunConfiguration::userEnvironmentChanges() const +QList RemoteLinuxRunConfiguration::userEnvironmentChanges() const { - return m_userEnvironmentChanges; + return m_d->userEnvironmentChanges; } -void MaemoRunConfiguration::setUserEnvironmentChanges( +void RemoteLinuxRunConfiguration::setUserEnvironmentChanges( const QList &diff) { - if (m_userEnvironmentChanges != diff) { - m_userEnvironmentChanges = diff; + if (m_d->userEnvironmentChanges != diff) { + m_d->userEnvironmentChanges = 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) { - m_systemEnvironment = environment; + if (m_d->systemEnvironment.size() == 0 || m_d->systemEnvironment != environment) { + m_d->systemEnvironment = environment; emit systemEnvironmentChanged(); } } -QString MaemoRunConfiguration::proFilePath() const +QString RemoteLinuxRunConfiguration::proFilePath() const { - return m_proFilePath; + return m_d->proFilePath; } -} // namespace Internal } // namespace RemoteLinux diff --git a/src/plugins/remotelinux/maemorunconfiguration.h b/src/plugins/remotelinux/remotelinuxrunconfiguration.h similarity index 73% rename from src/plugins/remotelinux/maemorunconfiguration.h rename to src/plugins/remotelinux/remotelinuxrunconfiguration.h index 545ecbabf48..d0bad258cb0 100644 --- a/src/plugins/remotelinux/maemorunconfiguration.h +++ b/src/plugins/remotelinux/remotelinuxrunconfiguration.h @@ -33,9 +33,10 @@ #ifndef MAEMORUNCONFIGURATION_H #define MAEMORUNCONFIGURATION_H +#include "linuxdeviceconfiguration.h" #include "maemoconstants.h" -#include "maemodeviceconfigurations.h" #include "maemodeployable.h" +#include "remotelinux_export.h" #include @@ -55,30 +56,33 @@ class Qt4ProFileNode; namespace RemoteLinux { namespace Internal { - class AbstractLinuxDeviceDeployStep; class MaemoDeviceConfigListModel; class MaemoRemoteMountsModel; class MaemoRunConfigurationFactory; +class MaemoRunConfigurationWidget; class MaemoToolChain; class Qt4MaemoDeployConfiguration; +class RemoteLinuxRunConfigurationPrivate; +} // namespace Internal -class MaemoRunConfiguration : public ProjectExplorer::RunConfiguration +class REMOTELINUX_EXPORT RemoteLinuxRunConfiguration : public ProjectExplorer::RunConfiguration { Q_OBJECT - friend class MaemoRunConfigurationFactory; + friend class Internal::MaemoRunConfigurationFactory; + friend class Internal::MaemoRunConfigurationWidget; public: - enum BaseEnvironmentBase { - CleanEnvironmentBase = 0, - SystemEnvironmentBase = 1 + enum BaseEnvironmentType { + CleanBaseEnvironment = 0, + SystemBaseEnvironment = 1 }; enum DebuggingType { DebugCppOnly, DebugQmlOnly, DebugCppAndQml }; - MaemoRunConfiguration(Qt4ProjectManager::Qt4BaseTarget *parent, + RemoteLinuxRunConfiguration(Qt4ProjectManager::Qt4BaseTarget *parent, const QString &proFilePath); - virtual ~MaemoRunConfiguration(); + virtual ~RemoteLinuxRunConfiguration(); bool isEnabled() const; QString disabledReason() const; @@ -87,39 +91,31 @@ public: Qt4ProjectManager::Qt4BaseTarget *qt4Target() const; Qt4ProjectManager::Qt4BuildConfiguration *activeQt4BuildConfiguration() const; - Qt4MaemoDeployConfiguration *deployConfig() const; - MaemoRemoteMountsModel *remoteMounts() const { return m_remoteMounts; } + Internal::Qt4MaemoDeployConfiguration *deployConfig() const; + Internal::MaemoRemoteMountsModel *remoteMounts() const; QString localExecutableFilePath() const; QString remoteExecutableFilePath() const; - const QString targetRoot() const; - const QString arguments() const; - void setArguments(const QString &args); - QSharedPointer deviceConfig() const; - MaemoPortList freePorts() const; + QString targetRoot() const; + QString arguments() const; + QSharedPointer deviceConfig() const; + PortList freePorts() const; bool useRemoteGdb() const; - void setUseRemoteGdb(bool useRemoteGdb) { m_useRemoteGdb = useRemoteGdb; } void updateFactoryState() { emit isEnabledChanged(isEnabled()); } DebuggingType debuggingType() const; - const QString gdbCmd() const; + QString gdbCmd() const; QString localDirToMountForRemoteGdb() const; QString remoteProjectSourcesMountPoint() const; virtual QVariantMap toMap() const; QString baseEnvironmentText() const; - BaseEnvironmentBase baseEnvironmentBase() const; - void setBaseEnvironmentBase(BaseEnvironmentBase env); - + BaseEnvironmentType baseEnvironmentType() const; Utils::Environment environment() const; Utils::Environment baseEnvironment() const; - QList userEnvironmentChanges() const; - void setUserEnvironmentChanges(const QList &diff); - Utils::Environment systemEnvironment() const; - void setSystemEnvironment(const Utils::Environment &environment); int portsUsedByDebuggers() const; bool hasEnoughFreePorts(const QString &mode) const; @@ -129,14 +125,13 @@ public: signals: void deviceConfigurationChanged(ProjectExplorer::Target *target); void targetInformationChanged() const; - void baseEnvironmentChanged(); void systemEnvironmentChanged(); void userEnvironmentChangesChanged(const QList &diff); protected: - MaemoRunConfiguration(Qt4ProjectManager::Qt4BaseTarget *parent, - MaemoRunConfiguration *source); + RemoteLinuxRunConfiguration(Qt4ProjectManager::Qt4BaseTarget *parent, + RemoteLinuxRunConfiguration *source); virtual bool fromMap(const QVariantMap &map); QString defaultDisplayName(); @@ -149,22 +144,17 @@ private slots: private: void init(); void handleParseState(bool success); - AbstractLinuxDeviceDeployStep *deployStep() const; + Internal::AbstractLinuxDeviceDeployStep *deployStep() const; - QString m_proFilePath; - mutable QString m_gdbPath; - MaemoRemoteMountsModel *m_remoteMounts; - QString m_arguments; - bool m_useRemoteGdb; + void setArguments(const QString &args); + void setUseRemoteGdb(bool useRemoteGdb); + void setBaseEnvironmentType(BaseEnvironmentType env); + void setUserEnvironmentChanges(const QList &diff); + void setSystemEnvironment(const Utils::Environment &environment); - BaseEnvironmentBase m_baseEnvironmentBase; - Utils::Environment m_systemEnvironment; - QList m_userEnvironmentChanges; - bool m_validParse; - mutable QString m_disabledReason; + Internal::RemoteLinuxRunConfigurationPrivate * const m_d; }; - } // namespace Internal } // namespace RemoteLinux #endif // MAEMORUNCONFIGURATION_H