summaryrefslogtreecommitdiffstats
path: root/qt-ui/configuredivecomputer.h
diff options
context:
space:
mode:
authorGravatar Joseph W. Joshua <joejoshw@gmail.com>2014-05-30 10:49:58 +0300
committerGravatar Thiago Macieira <thiago@macieira.org>2014-08-09 12:01:56 -0300
commit3e127a059f598a30e9cfd71411783d71f40b315f (patch)
tree666f4a3e7de121bf3a74973df1dc29e4ccc84a64 /qt-ui/configuredivecomputer.h
parenta7c9b25b053ee77a816e1555f1c00c3e4b996396 (diff)
downloadsubsurface-3e127a059f598a30e9cfd71411783d71f40b315f.tar.gz
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>
Diffstat (limited to 'qt-ui/configuredivecomputer.h')
-rw-r--r--qt-ui/configuredivecomputer.h26
1 files changed, 23 insertions, 3 deletions
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 <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);
};