Merge branch 'joshua-gsoc' of git://github.com/thiagomacieira/subsurface into josh

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>

Conflicts:
	subsurface.pro
This commit is contained in:
Dirk Hohndel 2014-08-18 20:25:06 -05:00
commit 150676ce3d
15 changed files with 3198 additions and 4 deletions

View file

@ -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);
}

View file

@ -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

View file

@ -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>

View file

@ -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;

View file

@ -146,6 +146,8 @@ slots:
void on_copy_triggered();
void on_paste_triggered();
void on_actionConfigure_Dive_Computer_triggered();
protected:
void closeEvent(QCloseEvent *);

View file

@ -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>