Linux device: s/name()/displayName()/

We use displayName for user visible names everywhere, so we should
also do that here.

Change-Id: I3d976c06fa04733ff82ea208efc0a17f86cc0d79
Reviewed-by: Christian Kandeler <christian.kandeler@nokia.com>
This commit is contained in:
Tobias Hunger
2011-11-16 09:37:29 +00:00
parent b671baeffb
commit cad3bb8085
6 changed files with 17 additions and 17 deletions

View File

@@ -74,7 +74,7 @@ public:
} }
SshConnectionParameters sshParameters; SshConnectionParameters sshParameters;
QString name; QString displayName;
QString osType; QString osType;
LinuxDeviceConfiguration::DeviceType deviceType; LinuxDeviceConfiguration::DeviceType deviceType;
PortList freePorts; PortList freePorts;
@@ -115,7 +115,7 @@ LinuxDeviceConfiguration::LinuxDeviceConfiguration(const QString &name, const QS
Origin origin) Origin origin)
: d(new LinuxDeviceConfigurationPrivate(sshParams)) : d(new LinuxDeviceConfigurationPrivate(sshParams))
{ {
d->name = name; d->displayName = name;
d->osType = osType; d->osType = osType;
d->deviceType = deviceType; d->deviceType = deviceType;
d->freePorts = freePorts; d->freePorts = freePorts;
@@ -127,7 +127,7 @@ LinuxDeviceConfiguration::LinuxDeviceConfiguration(const QSettings &settings, Id
: d(new LinuxDeviceConfigurationPrivate(SshConnectionParameters::NoProxy)) : d(new LinuxDeviceConfigurationPrivate(SshConnectionParameters::NoProxy))
{ {
d->origin = ManuallyAdded; d->origin = ManuallyAdded;
d->name = settings.value(NameKey).toString(); d->displayName = settings.value(NameKey).toString();
d->osType = settings.value(OsTypeKey).toString(); d->osType = settings.value(OsTypeKey).toString();
d->deviceType = static_cast<DeviceType>(settings.value(TypeKey, DefaultDeviceType).toInt()); d->deviceType = static_cast<DeviceType>(settings.value(TypeKey, DefaultDeviceType).toInt());
d->isDefault = settings.value(IsDefaultKey, false).toBool(); d->isDefault = settings.value(IsDefaultKey, false).toBool();
@@ -162,7 +162,7 @@ LinuxDeviceConfiguration::LinuxDeviceConfiguration(const QSettings &settings, Id
LinuxDeviceConfiguration::LinuxDeviceConfiguration(const LinuxDeviceConfiguration::ConstPtr &other) LinuxDeviceConfiguration::LinuxDeviceConfiguration(const LinuxDeviceConfiguration::ConstPtr &other)
: d(new LinuxDeviceConfigurationPrivate(other->d->sshParameters)) : d(new LinuxDeviceConfigurationPrivate(other->d->sshParameters))
{ {
d->name = other->d->name; d->displayName = other->d->displayName;
d->osType = other->d->osType; d->osType = other->d->osType;
d->deviceType = other->deviceType(); d->deviceType = other->deviceType();
d->freePorts = other->freePorts(); d->freePorts = other->freePorts();
@@ -184,7 +184,7 @@ QString LinuxDeviceConfiguration::defaultPublicKeyFilePath()
void LinuxDeviceConfiguration::save(QSettings &settings) const void LinuxDeviceConfiguration::save(QSettings &settings) const
{ {
settings.setValue(NameKey, d->name); settings.setValue(NameKey, d->displayName);
settings.setValue(OsTypeKey, d->osType); settings.setValue(OsTypeKey, d->osType);
settings.setValue(TypeKey, d->deviceType); settings.setValue(TypeKey, d->deviceType);
settings.setValue(HostKey, d->sshParameters.host); settings.setValue(HostKey, d->sshParameters.host);
@@ -230,11 +230,11 @@ bool LinuxDeviceConfiguration::isAutoDetected() const
} }
PortList LinuxDeviceConfiguration::freePorts() const { return d->freePorts; } PortList LinuxDeviceConfiguration::freePorts() const { return d->freePorts; }
QString LinuxDeviceConfiguration::name() const { return d->name; } QString LinuxDeviceConfiguration::displayName() const { return d->displayName; }
QString LinuxDeviceConfiguration::osType() const { return d->osType; } QString LinuxDeviceConfiguration::osType() const { return d->osType; }
bool LinuxDeviceConfiguration::isDefault() const { return d->isDefault; } bool LinuxDeviceConfiguration::isDefault() const { return d->isDefault; }
void LinuxDeviceConfiguration::setName(const QString &name) { d->name = name; } void LinuxDeviceConfiguration::setDisplayName(const QString &name) { d->displayName = name; }
void LinuxDeviceConfiguration::setInternalId(Id id) { d->internalId = id; } void LinuxDeviceConfiguration::setInternalId(Id id) { d->internalId = id; }
void LinuxDeviceConfiguration::setDefault(bool isDefault) { d->isDefault = isDefault; } void LinuxDeviceConfiguration::setDefault(bool isDefault) { d->isDefault = isDefault; }

View File

@@ -72,7 +72,7 @@ public:
PortList freePorts() const; PortList freePorts() const;
Utils::SshConnectionParameters sshParameters() const; Utils::SshConnectionParameters sshParameters() const;
QString name() const; QString displayName() const;
QString osType() const; QString osType() const;
DeviceType deviceType() const; DeviceType deviceType() const;
Id internalId() const; Id internalId() const;
@@ -100,7 +100,7 @@ private:
static Ptr create(const QSettings &settings, Id &nextId); static Ptr create(const QSettings &settings, Id &nextId);
static Ptr create(const ConstPtr &other); static Ptr create(const ConstPtr &other);
void setName(const QString &name); void setDisplayName(const QString &name);
void setInternalId(Id id); void setInternalId(Id id);
void setDefault(bool isDefault); void setDefault(bool isDefault);
void setSshParameters(const Utils::SshConnectionParameters &sshParameters); void setSshParameters(const Utils::SshConnectionParameters &sshParameters);

View File

@@ -60,7 +60,7 @@ public:
DevConfNameMatcher(const QString &name) : m_name(name) {} DevConfNameMatcher(const QString &name) : m_name(name) {}
bool operator()(const LinuxDeviceConfiguration::ConstPtr &devConfig) bool operator()(const LinuxDeviceConfiguration::ConstPtr &devConfig)
{ {
return devConfig->name() == m_name; return devConfig->displayName() == m_name;
} }
private: private:
const QString m_name; const QString m_name;
@@ -151,7 +151,7 @@ void LinuxDeviceConfigurations::addConfiguration(const LinuxDeviceConfiguration:
QTC_ASSERT(this != LinuxDeviceConfigurationsPrivate::instance, return); QTC_ASSERT(this != LinuxDeviceConfigurationsPrivate::instance, return);
// Ensure uniqueness of name. // Ensure uniqueness of name.
QString name = devConfig->name(); QString name = devConfig->displayName();
if (hasConfig(name)) { if (hasConfig(name)) {
const QString nameTemplate = name + QLatin1String(" (%1)"); const QString nameTemplate = name + QLatin1String(" (%1)");
int suffix = 2; int suffix = 2;
@@ -159,7 +159,7 @@ void LinuxDeviceConfigurations::addConfiguration(const LinuxDeviceConfiguration:
name = nameTemplate.arg(QString::number(suffix++)); name = nameTemplate.arg(QString::number(suffix++));
while (hasConfig(name)); while (hasConfig(name));
} }
devConfig->setName(name); devConfig->setDisplayName(name);
devConfig->setInternalId(d->nextId++); devConfig->setInternalId(d->nextId++);
beginInsertRows(QModelIndex(), rowCount(), rowCount()); beginInsertRows(QModelIndex(), rowCount(), rowCount());
@@ -374,7 +374,7 @@ QVariant LinuxDeviceConfigurations::data(const QModelIndex &index, int role) con
if (!index.isValid() || index.row() >= rowCount() || role != Qt::DisplayRole) if (!index.isValid() || index.row() >= rowCount() || role != Qt::DisplayRole)
return QVariant(); return QVariant();
const LinuxDeviceConfiguration::ConstPtr devConf = deviceAt(index.row()); const LinuxDeviceConfiguration::ConstPtr devConf = deviceAt(index.row());
QString name = devConf->name(); QString name = devConf->displayName();
if (devConf->isDefault()) { if (devConf->isDefault()) {
name += QLatin1Char(' ') + tr("(default for %1)") name += QLatin1Char(' ') + tr("(default for %1)")
.arg(RemoteLinuxUtils::osTypeToString(devConf->osType())); .arg(RemoteLinuxUtils::osTypeToString(devConf->osType()));

View File

@@ -216,7 +216,7 @@ void LinuxDeviceConfigurationsSettingsWidget::displayCurrent()
m_ui->passwordButton->setChecked(true); m_ui->passwordButton->setChecked(true);
else else
m_ui->keyButton->setChecked(true); m_ui->keyButton->setChecked(true);
m_nameValidator->setDisplayName(current->name()); m_nameValidator->setDisplayName(current->displayName());
m_ui->timeoutSpinBox->setValue(sshParams.timeout); m_ui->timeoutSpinBox->setValue(sshParams.timeout);
m_ui->removeConfigButton->setEnabled(!current->isAutoDetected()); m_ui->removeConfigButton->setEnabled(!current->isAutoDetected());
m_ui->hostLineEdit->setEnabled(!current->isAutoDetected()); m_ui->hostLineEdit->setEnabled(!current->isAutoDetected());
@@ -227,7 +227,7 @@ void LinuxDeviceConfigurationsSettingsWidget::displayCurrent()
void LinuxDeviceConfigurationsSettingsWidget::fillInValues() void LinuxDeviceConfigurationsSettingsWidget::fillInValues()
{ {
const LinuxDeviceConfiguration::ConstPtr &current = currentConfig(); const LinuxDeviceConfiguration::ConstPtr &current = currentConfig();
m_ui->nameLineEdit->setText(current->name()); m_ui->nameLineEdit->setText(current->displayName());
const SshConnectionParameters &sshParams = current->sshParameters(); const SshConnectionParameters &sshParams = current->sshParameters();
m_ui->hostLineEdit->setText(sshParams.host); m_ui->hostLineEdit->setText(sshParams.host);
m_ui->sshPortSpinBox->setValue(sshParams.port); m_ui->sshPortSpinBox->setValue(sshParams.port);

View File

@@ -91,7 +91,7 @@ QString RemoteLinuxUtils::osTypeToString(const QString &osType)
QString RemoteLinuxUtils::deviceConfigurationName(const LinuxDeviceConfiguration::ConstPtr &devConf) QString RemoteLinuxUtils::deviceConfigurationName(const LinuxDeviceConfiguration::ConstPtr &devConf)
{ {
return devConf ? devConf->name() : QCoreApplication::translate("RemoteLinux", "(No device)"); return devConf ? devConf->displayName() : QCoreApplication::translate("RemoteLinux", "(No device)");
} }
} // namespace RemoteLinux } // namespace RemoteLinux

View File

@@ -74,7 +74,7 @@ QVariant TypeSpecificDeviceConfigurationListModel::data(const QModelIndex &index
return QVariant(); return QVariant();
const LinuxDeviceConfiguration::ConstPtr &devConf = deviceAt(index.row()); const LinuxDeviceConfiguration::ConstPtr &devConf = deviceAt(index.row());
Q_ASSERT(devConf); Q_ASSERT(devConf);
QString displayedName = devConf->name(); QString displayedName = devConf->displayName();
if (devConf->isDefault() && devConf->osType() == m_targetOsType) if (devConf->isDefault() && devConf->osType() == m_targetOsType)
displayedName += QLatin1Char(' ') + tr("(default)"); displayedName += QLatin1Char(' ') + tr("(default)");
return displayedName; return displayedName;