forked from qt-creator/qt-creator
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: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user