forked from qt-creator/qt-creator
Device Support: Rename "internalId" to "id".
For consistency with what we do elsewhere. Change-Id: I51372b1e8723fd78b412bab06b1d01ad79fc3654 Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
@@ -58,7 +58,7 @@ static IDevice::Ptr findAutoDetectedDevice(const QList<IDevice::Ptr> &deviceList
|
|||||||
{
|
{
|
||||||
const Core::Id id(fingerprint);
|
const Core::Id id(fingerprint);
|
||||||
foreach (const IDevice::Ptr &device, deviceList) {
|
foreach (const IDevice::Ptr &device, deviceList) {
|
||||||
if (device->isAutoDetected() && device->type() == type && device->internalId() == id)
|
if (device->isAutoDetected() && device->type() == type && device->id() == id)
|
||||||
return device;
|
return device;
|
||||||
}
|
}
|
||||||
return IDevice::Ptr();
|
return IDevice::Ptr();
|
||||||
@@ -223,7 +223,7 @@ void DeviceManager::addDevice(const IDevice::Ptr &device)
|
|||||||
{
|
{
|
||||||
QTC_ASSERT(this != instance() || (device->isAutoDetected()), return);
|
QTC_ASSERT(this != instance() || (device->isAutoDetected()), return);
|
||||||
|
|
||||||
const int pos = indexForInternalId(device->internalId());
|
const int pos = indexForId(device->id());
|
||||||
if (pos >= 0)
|
if (pos >= 0)
|
||||||
removeDevice(pos);
|
removeDevice(pos);
|
||||||
|
|
||||||
@@ -238,14 +238,14 @@ void DeviceManager::addDevice(const IDevice::Ptr &device)
|
|||||||
}
|
}
|
||||||
device->setDisplayName(name);
|
device->setDisplayName(name);
|
||||||
if (!defaultDevice(device->type()))
|
if (!defaultDevice(device->type()))
|
||||||
d->defaultDevices.insert(device->type(), device->internalId());
|
d->defaultDevices.insert(device->type(), device->id());
|
||||||
d->devices << device;
|
d->devices << device;
|
||||||
if (this == instance() && d->clonedInstance)
|
if (this == instance() && d->clonedInstance)
|
||||||
d->clonedInstance->addDevice(device->clone());
|
d->clonedInstance->addDevice(device->clone());
|
||||||
if (this == instance()) {
|
if (this == instance()) {
|
||||||
QList<IDevice::Ptr>::Iterator it = d->inactiveAutoDetectedDevices.begin();
|
QList<IDevice::Ptr>::Iterator it = d->inactiveAutoDetectedDevices.begin();
|
||||||
while (it != d->inactiveAutoDetectedDevices.end()) {
|
while (it != d->inactiveAutoDetectedDevices.end()) {
|
||||||
if (it->data()->internalId() == device->internalId()) {
|
if (it->data()->id() == device->id()) {
|
||||||
d->inactiveAutoDetectedDevices.erase(it);
|
d->inactiveAutoDetectedDevices.erase(it);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -255,7 +255,7 @@ void DeviceManager::addDevice(const IDevice::Ptr &device)
|
|||||||
|
|
||||||
emit deviceAdded(device);
|
emit deviceAdded(device);
|
||||||
if (pos >= 0)
|
if (pos >= 0)
|
||||||
emit deviceUpdated(device->internalId());
|
emit deviceUpdated(device->id());
|
||||||
|
|
||||||
emit updated();
|
emit updated();
|
||||||
}
|
}
|
||||||
@@ -266,7 +266,7 @@ void DeviceManager::removeDevice(int idx)
|
|||||||
QTC_ASSERT(device, return);
|
QTC_ASSERT(device, return);
|
||||||
QTC_ASSERT(this != instance() || device->isAutoDetected(), return);
|
QTC_ASSERT(this != instance() || device->isAutoDetected(), return);
|
||||||
|
|
||||||
const bool wasDefault = d->defaultDevices.value(device->type()) == device->internalId();
|
const bool wasDefault = d->defaultDevices.value(device->type()) == device->id();
|
||||||
const QString deviceType = device->type();
|
const QString deviceType = device->type();
|
||||||
d->devices.removeAt(idx);
|
d->devices.removeAt(idx);
|
||||||
emit deviceRemoved(idx);
|
emit deviceRemoved(idx);
|
||||||
@@ -274,7 +274,7 @@ void DeviceManager::removeDevice(int idx)
|
|||||||
if (wasDefault) {
|
if (wasDefault) {
|
||||||
for (int i = 0; i < d->devices.count(); ++i) {
|
for (int i = 0; i < d->devices.count(); ++i) {
|
||||||
if (deviceAt(i)->type() == deviceType) {
|
if (deviceAt(i)->type() == deviceType) {
|
||||||
d->defaultDevices.insert(deviceAt(i)->type(), deviceAt(i)->internalId());
|
d->defaultDevices.insert(deviceAt(i)->type(), deviceAt(i)->id());
|
||||||
emit defaultStatusChanged(i);
|
emit defaultStatusChanged(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -282,7 +282,7 @@ void DeviceManager::removeDevice(int idx)
|
|||||||
}
|
}
|
||||||
if (this == instance() && d->clonedInstance) {
|
if (this == instance() && d->clonedInstance) {
|
||||||
d->clonedInstance->removeDevice(d->clonedInstance->
|
d->clonedInstance->removeDevice(d->clonedInstance->
|
||||||
indexForInternalId(device->internalId()));
|
indexForId(device->id()));
|
||||||
}
|
}
|
||||||
if (this == instance() && device->isAutoDetected())
|
if (this == instance() && device->isAutoDetected())
|
||||||
d->inactiveAutoDetectedDevices << device;
|
d->inactiveAutoDetectedDevices << device;
|
||||||
@@ -308,7 +308,7 @@ void DeviceManager::setDefaultDevice(int idx)
|
|||||||
const IDevice::ConstPtr &oldDefaultDevice = defaultDevice(device->type());
|
const IDevice::ConstPtr &oldDefaultDevice = defaultDevice(device->type());
|
||||||
if (device == oldDefaultDevice)
|
if (device == oldDefaultDevice)
|
||||||
return;
|
return;
|
||||||
d->defaultDevices.insert(device->type(), device->internalId());
|
d->defaultDevices.insert(device->type(), device->id());
|
||||||
emit defaultStatusChanged(idx);
|
emit defaultStatusChanged(idx);
|
||||||
for (int i = 0; i < d->devices.count(); ++i) {
|
for (int i = 0; i < d->devices.count(); ++i) {
|
||||||
if (d->devices.at(i) == oldDefaultDevice) {
|
if (d->devices.at(i) == oldDefaultDevice) {
|
||||||
@@ -365,7 +365,7 @@ bool DeviceManager::hasDevice(const QString &name) const
|
|||||||
|
|
||||||
IDevice::ConstPtr DeviceManager::find(const Core::Id &id) const
|
IDevice::ConstPtr DeviceManager::find(const Core::Id &id) const
|
||||||
{
|
{
|
||||||
const int index = indexForInternalId(id);
|
const int index = indexForId(id);
|
||||||
return index == -1 ? IDevice::ConstPtr() : deviceAt(index);
|
return index == -1 ? IDevice::ConstPtr() : deviceAt(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -383,30 +383,30 @@ IDevice::ConstPtr DeviceManager::defaultDevice(const QString &deviceType) const
|
|||||||
return find(id);
|
return find(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
int DeviceManager::indexForInternalId(const Core::Id &internalId) const
|
int DeviceManager::indexForId(const Core::Id &id) const
|
||||||
{
|
{
|
||||||
for (int i = 0; i < d->devices.count(); ++i) {
|
for (int i = 0; i < d->devices.count(); ++i) {
|
||||||
if (deviceAt(i)->internalId() == internalId)
|
if (deviceAt(i)->id() == id)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::Id DeviceManager::internalId(const IDevice::ConstPtr &device) const
|
Core::Id DeviceManager::deviceId(const IDevice::ConstPtr &device) const
|
||||||
{
|
{
|
||||||
return device ? device->internalId() : IDevice::invalidId();
|
return device ? device->id() : IDevice::invalidId();
|
||||||
}
|
}
|
||||||
|
|
||||||
int DeviceManager::indexOf(const IDevice::ConstPtr &device) const
|
int DeviceManager::indexOf(const IDevice::ConstPtr &device) const
|
||||||
{
|
{
|
||||||
return indexForInternalId(device->internalId());
|
return indexForId(device->id());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceManager::ensureOneDefaultDevicePerType()
|
void DeviceManager::ensureOneDefaultDevicePerType()
|
||||||
{
|
{
|
||||||
foreach (const IDevice::Ptr &device, d->devices) {
|
foreach (const IDevice::Ptr &device, d->devices) {
|
||||||
if (!defaultDevice(device->type()))
|
if (!defaultDevice(device->type()))
|
||||||
d->defaultDevices.insert(device->type(), device->internalId());
|
d->defaultDevices.insert(device->type(), device->id());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public:
|
|||||||
const QString &fingerprint);
|
const QString &fingerprint);
|
||||||
IDevice::ConstPtr defaultDevice(const QString &deviceType) const;
|
IDevice::ConstPtr defaultDevice(const QString &deviceType) const;
|
||||||
bool hasDevice(const QString &name) const;
|
bool hasDevice(const QString &name) const;
|
||||||
Core::Id internalId(const IDevice::ConstPtr &device) const;
|
Core::Id deviceId(const IDevice::ConstPtr &device) const;
|
||||||
|
|
||||||
int indexOf(const IDevice::ConstPtr &device) const;
|
int indexOf(const IDevice::ConstPtr &device) const;
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ private:
|
|||||||
void fromMap(const QVariantMap &map);
|
void fromMap(const QVariantMap &map);
|
||||||
QVariantMap toMap() const;
|
QVariantMap toMap() const;
|
||||||
void ensureOneDefaultDevicePerType();
|
void ensureOneDefaultDevicePerType();
|
||||||
int indexForInternalId(const Core::Id &internalId) const;
|
int indexForId(const Core::Id &id) const;
|
||||||
|
|
||||||
// For SettingsWidget.
|
// For SettingsWidget.
|
||||||
IDevice::Ptr mutableDeviceAt(int index) const;
|
IDevice::Ptr mutableDeviceAt(int index) const;
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ void DeviceSettingsWidget::displayCurrent()
|
|||||||
m_deviceManager->defaultDevice(current->type()) != current);
|
m_deviceManager->defaultDevice(current->type()) != current);
|
||||||
m_ui->osTypeValueLabel->setText(current->displayType());
|
m_ui->osTypeValueLabel->setText(current->displayType());
|
||||||
m_ui->autoDetectionValueLabel->setText(current->isAutoDetected()
|
m_ui->autoDetectionValueLabel->setText(current->isAutoDetected()
|
||||||
? tr("Yes (fingerprint is '%1')").arg(current->internalId().toString()) : tr("No"));
|
? tr("Yes (fingerprint is '%1')").arg(current->id().toString()) : tr("No"));
|
||||||
m_nameValidator->setDisplayName(current->displayName());
|
m_nameValidator->setDisplayName(current->displayName());
|
||||||
m_ui->removeConfigButton->setEnabled(!current->isAutoDetected());
|
m_ui->removeConfigButton->setEnabled(!current->isAutoDetected());
|
||||||
fillInValues();
|
fillInValues();
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ bool IDevice::isAutoDetected() const
|
|||||||
return d->origin == AutoDetected;
|
return d->origin == AutoDetected;
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::Id IDevice::internalId() const
|
Core::Id IDevice::id() const
|
||||||
{
|
{
|
||||||
return d->internalId;
|
return d->internalId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public:
|
|||||||
|
|
||||||
QString type() const;
|
QString type() const;
|
||||||
bool isAutoDetected() const;
|
bool isAutoDetected() const;
|
||||||
Core::Id internalId() const;
|
Core::Id id() const;
|
||||||
|
|
||||||
virtual QString displayType() const = 0;
|
virtual QString displayType() const = 0;
|
||||||
virtual IDeviceWidget *createWidget() = 0;
|
virtual IDeviceWidget *createWidget() = 0;
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ void RemoteLinuxDeployConfiguration::initialize()
|
|||||||
|
|
||||||
void RemoteLinuxDeployConfiguration::handleDeviceConfigurationListUpdated()
|
void RemoteLinuxDeployConfiguration::handleDeviceConfigurationListUpdated()
|
||||||
{
|
{
|
||||||
setDeviceConfig(DeviceManager::instance()->internalId(d->deviceConfiguration));
|
setDeviceConfig(DeviceManager::instance()->deviceId(d->deviceConfiguration));
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteLinuxDeployConfiguration::setDeviceConfig(const Core::Id &internalId)
|
void RemoteLinuxDeployConfiguration::setDeviceConfig(const Core::Id &internalId)
|
||||||
@@ -112,7 +112,7 @@ QVariantMap RemoteLinuxDeployConfiguration::toMap() const
|
|||||||
{
|
{
|
||||||
QVariantMap map = DeployConfiguration::toMap();
|
QVariantMap map = DeployConfiguration::toMap();
|
||||||
map.insert(QLatin1String(DeviceIdKey),
|
map.insert(QLatin1String(DeviceIdKey),
|
||||||
DeviceManager::instance()->internalId(d->deviceConfiguration).toString());
|
DeviceManager::instance()->deviceId(d->deviceConfiguration).toString());
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ void RemoteLinuxDeployConfigurationWidget::handleDeviceConfigurationListChanged(
|
|||||||
{
|
{
|
||||||
const LinuxDeviceConfiguration::ConstPtr &devConf
|
const LinuxDeviceConfiguration::ConstPtr &devConf
|
||||||
= d->deployConfiguration->deviceConfiguration();
|
= d->deployConfiguration->deviceConfiguration();
|
||||||
const Core::Id &internalId = DeviceManager::instance()->internalId(devConf);
|
const Core::Id &internalId = DeviceManager::instance()->deviceId(devConf);
|
||||||
const int newIndex
|
const int newIndex
|
||||||
= d->deployConfiguration->target()->deviceConfigModel()->indexForInternalId(internalId);
|
= d->deployConfiguration->target()->deviceConfigModel()->indexForInternalId(internalId);
|
||||||
d->ui.deviceConfigsComboBox->setCurrentIndex(newIndex);
|
d->ui.deviceConfigsComboBox->setCurrentIndex(newIndex);
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ int TypeSpecificDeviceConfigurationListModel::indexForInternalId(const Core::Id
|
|||||||
{
|
{
|
||||||
const int count = rowCount();
|
const int count = rowCount();
|
||||||
for (int i = 0; i < count; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
if (deviceAt(i)->internalId() == id)
|
if (deviceAt(i)->id() == id)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
Reference in New Issue
Block a user