Restructure ReadSettingsThread::run

This moves the dc_device_close call inside the if case for
dc_device_open, to get rid of the special error case and to look and
behave the same as the other ::run calls.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Anton Lundin 2015-05-27 21:19:09 +02:00 committed by Dirk Hohndel
parent a8c013869b
commit d850a67ce8

View file

@ -1508,18 +1508,16 @@ void ReadSettingsThread::run()
supported = false;
break;
}
} else {
lastError = tr("Could not a establish connection to the dive computer.");
emit error(lastError);
// So we don't trigger the "unsupported" clause later..
supported = true;
}
dc_device_close(m_data->device);
if (!supported) {
lastError = tr("This feature is not yet available for the selected dive computer.");
emit error(lastError);
}
} else {
lastError = tr("Could not a establish connection to the dive computer.");
emit error(lastError);
}
}
WriteSettingsThread::WriteSettingsThread(QObject *parent, device_data_t *data) : DeviceThread(parent, data)