From 3e127a059f598a30e9cfd71411783d71f40b315f Mon Sep 17 00:00:00 2001 From: "Joseph W. Joshua" Date: Fri, 30 May 2014 10:49:58 +0300 Subject: 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 Signed-off-by: Thiago Macieira --- qt-ui/configuredivecomputer.h | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'qt-ui/configuredivecomputer.h') diff --git a/qt-ui/configuredivecomputer.h b/qt-ui/configuredivecomputer.h index 8441c0cec..8b1c4b4c7 100644 --- a/qt-ui/configuredivecomputer.h +++ b/qt-ui/configuredivecomputer.h @@ -3,8 +3,9 @@ #include #include +#include #include "libdivecomputer.h" - +#include 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); }; -- cgit v1.2.3-70-g09d2