diff options
-rw-r--r-- | qt-ui/configuredivecomputer.cpp | 8 | ||||
-rw-r--r-- | qt-ui/configuredivecomputerdialog.cpp | 4 | ||||
-rw-r--r-- | qt-ui/configuredivecomputerdialog.ui | 87 | ||||
-rw-r--r-- | qt-ui/configuredivecomputerthreads.cpp | 16 |
4 files changed, 95 insertions, 20 deletions
diff --git a/qt-ui/configuredivecomputer.cpp b/qt-ui/configuredivecomputer.cpp index c88534e9f..a91a48d25 100644 --- a/qt-ui/configuredivecomputer.cpp +++ b/qt-ui/configuredivecomputer.cpp @@ -61,6 +61,8 @@ bool ConfigureDiveComputer::saveXMLBackup(QString fileName, DeviceDetails *detai xml += "\n</DiveComputer>"; xml += "\n<Settings>"; xml += addSettingToXML("CustomText", details->customText()); + xml += addSettingToXML("DiveMode", details->diveMode()); + xml += addSettingToXML("Saturation", details->saturation()); xml += addSettingToXML("LastDeco", details->lastDeco()); xml += addSettingToXML("Brightness", details->brightness()); xml += addSettingToXML("Units", details->units()); @@ -126,6 +128,12 @@ bool ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails *de if (settingName == "CustomText") details->setCustomText(keyString); + if (settingName == "Saturation") + details->setSaturation(keyString.toInt()); + + if (settingName == "DiveMode") + details->setDiveMode(keyString.toInt()); + if (settingName == "LastDeco") details->setLastDeco(keyString.toInt()); diff --git a/qt-ui/configuredivecomputerdialog.cpp b/qt-ui/configuredivecomputerdialog.cpp index d9cee9229..769f2cdc8 100644 --- a/qt-ui/configuredivecomputerdialog.cpp +++ b/qt-ui/configuredivecomputerdialog.cpp @@ -116,6 +116,8 @@ void ConfigureDiveComputerDialog::fill_computer_list() void ConfigureDiveComputerDialog::populateDeviceDetails() { deviceDetails->setCustomText(ui->customTextLlineEdit->text()); + deviceDetails->setDiveMode(ui->diveModeComboBox->currentIndex()); + deviceDetails->setSaturation(ui->saturationSpinBox->value()); deviceDetails->setLastDeco(ui->lastDecoSpinBox->value()); deviceDetails->setBrightness(ui->brightnessComboBox->currentIndex()); deviceDetails->setUnits(ui->unitsComboBox->currentIndex()); @@ -187,6 +189,8 @@ 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->lastDecoSpinBox->setValue(deviceDetails->lastDeco()); ui->brightnessComboBox->setCurrentIndex(deviceDetails->brightness()); ui->unitsComboBox->setCurrentIndex(deviceDetails->units()); diff --git a/qt-ui/configuredivecomputerdialog.ui b/qt-ui/configuredivecomputerdialog.ui index 22bd9b563..2d8825847 100644 --- a/qt-ui/configuredivecomputerdialog.ui +++ b/qt-ui/configuredivecomputerdialog.ui @@ -98,28 +98,28 @@ <string>HW OSTC 3</string> </attribute> <layout class="QGridLayout" name="gridLayout"> - <item row="3" column="1"> + <item row="4" column="1"> <widget class="QSpinBox" name="lastDecoSpinBox"> <property name="suffix"> <string> m</string> </property> </widget> </item> - <item row="7" column="0" colspan="4"> + <item row="8" column="0" colspan="4"> <widget class="QCheckBox" name="dateTimeSyncCheckBox"> <property name="text"> <string>Sync dive computer time with PC</string> </property> </widget> </item> - <item row="4" column="2"> + <item row="5" column="2"> <widget class="QLabel" name="label_11"> <property name="text"> <string>Units:</string> </property> </widget> </item> - <item row="5" column="2"> + <item row="6" column="2"> <widget class="QLabel" name="label_13"> <property name="text"> <string>Salinity (0-5%):</string> @@ -150,14 +150,14 @@ </property> </widget> </item> - <item row="4" column="0"> + <item row="5" column="0"> <widget class="QLabel" name="label_9"> <property name="text"> <string>Date Format:</string> </property> </widget> </item> - <item row="6" column="2"> + <item row="7" column="2"> <widget class="QLabel" name="label_15"> <property name="text"> <string>Compass Gain:</string> @@ -171,14 +171,14 @@ </property> </widget> </item> - <item row="3" column="0"> + <item row="4" column="0"> <widget class="QLabel" name="label_10"> <property name="text"> <string>Last Deco:</string> </property> </widget> </item> - <item row="8" column="0" colspan="4"> + <item row="9" column="0" colspan="4"> <spacer name="verticalSpacer"> <property name="orientation"> <enum>Qt::Vertical</enum> @@ -198,7 +198,7 @@ </property> </widget> </item> - <item row="6" column="1"> + <item row="7" column="1"> <widget class="QComboBox" name="diveModeColour"> <item> <property name="text"> @@ -222,7 +222,7 @@ </item> </widget> </item> - <item row="4" column="1"> + <item row="5" column="1"> <widget class="QComboBox" name="dateFormatComboBox"> <item> <property name="text"> @@ -241,7 +241,7 @@ </item> </widget> </item> - <item row="4" column="3"> + <item row="5" column="3"> <widget class="QComboBox" name="unitsComboBox"> <item> <property name="text"> @@ -279,7 +279,7 @@ </item> </widget> </item> - <item row="3" column="2"> + <item row="4" column="2"> <widget class="QLabel" name="label_4"> <property name="text"> <string>Brightness:</string> @@ -293,21 +293,21 @@ </property> </widget> </item> - <item row="6" column="0"> + <item row="7" column="0"> <widget class="QLabel" name="label_14"> <property name="text"> <string>Dive Mode Colour:</string> </property> </widget> </item> - <item row="5" column="0"> + <item row="6" column="0"> <widget class="QLabel" name="label_12"> <property name="text"> <string>Sampling Rate:</string> </property> </widget> </item> - <item row="3" column="3"> + <item row="4" column="3"> <widget class="QComboBox" name="brightnessComboBox"> <item> <property name="text"> @@ -326,7 +326,7 @@ </item> </widget> </item> - <item row="5" column="1"> + <item row="6" column="1"> <widget class="QComboBox" name="samplingRateComboBox"> <item> <property name="text"> @@ -347,7 +347,7 @@ </property> </widget> </item> - <item row="5" column="3"> + <item row="6" column="3"> <widget class="QSpinBox" name="salinitySpinBox"> <property name="suffix"> <string>%</string> @@ -357,7 +357,7 @@ </property> </widget> </item> - <item row="6" column="3"> + <item row="7" column="3"> <widget class="QComboBox" name="compassGainComboBox"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> @@ -407,6 +407,51 @@ </item> </widget> </item> + <item row="3" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Dive Mode:</string> + </property> + </widget> + </item> + <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="3" column="2"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Saturation:</string> + </property> + </widget> + </item> + <item row="3" column="3"> + <widget class="QSpinBox" name="saturationSpinBox"> + <property name="suffix"> + <string>%</string> + </property> + </widget> + </item> </layout> </widget> </widget> @@ -455,7 +500,7 @@ </layout> </widget> <tabstops> - <tabstop>device</tabstop> + <tabstop>cancel</tabstop> <tabstop>search</tabstop> <tabstop>retrieveDetails</tabstop> <tabstop>saveSettingsPushButton</tabstop> @@ -466,6 +511,8 @@ <tabstop>firmwareVersionLineEdit</tabstop> <tabstop>customTextLlineEdit</tabstop> <tabstop>languageComboBox</tabstop> + <tabstop>diveModeComboBox</tabstop> + <tabstop>saturationSpinBox</tabstop> <tabstop>lastDecoSpinBox</tabstop> <tabstop>brightnessComboBox</tabstop> <tabstop>dateFormatComboBox</tabstop> @@ -475,7 +522,7 @@ <tabstop>diveModeColour</tabstop> <tabstop>compassGainComboBox</tabstop> <tabstop>dateTimeSyncCheckBox</tabstop> - <tabstop>cancel</tabstop> + <tabstop>device</tabstop> </tabstops> <resources/> <connections/> diff --git a/qt-ui/configuredivecomputerthreads.cpp b/qt-ui/configuredivecomputerthreads.cpp index 369640459..f0e2bde6e 100644 --- a/qt-ui/configuredivecomputerthreads.cpp +++ b/qt-ui/configuredivecomputerthreads.cpp @@ -34,6 +34,14 @@ void ReadSettingsThread::run() //Read general settings unsigned char uData[1] = {0}; + //DiveMode + rc = hw_ostc3_device_config_read(m_data->device, 0x20, uData, sizeof(uData)); + if (rc == DC_STATUS_SUCCESS) + m_deviceDetails->setDiveMode(uData[0]); + //Saturation + rc = hw_ostc3_device_config_read(m_data->device, 0x2A, uData, sizeof(uData)); + if (rc == DC_STATUS_SUCCESS) + m_deviceDetails->setSaturation(uData[0]); //LastDeco rc = hw_ostc3_device_config_read(m_data->device, 0x2D, uData, sizeof(uData)); if (rc == DC_STATUS_SUCCESS) @@ -122,6 +130,14 @@ void WriteSettingsThread::run() 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, 0x20, data, sizeof(data)); + + //saturation + data[0] = m_deviceDetails->saturation(); + hw_ostc3_device_config_write(m_data->device, 0x2A, data, sizeof(data)); + //last deco data[0] = m_deviceDetails->lastDeco(); hw_ostc3_device_config_write(m_data->device, 0x2C, data, sizeof(data)); |