mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 23:33:24 +00:00
Remove the lastError from DeviceThreads
There is no reason for the DeviceThreads to keep a copy of the last error around, so this removes that code. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
f7be6daacc
commit
4124052b38
3 changed files with 13 additions and 22 deletions
|
@ -547,7 +547,7 @@ void ConfigureDiveComputer::setError(QString err)
|
||||||
void ConfigureDiveComputer::readThreadFinished()
|
void ConfigureDiveComputer::readThreadFinished()
|
||||||
{
|
{
|
||||||
setState(DONE);
|
setState(DONE);
|
||||||
if (readThread->lastError.isEmpty()) {
|
if (lastError.isEmpty()) {
|
||||||
//No error
|
//No error
|
||||||
emit message(tr("Dive computer details read successfully"));
|
emit message(tr("Dive computer details read successfully"));
|
||||||
}
|
}
|
||||||
|
@ -556,7 +556,7 @@ void ConfigureDiveComputer::readThreadFinished()
|
||||||
void ConfigureDiveComputer::writeThreadFinished()
|
void ConfigureDiveComputer::writeThreadFinished()
|
||||||
{
|
{
|
||||||
setState(DONE);
|
setState(DONE);
|
||||||
if (writeThread->lastError.isEmpty()) {
|
if (lastError.isEmpty()) {
|
||||||
//No error
|
//No error
|
||||||
emit message(tr("Setting successfully written to device"));
|
emit message(tr("Setting successfully written to device"));
|
||||||
}
|
}
|
||||||
|
@ -565,7 +565,7 @@ void ConfigureDiveComputer::writeThreadFinished()
|
||||||
void ConfigureDiveComputer::firmwareThreadFinished()
|
void ConfigureDiveComputer::firmwareThreadFinished()
|
||||||
{
|
{
|
||||||
setState(DONE);
|
setState(DONE);
|
||||||
if (firmwareThread->lastError.isEmpty()) {
|
if (lastError.isEmpty()) {
|
||||||
//No error
|
//No error
|
||||||
emit message(tr("Device firmware successfully updated"));
|
emit message(tr("Device firmware successfully updated"));
|
||||||
}
|
}
|
||||||
|
@ -574,7 +574,7 @@ void ConfigureDiveComputer::firmwareThreadFinished()
|
||||||
void ConfigureDiveComputer::resetThreadFinished()
|
void ConfigureDiveComputer::resetThreadFinished()
|
||||||
{
|
{
|
||||||
setState(DONE);
|
setState(DONE);
|
||||||
if (resetThread->lastError.isEmpty()) {
|
if (lastError.isEmpty()) {
|
||||||
//No error
|
//No error
|
||||||
emit message(tr("Device settings successfully reset"));
|
emit message(tr("Device settings successfully reset"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1511,12 +1511,10 @@ void ReadSettingsThread::run()
|
||||||
dc_device_close(m_data->device);
|
dc_device_close(m_data->device);
|
||||||
|
|
||||||
if (!supported) {
|
if (!supported) {
|
||||||
lastError = tr("This feature is not yet available for the selected dive computer.");
|
emit error(tr("This feature is not yet available for the selected dive computer."));
|
||||||
emit error(lastError);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
lastError = tr("Could not a establish connection to the dive computer.");
|
emit error(tr("Could not a establish connection to the dive computer."));
|
||||||
emit error(lastError);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1573,12 +1571,10 @@ void WriteSettingsThread::run()
|
||||||
dc_device_close(m_data->device);
|
dc_device_close(m_data->device);
|
||||||
|
|
||||||
if (!supported) {
|
if (!supported) {
|
||||||
lastError = tr("This feature is not yet available for the selected dive computer.");
|
emit error(tr("This feature is not yet available for the selected dive computer."));
|
||||||
emit error(lastError);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
lastError = tr("Could not a establish connection to the dive computer.");
|
emit error(tr("Could not a establish connection to the dive computer."));
|
||||||
emit error(lastError);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1618,14 +1614,12 @@ void FirmwareUpdateThread::run()
|
||||||
dc_device_close(m_data->device);
|
dc_device_close(m_data->device);
|
||||||
|
|
||||||
if (!supported) {
|
if (!supported) {
|
||||||
lastError = tr("This feature is not yet available for the selected dive computer.");
|
emit error(tr("This feature is not yet available for the selected dive computer."));
|
||||||
emit error(lastError);
|
|
||||||
} else if (rc != DC_STATUS_SUCCESS) {
|
} else if (rc != DC_STATUS_SUCCESS) {
|
||||||
lastError = tr("Firmware update failed!");
|
emit error(tr("Firmware update failed!"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
lastError = tr("Could not a establish connection to the dive computer.");
|
emit error(tr("Could not a establish connection to the dive computer."));
|
||||||
emit error(lastError);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1650,11 +1644,9 @@ void ResetSettingsThread::run()
|
||||||
dc_device_close(m_data->device);
|
dc_device_close(m_data->device);
|
||||||
|
|
||||||
if (!supported) {
|
if (!supported) {
|
||||||
lastError = tr("This feature is not yet available for the selected dive computer.");
|
emit error(tr("This feature is not yet available for the selected dive computer."));
|
||||||
emit error(lastError);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
lastError = tr("Could not a establish connection to the dive computer.");
|
emit error(tr("Could not a establish connection to the dive computer."));
|
||||||
emit error(lastError);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,6 @@ class DeviceThread : public QThread {
|
||||||
public:
|
public:
|
||||||
DeviceThread(QObject *parent, device_data_t *data);
|
DeviceThread(QObject *parent, device_data_t *data);
|
||||||
virtual void run() = 0;
|
virtual void run() = 0;
|
||||||
QString lastError;
|
|
||||||
signals:
|
signals:
|
||||||
void error(QString err);
|
void error(QString err);
|
||||||
void progress(int value);
|
void progress(int value);
|
||||||
|
|
Loading…
Add table
Reference in a new issue