mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
d63a3ce420
commit
74f27a0a39
7 changed files with 97 additions and 1 deletions
|
@ -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"));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue