Commit 13e0d4e3 authored by Christian Kandeler's avatar Christian Kandeler

Device support: Make DeviceManager::setDefaultDevice take an id.

This was the last DeviceManager function that still took an index, and
like with all others, that lead to a bug due to device filtering.

Task-number: QTCREATORBUG-7812
Change-Id: I4d5fbb7fa7a5b8238d343d231989452e8cf7e821
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent 03398ff8
......@@ -303,12 +303,12 @@ bool DeviceManager::isLoaded() const
return d->writer;
}
void DeviceManager::setDefaultDevice(int idx)
void DeviceManager::setDefaultDevice(Core::Id id)
{
QTC_ASSERT(this != instance(), return);
QTC_ASSERT(idx >= 0 && idx < deviceCount(), return);
const IDevice::ConstPtr &device = d->devices.at(idx);
const IDevice::ConstPtr &device = find(id);
QTC_ASSERT(device, return);
const IDevice::ConstPtr &oldDefaultDevice = defaultDevice(device->type());
if (device == oldDefaultDevice)
return;
......
......@@ -94,7 +94,7 @@ private:
// For SettingsWidget.
IDevice::Ptr mutableDevice(Core::Id id) const;
void setDefaultDevice(int index);
void setDefaultDevice(Core::Id id);
static DeviceManager *cloneInstance();
static void replaceInstance();
static void removeClonedInstance();
......
......@@ -268,7 +268,7 @@ void DeviceSettingsWidget::deviceNameEditingFinished()
void DeviceSettingsWidget::setDefaultDevice()
{
m_deviceManager->setDefaultDevice(currentIndex());
m_deviceManager->setDefaultDevice(currentDevice()->id());
m_ui->defaultDeviceButton->setEnabled(false);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment