mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Polish up on classes
This patch polishes up on all classes added for dive computer configuration to give a clean workflow. The classes can now write and read data from the OSTC 3. Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com> Signed-off-by: Thiago Macieira <thiago@macieira.org>
This commit is contained in:
parent
4fc16b1674
commit
20eb62a98a
7 changed files with 150 additions and 60 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue