aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Joseph W. Joshua <joejoshw@gmail.com>2014-06-10 15:03:26 +0300
committerGravatar Thiago Macieira <thiago@macieira.org>2014-08-09 12:06:42 -0300
commit4fc16b16749a73b8c06d41cb7cb22b78c77ab29e (patch)
tree6a434679d4f6d0677f920f910a2ddca39296cf87 /qt-ui
parent2432350064c6a9109501b3df21f56a9fe41aa686 (diff)
downloadsubsurface-4fc16b16749a73b8c06d41cb7cb22b78c77ab29e.tar.gz
Move divecomputer configuration code to different files
This splits the code in configuredivecomputer.cpp into multiple files. The read and write threads are moved to configuredivecomputerthreads.h/cpp, and the device details class is moved to devicedetails.h/.cpp Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com> Signed-off-by: Thiago Macieira <thiago@macieira.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/configuredivecomputer.cpp141
-rw-r--r--qt-ui/configuredivecomputer.h40
-rw-r--r--qt-ui/configuredivecomputerdialog.cpp36
-rw-r--r--qt-ui/configuredivecomputerdialog.h13
-rw-r--r--qt-ui/configuredivecomputerdialog.ui127
-rw-r--r--qt-ui/configuredivecomputerthreads.cpp81
-rw-r--r--qt-ui/configuredivecomputerthreads.h42
-rw-r--r--qt-ui/devicedetails.cpp88
-rw-r--r--qt-ui/devicedetails.h54
9 files changed, 398 insertions, 224 deletions
diff --git a/qt-ui/configuredivecomputer.cpp b/qt-ui/configuredivecomputer.cpp
index 8cc3a6953..d24c8905d 100644
--- a/qt-ui/configuredivecomputer.cpp
+++ b/qt-ui/configuredivecomputer.cpp
@@ -4,19 +4,21 @@
ConfigureDiveComputer::ConfigureDiveComputer(QObject *parent) :
QObject(parent),
readThread(0),
- writeThread(0)
+ writeThread(0),
+ m_deviceDetails(0)
{
setState(INITIAL);
}
-void ConfigureDiveComputer::readSettings(device_data_t *data)
+void ConfigureDiveComputer::readSettings(DeviceDetails *deviceDetails, device_data_t *data)
{
setState(READING);
+ m_deviceDetails = deviceDetails;
if (readThread)
readThread->deleteLater();
- readThread = new ReadSettingsThread(this, data);
+ readThread = new ReadSettingsThread(this, deviceDetails, data);
connect (readThread, SIGNAL(finished()),
this, SLOT(readThreadFinished()), Qt::QueuedConnection);
connect (readThread, SIGNAL(error(QString)), this, SLOT(setError(QString)));
@@ -24,19 +26,9 @@ void ConfigureDiveComputer::readSettings(device_data_t *data)
readThread->start();
}
-void ConfigureDiveComputer::setDeviceName(device_data_t *data, QString newName)
+void ConfigureDiveComputer::saveDeviceDetails()
{
- writeSettingToDevice(data, "Name", newName);
-}
-
-void ConfigureDiveComputer::setDeviceDateAndTime(device_data_t *data, QDateTime dateAndTime)
-{
- writeSettingToDevice(data, "DateAndTime", dateAndTime);
-}
-void ConfigureDiveComputer::setDeviceBrightness(device_data_t *data, int brighnessLevel)
-{
- writeSettingToDevice(data, "Brightness", brighnessLevel);
}
void ConfigureDiveComputer::setState(ConfigureDiveComputer::states newState)
@@ -45,20 +37,6 @@ void ConfigureDiveComputer::setState(ConfigureDiveComputer::states newState)
emit stateChanged(currentState);
}
-void ConfigureDiveComputer::writeSettingToDevice(device_data_t *data, QString settingName, QVariant settingValue)
-{
- setState(READING);
-
- if (writeThread)
- writeThread->deleteLater();
-
- writeThread = new WriteSettingsThread(this, data, settingName, settingValue);
- connect (writeThread, SIGNAL(error(QString)), this, SLOT(setError(QString)));
- connect (writeThread, SIGNAL(finished()), this, SLOT(writeThreadFinished()));
-
- writeThread->start();
-}
-
void ConfigureDiveComputer::setError(QString err)
{
lastError = err;
@@ -68,7 +46,7 @@ void ConfigureDiveComputer::setError(QString err)
void ConfigureDiveComputer::readThreadFinished()
{
setState(DONE);
- emit deviceSettings(readThread->result);
+ emit readFinished();
}
void ConfigureDiveComputer::writeThreadFinished()
@@ -79,108 +57,3 @@ void ConfigureDiveComputer::writeThreadFinished()
emit message(tr("Setting successfully written to device"));
}
}
-
-ReadSettingsThread::ReadSettingsThread(QObject *parent, device_data_t *data)
- : QThread(parent), data(data)
-{
-
-}
-
-void ReadSettingsThread::run()
-{
- dc_status_t rc;
- rc = dc_device_open(&data->device, data->context, data->descriptor, data->devname);
- if (rc == DC_STATUS_SUCCESS) {
- if (dc_device_get_type(data->device) == DC_FAMILY_HW_OSTC3) {
- unsigned char hw_data[10];
- hw_ostc3_device_version(data->device, hw_data, 10);
- QTextStream (&result) << "Device Version: " << hw_data; //just a test. I will work on decoding this
- } else {
- lastError = tr("This feature is not yet available for the selected dive computer.");
- emit error(lastError);
- }
- dc_device_close(data->device);
- } else {
- lastError = tr("Could not a establish connection to the dive computer.");
- emit error(lastError);
- }
-}
-
-WriteSettingsThread::WriteSettingsThread(QObject *parent, device_data_t *data, QString settingName, QVariant settingValue)
- : QThread(parent), data(data), m_settingName(settingName), m_settingValue(settingValue)
-{
-
-}
-
-void WriteSettingsThread::run()
-{
- bool supported = false;
- dc_status_t rc;
- rc = dc_device_open(&data->device, data->context, data->descriptor, data->devname);
- if (rc == DC_STATUS_SUCCESS) {
- dc_status_t result;
- if (m_settingName == "Name") {
- switch (dc_device_get_type(data->device)) {
- case DC_FAMILY_HW_OSTC3:
- supported = true;
- result = hw_ostc3_device_customtext(data->device, m_settingValue.toByteArray().data());
- break;
- case DC_FAMILY_HW_FROG:
- supported = true;
- result = hw_frog_device_customtext(data->device, m_settingValue.toByteArray().data());
- break;
- }
- }
- if (m_settingName == "DateAndTime") {
- QDateTime timeToSet = m_settingValue.toDateTime();
- 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();
-
- switch (dc_device_get_type(data->device)) {
- case DC_FAMILY_HW_OSTC3:
- supported = true;
- result = hw_ostc3_device_clock(data->device, &time);
- break;
- case DC_FAMILY_HW_OSTC:
- supported = true;
- result = hw_ostc_device_clock(data->device, &time);
- break;
- case DC_FAMILY_HW_FROG:
- supported = true;
- result = hw_frog_device_clock(data->device, &time);
- break;
- }
- }
- if (m_settingName == "Brightness") {
- switch (dc_device_get_type(data->device)) {
- case DC_FAMILY_HW_OSTC3:
- qDebug() << "Brightness";
- supported = true;
- unsigned char packet[1] = { m_settingValue.toInt() };
- result = hw_ostc3_device_config_write(data->device, 0x2D, packet, sizeof (packet));
- break;
- }
- }
- qDebug() << result;
- if (result != DC_STATUS_SUCCESS) {
- qDebug() << result;
- lastError = tr("An error occurred while sending data to the dive computer.");
- //Todo Update this message to change depending on actual result.
-
- emit error(lastError);
- }
- dc_device_close(data->device);
- } else {
- lastError = tr("Could not a establish connection to the dive computer.");
- emit error(lastError);
- }
- if (!supported) {
- lastError = tr("This feature is not yet available for the selected dive computer.");
- emit error(lastError);
- }
-}
diff --git a/qt-ui/configuredivecomputer.h b/qt-ui/configuredivecomputer.h
index 08c4e190f..65ceaa780 100644
--- a/qt-ui/configuredivecomputer.h
+++ b/qt-ui/configuredivecomputer.h
@@ -5,41 +5,15 @@
#include <QThread>
#include <QVariant>
#include "libdivecomputer.h"
+#include "configuredivecomputerthreads.h"
#include <QDateTime>
-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);
-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
public:
explicit ConfigureDiveComputer(QObject *parent = 0);
- void readSettings(device_data_t *data);
+ void readSettings(DeviceDetails *deviceDetails, device_data_t *data);
enum states {
INITIAL,
@@ -53,23 +27,23 @@ public:
QString lastError;
states currentState;
+ DeviceDetails *m_deviceDetails;
+ device_data_t *m_data;
+ void saveDeviceDetails();
+ void fetchDeviceDetails();
- void setDeviceName(device_data_t *data, QString newName);
- void setDeviceDateAndTime(device_data_t *data, QDateTime dateAndTime);
- void setDeviceBrightness(device_data_t *data, int brighnessLevel);
signals:
- void deviceSettings(QString settings);
void message(QString msg);
void error(QString err);
void readFinished();
void writeFinished();
void stateChanged(states newState);
+
private:
ReadSettingsThread *readThread;
WriteSettingsThread *writeThread;
void setState(states newState);
- void writeSettingToDevice(device_data_t *data, QString settingName, QVariant settingValue);
private slots:
void readThreadFinished();
void writeThreadFinished();
diff --git a/qt-ui/configuredivecomputerdialog.cpp b/qt-ui/configuredivecomputerdialog.cpp
index 1d5b1d7f8..8ae250468 100644
--- a/qt-ui/configuredivecomputerdialog.cpp
+++ b/qt-ui/configuredivecomputerdialog.cpp
@@ -33,14 +33,16 @@ ConfigureDiveComputerDialog::ConfigureDiveComputerDialog(QWidget *parent) :
ui(new Ui::ConfigureDiveComputerDialog),
config(0),
vendorModel(0),
- productModel(0)
+ productModel(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(deviceSettings(QString)), ui->availableDetails, SLOT(setText(QString)));
+ connect (config, SIGNAL(readFinished()), this, SLOT(deviceReadFinished()));
fill_computer_list();
@@ -157,7 +159,7 @@ void ConfigureDiveComputerDialog::readSettings()
ui->errorLabel->clear();
getDeviceData();
- config->readSettings(&device_data);
+ config->readSettings(deviceDetails, &device_data);
}
void ConfigureDiveComputerDialog::configMessage(QString msg)
@@ -181,6 +183,8 @@ void ConfigureDiveComputerDialog::getDeviceData()
set_default_dive_computer(device_data.vendor, device_data.product);
set_default_dive_computer_device(device_data.devname);
+
+ //deviceDetails->setData(&device_data);
}
void ConfigureDiveComputerDialog::on_cancel_clicked()
@@ -188,31 +192,13 @@ void ConfigureDiveComputerDialog::on_cancel_clicked()
this->close();
}
-void ConfigureDiveComputerDialog::on_setDeviceName_clicked()
+void ConfigureDiveComputerDialog::deviceReadFinished()
{
- ui->statusLabel->clear();
- ui->errorLabel->clear();
- ui->availableDetails->clear();
-
- QString newDeviceName = QInputDialog::getText(this, tr("Set device name"), tr("Enter the new name for this device:"));
- if (newDeviceName.length() > 0) {
- getDeviceData();
- config->setDeviceName(&device_data, newDeviceName);
- }
+ ui->brightnessComboBox->setCurrentIndex(config->m_deviceDetails->brightness());
}
-void ConfigureDiveComputerDialog::on_setDateAndTime_clicked()
+void ConfigureDiveComputerDialog::on_saveSettingsPushButton_clicked()
{
- ui->statusLabel->clear();
- ui->errorLabel->clear();
- ui->availableDetails->clear();
-
- getDeviceData();
- config->setDeviceDateAndTime(&device_data, QDateTime::currentDateTime());
+ config->saveDeviceDetails();
}
-void ConfigureDiveComputerDialog::on_setBrightnessButton_clicked()
-{
- getDeviceData();
- config->setDeviceBrightness(&device_data, ui->brightnessComboBox->currentIndex());
-}
diff --git a/qt-ui/configuredivecomputerdialog.h b/qt-ui/configuredivecomputerdialog.h
index 7c4243ab8..5a8bf63e1 100644
--- a/qt-ui/configuredivecomputerdialog.h
+++ b/qt-ui/configuredivecomputerdialog.h
@@ -4,8 +4,7 @@
#include <QDialog>
#include <QStringListModel>
#include "../libdivecomputer.h"
-
-class ConfigureDiveComputer;
+#include "configuredivecomputer.h"
namespace Ui {
class ConfigureDiveComputerDialog;
@@ -28,12 +27,8 @@ private slots:
void configMessage(QString msg);
void configError(QString err);
void on_cancel_clicked();
- void on_setDeviceName_clicked();
-
- void on_setDateAndTime_clicked();
-
- void on_setBrightnessButton_clicked();
-
+ void deviceReadFinished();
+ void on_saveSettingsPushButton_clicked();
private:
Ui::ConfigureDiveComputerDialog *ui;
@@ -49,6 +44,8 @@ private:
QStringListModel *productModel;
void fill_computer_list();
void fill_device_list(int dc_type);
+
+ DeviceDetails *deviceDetails;
};
#endif // CONFIGUREDIVECOMPUTERDIALOG_H
diff --git a/qt-ui/configuredivecomputerdialog.ui b/qt-ui/configuredivecomputerdialog.ui
index cb4dacb23..d7c584e0c 100644
--- a/qt-ui/configuredivecomputerdialog.ui
+++ b/qt-ui/configuredivecomputerdialog.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>362</width>
- <height>375</height>
+ <width>343</width>
+ <height>365</height>
</rect>
</property>
<property name="windowTitle">
@@ -92,32 +92,15 @@
</layout>
</item>
<item>
- <widget class="QTextBrowser" name="availableDetails"/>
- </item>
- <item>
<layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="0">
- <widget class="QPushButton" name="setDeviceName">
- <property name="text">
- <string>Set Device Name</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QPushButton" name="setDateAndTime">
- <property name="text">
- <string>Set Date &amp;&amp; Time</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
+ <item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Brightness:</string>
</property>
</widget>
</item>
- <item row="1" column="1">
+ <item row="3" column="1">
<widget class="QComboBox" name="brightnessComboBox">
<item>
<property name="text">
@@ -136,16 +119,91 @@
</item>
</widget>
</item>
- <item row="1" column="2">
- <widget class="QToolButton" name="setBrightnessButton">
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="serialNoLineEdit">
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <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="1">
+ <widget class="QLineEdit" name="customTextLlineEdit"/>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="label_6">
+ <property name="text">
+ <string>Language:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_7">
+ <property name="text">
+ <string>Serial No.</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>Custom Text:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_8">
<property name="text">
- <string>...</string>
+ <string>Firmware Version:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="firmwareVersionLineEdit">
+ <property name="readOnly">
+ <bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
<widget class="QLabel" name="errorLabel">
<property name="styleSheet">
<string notr="true">color: rgb(242, 19, 25);</string>
@@ -165,6 +223,13 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
+ <widget class="QPushButton" name="saveSettingsPushButton">
+ <property name="text">
+ <string>Save Chages to Device</string>
+ </property>
+ </widget>
+ </item>
+ <item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -188,6 +253,20 @@
</item>
</layout>
</widget>
+ <tabstops>
+ <tabstop>vendor</tabstop>
+ <tabstop>product</tabstop>
+ <tabstop>device</tabstop>
+ <tabstop>search</tabstop>
+ <tabstop>retrieveDetails</tabstop>
+ <tabstop>serialNoLineEdit</tabstop>
+ <tabstop>firmwareVersionLineEdit</tabstop>
+ <tabstop>customTextLlineEdit</tabstop>
+ <tabstop>brightnessComboBox</tabstop>
+ <tabstop>languageComboBox</tabstop>
+ <tabstop>saveSettingsPushButton</tabstop>
+ <tabstop>cancel</tabstop>
+ </tabstops>
<resources/>
<connections/>
</ui>
diff --git a/qt-ui/configuredivecomputerthreads.cpp b/qt-ui/configuredivecomputerthreads.cpp
new file mode 100644
index 000000000..f1ac3b5d9
--- /dev/null
+++ b/qt-ui/configuredivecomputerthreads.cpp
@@ -0,0 +1,81 @@
+#include "configuredivecomputerthreads.h"
+#include "libdivecomputer/hw.h"
+#include <QDebug>
+
+ReadSettingsThread::ReadSettingsThread(QObject *parent, DeviceDetails *deviceDetails, device_data_t *data)
+ : QThread(parent), m_deviceDetails(deviceDetails), 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) {
+ switch (dc_device_get_type(m_data->device)) {
+ 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("");
+ unsigned char uData[1];
+ rc = hw_ostc3_device_config_read(m_data->device, 0x2D, uData, sizeof(uData));
+ if (rc == DC_STATUS_SUCCESS)
+ m_deviceDetails->setBrightness(uData[0]);
+ rc = hw_ostc3_device_config_read(m_data->device, 0x32, uData, sizeof(uData));
+ if (rc == DC_STATUS_SUCCESS)
+ m_deviceDetails->setLanguage(uData[0]);
+ rc = hw_ostc3_device_config_read(m_data->device, 0x33, uData, sizeof(uData));
+ if (rc == DC_STATUS_SUCCESS)
+ m_deviceDetails->setDateFormat(uData[0]);
+ break;
+
+ }
+ 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, DeviceDetails *deviceDetails, QString settingName, QVariant settingValue)
+ : QThread(parent), m_deviceDetails(deviceDetails), m_settingName(settingName), m_settingValue(settingValue)
+{
+
+}
+
+void WriteSettingsThread::run()
+{
+ bool supported = false;
+ dc_status_t rc;
+
+ switch (dc_device_get_type(data->device)) {
+ case DC_FAMILY_HW_OSTC3:
+ rc = dc_device_open(&data->device, data->context, data->descriptor, data->devname);
+ if (rc == DC_STATUS_SUCCESS) {
+
+ } else {
+ lastError = tr("Could not a establish connection to the dive computer.");
+ emit error(lastError);
+ }
+ break;
+
+ if (!supported) {
+ lastError = tr("This feature is not yet available for the selected dive computer.");
+ emit error(lastError);
+ }
+ }
+}
diff --git a/qt-ui/configuredivecomputerthreads.h b/qt-ui/configuredivecomputerthreads.h
new file mode 100644
index 000000000..c684cddaa
--- /dev/null
+++ b/qt-ui/configuredivecomputerthreads.h
@@ -0,0 +1,42 @@
+#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, DeviceDetails *deviceDetails, device_data_t *data);
+ virtual void run();
+ QString result;
+ QString lastError;
+signals:
+ void error(QString err);
+private:
+ DeviceDetails *m_deviceDetails;
+ device_data_t *m_data;
+};
+
+class WriteSettingsThread : public QThread {
+ Q_OBJECT
+public:
+ WriteSettingsThread(QObject *parent, DeviceDetails *deviceDetails, 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;
+
+ DeviceDetails *m_deviceDetails;
+};
+
+#endif // CONFIGUREDIVECOMPUTERTHREADS_H
diff --git a/qt-ui/devicedetails.cpp b/qt-ui/devicedetails.cpp
new file mode 100644
index 000000000..e5a90b9da
--- /dev/null
+++ b/qt-ui/devicedetails.cpp
@@ -0,0 +1,88 @@
+#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;
+}
diff --git a/qt-ui/devicedetails.h b/qt-ui/devicedetails.h
new file mode 100644
index 000000000..9f5e7c1dd
--- /dev/null
+++ b/qt-ui/devicedetails.h
@@ -0,0 +1,54 @@
+#ifndef DEVICEDETAILS_H
+#define DEVICEDETAILS_H
+
+#include <QObject>
+#include <QDateTime>
+#include "libdivecomputer.h"
+
+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);
+
+private:
+ device_data_t *m_data;
+ QString m_serialNo;
+ QString m_firmwareVersion;
+ QString m_customText;
+ int m_brightness;
+ int m_diveModeColor;
+ int m_language;
+ int m_dateFormat;
+ int m_lastDeco;
+};
+
+
+#endif // DEVICEDETAILS_H