diff options
author | Anton Lundin <glance@acc.umu.se> | 2014-10-18 00:33:47 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-10-18 15:22:22 -0700 |
commit | 74f27a0a399a1f7c63d5542eec744102c301671f (patch) | |
tree | bf56cb41966f9e6de5615fbb516e7c3e2aba2821 /configuredivecomputer.cpp | |
parent | d63a3ce420fcaa6a4b576a840b9d17984f776b2a (diff) | |
download | subsurface-74f27a0a399a1f7c63d5542eec744102c301671f.tar.gz |
Add support to reset OSTC3 settings to default
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'configuredivecomputer.cpp')
-rw-r--r-- | configuredivecomputer.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/configuredivecomputer.cpp b/configuredivecomputer.cpp index efda2729a..1b2b9e80b 100644 --- a/configuredivecomputer.cpp +++ b/configuredivecomputer.cpp @@ -12,7 +12,8 @@ ConfigureDiveComputer::ConfigureDiveComputer(QObject *parent) : QObject(parent), readThread(0), - writeThread(0) + writeThread(0), + resetThread(0) { setState(INITIAL); } @@ -514,6 +515,21 @@ void ConfigureDiveComputer::startFirmwareUpdate(QString fileName, device_data_t } +void ConfigureDiveComputer::resetSettings(device_data_t *data) +{ + setState(RESETTING); + + if (resetThread) + resetThread->deleteLater(); + + resetThread = new ResetSettingsThread(this, data); + connect(resetThread, SIGNAL(finished()), + this, SLOT(resetThreadFinished()), Qt::QueuedConnection); + connect(resetThread, SIGNAL(error(QString)), this, SLOT(setError(QString))); + + resetThread->start(); +} + void ConfigureDiveComputer::setState(ConfigureDiveComputer::states newState) { currentState = newState; @@ -540,3 +556,12 @@ void ConfigureDiveComputer::writeThreadFinished() emit message(tr("Setting successfully written to device")); } } + +void ConfigureDiveComputer::resetThreadFinished() +{ + setState(DONE); + if (resetThread->lastError.isEmpty()) { + //No error + emit message(tr("Device settings successfully resetted")); + } +} |