summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-08-18 20:25:06 -0500
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-08-18 20:25:06 -0500
commit150676ce3df0f60bd99204886c3a4e458253c093 (patch)
treed722dafb6487d2dc56e78f8e39965fb1b7bed362
parent48fe5254dc9540f6b9fc13ab17029e6c7b8de975 (diff)
parent7264ec2fa877eeffa99745ac4d7af91b93217aa5 (diff)
downloadsubsurface-150676ce3df0f60bd99204886c3a4e458253c093.tar.gz
Merge branch 'joshua-gsoc' of git://github.com/thiagomacieira/subsurface into josh
Signed-off-by: Dirk Hohndel <dirk@hohndel.org> Conflicts: subsurface.pro
-rw-r--r--configuredivecomputer.cpp434
-rw-r--r--configuredivecomputer.h56
-rw-r--r--configuredivecomputerthreads.cpp544
-rw-r--r--configuredivecomputerthreads.h58
-rw-r--r--devicedetails.cpp487
-rw-r--r--devicedetails.h202
-rw-r--r--icons/ostc3.pngbin0 -> 28943 bytes
-rw-r--r--qt-ui/configuredivecomputerdialog.cpp467
-rw-r--r--qt-ui/configuredivecomputerdialog.h60
-rw-r--r--qt-ui/configuredivecomputerdialog.ui860
-rw-r--r--qt-ui/mainwindow.cpp7
-rw-r--r--qt-ui/mainwindow.h2
-rw-r--r--qt-ui/mainwindow.ui7
-rw-r--r--subsurface.pro15
-rw-r--r--subsurface.qrc3
15 files changed, 3198 insertions, 4 deletions
diff --git a/configuredivecomputer.cpp b/configuredivecomputer.cpp
new file mode 100644
index 000000000..5fe5a4a91
--- /dev/null
+++ b/configuredivecomputer.cpp
@@ -0,0 +1,434 @@
+#include "configuredivecomputer.h"
+#include "libdivecomputer/hw.h"
+#include <QDebug>
+#include <QFile>
+#include <libxml/parser.h>
+#include <libxml/parserInternals.h>
+#include <libxml/tree.h>
+#include <libxslt/transform.h>
+#include <QStringList>
+#include <QXmlStreamWriter>
+
+ConfigureDiveComputer::ConfigureDiveComputer(QObject *parent) :
+ QObject(parent),
+ readThread(0),
+ writeThread(0)
+{
+ setState(INITIAL);
+}
+
+void ConfigureDiveComputer::readSettings(device_data_t *data)
+{
+ setState(READING);
+
+ if (readThread)
+ readThread->deleteLater();
+
+ 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(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();
+}
+
+bool ConfigureDiveComputer::saveXMLBackup(QString fileName, DeviceDetails *details, device_data_t *data)
+{
+ QString xml = "";
+ QString vendor = data->vendor;
+ QString product = data->product;
+ QXmlStreamWriter writer(&xml);
+ writer.setAutoFormatting(true);
+
+ writer.writeStartDocument();
+ writer.writeStartElement("DiveComputerSettingsBackup");
+ writer.writeStartElement("DiveComputer");
+ writer.writeTextElement("Vendor", vendor);
+ writer.writeTextElement("Product", product);
+ writer.writeEndElement();
+ writer.writeStartElement("Settings");
+ writer.writeTextElement("CustomText", details->customText());
+ //Add gasses
+ QString gas1 = QString("%1,%2,%3,%4")
+ .arg(QString::number(details->gas1().oxygen),
+ QString::number(details->gas1().helium),
+ QString::number(details->gas1().type),
+ QString::number(details->gas1().depth)
+ );
+ QString gas2 = QString("%1,%2,%3,%4")
+ .arg(QString::number(details->gas2().oxygen),
+ QString::number(details->gas2().helium),
+ QString::number(details->gas2().type),
+ QString::number(details->gas2().depth)
+ );
+ QString gas3 = QString("%1,%2,%3,%4")
+ .arg(QString::number(details->gas3().oxygen),
+ QString::number(details->gas3().helium),
+ QString::number(details->gas3().type),
+ QString::number(details->gas3().depth)
+ );
+ QString gas4 = QString("%1,%2,%3,%4")
+ .arg(QString::number(details->gas4().oxygen),
+ QString::number(details->gas4().helium),
+ QString::number(details->gas4().type),
+ QString::number(details->gas4().depth)
+ );
+ QString gas5 = QString("%1,%2,%3,%4")
+ .arg(QString::number(details->gas5().oxygen),
+ QString::number(details->gas5().helium),
+ QString::number(details->gas5().type),
+ QString::number(details->gas5().depth)
+ );
+ writer.writeTextElement("Gas1", gas1);
+ writer.writeTextElement("Gas2", gas2);
+ writer.writeTextElement("Gas3", gas3);
+ writer.writeTextElement("Gas4", gas4);
+ writer.writeTextElement("Gas5", gas5);
+ //
+ //Add dil values
+ QString dil1 = QString("%1,%2,%3,%4")
+ .arg(QString::number(details->dil1().oxygen),
+ QString::number(details->dil1().helium),
+ QString::number(details->dil1().type),
+ QString::number(details->dil1().depth)
+ );
+ QString dil2 = QString("%1,%2,%3,%4")
+ .arg(QString::number(details->dil2().oxygen),
+ QString::number(details->dil2().helium),
+ QString::number(details->dil2().type),
+ QString::number(details->dil2().depth)
+ );
+ QString dil3 = QString("%1,%2,%3,%4")
+ .arg(QString::number(details->dil3().oxygen),
+ QString::number(details->dil3().helium),
+ QString::number(details->dil3().type),
+ QString::number(details->dil3().depth)
+ );
+ QString dil4 = QString("%1,%2,%3,%4")
+ .arg(QString::number(details->dil4().oxygen),
+ QString::number(details->dil4().helium),
+ QString::number(details->dil4().type),
+ QString::number(details->dil4().depth)
+ );
+ QString dil5 = QString("%1,%2,%3,%4")
+ .arg(QString::number(details->dil5().oxygen),
+ QString::number(details->dil5().helium),
+ QString::number(details->dil5().type),
+ QString::number(details->dil5().depth)
+ );
+ writer.writeTextElement("Dil1", dil1);
+ writer.writeTextElement("Dil2", dil2);
+ writer.writeTextElement("Dil3", dil3);
+ writer.writeTextElement("Dil4", dil4);
+ writer.writeTextElement("Dil5", dil5);
+ //
+ //Add set point values
+ QString sp1 = QString("%1,%2")
+ .arg(QString::number(details->sp1().sp),
+ QString::number(details->sp1().depth)
+ );
+ QString sp2 = QString("%1,%2")
+ .arg(QString::number(details->sp2().sp),
+ QString::number(details->sp2().depth)
+ );
+ QString sp3 = QString("%1,%2")
+ .arg(QString::number(details->sp3().sp),
+ QString::number(details->sp3().depth)
+ );
+ QString sp4 = QString("%1,%2")
+ .arg(QString::number(details->sp4().sp),
+ QString::number(details->sp4().depth)
+ );
+ QString sp5 = QString("%1,%2")
+ .arg(QString::number(details->sp5().sp),
+ QString::number(details->sp5().depth)
+ );
+ writer.writeTextElement("SetPoint1", sp1);
+ writer.writeTextElement("SetPoint2", sp2);
+ writer.writeTextElement("SetPoint3", sp3);
+ writer.writeTextElement("SetPoint4", sp4);
+ writer.writeTextElement("SetPoint5", sp5);
+
+ //Other Settings
+ writer.writeTextElement("DiveMode", QString::number(details->diveMode()));
+ writer.writeTextElement("Saturation", QString::number(details->saturation()));
+ writer.writeTextElement("Desaturation", QString::number(details->desaturation()));
+ writer.writeTextElement("LastDeco", QString::number(details->lastDeco()));
+ writer.writeTextElement("Brightness", QString::number(details->brightness()));
+ writer.writeTextElement("Units", QString::number(details->units()));
+ writer.writeTextElement("SamplingRate", QString::number(details->samplingRate()));
+ writer.writeTextElement("Salinity", QString::number(details->salinity()));
+ writer.writeTextElement("DiveModeColor", QString::number(details->diveModeColor()));
+ writer.writeTextElement("Language", QString::number(details->language()));
+ writer.writeTextElement("DateFormat", QString::number(details->dateFormat()));
+ writer.writeTextElement("CompassGain", QString::number(details->compassGain()));
+
+ writer.writeEndElement();
+ writer.writeEndElement();
+
+ writer.writeEndDocument();
+ QFile file(fileName);
+ if (!file.open(QIODevice::WriteOnly)) {
+ lastError = tr("Could not save the backup file %1. Error Message: %2")
+ .arg(fileName, file.errorString());
+ return false;
+ }
+ //file open successful. write data and save.
+ QTextStream out(&file);
+ out << xml;
+
+ file.close();
+ return true;
+}
+
+bool ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails *details)
+{
+ QFile file(fileName);
+ if (!file.open(QIODevice::ReadOnly)) {
+ lastError = tr("Could not open backup file: %1").arg(file.errorString());
+ return false;
+ }
+
+ QString xml = file.readAll();
+
+ QXmlStreamReader reader(xml);
+ while (!reader.atEnd()) {
+ if (reader.isStartElement()) {
+ QString settingName = reader.name().toString();
+ reader.readNext();
+ QString keyString = reader.text().toString();
+
+ if (settingName == "CustomText")
+ details->setCustomText(keyString);
+
+ if (settingName == "Gas1") {
+ QStringList gasData = keyString.split(",");
+ gas gas1;
+ gas1.oxygen = gasData.at(0).toInt();
+ gas1.helium = gasData.at(1).toInt();
+ gas1.type = gasData.at(2).toInt();
+ gas1.depth = gasData.at(3).toInt();
+ details->setGas1(gas1);
+ }
+
+ if (settingName == "Gas2") {
+ QStringList gasData = keyString.split(",");
+ gas gas2;
+ gas2.oxygen = gasData.at(0).toInt();
+ gas2.helium = gasData.at(1).toInt();
+ gas2.type = gasData.at(2).toInt();
+ gas2.depth = gasData.at(3).toInt();
+ details->setGas1(gas2);
+ }
+
+ if (settingName == "Gas3") {
+ QStringList gasData = keyString.split(",");
+ gas gas3;
+ gas3.oxygen = gasData.at(0).toInt();
+ gas3.helium = gasData.at(1).toInt();
+ gas3.type = gasData.at(2).toInt();
+ gas3.depth = gasData.at(3).toInt();
+ details->setGas3(gas3);
+ }
+
+ if (settingName == "Gas4") {
+ QStringList gasData = keyString.split(",");
+ gas gas4;
+ gas4.oxygen = gasData.at(0).toInt();
+ gas4.helium = gasData.at(1).toInt();
+ gas4.type = gasData.at(2).toInt();
+ gas4.depth = gasData.at(3).toInt();
+ details->setGas4(gas4);
+ }
+
+ if (settingName == "Gas5") {
+ QStringList gasData = keyString.split(",");
+ gas gas5;
+ gas5.oxygen = gasData.at(0).toInt();
+ gas5.helium = gasData.at(1).toInt();
+ gas5.type = gasData.at(2).toInt();
+ gas5.depth = gasData.at(3).toInt();
+ details->setGas5(gas5);
+ }
+
+ if (settingName == "Dil1") {
+ QStringList dilData = keyString.split(",");
+ gas dil1;
+ dil1.oxygen = dilData.at(0).toInt();
+ dil1.helium = dilData.at(1).toInt();
+ dil1.type = dilData.at(2).toInt();
+ dil1.depth = dilData.at(3).toInt();
+ details->setDil1(dil1);
+ }
+
+ if (settingName == "Dil2") {
+ QStringList dilData = keyString.split(",");
+ gas dil2;
+ dil2.oxygen = dilData.at(0).toInt();
+ dil2.helium = dilData.at(1).toInt();
+ dil2.type = dilData.at(2).toInt();
+ dil2.depth = dilData.at(3).toInt();
+ details->setDil1(dil2);
+ }
+
+ if (settingName == "Dil3") {
+ QStringList dilData = keyString.split(",");
+ gas dil3;
+ dil3.oxygen = dilData.at(0).toInt();
+ dil3.helium = dilData.at(1).toInt();
+ dil3.type = dilData.at(2).toInt();
+ dil3.depth = dilData.at(3).toInt();
+ details->setDil3(dil3);
+ }
+
+ if (settingName == "Dil4") {
+ QStringList dilData = keyString.split(",");
+ gas dil4;
+ dil4.oxygen = dilData.at(0).toInt();
+ dil4.helium = dilData.at(1).toInt();
+ dil4.type = dilData.at(2).toInt();
+ dil4.depth = dilData.at(3).toInt();
+ details->setDil4(dil4);
+ }
+
+ if (settingName == "Dil5") {
+ QStringList dilData = keyString.split(",");
+ gas dil5;
+ dil5.oxygen = dilData.at(0).toInt();
+ dil5.helium = dilData.at(1).toInt();
+ dil5.type = dilData.at(2).toInt();
+ dil5.depth = dilData.at(3).toInt();
+ details->setDil5(dil5);
+ }
+
+ if (settingName == "SetPoint1") {
+ QStringList spData = keyString.split(",");
+ setpoint sp1;
+ sp1.sp = spData.at(0).toInt();
+ sp1.depth = spData.at(1).toInt();
+ details->setSp1(sp1);
+ }
+
+ if (settingName == "SetPoint2") {
+ QStringList spData = keyString.split(",");
+ setpoint sp2;
+ sp2.sp = spData.at(0).toInt();
+ sp2.depth = spData.at(1).toInt();
+ details->setSp2(sp2);
+ }
+
+ if (settingName == "SetPoint3") {
+ QStringList spData = keyString.split(",");
+ setpoint sp3;
+ sp3.sp = spData.at(0).toInt();
+ sp3.depth = spData.at(1).toInt();
+ details->setSp3(sp3);
+ }
+
+ if (settingName == "SetPoint4") {
+ QStringList spData = keyString.split(",");
+ setpoint sp4;
+ sp4.sp = spData.at(0).toInt();
+ sp4.depth = spData.at(1).toInt();
+ details->setSp4(sp4);
+ }
+
+ if (settingName == "SetPoint5") {
+ QStringList spData = keyString.split(",");
+ setpoint sp5;
+ sp5.sp = spData.at(0).toInt();
+ sp5.depth = spData.at(1).toInt();
+ details->setSp5(sp5);
+ }
+
+ if (settingName == "Saturation")
+ details->setSaturation(keyString.toInt());
+
+ if (settingName == "Desaturation")
+ details->setDesaturation(keyString.toInt());
+
+ if (settingName == "DiveMode")
+ details->setDiveMode(keyString.toInt());
+
+ if (settingName == "LastDeco")
+ details->setLastDeco(keyString.toInt());
+
+ if (settingName == "Brightness")
+ details->setBrightness(keyString.toInt());
+
+ if (settingName == "Units")
+ details->setUnits(keyString.toInt());
+
+ if (settingName == "SamplingRate")
+ details->setSamplingRate(keyString.toInt());
+
+ if (settingName == "Salinity")
+ details->setSalinity(keyString.toInt());
+
+ if (settingName == "DiveModeColour")
+ details->setDiveModeColor(keyString.toInt());
+
+ if (settingName == "Language")
+ details->setLanguage(keyString.toInt());
+
+ if (settingName == "DateFormat")
+ details->setDateFormat(keyString.toInt());
+
+ if (settingName == "CompassGain")
+ details->setCompassGain(keyString.toInt());
+ }
+ reader.readNext();
+ }
+
+ return true;
+}
+
+void ConfigureDiveComputer::startFirmwareUpdate(QString fileName, device_data_t *data)
+{
+
+}
+
+void ConfigureDiveComputer::setState(ConfigureDiveComputer::states newState)
+{
+ currentState = newState;
+ emit stateChanged(currentState);
+}
+
+void ConfigureDiveComputer::setError(QString err)
+{
+ lastError = err;
+ emit error(err);
+}
+
+void ConfigureDiveComputer::readThreadFinished()
+{
+ setState(DONE);
+ emit readFinished();
+}
+
+void ConfigureDiveComputer::writeThreadFinished()
+{
+ setState(DONE);
+ if (writeThread->lastError.isEmpty()) {
+ //No error
+ emit message(tr("Setting successfully written to device"));
+ }
+}
diff --git a/configuredivecomputer.h b/configuredivecomputer.h
new file mode 100644
index 000000000..4522e9fbe
--- /dev/null
+++ b/configuredivecomputer.h
@@ -0,0 +1,56 @@
+#ifndef CONFIGUREDIVECOMPUTER_H
+#define CONFIGUREDIVECOMPUTER_H
+
+#include <QObject>
+#include <QThread>
+#include <QVariant>
+#include "libdivecomputer.h"
+#include "configuredivecomputerthreads.h"
+#include <QDateTime>
+
+#include "libxml/xmlreader.h"
+
+class ConfigureDiveComputer : public QObject
+{
+ Q_OBJECT
+public:
+ explicit ConfigureDiveComputer(QObject *parent = 0);
+ void readSettings(device_data_t *data);
+
+ enum states {
+ INITIAL,
+ READING,
+ WRITING,
+ CANCELLING,
+ CANCELLED,
+ ERROR,
+ DONE,
+ };
+
+ QString lastError;
+ states currentState;
+ device_data_t *m_data;
+ void saveDeviceDetails(DeviceDetails *details, device_data_t *data);
+ void fetchDeviceDetails();
+ bool saveXMLBackup(QString fileName, DeviceDetails *details, device_data_t *data);
+ bool restoreXMLBackup(QString fileName, DeviceDetails *details);
+ void startFirmwareUpdate(QString fileName, device_data_t *data);
+signals:
+ void message(QString msg);
+ void error(QString err);
+ void readFinished();
+ void writeFinished();
+ void stateChanged(states newState);
+ void deviceDetailsChanged(DeviceDetails *newDetails);
+
+private:
+ ReadSettingsThread *readThread;
+ WriteSettingsThread *writeThread;
+ void setState(states newState);
+private slots:
+ void readThreadFinished();
+ void writeThreadFinished();
+ void setError(QString err);
+};
+
+#endif // CONFIGUREDIVECOMPUTER_H
diff --git a/configuredivecomputerthreads.cpp b/configuredivecomputerthreads.cpp
new file mode 100644
index 000000000..0e32f5475
--- /dev/null
+++ b/configuredivecomputerthreads.cpp
@@ -0,0 +1,544 @@
+#include "configuredivecomputerthreads.h"
+#include "libdivecomputer/hw.h"
+#include <QDebug>
+#include <QDateTime>
+#include <QStringList>
+
+#define OSTC3_GAS1 0x10
+#define OSTC3_GAS2 0x11
+#define OSTC3_GAS3 0x12
+#define OSTC3_GAS4 0x13
+#define OSTC3_GAS5 0x14
+#define OSTC3_DIL1 0x15
+#define OSTC3_DIL2 0x16
+#define OSTC3_DIL3 0x17
+#define OSTC3_DIL4 0x18
+#define OSTC3_DIL5 0x19
+#define OSTC3_SP1 0x1A
+#define OSTC3_SP2 0x1B
+#define OSTC3_SP3 0x1C
+#define OSTC3_SP4 0x1D
+#define OSTC3_SP5 0x1E
+#define OSTC3_CCR_MODE 0x1F
+#define OSTC3_DIVE_MODE 0x20
+#define OSTC3_DECO_TYPE 0x21
+#define OSTC3_PP02_MAX 0x22
+#define OSTC3_PP02_MIN 0x23
+#define OSTC3_FUTURE_TTS 0x24
+#define OSTC3_GF_LOW 0x25
+#define OSTC3_GF_HIGH 0x26
+#define OSTC3_AGF_LOW 0x27
+#define OSTC3_AGF_HIGH 0x28
+#define OSTC3_AGF_SELECTABLE 0x29
+#define OSTC3_SATURATION 0x2A
+#define OSTC3_DESATURATION 0x2B
+#define OSTC3_LAST_DECO 0x2C
+#define OSTC3_BRIGHTNESS 0x2D
+#define OSTC3_UNITS 0x2E
+#define OSTC3_SAMPLING_RATE 0x2F
+#define OSTC3_SALINITY 0x30
+#define OSTC3_DIVEMODE_COLOR 0x31
+#define OSTC3_LANGUAGE 0x32
+#define OSTC3_DATE_FORMAT 0x33
+#define OSTC3_COMPASS_GAIN 0x34
+#define OSTC3_PRESSURE_SENSOR_OFFSET 0x35
+#define OSTC3_SAFETY_STOP 0x36
+
+ReadSettingsThread::ReadSettingsThread(QObject *parent, device_data_t *data)
+ : QThread(parent), m_data(data)
+{
+
+}
+
+void ReadSettingsThread::run()
+{
+ bool supported = false;
+ dc_status_t rc;
+ rc = rc = dc_device_open(&m_data->device, m_data->context, m_data->descriptor, m_data->devname);
+ if (rc == DC_STATUS_SUCCESS) {
+ DeviceDetails *m_deviceDetails = new DeviceDetails(0);
+ switch (dc_device_get_type(m_data->device)) {
+#if DC_VERSION_CHECK(0, 5, 0)
+ case DC_FAMILY_HW_OSTC3:
+ supported = true;
+ m_deviceDetails->setBrightness(0);
+ m_deviceDetails->setCustomText("");
+ m_deviceDetails->setDateFormat(0);
+ m_deviceDetails->setDiveModeColor(0);
+ m_deviceDetails->setFirmwareVersion("");
+ m_deviceDetails->setLanguage(0);
+ m_deviceDetails->setLastDeco(0);
+ m_deviceDetails->setSerialNo("");
+ m_deviceDetails->setCompassGain(0);
+ m_deviceDetails->setSalinity(0);
+ m_deviceDetails->setSamplingRate(0);
+ m_deviceDetails->setUnits(0);
+
+
+ //Gread gas mixes
+ gas gas1;
+ gas gas2;
+ gas gas3;
+ gas gas4;
+ gas gas5;
+ //Gas 1
+ unsigned char gasData[4] = {0,0,0,0};
+ rc = hw_ostc3_device_config_read(m_data->device, OSTC3_GAS1, gasData, sizeof(gasData));
+ if (rc == DC_STATUS_SUCCESS) {
+ //Gas data read successful
+ gas1.depth = gasData[3];
+ gas1.oxygen = gasData[0];
+ gas1.helium = gasData[1];
+ gas1.type = gasData[2];
+ }
+ //Gas 2
+ rc = hw_ostc3_device_config_read(m_data->device, OSTC3_GAS2, gasData, sizeof(gasData));
+ if (rc == DC_STATUS_SUCCESS) {
+ //Gas data read successful
+ gas2.depth = gasData[3];
+ gas2.oxygen = gasData[0];
+ gas2.helium = gasData[1];
+ gas2.type = gasData[2];
+ }
+ //Gas 3
+ rc = hw_ostc3_device_config_read(m_data->device, OSTC3_GAS3, gasData, sizeof(gasData));
+ if (rc == DC_STATUS_SUCCESS) {
+ //Gas data read successful
+ gas3.depth = gasData[3];
+ gas3.oxygen = gasData[0];
+ gas3.helium = gasData[1];
+ gas3.type = gasData[2];
+ }
+ //Gas 4
+ rc = hw_ostc3_device_config_read(m_data->device, OSTC3_GAS4, gasData, sizeof(gasData));
+ if (rc == DC_STATUS_SUCCESS) {
+ //Gas data read successful
+ gas4.depth = gasData[3];
+ gas4.oxygen = gasData[0];
+ gas4.helium = gasData[1];
+ gas4.type = gasData[2];
+ }
+ //Gas 5
+ rc = hw_ostc3_device_config_read(m_data->device, OSTC3_GAS5, gasData, sizeof(gasData));
+ if (rc == DC_STATUS_SUCCESS) {
+ //Gas data read successful
+ gas5.depth = gasData[3];
+ gas5.oxygen = gasData[0];
+ gas5.helium = gasData[1];
+ gas5.type = gasData[2];
+ }
+
+ m_deviceDetails->setGas1(gas1);
+ m_deviceDetails->setGas2(gas2);
+ m_deviceDetails->setGas3(gas3);
+ m_deviceDetails->setGas4(gas4);
+ m_deviceDetails->setGas5(gas5);
+
+ //Read Dil Values
+ gas dil1;
+ gas dil2;
+ gas dil3;
+ gas dil4;
+ gas dil5;
+ //Dil 1
+ unsigned char dilData[4] = {0,0,0,0};
+ rc = hw_ostc3_device_config_read(m_data->device, OSTC3_DIL1, dilData, sizeof(dilData));
+ if (rc == DC_STATUS_SUCCESS) {
+ //Data read successful
+ dil1.depth = dilData[3];
+ dil1.oxygen = dilData[0];
+ dil1.helium = dilData[1];
+ dil1.type = dilData[2];
+ }
+ //Dil 2
+ rc = hw_ostc3_device_config_read(m_data->device, OSTC3_DIL2, dilData, sizeof(dilData));
+ if (rc == DC_STATUS_SUCCESS) {
+ //Data read successful
+ dil2.depth = dilData[3];
+ dil2.oxygen = dilData[0];
+ dil2.helium = dilData[1];
+ dil2.type = dilData[2];
+ }
+ //Dil 3
+ rc = hw_ostc3_device_config_read(m_data->device, OSTC3_DIL3, dilData, sizeof(dilData));
+ if (rc == DC_STATUS_SUCCESS) {
+ //Data read successful
+ dil3.depth = dilData[3];
+ dil3.oxygen = dilData[0];
+ dil3.helium = dilData[1];
+ dil3.type = dilData[2];
+ }
+ //Dil 4
+ rc = hw_ostc3_device_config_read(m_data->device, OSTC3_DIL4, dilData, sizeof(dilData));
+ if (rc == DC_STATUS_SUCCESS) {
+ //Data read successful
+ dil4.depth = dilData[3];
+ dil4.oxygen = dilData[0];
+ dil4.helium = dilData[1];
+ dil4.type = dilData[2];
+ }
+ //Dil 5
+ rc = hw_ostc3_device_config_read(m_data->device, OSTC3_DIL5, dilData, sizeof(dilData));
+ if (rc == DC_STATUS_SUCCESS) {
+ //Data read successful
+ dil5.depth = dilData[3];
+ dil5.oxygen = dilData[0];
+ dil5.helium = dilData[1];
+ dil5.type = dilData[2];
+ }
+
+ m_deviceDetails->setDil1(dil1);
+ m_deviceDetails->setDil2(dil2);
+ m_deviceDetails->setDil3(dil3);
+ m_deviceDetails->setDil4(dil4);
+ m_deviceDetails->setDil5(dil5);
+
+ //Read set point Values
+ setpoint sp1;
+ setpoint sp2;
+ setpoint sp3;
+ setpoint sp4;
+ setpoint sp5;
+
+ unsigned char spData[2] = {0,0};
+
+ //Sp 1
+ rc = hw_ostc3_device_config_read(m_data->device, OSTC3_SP1, spData, sizeof(spData));
+ if (rc == DC_STATUS_SUCCESS) {
+ //Data read successful
+ sp1.sp = dilData[0];
+ sp1.depth = dilData[1];
+ }
+ //Sp 2
+ rc = hw_ostc3_device_config_read(m_data->device, OSTC3_SP2, spData, sizeof(spData));
+ if (rc == DC_STATUS_SUCCESS) {
+ //Data read successful
+ sp2.sp = dilData[0];
+ sp2.depth = dilData[1];
+ }
+ //Sp 3
+ rc = hw_ostc3_device_config_read(m_data->device, OSTC3_SP3, spData, sizeof(spData));
+ if (rc == DC_STATUS_SUCCESS) {
+ //Data read successful
+ sp3.sp = dilData[0];
+ sp3.depth = dilData[1];
+ }
+ //Sp 4
+ rc = hw_ostc3_device_config_read(m_data->device, OSTC3_SP4, spData, sizeof(spData));
+ if (rc == DC_STATUS_SUCCESS) {
+ //Data read successful
+ sp4.sp = dilData[0];
+ sp4.depth = dilData[1];
+ }
+ //Sp 5
+ rc = hw_ostc3_device_config_read(m_data->device, OSTC3_SP5, spData, sizeof(spData));
+ if (rc == DC_STATUS_SUCCESS) {
+ //Data read successful
+ sp5.sp = dilData[0];
+ sp5.depth = dilData[1];
+ }
+
+
+ //Read other settings
+ unsigned char uData[1] = {0};
+ //DiveMode
+ rc = hw_ostc3_device_config_read(m_data->device, OSTC3_DIVE_MODE, uData, sizeof(uData));
+ if (rc == DC_STATUS_SUCCESS)
+ m_deviceDetails->setDiveMode(uData[0]);
+ //Saturation
+ rc = hw_ostc3_device_config_read(m_data->device, OSTC3_SATURATION, uData, sizeof(uData));
+ if (rc == DC_STATUS_SUCCESS)
+ m_deviceDetails->setSaturation(uData[0]);
+ //LastDeco
+ rc = hw_ostc3_device_config_read(m_data->device, OSTC3_LAST_DECO, uData, sizeof(uData));
+ if (rc == DC_STATUS_SUCCESS)
+ m_deviceDetails->setLastDeco(uData[0]);
+ //Brightness
+ rc = hw_ostc3_device_config_read(m_data->device, OSTC3_BRIGHTNESS, uData, sizeof(uData));
+ if (rc == DC_STATUS_SUCCESS)
+ m_deviceDetails->setBrightness(uData[0]);
+ //Units
+ rc = hw_ostc3_device_config_read(m_data->device, OSTC3_UNITS, uData, sizeof(uData));
+ if (rc == DC_STATUS_SUCCESS)
+ m_deviceDetails->setUnits(uData[0]);
+ //Sampling Rate
+ rc = hw_ostc3_device_config_read(m_data->device, OSTC3_SAMPLING_RATE, uData, sizeof(uData));
+ if (rc == DC_STATUS_SUCCESS)
+ m_deviceDetails->setSamplingRate(uData[0]);
+ //Salinity
+ rc = hw_ostc3_device_config_read(m_data->device, OSTC3_SALINITY, uData, sizeof(uData));
+ if (rc == DC_STATUS_SUCCESS)
+ m_deviceDetails->setSalinity(uData[0]);
+ //Dive mode colour
+ rc = hw_ostc3_device_config_read(m_data->device, OSTC3_DIVEMODE_COLOR, uData, sizeof(uData));
+ if (rc == DC_STATUS_SUCCESS)
+ m_deviceDetails->setDiveModeColor(uData[0]);
+ //Language
+ rc = hw_ostc3_device_config_read(m_data->device, OSTC3_LANGUAGE, uData, sizeof(uData));
+ if (rc == DC_STATUS_SUCCESS)
+ m_deviceDetails->setLanguage(uData[0]);
+ //Date Format
+ rc = hw_ostc3_device_config_read(m_data->device, OSTC3_DATE_FORMAT, uData, sizeof(uData));
+ if (rc == DC_STATUS_SUCCESS)
+ m_deviceDetails->setDateFormat(uData[0]);
+
+
+ //read firmware settings
+ unsigned char fData[64] = {0};
+ rc = hw_ostc3_device_version (m_data->device, fData, sizeof (fData));
+ if (rc == DC_STATUS_SUCCESS) {
+ int serial = fData[0] + (fData[1] << 8);
+ m_deviceDetails->setSerialNo(QString::number(serial));
+ m_deviceDetails->setFirmwareVersion(QString::number(fData[2]) + "." + QString::number(fData[3]));
+ QByteArray ar((char *)fData + 4, 60);
+ m_deviceDetails->setCustomText(ar.trimmed());
+ }
+
+ emit devicedetails(m_deviceDetails);
+ break;
+#endif // divecomputer 0.5.0
+ }
+ dc_device_close(m_data->device);
+
+ if (!supported) {
+ lastError = tr("This feature is not yet available for the selected dive computer.");
+ emit error(lastError);
+ }
+ }
+ else {
+ lastError = tr("Could not a establish connection to the dive computer.");
+ emit error(lastError);
+ }
+}
+
+WriteSettingsThread::WriteSettingsThread(QObject *parent, device_data_t *data)
+ : QThread(parent), m_data(data) {
+
+}
+
+void WriteSettingsThread::setDeviceDetails(DeviceDetails *details)
+{
+ m_deviceDetails = details;
+}
+
+void WriteSettingsThread::run()
+{
+ bool supported = false;
+ dc_status_t rc;
+ rc = rc = dc_device_open(&m_data->device, m_data->context, m_data->descriptor, m_data->devname);
+ if (rc == DC_STATUS_SUCCESS) {
+ switch (dc_device_get_type(m_data->device)) {
+#if DC_VERSION_CHECK(0,5,0)
+ case DC_FAMILY_HW_OSTC3:
+ supported = true;
+ //write gas values
+ unsigned char gas1Data[4] = {m_deviceDetails->gas1().oxygen,
+ m_deviceDetails->gas1().helium,
+ m_deviceDetails->gas1().type,
+ m_deviceDetails->gas1().depth};
+
+ unsigned char gas2Data[4] = {m_deviceDetails->gas2().oxygen,
+ m_deviceDetails->gas2().helium,
+ m_deviceDetails->gas2().type,
+ m_deviceDetails->gas2().depth};
+
+ unsigned char gas3Data[4] = {m_deviceDetails->gas3().oxygen,
+ m_deviceDetails->gas3().helium,
+ m_deviceDetails->gas3().type,
+ m_deviceDetails->gas3().depth};
+
+ unsigned char gas4Data[4] = {m_deviceDetails->gas4().oxygen,
+ m_deviceDetails->gas4().helium,
+ m_deviceDetails->gas4().type,
+ m_deviceDetails->gas4().depth};
+
+ unsigned char gas5Data[4] = {m_deviceDetails->gas5().oxygen,
+ m_deviceDetails->gas5().helium,
+ m_deviceDetails->gas5().type,
+ m_deviceDetails->gas5().depth};
+ //gas 1
+ hw_ostc3_device_config_write(m_data->device, OSTC3_GAS1, gas1Data, sizeof(gas1Data));
+ //gas 2
+ hw_ostc3_device_config_write(m_data->device, OSTC3_GAS2, gas2Data, sizeof(gas2Data));
+ //gas 3
+ hw_ostc3_device_config_write(m_data->device, OSTC3_GAS3, gas3Data, sizeof(gas3Data));
+ //gas 4
+ hw_ostc3_device_config_write(m_data->device, OSTC3_GAS4, gas4Data, sizeof(gas4Data));
+ //gas 5
+ hw_ostc3_device_config_write(m_data->device, OSTC3_GAS5, gas5Data, sizeof(gas5Data));
+
+ //write set point values
+ unsigned char sp1Data[2] = {m_deviceDetails->sp1().sp,
+ m_deviceDetails->sp1().depth};
+
+ unsigned char sp2Data[2] = {m_deviceDetails->sp2().sp,
+ m_deviceDetails->sp2().depth};
+
+ unsigned char sp3Data[2] = {m_deviceDetails->sp3().sp,
+ m_deviceDetails->sp3().depth};
+
+ unsigned char sp4Data[2] = {m_deviceDetails->sp4().sp,
+ m_deviceDetails->sp4().depth};
+
+ unsigned char sp5Data[2] = {m_deviceDetails->sp5().sp,
+ m_deviceDetails->sp5().depth};
+
+ //sp 1
+ hw_ostc3_device_config_write(m_data->device, OSTC3_SP1, sp1Data, sizeof(sp1Data));
+ //sp 2
+ hw_ostc3_device_config_write(m_data->device, OSTC3_SP2, sp2Data, sizeof(sp2Data));
+ //sp 3
+ hw_ostc3_device_config_write(m_data->device, OSTC3_SP3, sp3Data, sizeof(sp3Data));
+ //sp 4
+ hw_ostc3_device_config_write(m_data->device, OSTC3_SP4, sp4Data, sizeof(sp4Data));
+ //sp 5
+ hw_ostc3_device_config_write(m_data->device, OSTC3_SP5, sp5Data, sizeof(sp5Data));
+
+ //write dil values
+ unsigned char dil1Data[4] = {m_deviceDetails->dil1().oxygen,
+ m_deviceDetails->dil1().helium,
+ m_deviceDetails->dil1().type,
+ m_deviceDetails->dil1().depth};
+
+ unsigned char dil2Data[4] = {m_deviceDetails->dil2().oxygen,
+ m_deviceDetails->dil2().helium,
+ m_deviceDetails->dil2().type,
+ m_deviceDetails->dil2().depth};
+
+ unsigned char dil3Data[4] = {m_deviceDetails->dil3().oxygen,
+ m_deviceDetails->dil3().helium,
+ m_deviceDetails->dil3().type,
+ m_deviceDetails->dil3().depth};
+
+ unsigned char dil4Data[4] = {m_deviceDetails->dil4().oxygen,
+ m_deviceDetails->dil4().helium,
+ m_deviceDetails->dil4().type,
+ m_deviceDetails->dil4().depth};
+
+ unsigned char dil5Data[4] = {m_deviceDetails->dil5().oxygen,
+ m_deviceDetails->dil5().helium,
+ m_deviceDetails->dil5().type,
+ m_deviceDetails->dil5().depth};
+ //dil 1
+ hw_ostc3_device_config_write(m_data->device, OSTC3_DIL1, dil1Data, sizeof(gas1Data));
+ //dil 2
+ hw_ostc3_device_config_write(m_data->device, OSTC3_DIL2, dil2Data, sizeof(dil2Data));
+ //dil 3
+ hw_ostc3_device_config_write(m_data->device, OSTC3_DIL3, dil3Data, sizeof(dil3Data));
+ //dil 4
+ hw_ostc3_device_config_write(m_data->device, OSTC3_DIL4, dil4Data, sizeof(dil4Data));
+ //dil 5
+ hw_ostc3_device_config_write(m_data->device, OSTC3_DIL5, dil5Data, sizeof(dil5Data));
+
+
+ //write general settings
+ //custom text
+ hw_ostc3_device_customtext(m_data->device, m_deviceDetails->customText().toUtf8().data());
+ unsigned char data[1] = {0};
+
+ //dive mode
+ data[0] = m_deviceDetails->diveMode();
+ hw_ostc3_device_config_write(m_data->device, OSTC3_DIVE_MODE, data, sizeof(data));
+
+ //saturation
+ data[0] = m_deviceDetails->saturation();
+ hw_ostc3_device_config_write(m_data->device, OSTC3_SATURATION, data, sizeof(data));
+
+ //last deco
+ data[0] = m_deviceDetails->lastDeco();
+ hw_ostc3_device_config_write(m_data->device, OSTC3_LAST_DECO, data, sizeof(data));
+
+ //brightness
+ data[0] = m_deviceDetails->brightness();
+ hw_ostc3_device_config_write(m_data->device, OSTC3_BRIGHTNESS, data, sizeof(data));
+
+ //units
+ data[0] = m_deviceDetails->units();
+ hw_ostc3_device_config_write(m_data->device, OSTC3_UNITS, data, sizeof(data));
+
+ //sampling rate
+ data[0] = m_deviceDetails->samplingRate();
+ hw_ostc3_device_config_write(m_data->device, OSTC3_SAMPLING_RATE, data, sizeof(data));
+
+ //salinity
+ data[0] = m_deviceDetails->salinity();
+ hw_ostc3_device_config_write(m_data->device, OSTC3_SALINITY, data, sizeof(data));
+
+ //dive mode colour
+ data[0] = m_deviceDetails->diveModeColor();
+ hw_ostc3_device_config_write(m_data->device, OSTC3_DIVEMODE_COLOR, data, sizeof(data));
+
+ //language
+ data[0] = m_deviceDetails->language();
+ hw_ostc3_device_config_write(m_data->device, OSTC3_LANGUAGE, data, sizeof(data));
+
+ //date format
+ data[0] = m_deviceDetails->dateFormat();
+ hw_ostc3_device_config_write(m_data->device, OSTC3_DATE_FORMAT, data, sizeof(data));
+
+ //compass gain
+ data[0] = m_deviceDetails->compassGain();
+ hw_ostc3_device_config_write(m_data->device, OSTC3_COMPASS_GAIN, data, sizeof(data));
+
+ //sync date and time
+ if (m_deviceDetails->syncTime()) {
+ QDateTime timeToSet = QDateTime::currentDateTime();
+ dc_datetime_t time;
+ time.year = timeToSet.date().year();
+ time.month = timeToSet.date().month();
+ time.day = timeToSet.date().day();
+ time.hour = timeToSet.time().hour();
+ time.minute = timeToSet.time().minute();
+ time.second = timeToSet.time().second();
+ hw_ostc3_device_clock(m_data->device, &time);
+ }
+
+ break;
+#endif // divecomputer 0.5.0
+ }
+ dc_device_close(m_data->device);
+
+ if (!supported) {
+ lastError = tr("This feature is not yet available for the selected dive computer.");
+ emit error(lastError);
+ }
+ }
+ else {
+ lastError = tr("Could not a establish connection to the dive computer.");
+ emit error(lastError);
+ }
+}
+
+
+FirmwareUpdateThread::FirmwareUpdateThread(QObject *parent, device_data_t *data, QString fileName)
+: QThread(parent), m_data(data), m_fileName(fileName)
+{
+
+}
+
+void FirmwareUpdateThread::run()
+{
+ bool supported = false;
+ dc_status_t rc;
+ rc = rc = dc_device_open(&m_data->device, m_data->context, m_data->descriptor, m_data->devname);
+ if (rc == DC_STATUS_SUCCESS) {
+ switch (dc_device_get_type(m_data->device)) {
+#if DC_VERSION_CHECK(0, 5, 0)
+ case DC_FAMILY_HW_OSTC3:
+ supported = true;
+ //hw_ostc3_device_fwupdate(m_data->device, m_fileName.toUtf8().data());
+ break;
+#endif // divecomputer 0.5.0
+ }
+ dc_device_close(m_data->device);
+
+ if (!supported) {
+ lastError = tr("This feature is not yet available for the selected dive computer.");
+ emit error(lastError);
+ }
+ }
+ else {
+ lastError = tr("Could not a establish connection to the dive computer.");
+ emit error(lastError);
+ }
+}
diff --git a/configuredivecomputerthreads.h b/configuredivecomputerthreads.h
new file mode 100644
index 000000000..66df7a93b
--- /dev/null
+++ b/configuredivecomputerthreads.h
@@ -0,0 +1,58 @@
+#ifndef CONFIGUREDIVECOMPUTERTHREADS_H
+#define CONFIGUREDIVECOMPUTERTHREADS_H
+
+#include <QObject>
+#include <QThread>
+#include <QVariant>
+#include "libdivecomputer.h"
+#include <QDateTime>
+#include "devicedetails.h"
+
+class ReadSettingsThread : public QThread
+{
+ Q_OBJECT
+public:
+ ReadSettingsThread(QObject *parent, device_data_t *data);
+ virtual void run();
+ QString result;
+ QString lastError;
+signals:
+ void error(QString err);
+ void devicedetails(DeviceDetails *newDeviceDetails);
+private:
+ device_data_t *m_data;
+};
+
+class WriteSettingsThread : public QThread
+{
+ Q_OBJECT
+public:
+ WriteSettingsThread(QObject *parent, device_data_t *data);
+ void setDeviceDetails(DeviceDetails *details);
+ virtual void run();
+ QString result;
+ QString lastError;
+signals:
+ void error(QString err);
+private:
+ device_data_t *m_data;
+ DeviceDetails *m_deviceDetails;
+};
+
+class FirmwareUpdateThread : public QThread
+{
+ Q_OBJECT
+public:
+ FirmwareUpdateThread(QObject *parent, device_data_t *data, QString fileName);
+ virtual void run();
+ QString lastError;
+signals:
+ void progress(int percent);
+ void message(QString msg);
+ void error(QString err);
+private:
+ device_data_t *m_data;
+ QString m_fileName;
+};
+
+#endif // CONFIGUREDIVECOMPUTERTHREADS_H
diff --git a/devicedetails.cpp b/devicedetails.cpp
new file mode 100644
index 000000000..db95cfd41
--- /dev/null
+++ b/devicedetails.cpp
@@ -0,0 +1,487 @@
+#include "devicedetails.h"
+
+DeviceDetails::DeviceDetails(QObject *parent) :
+ QObject(parent)
+{
+
+}
+
+device_data_t *DeviceDetails::data() const
+{
+ return m_data;
+}
+
+void DeviceDetails::setData(device_data_t *data)
+{
+ m_data = data;
+}
+
+QString DeviceDetails::serialNo() const
+{
+ return m_serialNo;
+}
+
+void DeviceDetails::setSerialNo(const QString &serialNo)
+{
+ m_serialNo = serialNo;
+}
+
+QString DeviceDetails::firmwareVersion() const
+{
+ return m_firmwareVersion;
+}
+
+void DeviceDetails::setFirmwareVersion(const QString &firmwareVersion)
+{
+ m_firmwareVersion = firmwareVersion;
+}
+
+QString DeviceDetails::customText() const
+{
+ return m_customText;
+}
+
+void DeviceDetails::setCustomText(const QString &customText)
+{
+ m_customText = customText;
+}
+
+int DeviceDetails::brightness() const
+{
+ return m_brightness;
+}
+
+void DeviceDetails::setBrightness(int brightness)
+{
+ m_brightness = brightness;
+}
+
+int DeviceDetails::diveModeColor() const
+{
+ return m_diveModeColor;
+}
+
+void DeviceDetails::setDiveModeColor(int diveModeColor)
+{
+ m_diveModeColor = diveModeColor;
+}
+
+int DeviceDetails::language() const
+{
+ return m_language;
+}
+
+void DeviceDetails::setLanguage(int language)
+{
+ m_language = language;
+}
+
+int DeviceDetails::dateFormat() const
+{
+ return m_dateFormat;
+}
+
+void DeviceDetails::setDateFormat(int dateFormat)
+{
+ m_dateFormat = dateFormat;
+}
+
+int DeviceDetails::lastDeco() const
+{
+ return m_lastDeco;
+}
+
+void DeviceDetails::setLastDeco(int lastDeco)
+{
+ m_lastDeco = lastDeco;
+}
+
+bool DeviceDetails::syncTime() const
+{
+ return m_syncTime;
+}
+
+void DeviceDetails::setSyncTime(bool syncTime)
+{
+ m_syncTime = syncTime;
+}
+
+gas DeviceDetails::gas1() const
+{
+ return m_gas1;
+}
+
+void DeviceDetails::setGas1(const gas &gas1)
+{
+ m_gas1 = gas1;
+}
+
+gas DeviceDetails::gas2() const
+{
+ return m_gas2;
+}
+
+void DeviceDetails::setGas2(const gas &gas2)
+{
+ m_gas2 = gas2;
+}
+
+gas DeviceDetails::gas3() const
+{
+ return m_gas3;
+}
+
+void DeviceDetails::setGas3(const gas &gas3)
+{
+ m_gas3 = gas3;
+}
+
+gas DeviceDetails::gas4() const
+{
+ return m_gas4;
+}
+
+void DeviceDetails::setGas4(const gas &gas4)
+{
+ m_gas4 = gas4;
+}
+
+gas DeviceDetails::gas5() const
+{
+ return m_gas5;
+}
+
+void DeviceDetails::setGas5(const gas &gas5)
+{
+ m_gas5 = gas5;
+}
+
+gas DeviceDetails::dil1() const
+{
+ return m_dil1;
+}
+
+void DeviceDetails::setDil1(const gas &dil1)
+{
+ m_dil1 = dil1;
+}
+
+gas DeviceDetails::dil2() const
+{
+ return m_dil2;
+}
+
+void DeviceDetails::setDil2(const gas &dil2)
+{
+ m_dil2 = dil2;
+}
+
+gas DeviceDetails::dil3() const
+{
+ return m_dil3;
+}
+
+void DeviceDetails::setDil3(const gas &dil3)
+{
+ m_dil3 = dil3;
+}
+
+gas DeviceDetails::dil4() const
+{
+ return m_dil4;
+}
+
+void DeviceDetails::setDil4(const gas &dil4)
+{
+ m_dil4 = dil4;
+}
+
+gas DeviceDetails::dil5() const
+{
+ return m_dil5;
+}
+
+void DeviceDetails::setDil5(const gas &dil5)
+{
+ m_dil5 = dil5;
+}
+
+setpoint DeviceDetails::sp1() const
+{
+ return m_sp1;
+}
+
+void DeviceDetails::setSp1(const setpoint &sp1)
+{
+ m_sp1 = sp1;
+}
+
+setpoint DeviceDetails::sp2() const
+{
+ return m_sp2;
+}
+
+void DeviceDetails::setSp2(const setpoint &sp2)
+{
+ m_sp2 = sp2;
+}
+
+setpoint DeviceDetails::sp3() const
+{
+ return m_sp3;
+}
+
+void DeviceDetails::setSp3(const setpoint &sp3)
+{
+ m_sp3 = sp3;
+}
+
+setpoint DeviceDetails::sp4() const
+{
+ return m_sp4;
+}
+
+void DeviceDetails::setSp4(const setpoint &sp4)
+{
+ m_sp4 = sp4;
+}
+
+setpoint DeviceDetails::sp5() const
+{
+ return m_sp5;
+}
+
+void DeviceDetails::setSp5(const setpoint &sp5)
+{
+ m_sp5 = sp5;
+}
+
+int DeviceDetails::ccrMode() const
+{
+ return m_ccrMode;
+}
+
+void DeviceDetails::setCcrMode(int ccrMode)
+{
+ m_ccrMode = ccrMode;
+}
+
+int DeviceDetails::diveMode() const
+{
+ return m_diveMode;
+}
+
+void DeviceDetails::setDiveMode(int diveMode)
+{
+ m_diveMode = diveMode;
+}
+
+int DeviceDetails::decoType() const
+{
+ return m_decoType;
+}
+
+void DeviceDetails::setDecoType(int decoType)
+{
+ m_decoType = decoType;
+}
+
+int DeviceDetails::pp02Max() const
+{
+ return m_pp02Max;
+}
+
+void DeviceDetails::setPp02Max(int pp02Max)
+{
+ m_pp02Max = pp02Max;
+}
+
+int DeviceDetails::pp02Min() const
+{
+ return m_pp02Min;
+}
+
+void DeviceDetails::setPp02Min(int pp02Min)
+{
+ m_pp02Min = pp02Min;
+}
+
+int DeviceDetails::futureTTS() const
+{
+ return m_futureTTS;
+}
+
+void DeviceDetails::setFutureTTS(int futureTTS)
+{
+ m_futureTTS = futureTTS;
+}
+
+int DeviceDetails::gfLow() const
+{
+ return m_gfLow;
+}
+
+void DeviceDetails::setGfLow(int gfLow)
+{
+ m_gfLow = gfLow;
+}
+
+int DeviceDetails::gfHigh() const
+{
+ return m_gfHigh;
+}
+
+void DeviceDetails::setGfHigh(int gfHigh)
+{
+ m_gfHigh = gfHigh;
+}
+
+int DeviceDetails::aGFLow() const
+{
+ return m_aGFLow;
+}
+
+void DeviceDetails::setAGFLow(int aGFLow)
+{
+ m_aGFLow = aGFLow;
+}
+
+int DeviceDetails::aGFHigh() const
+{
+ return m_aGFHigh;
+}
+
+void DeviceDetails::setAGFHigh(int aGFHigh)
+{
+ m_aGFHigh = aGFHigh;
+}
+
+int DeviceDetails::aGFSelectable() const
+{
+ return m_aGFSelectable;
+}
+
+void DeviceDetails::setAGFSelectable(int aGFSelectable)
+{
+ m_aGFSelectable = aGFSelectable;
+}
+
+int DeviceDetails::saturation() const
+{
+ return m_saturation;
+}
+
+void DeviceDetails::setSaturation(int saturation)
+{
+ m_saturation = saturation;
+}
+
+int DeviceDetails::desaturation() const
+{
+ return m_desaturation;
+}
+
+void DeviceDetails::setDesaturation(int desaturation)
+{
+ m_desaturation = desaturation;
+}
+
+int DeviceDetails::units() const
+{
+ return m_units;
+}
+
+void DeviceDetails::setUnits(int units)
+{
+ m_units = units;
+}
+
+int DeviceDetails::samplingRate() const
+{
+ return m_samplingRate;
+}
+
+void DeviceDetails::setSamplingRate(int samplingRate)
+{
+ m_samplingRate = samplingRate;
+}
+
+int DeviceDetails::salinity() const
+{
+ return m_salinity;
+}
+
+void DeviceDetails::setSalinity(int salinity)
+{
+ m_salinity = salinity;
+}
+
+int DeviceDetails::compassGain() const
+{
+ return m_compassGain;
+}
+
+void DeviceDetails::setCompassGain(int compassGain)
+{
+ m_compassGain = compassGain;
+}
+
+int DeviceDetails::pressureSensorOffset() const
+{
+ return m_pressureSensorOffset;
+}
+
+void DeviceDetails::setPressureSensorOffset(int pressureSensorOffset)
+{
+ m_pressureSensorOffset = pressureSensorOffset;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/devicedetails.h b/devicedetails.h
new file mode 100644
index 000000000..d754e9774
--- /dev/null
+++ b/devicedetails.h
@@ -0,0 +1,202 @@
+#ifndef DEVICEDETAILS_H
+#define DEVICEDETAILS_H
+
+#include <QObject>
+#include <QDateTime>
+#include "libdivecomputer.h"
+
+struct gas {
+ int oxygen;
+ int helium;
+ int type;
+ int depth;
+};
+
+struct setpoint {
+ int sp;
+ int depth;
+};
+
+class DeviceDetails : public QObject
+{
+ Q_OBJECT
+public:
+ explicit DeviceDetails(QObject *parent = 0);
+
+ device_data_t *data() const;
+ void setData(device_data_t *data);
+
+ QString serialNo() const;
+ void setSerialNo(const QString &serialNo);
+
+ QString firmwareVersion() const;
+ void setFirmwareVersion(const QString &firmwareVersion);
+
+ QString customText() const;
+ void setCustomText(const QString &customText);
+
+ int brightness() const;
+ void setBrightness(int brightness);
+
+ int diveModeColor() const;
+ void setDiveModeColor(int diveModeColor);
+
+ int language() const;
+ void setLanguage(int language);
+
+ int dateFormat() const;
+ void setDateFormat(int dateFormat);
+
+ int lastDeco() const;
+ void setLastDeco(int lastDeco);
+
+ bool syncTime() const;
+ void setSyncTime(bool syncTime);
+
+ gas gas1() const;
+ void setGas1(const gas &gas1);
+
+ gas gas2() const;
+ void setGas2(const gas &gas2);
+
+ gas gas3() const;
+ void setGas3(const gas &gas3);
+
+ gas gas4() const;
+ void setGas4(const gas &gas4);
+
+ gas gas5() const;
+ void setGas5(const gas &gas5);
+
+ gas dil1() const;
+ void setDil1(const gas &dil1);
+
+ gas dil2() const;
+ void setDil2(const gas &dil2);
+
+ gas dil3() const;
+ void setDil3(const gas &dil3);
+
+ gas dil4() const;
+ void setDil4(const gas &dil4);
+
+ gas dil5() const;
+ void setDil5(const gas &dil5);
+
+ setpoint sp1() const;
+ void setSp1(const setpoint &sp1);
+
+ setpoint sp2() const;
+ void setSp2(const setpoint &sp2);
+
+ setpoint sp3() const;
+ void setSp3(const setpoint &sp3);
+
+ setpoint sp4() const;
+ void setSp4(const setpoint &sp4);
+
+ setpoint sp5() const;
+ void setSp5(const setpoint &sp5);
+
+ int ccrMode() const;
+ void setCcrMode(int ccrMode);
+
+ int diveMode() const;
+ void setDiveMode(int diveMode);
+
+ int decoType() const;
+ void setDecoType(int decoType);
+
+ int pp02Max() const;
+ void setPp02Max(int pp02Max);
+
+ int pp02Min() const;
+ void setPp02Min(int pp02Min);
+
+ int futureTTS() const;
+ void setFutureTTS(int futureTTS);
+
+ int gfLow() const;
+ void setGfLow(int gfLow);
+
+ int gfHigh() const;
+ void setGfHigh(int gfHigh);
+
+ int aGFLow() const;
+ void setAGFLow(int aGFLow);
+
+ int aGFHigh() const;
+ void setAGFHigh(int aGFHigh);
+
+ int aGFSelectable() const;
+ void setAGFSelectable(int aGFSelectable);
+
+ int saturation() const;
+ void setSaturation(int saturation);
+
+ int desaturation() const;
+ void setDesaturation(int desaturation);
+
+ int units() const;
+ void setUnits(int units);
+
+ int samplingRate() const;
+ void setSamplingRate(int samplingRate);
+
+ int salinity() const;
+ void setSalinity(int salinity);
+
+ int compassGain() const;
+ void setCompassGain(int compassGain);
+
+ int pressureSensorOffset() const;
+ void setPressureSensorOffset(int pressureSensorOffset);
+
+private:
+ device_data_t *m_data;
+ QString m_serialNo;
+ QString m_firmwareVersion;
+ QString m_customText;
+ bool m_syncTime;
+ gas m_gas1;
+ gas m_gas2;
+ gas m_gas3;
+ gas m_gas4;
+ gas m_gas5;
+ gas m_dil1;
+ gas m_dil2;
+ gas m_dil3;
+ gas m_dil4;
+ gas m_dil5;
+ setpoint m_sp1;
+ setpoint m_sp2;
+ setpoint m_sp3;
+ setpoint m_sp4;
+ setpoint m_sp5;
+ int m_ccrMode;
+ int m_diveMode;
+ int m_decoType;
+ int m_pp02Max;
+ int m_pp02Min;
+ int m_futureTTS;
+ int m_gfLow;
+ int m_gfHigh;
+ int m_aGFLow;
+ int m_aGFHigh;
+ int m_aGFSelectable;
+ int m_saturation;
+ int m_desaturation;
+ int m_lastDeco;
+ int m_brightness;
+ int m_units;
+ int m_samplingRate;
+ int m_salinity;
+ int m_diveModeColor;
+ int m_language;
+ int m_dateFormat;
+ int m_compassGain;
+ int m_pressureSensorOffset;
+};
+
+
+#endif // DEVICEDETAILS_H
diff --git a/icons/ostc3.png b/icons/ostc3.png
new file mode 100644
index 000000000..5c49a76b3
--- /dev/null
+++ b/icons/ostc3.png
Binary files differ
diff --git a/qt-ui/configuredivecomputerdialog.cpp b/qt-ui/configuredivecomputerdialog.cpp
new file mode 100644
index 000000000..e40522529
--- /dev/null
+++ b/qt-ui/configuredivecomputerdialog.cpp
@@ -0,0 +1,467 @@
+#include "configuredivecomputerdialog.h"
+#include "ui_configuredivecomputerdialog.h"
+
+#include "../divecomputer.h"
+#include "../libdivecomputer.h"
+#include "../helpers.h"
+#include "../display.h"
+#include "../divelist.h"
+#include "configuredivecomputer.h"
+#include <QFileDialog>
+#include <QMessageBox>
+struct product {
+ const char *product;
+ dc_descriptor_t *descriptor;
+ struct product *next;
+};
+
+struct vendor {
+ const char *vendor;
+ struct product *productlist;
+ struct vendor *next;
+};
+
+struct mydescriptor {
+ const char *vendor;
+ const char *product;
+ dc_family_t type;
+ unsigned int model;
+};
+
+ConfigureDiveComputerDialog::ConfigureDiveComputerDialog(QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::ConfigureDiveComputerDialog),
+ config(0),
+ deviceDetails(0)
+{
+ ui->setupUi(this);
+
+ deviceDetails = new DeviceDetails(this);
+ config = new ConfigureDiveComputer(this);
+ connect(config, SIGNAL(error(QString)), this, SLOT(configError(QString)));
+ connect(config, SIGNAL(message(QString)), this, SLOT(configMessage(QString)));
+ connect(config, SIGNAL(readFinished()), this, SLOT(deviceReadFinished()));
+ connect(config, SIGNAL(deviceDetailsChanged(DeviceDetails*)),
+ this, SLOT(deviceDetailsReceived(DeviceDetails*)));
+ connect(ui->retrieveDetails, SIGNAL(clicked()), this, SLOT(readSettings()));
+
+ memset(&device_data, 0, sizeof(device_data));
+ fill_computer_list();
+ if (default_dive_computer_device)
+ ui->device->setEditText(default_dive_computer_device);
+
+ ui->DiveComputerList->setCurrentRow(0);
+ on_DiveComputerList_currentRowChanged(0);
+}
+
+ConfigureDiveComputerDialog::~ConfigureDiveComputerDialog()
+{
+ delete ui;
+}
+
+
+static void fillDeviceList(const char *name, void *data)
+{
+ QComboBox *comboBox = (QComboBox *)data;
+ comboBox->addItem(name);
+}
+
+void ConfigureDiveComputerDialog::fill_device_list(int dc_type)
+{
+ int deviceIndex;
+ ui->device->clear();
+ deviceIndex = enumerate_devices(fillDeviceList, ui->device, dc_type);
+ if (deviceIndex >= 0)
+ ui->device->setCurrentIndex(deviceIndex);
+}
+
+void ConfigureDiveComputerDialog::fill_computer_list()
+{
+ dc_iterator_t *iterator = NULL;
+ dc_descriptor_t *descriptor = NULL;
+
+ struct mydescriptor *mydescriptor;
+
+ dc_descriptor_iterator(&iterator);
+ while (dc_iterator_next(iterator, &descriptor) == DC_STATUS_SUCCESS) {
+ const char *vendor = dc_descriptor_get_vendor(descriptor);
+ const char *product = dc_descriptor_get_product(descriptor);
+
+ if (!vendorList.contains(vendor))
+ vendorList.append(vendor);
+
+ if (!productList[vendor].contains(product))
+ productList[vendor].push_back(product);
+
+ descriptorLookup[QString(vendor) + QString(product)] = descriptor;
+ }
+ dc_iterator_free(iterator);
+
+ mydescriptor = (struct mydescriptor *)malloc(sizeof(struct mydescriptor));
+ mydescriptor->vendor = "Uemis";
+ mydescriptor->product = "Zurich";
+ mydescriptor->type = DC_FAMILY_NULL;
+ mydescriptor->model = 0;
+
+ if (!vendorList.contains("Uemis"))
+ vendorList.append("Uemis");
+
+ if (!productList["Uemis"].contains("Zurich"))
+ productList["Uemis"].push_back("Zurich");
+
+ descriptorLookup["UemisZurich"] = (dc_descriptor_t *)mydescriptor;
+
+ qSort(vendorList);
+}
+
+void ConfigureDiveComputerDialog::populateDeviceDetails()
+{
+ deviceDetails->setCustomText(ui->customTextLlineEdit->text());
+ deviceDetails->setDiveMode(ui->diveModeComboBox->currentIndex());
+ deviceDetails->setSaturation(ui->saturationSpinBox->value());
+ deviceDetails->setDesaturation(ui->desaturationSpinBox->value());
+ deviceDetails->setLastDeco(ui->lastDecoSpinBox->value());
+ deviceDetails->setBrightness(ui->brightnessComboBox->currentIndex());
+ deviceDetails->setUnits(ui->unitsComboBox->currentIndex());
+ deviceDetails->setSamplingRate(ui->samplingRateComboBox->currentIndex());
+ deviceDetails->setSalinity(ui->salinitySpinBox->value());
+ deviceDetails->setDiveModeColor(ui->diveModeColour->currentIndex());
+ deviceDetails->setLanguage(ui->languageComboBox->currentIndex());
+ deviceDetails->setDateFormat(ui->dateFormatComboBox->currentIndex());
+ deviceDetails->setCompassGain(ui->compassGainComboBox->currentIndex());
+ deviceDetails->setSyncTime(ui->dateTimeSyncCheckBox->isChecked());
+
+ //set gas values
+ gas gas1;
+ gas gas2;
+ gas gas3;
+ gas gas4;
+ gas gas5;
+
+ gas1.oxygen = ui->ostc3GasTable->item(0, 1)->text().toInt();
+ gas1.helium = ui->ostc3GasTable->item(0, 2)->text().toInt();
+ gas1.type = ui->ostc3GasTable->item(0, 3)->text().toInt();
+ gas1.depth = ui->ostc3GasTable->item(0, 4)->text().toInt();
+
+ gas2.oxygen = ui->ostc3GasTable->item(1, 1)->text().toInt();
+ gas2.helium = ui->ostc3GasTable->item(1, 2)->text().toInt();
+ gas2.type = ui->ostc3GasTable->item(1, 3)->text().toInt();
+ gas2.depth = ui->ostc3GasTable->item(1, 4)->text().toInt();
+
+ gas3.oxygen = ui->ostc3GasTable->item(2, 1)->text().toInt();
+ gas3.helium = ui->ostc3GasTable->item(2, 2)->text().toInt();
+ gas3.type = ui->ostc3GasTable->item(2, 3)->text().toInt();
+ gas3.depth = ui->ostc3GasTable->item(2, 4)->text().toInt();
+
+ gas4.oxygen = ui->ostc3GasTable->item(3, 1)->text().toInt();
+ gas4.helium = ui->ostc3GasTable->item(3, 2)->text().toInt();
+ gas4.type = ui->ostc3GasTable->item(3, 3)->text().toInt();
+ gas4.depth = ui->ostc3GasTable->item(3, 4)->text().toInt();
+
+ gas5.oxygen = ui->ostc3GasTable->item(4, 1)->text().toInt();
+ gas5.helium = ui->ostc3GasTable->item(4, 2)->text().toInt();
+ gas5.type = ui->ostc3GasTable->item(4, 3)->text().toInt();
+ gas5.depth = ui->ostc3GasTable->item(4, 4)->text().toInt();
+
+ deviceDetails->setGas1(gas1);
+ deviceDetails->setGas2(gas2);
+ deviceDetails->setGas3(gas3);
+ deviceDetails->setGas4(gas4);
+ deviceDetails->setGas5(gas5);
+
+ //set dil values
+ gas dil1;
+ gas dil2;
+ gas dil3;
+ gas dil4;
+ gas dil5;
+
+ dil1.oxygen = ui->ostc3DilTable->item(0, 1)->text().toInt();
+ dil1.helium = ui->ostc3DilTable->item(0, 2)->text().toInt();
+ dil1.type = ui->ostc3DilTable->item(0, 3)->text().toInt();
+ dil1.depth = ui->ostc3DilTable->item(0, 4)->text().toInt();
+
+ dil2.oxygen = ui->ostc3DilTable->item(1, 1)->text().toInt();
+ dil2.helium = ui->ostc3DilTable->item(1, 2)->text().toInt();
+ dil2.type = ui->ostc3DilTable->item(1, 3)->text().toInt();
+ dil2.depth = ui->ostc3DilTable->item(1, 4)->text().toInt();
+
+ dil3.oxygen = ui->ostc3DilTable->item(2, 1)->text().toInt();
+ dil3.helium = ui->ostc3DilTable->item(2, 2)->text().toInt();
+ dil3.type = ui->ostc3DilTable->item(2, 3)->text().toInt();
+ dil3.depth = ui->ostc3DilTable->item(2, 4)->text().toInt();
+
+ dil4.oxygen = ui->ostc3DilTable->item(3, 1)->text().toInt();
+ dil4.helium = ui->ostc3DilTable->item(3, 2)->text().toInt();
+ dil4.type = ui->ostc3DilTable->item(3, 3)->text().toInt();
+ dil4.depth = ui->ostc3DilTable->item(3, 4)->text().toInt();
+
+ dil5.oxygen = ui->ostc3DilTable->item(4, 1)->text().toInt();
+ dil5.helium = ui->ostc3DilTable->item(4, 2)->text().toInt();
+ dil5.type = ui->ostc3DilTable->item(4, 3)->text().toInt();
+ dil5.depth = ui->ostc3DilTable->item(4, 4)->text().toInt();
+
+ deviceDetails->setDil1(dil1);
+ deviceDetails->setDil2(dil2);
+ deviceDetails->setDil3(dil3);
+ deviceDetails->setDil4(dil4);
+ deviceDetails->setDil5(dil5);
+
+ //set set point details
+ setpoint sp1;
+ setpoint sp2;
+ setpoint sp3;
+ setpoint sp4;
+ setpoint sp5;
+
+ sp1.sp = ui->ostc3SetPointTable->item(0, 1)->text().toInt();
+ sp1.depth = ui->ostc3SetPointTable->item(0, 2)->text().toInt();
+
+ sp2.sp = ui->ostc3SetPointTable->item(1, 1)->text().toInt();
+ sp2.depth = ui->ostc3SetPointTable->item(1, 2)->text().toInt();
+
+ sp3.sp = ui->ostc3SetPointTable->item(2, 1)->text().toInt();
+ sp3.depth = ui->ostc3SetPointTable->item(2, 2)->text().toInt();
+
+ sp4.sp = ui->ostc3SetPointTable->item(3, 1)->text().toInt();
+ sp4.depth = ui->ostc3SetPointTable->item(3, 2)->text().toInt();
+
+ sp5.sp = ui->ostc3SetPointTable->item(4, 1)->text().toInt();
+ sp5.depth = ui->ostc3SetPointTable->item(4, 2)->text().toInt();
+}
+
+void ConfigureDiveComputerDialog::readSettings()
+{
+ ui->statusLabel->clear();
+ ui->errorLabel->clear();
+
+ getDeviceData();
+ config->readSettings(&device_data);
+}
+
+void ConfigureDiveComputerDialog::configMessage(QString msg)
+{
+ ui->statusLabel->setText(msg);
+}
+
+void ConfigureDiveComputerDialog::configError(QString err)
+{
+ ui->statusLabel->setText("");
+ ui->errorLabel->setText(err);
+}
+
+void ConfigureDiveComputerDialog::getDeviceData()
+{
+ device_data.devname = strdup(ui->device->currentText().toUtf8().data());
+ device_data.vendor = strdup(selected_vendor.toUtf8().data());
+ device_data.product = strdup(selected_product.toUtf8().data());
+
+ device_data.descriptor = descriptorLookup[selected_vendor + selected_product];
+ device_data.deviceid = device_data.diveid = 0;
+
+ set_default_dive_computer_device(device_data.devname);
+}
+
+void ConfigureDiveComputerDialog::on_cancel_clicked()
+{
+ this->close();
+}
+
+void ConfigureDiveComputerDialog::deviceReadFinished()
+{
+ ui->statusLabel->setText(tr("Dive computer details read successfully."));
+}
+
+void ConfigureDiveComputerDialog::on_saveSettingsPushButton_clicked()
+{
+ populateDeviceDetails();
+ getDeviceData();
+ config->saveDeviceDetails(deviceDetails, &device_data);
+}
+
+void ConfigureDiveComputerDialog::deviceDetailsReceived(DeviceDetails *newDeviceDetails)
+{
+ deviceDetails = newDeviceDetails;
+ reloadValues();
+}
+
+void ConfigureDiveComputerDialog::reloadValues()
+{
+ ui->serialNoLineEdit->setText(deviceDetails->serialNo());
+ ui->firmwareVersionLineEdit->setText(deviceDetails->firmwareVersion());
+ ui->customTextLlineEdit->setText(deviceDetails->customText());
+ ui->diveModeComboBox->setCurrentIndex(deviceDetails->diveMode());
+ ui->saturationSpinBox->setValue(deviceDetails->saturation());
+ ui->desaturationSpinBox->setValue(deviceDetails->desaturation());
+ ui->lastDecoSpinBox->setValue(deviceDetails->lastDeco());
+ ui->brightnessComboBox->setCurrentIndex(deviceDetails->brightness());
+ ui->unitsComboBox->setCurrentIndex(deviceDetails->units());
+ ui->samplingRateComboBox->setCurrentIndex(deviceDetails->samplingRate());
+ ui->salinitySpinBox->setValue(deviceDetails->salinity());
+ ui->diveModeColour->setCurrentIndex(deviceDetails->diveModeColor());
+ ui->languageComboBox->setCurrentIndex(deviceDetails->language());
+ ui->dateFormatComboBox->setCurrentIndex(deviceDetails->dateFormat());
+ ui->compassGainComboBox->setCurrentIndex(deviceDetails->compassGain());
+
+ //load gas 1 values
+ ui->ostc3GasTable->setItem(0,1, new QTableWidgetItem(QString::number(deviceDetails->gas1().oxygen)));
+ ui->ostc3GasTable->setItem(0,2, new QTableWidgetItem(QString::number(deviceDetails->gas1().helium)));
+ ui->ostc3GasTable->setItem(0,3, new QTableWidgetItem(QString::number(deviceDetails->gas1().type)));
+ ui->ostc3GasTable->setItem(0,4, new QTableWidgetItem(QString::number(deviceDetails->gas1().depth)));
+
+ //load gas 2 values
+ ui->ostc3GasTable->setItem(1,1, new QTableWidgetItem(QString::number(deviceDetails->gas2().oxygen)));
+ ui->ostc3GasTable->setItem(1,2, new QTableWidgetItem(QString::number(deviceDetails->gas2().helium)));
+ ui->ostc3GasTable->setItem(1,3, new QTableWidgetItem(QString::number(deviceDetails->gas2().type)));
+ ui->ostc3GasTable->setItem(1,4, new QTableWidgetItem(QString::number(deviceDetails->gas2().depth)));
+
+ //load gas 3 values
+ ui->ostc3GasTable->setItem(2,1, new QTableWidgetItem(QString::number(deviceDetails->gas3().oxygen)));
+ ui->ostc3GasTable->setItem(2,2, new QTableWidgetItem(QString::number(deviceDetails->gas3().helium)));
+ ui->ostc3GasTable->setItem(2,3, new QTableWidgetItem(QString::number(deviceDetails->gas3().type)));
+ ui->ostc3GasTable->setItem(2,4, new QTableWidgetItem(QString::number(deviceDetails->gas3().depth)));
+
+ //load gas 4 values
+ ui->ostc3GasTable->setItem(3,1, new QTableWidgetItem(QString::number(deviceDetails->gas4().oxygen)));
+ ui->ostc3GasTable->setItem(3,2, new QTableWidgetItem(QString::number(deviceDetails->gas4().helium)));
+ ui->ostc3GasTable->setItem(3,3, new QTableWidgetItem(QString::number(deviceDetails->gas4().type)));
+ ui->ostc3GasTable->setItem(3,4, new QTableWidgetItem(QString::number(deviceDetails->gas4().depth)));
+
+ //load gas 5 values
+ ui->ostc3GasTable->setItem(4,1, new QTableWidgetItem(QString::number(deviceDetails->gas5().oxygen)));
+ ui->ostc3GasTable->setItem(4,2, new QTableWidgetItem(QString::number(deviceDetails->gas5().helium)));
+ ui->ostc3GasTable->setItem(4,3, new QTableWidgetItem(QString::number(deviceDetails->gas5().type)));
+ ui->ostc3GasTable->setItem(4,4, new QTableWidgetItem(QString::number(deviceDetails->gas5().depth)));
+
+ //load dil 1 values
+ ui->ostc3DilTable->setItem(0,1, new QTableWidgetItem(QString::number(deviceDetails->dil1().oxygen)));
+ ui->ostc3DilTable->setItem(0,2, new QTableWidgetItem(QString::number(deviceDetails->dil1().helium)));
+ ui->ostc3DilTable->setItem(0,3, new QTableWidgetItem(QString::number(deviceDetails->dil1().type)));
+ ui->ostc3DilTable->setItem(0,4, new QTableWidgetItem(QString::number(deviceDetails->dil1().depth)));
+
+ //load dil 2 values
+ ui->ostc3DilTable->setItem(1,1, new QTableWidgetItem(QString::number(deviceDetails->dil2().oxygen)));
+ ui->ostc3DilTable->setItem(1,2, new QTableWidgetItem(QString::number(deviceDetails->dil2().helium)));
+ ui->ostc3DilTable->setItem(1,3, new QTableWidgetItem(QString::number(deviceDetails->dil2().type)));
+ ui->ostc3DilTable->setItem(1,4, new QTableWidgetItem(QString::number(deviceDetails->dil2().depth)));
+
+ //load dil 3 values
+ ui->ostc3DilTable->setItem(2,1, new QTableWidgetItem(QString::number(deviceDetails->dil3().oxygen)));
+ ui->ostc3DilTable->setItem(2,2, new QTableWidgetItem(QString::number(deviceDetails->dil3().helium)));
+ ui->ostc3DilTable->setItem(2,3, new QTableWidgetItem(QString::number(deviceDetails->dil3().type)));
+ ui->ostc3DilTable->setItem(2,4, new QTableWidgetItem(QString::number(deviceDetails->dil3().depth)));
+
+ //load dil 4 values
+ ui->ostc3DilTable->setItem(3,1, new QTableWidgetItem(QString::number(deviceDetails->dil4().oxygen)));
+ ui->ostc3DilTable->setItem(3,2, new QTableWidgetItem(QString::number(deviceDetails->dil4().helium)));
+ ui->ostc3DilTable->setItem(3,3, new QTableWidgetItem(QString::number(deviceDetails->dil4().type)));
+ ui->ostc3DilTable->setItem(3,4, new QTableWidgetItem(QString::number(deviceDetails->dil4().depth)));
+
+ //load dil 5 values
+ ui->ostc3DilTable->setItem(4,1, new QTableWidgetItem(QString::number(deviceDetails->dil5().oxygen)));
+ ui->ostc3DilTable->setItem(4,2, new QTableWidgetItem(QString::number(deviceDetails->dil5().helium)));
+ ui->ostc3DilTable->setItem(4,3, new QTableWidgetItem(QString::number(deviceDetails->dil5().type)));
+ ui->ostc3DilTable->setItem(4,4, new QTableWidgetItem(QString::number(deviceDetails->dil5().depth)));
+
+ //load set point 1 values
+ ui->ostc3SetPointTable->setItem(0, 1, new QTableWidgetItem(QString::number(deviceDetails->sp1().sp)));
+ ui->ostc3SetPointTable->setItem(0, 2, new QTableWidgetItem(QString::number(deviceDetails->sp1().depth)));
+
+ //load set point 2 values
+ ui->ostc3SetPointTable->setItem(1, 1, new QTableWidgetItem(QString::number(deviceDetails->sp2().sp)));
+ ui->ostc3SetPointTable->setItem(1, 2, new QTableWidgetItem(QString::number(deviceDetails->sp2().depth)));
+
+ //load set point 3 values
+ ui->ostc3SetPointTable->setItem(2, 1, new QTableWidgetItem(QString::number(deviceDetails->sp3().sp)));
+ ui->ostc3SetPointTable->setItem(2, 2, new QTableWidgetItem(QString::number(deviceDetails->sp3().depth)));
+
+ //load set point 4 values
+ ui->ostc3SetPointTable->setItem(3, 1, new QTableWidgetItem(QString::number(deviceDetails->sp4().sp)));
+ ui->ostc3SetPointTable->setItem(3, 2, new QTableWidgetItem(QString::number(deviceDetails->sp4().depth)));
+
+ //load set point 5 values
+ ui->ostc3SetPointTable->setItem(4, 1, new QTableWidgetItem(QString::number(deviceDetails->sp5().sp)));
+ ui->ostc3SetPointTable->setItem(4, 2, new QTableWidgetItem(QString::number(deviceDetails->sp5().depth)));
+}
+
+
+void ConfigureDiveComputerDialog::on_backupButton_clicked()
+{
+ QString filename = existing_filename ?: prefs.default_filename;
+ QFileInfo fi(filename);
+ filename = fi.absolutePath().append(QDir::separator()).append("Backup.xml");
+ QString backupPath = QFileDialog::getSaveFileName(this, tr("Backup Dive Computer Settings"),
+ filename, tr("Backup files (*.xml)")
+ );
+ if (!backupPath.isEmpty()) {
+ populateDeviceDetails();
+ getDeviceData();
+ if (!config->saveXMLBackup(backupPath, deviceDetails, &device_data)) {
+ QMessageBox::critical(this, tr("XML Backup Error"),
+ tr("An error occurred while saving the backup file.\n%1")
+ .arg(config->lastError)
+ );
+ } else {
+ QMessageBox::information(this, tr("Backup succeeded"),
+ tr("Your settings have been saved to: %1")
+ .arg(filename)
+ );
+ }
+ }
+}
+
+void ConfigureDiveComputerDialog::on_restoreBackupButton_clicked()
+{
+ QString filename = existing_filename ?: prefs.default_filename;
+ QFileInfo fi(filename);
+ filename = fi.absolutePath().append(QDir::separator()).append("Backup.xml");
+ QString restorePath = QFileDialog::getOpenFileName(this, tr("Restore Dive Computer Settings"),
+ filename, tr("Backup files (*.xml)")
+ );
+ if (!restorePath.isEmpty()) {
+ if (!config->restoreXMLBackup(restorePath, deviceDetails)) {
+ QMessageBox::critical(this, tr("XML Restore Error"),
+ tr("An error occurred while restoring the backup file.\n%1")
+ .arg(config->lastError)
+ );
+ } else {
+ reloadValues();
+ //getDeviceData();
+ //config->saveDeviceDetails(deviceDetails, &device_data);
+ QMessageBox::information(this, tr("Restore succeeded"),
+ tr("Your settings have been restored successfully.")
+ );
+ }
+ }
+}
+
+void ConfigureDiveComputerDialog::on_updateFirmwareButton_clicked()
+{
+ QString filename = existing_filename ?: prefs.default_filename;
+ QFileInfo fi(filename);
+ filename = fi.absolutePath();
+ QString firmwarePath = QFileDialog::getOpenFileName(this, tr("Select firmware file"),
+ filename, tr("All files (*.*)")
+ );
+ if (!firmwarePath.isEmpty()) {
+ getDeviceData();
+ config->startFirmwareUpdate(firmwarePath, &device_data);
+ }
+}
+
+void ConfigureDiveComputerDialog::on_DiveComputerList_currentRowChanged(int currentRow)
+{
+ switch (currentRow) {
+ case 0:
+ selected_vendor = "Heinrichs Weikamp";
+ selected_product = "OSTC 3";
+ break;
+ }
+
+ int dcType = DC_TYPE_SERIAL;
+
+
+ if (selected_vendor == QString("Uemis"))
+ dcType = DC_TYPE_UEMIS;
+ fill_device_list(dcType);
+}
diff --git a/qt-ui/configuredivecomputerdialog.h b/qt-ui/configuredivecomputerdialog.h
new file mode 100644
index 000000000..66871efa3
--- /dev/null
+++ b/qt-ui/configuredivecomputerdialog.h
@@ -0,0 +1,60 @@
+#ifndef CONFIGUREDIVECOMPUTERDIALOG_H
+#define CONFIGUREDIVECOMPUTERDIALOG_H
+
+#include <QDialog>
+#include <QStringListModel>
+#include "../libdivecomputer.h"
+#include "configuredivecomputer.h"
+
+namespace Ui {
+class ConfigureDiveComputerDialog;
+}
+
+class ConfigureDiveComputerDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit ConfigureDiveComputerDialog(QWidget *parent = 0);
+ ~ConfigureDiveComputerDialog();
+
+private slots:
+ void readSettings();
+ void configMessage(QString msg);
+ void configError(QString err);
+ void on_cancel_clicked();
+ void deviceReadFinished();
+ void on_saveSettingsPushButton_clicked();
+ void deviceDetailsReceived(DeviceDetails *newDeviceDetails);
+ void reloadValues();
+ void on_backupButton_clicked();
+
+ void on_restoreBackupButton_clicked();
+
+
+ void on_updateFirmwareButton_clicked();
+
+ void on_DiveComputerList_currentRowChanged(int currentRow);
+
+private:
+ Ui::ConfigureDiveComputerDialog *ui;
+
+ QStringList vendorList;
+ QHash<QString, QStringList> productList;
+
+ ConfigureDiveComputer *config;
+ device_data_t device_data;
+ void getDeviceData();
+
+ QHash<QString, dc_descriptor_t *> descriptorLookup;
+ void fill_device_list(int dc_type);
+ void fill_computer_list();
+
+ DeviceDetails *deviceDetails;
+ void populateDeviceDetails();
+
+ QString selected_vendor;
+ QString selected_product;
+};
+
+#endif // CONFIGUREDIVECOMPUTERDIALOG_H
diff --git a/qt-ui/configuredivecomputerdialog.ui b/qt-ui/configuredivecomputerdialog.ui
new file mode 100644
index 000000000..41745a652
--- /dev/null
+++ b/qt-ui/configuredivecomputerdialog.ui
@@ -0,0 +1,860 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ConfigureDiveComputerDialog</class>
+ <widget class="QDialog" name="ConfigureDiveComputerDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>844</width>
+ <height>616</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Configure Dive Computer</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Device or Mount Point</string>
+ </property>
+ <property name="buddy">
+ <cstring>device</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QComboBox" name="device">
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="search">
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QPushButton" name="retrieveDetails">
+ <property name="text">
+ <string>Retrieve available details:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="saveSettingsPushButton">
+ <property name="text">
+ <string>Save Chages to Device</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="backupButton">
+ <property name="text">
+ <string>Backup</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="restoreBackupButton">
+ <property name="text">
+ <string>Restore Backup</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="updateFirmwareButton">
+ <property name="text">
+ <string>Update Firmware</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="cancel">
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QSplitter" name="splitter">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <widget class="QListWidget" name="DiveComputerList">
+ <property name="maximumSize">
+ <size>
+ <width>200</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>12</pointsize>
+ </font>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>64</width>
+ <height>64</height>
+ </size>
+ </property>
+ <item>
+ <property name="text">
+ <string>OSTC 3</string>
+ </property>
+ <property name="icon">
+ <iconset resource="../subsurface.qrc">
+ <normaloff>:/icons/ostc3.png</normaloff>:/icons/ostc3.png</iconset>
+ </property>
+ </item>
+ </widget>
+ <widget class="QStackedWidget" name="dcStackedWidget">
+ <widget class="QWidget" name="page_2">
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_7">
+ <property name="text">
+ <string>Serial No.</string>
+ </property>
+ <property name="buddy">
+ <cstring>serialNoLineEdit</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="serialNoLineEdit">
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QLabel" name="label_8">
+ <property name="text">
+ <string>Firmware Version:</string>
+ </property>
+ <property name="buddy">
+ <cstring>firmwareVersionLineEdit</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="3">
+ <widget class="QLineEdit" name="firmwareVersionLineEdit">
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>Custom Text:</string>
+ </property>
+ <property name="buddy">
+ <cstring>customTextLlineEdit</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="customTextLlineEdit">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <widget class="QLabel" name="label_6">
+ <property name="text">
+ <string>Language:</string>
+ </property>
+ <property name="buddy">
+ <cstring>languageComboBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="3">
+ <widget class="QComboBox" name="languageComboBox">
+ <item>
+ <property name="text">
+ <string>English</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>German</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>French</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Italian</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Dive Mode:</string>
+ </property>
+ <property name="buddy">
+ <cstring>diveModeComboBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QComboBox" name="diveModeComboBox">
+ <item>
+ <property name="text">
+ <string>OC</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>CC</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Gauge</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Apnea</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="2" column="2">
+ <widget class="QLabel" name="label_9">
+ <property name="text">
+ <string>Date Format:</string>
+ </property>
+ <property name="buddy">
+ <cstring>dateFormatComboBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="3">
+ <widget class="QComboBox" name="dateFormatComboBox">
+ <item>
+ <property name="text">
+ <string>MMDDYY</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>DDMMYY</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>YYMMDD</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Saturation:</string>
+ </property>
+ <property name="buddy">
+ <cstring>saturationSpinBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QSpinBox" name="saturationSpinBox">
+ <property name="suffix">
+ <string>%</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="2">
+ <widget class="QLabel" name="label_16">
+ <property name="text">
+ <string>Desaturation:</string>
+ </property>
+ <property name="buddy">
+ <cstring>desaturationSpinBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="3">
+ <widget class="QSpinBox" name="desaturationSpinBox">
+ <property name="suffix">
+ <string>%</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="label_10">
+ <property name="text">
+ <string>Last Deco:</string>
+ </property>
+ <property name="buddy">
+ <cstring>lastDecoSpinBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <widget class="QSpinBox" name="lastDecoSpinBox">
+ <property name="suffix">
+ <string> m</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="2">
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>Brightness:</string>
+ </property>
+ <property name="buddy">
+ <cstring>brightnessComboBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="3">
+ <widget class="QComboBox" name="brightnessComboBox">
+ <item>
+ <property name="text">
+ <string>Eco</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Medium</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>High</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="5" column="0">
+ <widget class="QLabel" name="label_12">
+ <property name="text">
+ <string>Sampling Rate:</string>
+ </property>
+ <property name="buddy">
+ <cstring>samplingRateComboBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1">
+ <widget class="QComboBox" name="samplingRateComboBox">
+ <item>
+ <property name="text">
+ <string>2s</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>10s</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="5" column="2">
+ <widget class="QLabel" name="label_11">
+ <property name="text">
+ <string>Units:</string>
+ </property>
+ <property name="buddy">
+ <cstring>unitsComboBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="3">
+ <widget class="QComboBox" name="unitsComboBox">
+ <item>
+ <property name="text">
+ <string>m/°C</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>ft/°F</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="6" column="0">
+ <widget class="QLabel" name="label_14">
+ <property name="text">
+ <string>Dive Mode Colour:</string>
+ </property>
+ <property name="buddy">
+ <cstring>diveModeColour</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="1">
+ <widget class="QComboBox" name="diveModeColour">
+ <item>
+ <property name="text">
+ <string>Standard</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Red</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Green</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Blue</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="6" column="2">
+ <widget class="QLabel" name="label_13">
+ <property name="text">
+ <string>Salinity (0-5%):</string>
+ </property>
+ <property name="buddy">
+ <cstring>salinitySpinBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="3">
+ <widget class="QSpinBox" name="salinitySpinBox">
+ <property name="suffix">
+ <string>%</string>
+ </property>
+ <property name="maximum">
+ <number>5</number>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="0" colspan="2">
+ <widget class="QCheckBox" name="dateTimeSyncCheckBox">
+ <property name="text">
+ <string>Sync dive computer time with PC</string>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="2">
+ <widget class="QLabel" name="label_15">
+ <property name="text">
+ <string>Compass Gain:</string>
+ </property>
+ <property name="buddy">
+ <cstring>compassGainComboBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="3">
+ <widget class="QComboBox" name="compassGainComboBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <item>
+ <property name="text">
+ <string>230LSB/Gauss</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>330LSB/Gauss</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>390LSB/Gauss</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>440LSB/Gauss</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>660LSB/Gauss</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>820LSB/Gauss</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>1090LSB/Gauss</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>1370LSB/Gauss</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="8" column="0" colspan="2">
+ <widget class="QTableWidget" name="ostc3GasTable">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>1</verstretch>
+ </sizepolicy>
+ </property>
+ <row>
+ <property name="text">
+ <string/>
+ </property>
+ </row>
+ <row>
+ <property name="text">
+ <string/>
+ </property>
+ </row>
+ <row>
+ <property name="text">
+ <string/>
+ </property>
+ </row>
+ <row>
+ <property name="text">
+ <string/>
+ </property>
+ </row>
+ <row>
+ <property name="text">
+ <string/>
+ </property>
+ </row>
+ <column>
+ <property name="text">
+ <string/>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>%O2</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>%He</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Type</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Change Depth</string>
+ </property>
+ </column>
+ <item row="0" column="0">
+ <property name="text">
+ <string>Gas 1</string>
+ </property>
+ </item>
+ <item row="1" column="0">
+ <property name="text">
+ <string>Gas 2</string>
+ </property>
+ </item>
+ <item row="2" column="0">
+ <property name="text">
+ <string>Gas 3</string>
+ </property>
+ </item>
+ <item row="3" column="0">
+ <property name="text">
+ <string>Gas 4</string>
+ </property>
+ </item>
+ <item row="4" column="0">
+ <property name="text">
+ <string>Gas 5</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="8" column="2" colspan="2">
+ <widget class="QTableWidget" name="ostc3DilTable">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>2</verstretch>
+ </sizepolicy>
+ </property>
+ <row>
+ <property name="text">
+ <string/>
+ </property>
+ </row>
+ <row>
+ <property name="text">
+ <string/>
+ </property>
+ </row>
+ <row>
+ <property name="text">
+ <string/>
+ </property>
+ </row>
+ <row>
+ <property name="text">
+ <string/>
+ </property>
+ </row>
+ <row>
+ <property name="text">
+ <string/>
+ </property>
+ </row>
+ <column>
+ <property name="text">
+ <string/>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>%He</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>%O2</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Type</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Change Depth</string>
+ </property>
+ </column>
+ <item row="0" column="0">
+ <property name="text">
+ <string>Dil 1</string>
+ </property>
+ </item>
+ <item row="1" column="0">
+ <property name="text">
+ <string>Dil 2</string>
+ </property>
+ </item>
+ <item row="2" column="0">
+ <property name="text">
+ <string>Dil 3</string>
+ </property>
+ </item>
+ <item row="3" column="0">
+ <property name="text">
+ <string>Dil 4</string>
+ </property>
+ </item>
+ <item row="4" column="0">
+ <property name="text">
+ <string>Dil 5</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="9" column="0" colspan="2">
+ <widget class="QTableWidget" name="ostc3SetPointTable">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>1</verstretch>
+ </sizepolicy>
+ </property>
+ <row>
+ <property name="text">
+ <string/>
+ </property>
+ </row>
+ <row>
+ <property name="text">
+ <string/>
+ </property>
+ </row>
+ <row>
+ <property name="text">
+ <string/>
+ </property>
+ </row>
+ <row>
+ <property name="text">
+ <string/>
+ </property>
+ </row>
+ <row>
+ <property name="text">
+ <string/>
+ </property>
+ </row>
+ <column>
+ <property name="text">
+ <string/>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Set Point [cbar]</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Change Depth [m]</string>
+ </property>
+ </column>
+ <item row="0" column="0">
+ <property name="text">
+ <string>SP 1</string>
+ </property>
+ </item>
+ <item row="1" column="0">
+ <property name="text">
+ <string>SP 2</string>
+ </property>
+ </item>
+ <item row="2" column="0">
+ <property name="text">
+ <string>SP 3</string>
+ </property>
+ </item>
+ <item row="3" column="0">
+ <property name="text">
+ <string>SP 4</string>
+ </property>
+ </item>
+ <item row="4" column="0">
+ <property name="text">
+ <string>SP 5</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="errorLabel">
+ <property name="styleSheet">
+ <string notr="true">color: rgb(242, 19, 25);</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="statusLabel">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <tabstops>
+ <tabstop>device</tabstop>
+ <tabstop>search</tabstop>
+ <tabstop>retrieveDetails</tabstop>
+ <tabstop>saveSettingsPushButton</tabstop>
+ <tabstop>backupButton</tabstop>
+ <tabstop>restoreBackupButton</tabstop>
+ <tabstop>cancel</tabstop>
+ </tabstops>
+ <resources>
+ <include location="../subsurface.qrc"/>
+ </resources>
+ <connections>
+ <connection>
+ <sender>DiveComputerList</sender>
+ <signal>currentRowChanged(int)</signal>
+ <receiver>dcStackedWidget</receiver>
+ <slot>setCurrentIndex(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>258</x>
+ <y>130</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>292</x>
+ <y>118</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index b27f2b606..74015c73f 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -41,6 +41,7 @@
#include "worldmap-save.h"
#include "updatemanager.h"
#include "planner.h"
+#include "configuredivecomputerdialog.h"
#ifndef NO_PRINTING
#include <QPrintDialog>
#include "printdialog.h"
@@ -1298,6 +1299,12 @@ void MainWindow::on_actionExport_triggered()
diveLogExport.exec();
}
+void MainWindow::on_actionConfigure_Dive_Computer_triggered()
+{
+ ConfigureDiveComputerDialog *dcConfig = new ConfigureDiveComputerDialog(this);
+ dcConfig->show();
+}
+
void MainWindow::setEnabledToolbar(bool arg1)
{
QList<QToolButton*> toolBar;
diff --git a/qt-ui/mainwindow.h b/qt-ui/mainwindow.h
index 40d82afb9..5ef5eed4a 100644
--- a/qt-ui/mainwindow.h
+++ b/qt-ui/mainwindow.h
@@ -146,6 +146,8 @@ slots:
void on_copy_triggered();
void on_paste_triggered();
+ void on_actionConfigure_Dive_Computer_triggered();
+
protected:
void closeEvent(QCloseEvent *);
diff --git a/qt-ui/mainwindow.ui b/qt-ui/mainwindow.ui
index 63d78c702..dca59e706 100644
--- a/qt-ui/mainwindow.ui
+++ b/qt-ui/mainwindow.ui
@@ -707,6 +707,8 @@ p, li { white-space: pre-wrap; }
<addaction name="actionPrint"/>
<addaction name="actionPreferences"/>
<addaction name="separator"/>
+ <addaction name="actionConfigure_Dive_Computer"/>
+ <addaction name="separator"/>
<addaction name="actionRecent1"/>
<addaction name="actionRecent2"/>
<addaction name="actionRecent3"/>
@@ -1067,6 +1069,11 @@ p, li { white-space: pre-wrap; }
<string>Ctrl+E</string>
</property>
</action>
+ <action name="actionConfigure_Dive_Computer">
+ <property name="text">
+ <string>Configure Dive Computer</string>
+ </property>
+ </action>
</widget>
<customwidgets>
<customwidget>
diff --git a/subsurface.pro b/subsurface.pro
index f3b0f97fe..af3f6e1b8 100644
--- a/subsurface.pro
+++ b/subsurface.pro
@@ -88,7 +88,11 @@ HEADERS = \
qt-ui/updatemanager.h \
qt-ui/divelogexportdialog.h \
qt-ui/usersurvey.h \
- subsurfacesysinfo.h
+ subsurfacesysinfo.h \
+ qt-ui/configuredivecomputerdialog.h \
+ configuredivecomputer.h \
+ configuredivecomputerthreads.h \
+ devicedetails.h
android: HEADERS -= \
qt-ui/usermanual.h \
@@ -168,7 +172,11 @@ SOURCES = \
qt-ui/updatemanager.cpp \
qt-ui/divelogexportdialog.cpp \
qt-ui/usersurvey.cpp \
- subsurfacesysinfo.cpp
+ subsurfacesysinfo.cpp \
+ qt-ui/configuredivecomputerdialog.cpp \
+ configuredivecomputer.cpp \
+ configuredivecomputerthreads.cpp \
+ devicedetails.cpp
android: SOURCES += android.cpp
else: linux*: SOURCES += linux.c
@@ -200,7 +208,8 @@ FORMS = \
qt-ui/divelogexportdialog.ui \
qt-ui/plannerSettings.ui \
qt-ui/usersurvey.ui \
- qt-ui/divecomponentselection.ui
+ qt-ui/divecomponentselection.ui \
+ qt-ui/configuredivecomputerdialog.ui
# Nether usermanual or printing is supported on android right now
android: FORMS -= qt-ui/printoptions.ui
diff --git a/subsurface.qrc b/subsurface.qrc
index dfeea6819..1951bb424 100644
--- a/subsurface.qrc
+++ b/subsurface.qrc
@@ -59,10 +59,11 @@
<file alias="icon_ead">icons/ead.png</file>
<file alias="icon_HR">icons/icon-HR.png</file>
<file alias="calendar">icons/calendarbg.png</file>
- <file alias="pictures">icons/pictures.png</file>
+ <file alias="pictures">icons/pictures.png</file>
<file>icons/subsurface/index.theme</file>
<file>icons/subsurface/32x32/actions/go-down.png</file>
<file>icons/subsurface/32x32/actions/go-up.png</file>
<file>icons/subsurface/32x32/actions/window-close.png</file>
+ <file>icons/ostc3.png</file>
</qresource>
</RCC>