diff options
author | Christian Kandeler <christian.kandeler@nokia.com> | 2011-02-02 10:30:38 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@nokia.com> | 2011-02-02 17:54:22 +0100 |
commit | 77baa801f448cdb6562bae70f3f0b89cfce4aa29 (patch) | |
tree | 6f7bf582ed13c5c672373ea4227f81d1b6fa25ec /src/plugins/qt4projectmanager/qt-maemo | |
parent | b6e729039a2478d2f20e22eb22d7609473190325 (diff) | |
download | qt-creator-77baa801f448cdb6562bae70f3f0b89cfce4aa29.tar.gz |
Maemo: Add OS type to device configuration.
Not used anywhere as of now.
Diffstat (limited to 'src/plugins/qt4projectmanager/qt-maemo')
3 files changed, 41 insertions, 13 deletions
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigurations.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigurations.cpp index c5dde2877e..fb187e1775 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigurations.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigurations.cpp @@ -54,6 +54,7 @@ namespace { 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"); @@ -76,7 +77,6 @@ namespace { const int DefaultGdbServerPortSim(13219); const QString DefaultHostNameHW(QLatin1String("192.168.2.15")); const QString DefaultHostNameSim(QLatin1String("localhost")); - const QString DefaultUserName(QLatin1String("developer")); const AuthType DefaultAuthType(Core::SshConnectionParameters::AuthByKey); const int DefaultTimeout(30); const MaemoDeviceConfig::DeviceType DefaultDeviceType(MaemoDeviceConfig::Physical); @@ -220,9 +220,9 @@ QString MaemoPortList::toString() const MaemoDeviceConfig::Ptr MaemoDeviceConfig::create(const QString &name, - DeviceType type, Id &nextId) + MaemoGlobal::MaemoVersion osVersion, DeviceType type, Id &nextId) { - return Ptr(new MaemoDeviceConfig(name, type, nextId)); + return Ptr(new MaemoDeviceConfig(name, osVersion, type, nextId)); } MaemoDeviceConfig::Ptr MaemoDeviceConfig::create(const QSettings &settings, @@ -236,10 +236,11 @@ MaemoDeviceConfig::Ptr MaemoDeviceConfig::create(const ConstPtr &other) return Ptr(new MaemoDeviceConfig(other)); } -MaemoDeviceConfig::MaemoDeviceConfig(const QString &name, DeviceType devType, - Id &nextId) +MaemoDeviceConfig::MaemoDeviceConfig(const QString &name, + MaemoGlobal::MaemoVersion osVersion, DeviceType devType, Id &nextId) : m_sshParameters(Core::SshConnectionParameters::NoProxy), m_name(name), + m_osVersion(osVersion), m_type(devType), m_portsSpec(defaultPortsSpec(m_type)), m_isDefault(false), @@ -247,7 +248,7 @@ MaemoDeviceConfig::MaemoDeviceConfig(const QString &name, DeviceType devType, { m_sshParameters.host = defaultHost(m_type); m_sshParameters.port = defaultSshPort(m_type); - m_sshParameters.uname = DefaultUserName; + m_sshParameters.uname = defaultUser(m_osVersion); m_sshParameters.authType = DefaultAuthType; m_sshParameters.privateKeyFile = MaemoDeviceConfigurations::instance()->defaultSshKeyFilePath(); @@ -258,6 +259,7 @@ MaemoDeviceConfig::MaemoDeviceConfig(const QSettings &settings, Id &nextId) : m_sshParameters(Core::SshConnectionParameters::NoProxy), m_name(settings.value(NameKey).toString()), + m_osVersion(static_cast<MaemoGlobal::MaemoVersion>(settings.value(OsVersionKey, MaemoGlobal::Maemo5).toInt())), m_type(static_cast<DeviceType>(settings.value(TypeKey, DefaultDeviceType).toInt())), m_portsSpec(settings.value(PortsSpecKey, defaultPortsSpec(m_type)).toString()), m_isDefault(settings.value(IsDefaultKey, false).toBool()), @@ -267,7 +269,7 @@ MaemoDeviceConfig::MaemoDeviceConfig(const QSettings &settings, ++nextId; m_sshParameters.host = settings.value(HostKey, defaultHost(m_type)).toString(); m_sshParameters.port = settings.value(SshPortKey, defaultSshPort(m_type)).toInt(); - m_sshParameters.uname = settings.value(UserNameKey, DefaultUserName).toString(); + m_sshParameters.uname = settings.value(UserNameKey, defaultUser(m_osVersion)).toString(); m_sshParameters.authType = static_cast<AuthType>(settings.value(AuthKey, DefaultAuthType).toInt()); m_sshParameters.pwd = settings.value(PasswordKey).toString(); @@ -279,6 +281,7 @@ MaemoDeviceConfig::MaemoDeviceConfig(const QSettings &settings, 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), @@ -308,6 +311,20 @@ QString MaemoDeviceConfig::defaultHost(DeviceType type) const return type == Physical ? DefaultHostNameHW : DefaultHostNameSim; } +QString MaemoDeviceConfig::defaultUser(MaemoGlobal::MaemoVersion osVersion) const +{ + switch (osVersion) { + case MaemoGlobal::Maemo5: + case MaemoGlobal::Maemo6: + return QLatin1String("developer"); + case MaemoGlobal::Meego: + return QLatin1String("meego"); + default: + Q_ASSERT(false); + return QString(); + } +} + MaemoPortList MaemoDeviceConfig::freePorts() const { return PortsSpecParser(m_portsSpec).parse(); @@ -316,6 +333,7 @@ MaemoPortList MaemoDeviceConfig::freePorts() const 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); @@ -404,7 +422,8 @@ void MaemoDeviceConfigurations::setupShadowDevConf(int idx) const MaemoDeviceConfig::DeviceType shadowType = devConf->type() == MaemoDeviceConfig::Physical ? MaemoDeviceConfig::Simulator : MaemoDeviceConfig::Physical; - shadowConf = MaemoDeviceConfig::create(devConf->name(), shadowType, m_nextId); + shadowConf = MaemoDeviceConfig::create(devConf->name(), + devConf->osVersion(), shadowType, m_nextId); shadowConf->m_sshParameters.authType = devConf->m_sshParameters.authType; shadowConf->m_sshParameters.timeout = devConf->m_sshParameters.timeout; shadowConf->m_sshParameters.pwd = devConf->m_sshParameters.pwd; @@ -416,11 +435,11 @@ void MaemoDeviceConfigurations::setupShadowDevConf(int idx) } void MaemoDeviceConfigurations::addConfiguration(const QString &name, - MaemoDeviceConfig::DeviceType type) + MaemoGlobal::MaemoVersion osVersion, MaemoDeviceConfig::DeviceType type) { beginInsertRows(QModelIndex(), rowCount(), rowCount()); const MaemoDeviceConfig::Ptr devConf - = MaemoDeviceConfig::create(name, type, m_nextId); + = MaemoDeviceConfig::create(name, osVersion, type, m_nextId); if (m_devConfigs.isEmpty()) devConf->m_isDefault = true; m_devConfigs << devConf; diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigurations.h b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigurations.h index fb2cd70190..8a89a9c892 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigurations.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigurations.h @@ -35,6 +35,8 @@ #ifndef MAEMODEVICECONFIGURATIONS_H #define MAEMODEVICECONFIGURATIONS_H +#include "maemoglobal.h" + #include <coreplugin/ssh/sshconnection.h> #include <QtCore/QAbstractListModel> @@ -77,6 +79,7 @@ public: MaemoPortList freePorts() const; Core::SshConnectionParameters sshParameters() const { return m_sshParameters; } QString name() const { return m_name; } + MaemoGlobal::MaemoVersion osVersion() const { return m_osVersion; } DeviceType type() const { return m_type; } QString portsSpec() const { return m_portsSpec; } bool isDefault() const { return m_isDefault; } @@ -87,14 +90,16 @@ public: private: typedef QSharedPointer<MaemoDeviceConfig> Ptr; - MaemoDeviceConfig(const QString &name, DeviceType type, Id &nextId); + MaemoDeviceConfig(const QString &name, MaemoGlobal::MaemoVersion osVersion, + DeviceType type, Id &nextId); MaemoDeviceConfig(const QSettings &settings, Id &nextId); MaemoDeviceConfig(const ConstPtr &other); MaemoDeviceConfig(const MaemoDeviceConfig &); MaemoDeviceConfig &operator=(const MaemoDeviceConfig &); - static Ptr create(const QString &name, DeviceType type, Id &nextId); + static Ptr create(const QString &name, MaemoGlobal::MaemoVersion osVersion, + DeviceType type, Id &nextId); static Ptr create(const QSettings &settings, Id &nextId); static Ptr create(const ConstPtr &other); @@ -102,9 +107,11 @@ private: int defaultSshPort(DeviceType type) const; QString defaultPortsSpec(DeviceType type) const; QString defaultHost(DeviceType type) const; + QString defaultUser(MaemoGlobal::MaemoVersion osVersion) const; Core::SshConnectionParameters m_sshParameters; QString m_name; + MaemoGlobal::MaemoVersion m_osVersion; DeviceType m_type; QString m_portsSpec; bool m_isDefault; @@ -133,6 +140,7 @@ public: QString defaultSshKeyFilePath() const { return m_defaultSshKeyFilePath; } void addConfiguration(const QString &name, + MaemoGlobal::MaemoVersion osVersion, MaemoDeviceConfig::DeviceType type); void removeConfiguration(int index); void setConfigurationName(int i, const QString &name); diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigurationssettingswidget.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigurationssettingswidget.cpp index 5ffc00f13f..912726090d 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigurationssettingswidget.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigurationssettingswidget.cpp @@ -180,7 +180,8 @@ void MaemoDeviceConfigurationsSettingsWidget::addConfig() isUnique = !m_devConfigs->hasConfig(newName); } while (!isUnique); - m_devConfigs->addConfiguration(newName, MaemoDeviceConfig::Physical); + m_devConfigs->addConfiguration(newName, MaemoGlobal::Maemo5, + MaemoDeviceConfig::Physical); m_ui->removeConfigButton->setEnabled(true); m_ui->configurationComboBox->setCurrentIndex(m_ui->configurationComboBox->count()-1); m_ui->configurationComboBox->setFocus(); |