diff options
Diffstat (limited to 'qt-ui/configuredivecomputer.cpp')
-rw-r--r-- | qt-ui/configuredivecomputer.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/qt-ui/configuredivecomputer.cpp b/qt-ui/configuredivecomputer.cpp index d24c8905d..ad431eefe 100644 --- a/qt-ui/configuredivecomputer.cpp +++ b/qt-ui/configuredivecomputer.cpp @@ -4,31 +4,42 @@ ConfigureDiveComputer::ConfigureDiveComputer(QObject *parent) : QObject(parent), readThread(0), - writeThread(0), - m_deviceDetails(0) + writeThread(0) { setState(INITIAL); } -void ConfigureDiveComputer::readSettings(DeviceDetails *deviceDetails, device_data_t *data) +void ConfigureDiveComputer::readSettings(device_data_t *data) { setState(READING); - m_deviceDetails = deviceDetails; if (readThread) readThread->deleteLater(); - readThread = new ReadSettingsThread(this, deviceDetails, data); + readThread = new ReadSettingsThread(this, data); connect (readThread, SIGNAL(finished()), this, SLOT(readThreadFinished()), Qt::QueuedConnection); connect (readThread, SIGNAL(error(QString)), this, SLOT(setError(QString))); + connect (readThread, SIGNAL(devicedetails(DeviceDetails*)), this, + SIGNAL(deviceDetailsChanged(DeviceDetails*))); readThread->start(); } -void ConfigureDiveComputer::saveDeviceDetails() +void ConfigureDiveComputer::saveDeviceDetails(DeviceDetails *details, device_data_t *data) { + setState(WRITING); + if (writeThread) + writeThread->deleteLater(); + + writeThread = new WriteSettingsThread(this, data); + connect (writeThread, SIGNAL(finished()), + this, SLOT(writeThreadFinished()), Qt::QueuedConnection); + connect (writeThread, SIGNAL(error(QString)), this, SLOT(setError(QString))); + + writeThread->setDeviceDetails(details); + writeThread->start(); } void ConfigureDiveComputer::setState(ConfigureDiveComputer::states newState) |