diff options
-rw-r--r-- | qt-ui/configuredivecomputer.cpp | 4 | ||||
-rw-r--r-- | qt-ui/configuredivecomputerdialog.cpp | 10 | ||||
-rw-r--r-- | qt-ui/configuredivecomputerdialog.ui | 474 | ||||
-rw-r--r-- | qt-ui/configuredivecomputerthreads.cpp | 25 |
4 files changed, 354 insertions, 159 deletions
diff --git a/qt-ui/configuredivecomputer.cpp b/qt-ui/configuredivecomputer.cpp index a91a48d25..01df1c744 100644 --- a/qt-ui/configuredivecomputer.cpp +++ b/qt-ui/configuredivecomputer.cpp @@ -63,6 +63,7 @@ bool ConfigureDiveComputer::saveXMLBackup(QString fileName, DeviceDetails *detai xml += addSettingToXML("CustomText", details->customText()); xml += addSettingToXML("DiveMode", details->diveMode()); xml += addSettingToXML("Saturation", details->saturation()); + xml += addSettingToXML("Desaturation", details->desaturation()); xml += addSettingToXML("LastDeco", details->lastDeco()); xml += addSettingToXML("Brightness", details->brightness()); xml += addSettingToXML("Units", details->units()); @@ -131,6 +132,9 @@ bool ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails *de if (settingName == "Saturation") details->setSaturation(keyString.toInt()); + if (settingName == "Desaturation") + details->setDesaturation(keyString.toInt()); + if (settingName == "DiveMode") details->setDiveMode(keyString.toInt()); diff --git a/qt-ui/configuredivecomputerdialog.cpp b/qt-ui/configuredivecomputerdialog.cpp index 769f2cdc8..ece02a3d0 100644 --- a/qt-ui/configuredivecomputerdialog.cpp +++ b/qt-ui/configuredivecomputerdialog.cpp @@ -118,6 +118,7 @@ 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()); @@ -168,7 +169,7 @@ void ConfigureDiveComputerDialog::on_cancel_clicked() void ConfigureDiveComputerDialog::deviceReadFinished() { - + ui->statusLabel->setText(tr("Dive computer details read successfully.")); } void ConfigureDiveComputerDialog::on_saveSettingsPushButton_clicked() @@ -191,6 +192,7 @@ void ConfigureDiveComputerDialog::reloadValues() 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()); @@ -200,6 +202,12 @@ void ConfigureDiveComputerDialog::reloadValues() 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))); } diff --git a/qt-ui/configuredivecomputerdialog.ui b/qt-ui/configuredivecomputerdialog.ui index 076b66fd1..6099535e8 100644 --- a/qt-ui/configuredivecomputerdialog.ui +++ b/qt-ui/configuredivecomputerdialog.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>592</width> - <height>507</height> + <width>701</width> + <height>620</height> </rect> </property> <property name="windowTitle"> @@ -98,48 +98,48 @@ <string>HW OSTC 3</string> </attribute> <layout class="QGridLayout" name="gridLayout"> - <item row="5" column="1"> - <widget class="QSpinBox" name="lastDecoSpinBox"> - <property name="suffix"> - <string> m</string> + <item row="0" column="0"> + <widget class="QLabel" name="label_7"> + <property name="text"> + <string>Serial No.</string> </property> </widget> </item> - <item row="8" column="0"> - <widget class="QLabel" name="label_14"> - <property name="text"> - <string>Dive Mode Colour:</string> + <item row="0" column="1"> + <widget class="QLineEdit" name="serialNoLineEdit"> + <property name="readOnly"> + <bool>true</bool> </property> </widget> </item> - <item row="9" column="0" colspan="4"> - <widget class="QCheckBox" name="dateTimeSyncCheckBox"> + <item row="1" column="0"> + <widget class="QLabel" name="label_8"> <property name="text"> - <string>Sync dive computer time with PC</string> + <string>Firmware Version:</string> </property> </widget> </item> - <item row="6" column="2"> - <widget class="QLabel" name="label_11"> - <property name="text"> - <string>Units:</string> + <item row="1" column="1"> + <widget class="QLineEdit" name="firmwareVersionLineEdit"> + <property name="readOnly"> + <bool>true</bool> </property> </widget> </item> - <item row="7" column="2"> - <widget class="QLabel" name="label_13"> + <item row="2" column="0"> + <widget class="QLabel" name="label_5"> <property name="text"> - <string>Salinity (0-5%):</string> + <string>Custom Text:</string> </property> </widget> </item> - <item row="7" column="3"> - <widget class="QSpinBox" name="salinitySpinBox"> - <property name="suffix"> - <string>%</string> - </property> - <property name="maximum"> - <number>5</number> + <item row="2" 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> @@ -150,41 +150,86 @@ </property> </widget> </item> - <item row="6" column="0"> - <widget class="QLabel" name="label_9"> + <item row="2" 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="3" column="0"> + <widget class="QLabel" name="label"> <property name="text"> - <string>Date Format:</string> + <string>Dive Mode:</string> </property> </widget> </item> - <item row="2" column="1"> - <widget class="QLineEdit" name="customTextLlineEdit"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>1</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> + <item row="3" 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="0"> - <widget class="QLabel" name="label_5"> + <item row="4" column="0"> + <widget class="QLabel" name="label_2"> <property name="text"> - <string>Custom Text:</string> + <string>Saturation:</string> </property> </widget> </item> - <item row="8" column="2"> - <widget class="QLabel" name="label_15"> + <item row="4" column="1"> + <widget class="QSpinBox" name="saturationSpinBox"> + <property name="suffix"> + <string>%</string> + </property> + </widget> + </item> + <item row="4" column="2"> + <widget class="QLabel" name="label_16"> <property name="text"> - <string>Compass Gain:</string> + <string>Desaturation:</string> </property> </widget> </item> - <item row="1" column="1"> - <widget class="QLineEdit" name="firmwareVersionLineEdit"> - <property name="readOnly"> - <bool>true</bool> + <item row="4" column="3"> + <widget class="QSpinBox" name="desaturationSpinBox"> + <property name="suffix"> + <string>%</string> </property> </widget> </item> @@ -195,49 +240,45 @@ </property> </widget> </item> - <item row="0" column="1"> - <widget class="QLineEdit" name="serialNoLineEdit"> - <property name="readOnly"> - <bool>true</bool> + <item row="5" column="1"> + <widget class="QSpinBox" name="lastDecoSpinBox"> + <property name="suffix"> + <string> m</string> </property> </widget> </item> - <item row="8" column="1"> - <widget class="QComboBox" name="diveModeColour"> - <item> - <property name="text"> - <string>Standard</string> - </property> - </item> + <item row="5" column="2"> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string>Brightness:</string> + </property> + </widget> + </item> + <item row="5" column="3"> + <widget class="QComboBox" name="brightnessComboBox"> <item> <property name="text"> - <string>Red</string> + <string>Eco</string> </property> </item> <item> <property name="text"> - <string>Green</string> + <string>Medium</string> </property> </item> <item> <property name="text"> - <string>Blue</string> + <string>High</string> </property> </item> </widget> </item> - <item row="10" column="0" colspan="4"> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> + <item row="6" column="0"> + <widget class="QLabel" name="label_9"> + <property name="text"> + <string>Date Format:</string> </property> - </spacer> + </widget> </item> <item row="6" column="1"> <widget class="QComboBox" name="dateFormatComboBox"> @@ -258,28 +299,11 @@ </item> </widget> </item> - <item row="2" 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> + <item row="6" column="2"> + <widget class="QLabel" name="label_11"> + <property name="text"> + <string>Units:</string> + </property> </widget> </item> <item row="6" column="3"> @@ -296,20 +320,6 @@ </item> </widget> </item> - <item row="5" column="2"> - <widget class="QLabel" name="label_4"> - <property name="text"> - <string>Brightness:</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="7" column="0"> <widget class="QLabel" name="label_12"> <property name="text"> @@ -317,25 +327,6 @@ </property> </widget> </item> - <item row="5" 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="7" column="1"> <widget class="QComboBox" name="samplingRateComboBox"> <item> @@ -350,44 +341,61 @@ </item> </widget> </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_8"> + <item row="7" column="2"> + <widget class="QLabel" name="label_13"> <property name="text"> - <string>Firmware Version:</string> + <string>Salinity (0-5%):</string> </property> </widget> </item> - <item row="3" column="0"> - <widget class="QLabel" name="label"> + <item row="7" column="3"> + <widget class="QSpinBox" name="salinitySpinBox"> + <property name="suffix"> + <string>%</string> + </property> + <property name="maximum"> + <number>5</number> + </property> + </widget> + </item> + <item row="8" column="0"> + <widget class="QLabel" name="label_14"> <property name="text"> - <string>Dive Mode:</string> + <string>Dive Mode Colour:</string> </property> </widget> </item> - <item row="3" column="1"> - <widget class="QComboBox" name="diveModeComboBox"> + <item row="8" column="1"> + <widget class="QComboBox" name="diveModeColour"> <item> <property name="text"> - <string>OC</string> + <string>Standard</string> </property> </item> <item> <property name="text"> - <string>CC</string> + <string>Red</string> </property> </item> <item> <property name="text"> - <string>Gauge</string> + <string>Green</string> </property> </item> <item> <property name="text"> - <string>Apnea</string> + <string>Blue</string> </property> </item> </widget> </item> + <item row="8" column="2"> + <widget class="QLabel" name="label_15"> + <property name="text"> + <string>Compass Gain:</string> + </property> + </widget> + </item> <item row="8" column="3"> <widget class="QComboBox" name="compassGainComboBox"> <property name="sizePolicy"> @@ -438,33 +446,183 @@ </item> </widget> </item> - <item row="4" column="0"> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>Saturation:</string> - </property> + <item row="9" column="0" colspan="2"> + <widget class="QTableWidget" name="ostc3GasTable"> + <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>Gas No.</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>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="4" column="1"> - <widget class="QSpinBox" name="saturationSpinBox"> - <property name="suffix"> - <string>%</string> - </property> + <item row="9" column="2" colspan="2"> + <widget class="QTableWidget" name="ostc3DilTable"> + <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>Gas No.</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>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="4" column="2"> - <widget class="QLabel" name="label_16"> + <item row="10" column="0" colspan="2"> + <widget class="QCheckBox" name="dateTimeSyncCheckBox"> <property name="text"> - <string>Desaturation:</string> + <string>Sync dive computer time with PC</string> </property> </widget> </item> - <item row="4" column="3"> - <widget class="QSpinBox" name="desaturationSpinBox"> - <property name="suffix"> - <string>%</string> + <item row="11" column="0" colspan="4"> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> </property> - </widget> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> </item> </layout> </widget> diff --git a/qt-ui/configuredivecomputerthreads.cpp b/qt-ui/configuredivecomputerthreads.cpp index f0e2bde6e..3afb11bc5 100644 --- a/qt-ui/configuredivecomputerthreads.cpp +++ b/qt-ui/configuredivecomputerthreads.cpp @@ -32,6 +32,31 @@ void ReadSettingsThread::run() 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, 0x10, gasData, sizeof(gasData)); + if (rc == DC_STATUS_SUCCESS) { + //Gas 1 read successful + gas gas1; + gas1.depth = gasData[3]; + gas1.oxygen = gasData[0]; + gas1.helium = gasData[1]; + gas1.type = gasData[2]; + } + + m_deviceDetails->setGas1(gas1); + m_deviceDetails->setGas2(gas2); + m_deviceDetails->setGas3(gas3); + m_deviceDetails->setGas4(gas4); + m_deviceDetails->setGas5(gas5); + //Read general settings unsigned char uData[1] = {0}; //DiveMode |