mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Create class to write settings to dive computer
Adds a class to write settings to dive computer, and modifies the existing ones to integrate it. Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com> Signed-off-by: Thiago Macieira <thiago@macieira.org>
This commit is contained in:
parent
a7c9b25b05
commit
3e127a059f
5 changed files with 156 additions and 9 deletions
|
@ -3,8 +3,9 @@
|
|||
|
||||
#include <QObject>
|
||||
#include <QThread>
|
||||
#include <QVariant>
|
||||
#include "libdivecomputer.h"
|
||||
|
||||
#include <QDateTime>
|
||||
class ReadSettingsThread : public QThread {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -18,6 +19,21 @@ private:
|
|||
device_data_t *data;
|
||||
};
|
||||
|
||||
class WriteSettingsThread : public QThread {
|
||||
Q_OBJECT
|
||||
public:
|
||||
WriteSettingsThread(QObject *parent, device_data_t *data, QString settingName, QVariant settingValue);
|
||||
virtual void run();
|
||||
QString result;
|
||||
QString lastError;
|
||||
signals:
|
||||
void error(QString err);
|
||||
private:
|
||||
device_data_t *data;
|
||||
QString m_settingName;
|
||||
QVariant m_settingValue;
|
||||
};
|
||||
|
||||
class ConfigureDiveComputer : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -37,6 +53,9 @@ public:
|
|||
|
||||
QString lastError;
|
||||
states currentState;
|
||||
|
||||
void setDeviceName(device_data_t *data, QString newName);
|
||||
void setDeviceDateAndTime(device_data_t *data, QDateTime dateAndTime);
|
||||
signals:
|
||||
void deviceSettings(QString settings);
|
||||
void message(QString msg);
|
||||
|
@ -46,12 +65,13 @@ signals:
|
|||
void stateChanged(states newState);
|
||||
private:
|
||||
ReadSettingsThread *readThread;
|
||||
WriteSettingsThread *writeThread;
|
||||
void setState(states newState);
|
||||
|
||||
|
||||
void readHWSettings(device_data_t *data);
|
||||
void writeSettingToDevice(device_data_t *data, QString settingName, QVariant settingValue);
|
||||
private slots:
|
||||
void readThreadFinished();
|
||||
void writeThreadFinished();
|
||||
void setError(QString err);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue