[PATCH 3/5] Remove the lastError from DeviceThreads
Anton Lundin
glance at acc.umu.se
Wed May 27 12:19:11 PDT 2015
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 at acc.umu.se>
---
configuredivecomputer.cpp | 8 ++++----
configuredivecomputerthreads.cpp | 26 +++++++++-----------------
configuredivecomputerthreads.h | 1 -
3 files changed, 13 insertions(+), 22 deletions(-)
diff --git a/configuredivecomputer.cpp b/configuredivecomputer.cpp
index 432aec8..742736d 100644
--- a/configuredivecomputer.cpp
+++ b/configuredivecomputer.cpp
@@ -547,7 +547,7 @@ void ConfigureDiveComputer::setError(QString err)
void ConfigureDiveComputer::readThreadFinished()
{
setState(DONE);
- if (readThread->lastError.isEmpty()) {
+ if (lastError.isEmpty()) {
//No error
emit message(tr("Dive computer details read successfully"));
}
@@ -556,7 +556,7 @@ void ConfigureDiveComputer::readThreadFinished()
void ConfigureDiveComputer::writeThreadFinished()
{
setState(DONE);
- if (writeThread->lastError.isEmpty()) {
+ if (lastError.isEmpty()) {
//No error
emit message(tr("Setting successfully written to device"));
}
@@ -565,7 +565,7 @@ void ConfigureDiveComputer::writeThreadFinished()
void ConfigureDiveComputer::firmwareThreadFinished()
{
setState(DONE);
- if (firmwareThread->lastError.isEmpty()) {
+ if (lastError.isEmpty()) {
//No error
emit message(tr("Device firmware successfully updated"));
}
@@ -574,7 +574,7 @@ void ConfigureDiveComputer::firmwareThreadFinished()
void ConfigureDiveComputer::resetThreadFinished()
{
setState(DONE);
- if (resetThread->lastError.isEmpty()) {
+ if (lastError.isEmpty()) {
//No error
emit message(tr("Device settings successfully reset"));
}
diff --git a/configuredivecomputerthreads.cpp b/configuredivecomputerthreads.cpp
index 50cdc68..72915ea 100644
--- a/configuredivecomputerthreads.cpp
+++ b/configuredivecomputerthreads.cpp
@@ -1511,12 +1511,10 @@ void ReadSettingsThread::run()
dc_device_close(m_data->device);
if (!supported) {
- lastError = tr("This feature is not yet available for the selected dive computer.");
- emit error(lastError);
+ emit error(tr("This feature is not yet available for the selected dive computer."));
}
} else {
- lastError = tr("Could not a establish connection to the dive computer.");
- emit error(lastError);
+ emit error(tr("Could not a establish connection to the dive computer."));
}
}
@@ -1573,12 +1571,10 @@ void WriteSettingsThread::run()
dc_device_close(m_data->device);
if (!supported) {
- lastError = tr("This feature is not yet available for the selected dive computer.");
- emit error(lastError);
+ emit error(tr("This feature is not yet available for the selected dive computer."));
}
} else {
- lastError = tr("Could not a establish connection to the dive computer.");
- emit error(lastError);
+ emit error(tr("Could not a establish connection to the dive computer."));
}
}
@@ -1618,14 +1614,12 @@ void FirmwareUpdateThread::run()
dc_device_close(m_data->device);
if (!supported) {
- lastError = tr("This feature is not yet available for the selected dive computer.");
- emit error(lastError);
+ emit error(tr("This feature is not yet available for the selected dive computer."));
} else if (rc != DC_STATUS_SUCCESS) {
- lastError = tr("Firmware update failed!");
+ emit error(tr("Firmware update failed!"));
}
} else {
- lastError = tr("Could not a establish connection to the dive computer.");
- emit error(lastError);
+ emit error(tr("Could not a establish connection to the dive computer."));
}
}
@@ -1650,11 +1644,9 @@ void ResetSettingsThread::run()
dc_device_close(m_data->device);
if (!supported) {
- lastError = tr("This feature is not yet available for the selected dive computer.");
- emit error(lastError);
+ emit error(tr("This feature is not yet available for the selected dive computer."));
}
} else {
- lastError = tr("Could not a establish connection to the dive computer.");
- emit error(lastError);
+ emit error(tr("Could not a establish connection to the dive computer."));
}
}
diff --git a/configuredivecomputerthreads.h b/configuredivecomputerthreads.h
index 7aa9cb2..1d7a36f 100644
--- a/configuredivecomputerthreads.h
+++ b/configuredivecomputerthreads.h
@@ -13,7 +13,6 @@ class DeviceThread : public QThread {
public:
DeviceThread(QObject *parent, device_data_t *data);
virtual void run() = 0;
- QString lastError;
signals:
void error(QString err);
void progress(int value);
--
2.1.4
More information about the subsurface
mailing list