summaryrefslogtreecommitdiffstats
path: root/qt-ui/configuredivecomputerdialog.cpp
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2014-10-12 16:51:30 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-10-12 12:32:21 -0400
commit9c0e2fc823bd75ca4c01ee4cb66b5153b7cead4f (patch)
tree39f475446ea7dbc257c4eb95cb35f2773b60557b /qt-ui/configuredivecomputerdialog.cpp
parent3836e640928be83a17910e4c1ae0b6ba564b08a9 (diff)
downloadsubsurface-9c0e2fc823bd75ca4c01ee4cb66b5153b7cead4f.tar.gz
Connect the Suunto Vyper Configuration ui
This code connects up the configuration ui with the backing data structures thats gets read/written to/from the devices. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/configuredivecomputerdialog.cpp')
-rw-r--r--qt-ui/configuredivecomputerdialog.cpp66
1 files changed, 66 insertions, 0 deletions
diff --git a/qt-ui/configuredivecomputerdialog.cpp b/qt-ui/configuredivecomputerdialog.cpp
index 39ec9fbc2..635740a24 100644
--- a/qt-ui/configuredivecomputerdialog.cpp
+++ b/qt-ui/configuredivecomputerdialog.cpp
@@ -116,6 +116,18 @@ void ConfigureDiveComputerDialog::fill_computer_list()
void ConfigureDiveComputerDialog::populateDeviceDetails()
{
+ switch(ui->dcStackedWidget->currentIndex()) {
+ case 0:
+ populateDeviceDetailsOSTC3();
+ break;
+ case 1:
+ populateDeviceDetailsSuuntoVyper();
+ break;
+ }
+}
+
+void ConfigureDiveComputerDialog::populateDeviceDetailsOSTC3()
+{
deviceDetails->setCustomText(ui->customTextLlineEdit->text());
deviceDetails->setDiveMode(ui->diveModeComboBox->currentIndex());
deviceDetails->setSaturation(ui->saturationSpinBox->value());
@@ -236,6 +248,23 @@ void ConfigureDiveComputerDialog::populateDeviceDetails()
deviceDetails->setSp5(sp5);
}
+void ConfigureDiveComputerDialog::populateDeviceDetailsSuuntoVyper()
+{
+ deviceDetails->setCustomText(ui->customTextLlineEdit_1->text());
+ deviceDetails->setSamplingRate(ui->samplingRateComboBox_1->currentIndex() == 3 ? 60 : (ui->samplingRateComboBox_1->currentIndex() + 1) * 10);
+ deviceDetails->setAltitude(ui->altitudeRangeComboBox->currentIndex());
+ deviceDetails->setPersonalSafety(ui->personalSafetyComboBox->currentIndex());
+ deviceDetails->setTimeFormat(ui->timeFormatComboBox->currentIndex());
+ deviceDetails->setUnits(ui->unitsComboBox_1->currentIndex());
+ deviceDetails->setDiveMode(ui->diveModeComboBox_1->currentIndex());
+ deviceDetails->setLightEnabled(ui->lightCheckBox->isChecked());
+ deviceDetails->setLight(ui->lightSpinBox->value());
+ deviceDetails->setAlarmDepthEnabled(ui->alarmDepthCheckBox->isChecked());
+ deviceDetails->setAlarmDepth(units_to_depth(ui->alarmDepthDoubleSpinBox->value()));
+ deviceDetails->setAlarmTimeEnabled(ui->alarmTimeCheckBox->isChecked());
+ deviceDetails->setAlarmTime(ui->alarmTimeSpinBox->value());
+}
+
void ConfigureDiveComputerDialog::readSettings()
{
ui->statusLabel->clear();
@@ -293,6 +322,18 @@ void ConfigureDiveComputerDialog::deviceDetailsReceived(DeviceDetails *newDevice
void ConfigureDiveComputerDialog::reloadValues()
{
+ switch(ui->dcStackedWidget->currentIndex()) {
+ case 0:
+ reloadValuesOSTC3();
+ break;
+ case 1:
+ reloadValuesSuuntoVyper();
+ break;
+ }
+}
+
+void ConfigureDiveComputerDialog::reloadValuesOSTC3()
+{
ui->serialNoLineEdit->setText(deviceDetails->serialNo());
ui->firmwareVersionLineEdit->setText(deviceDetails->firmwareVersion());
ui->customTextLlineEdit->setText(deviceDetails->customText());
@@ -390,6 +431,31 @@ void ConfigureDiveComputerDialog::reloadValues()
ui->ostc3SetPointTable->setItem(4, 2, new QTableWidgetItem(QString::number(deviceDetails->sp5().depth)));
}
+void ConfigureDiveComputerDialog::reloadValuesSuuntoVyper()
+{
+ const char *depth_unit;
+ ui->maxDepthDoubleSpinBox->setValue(get_depth_units(deviceDetails->maxDepth(), NULL, &depth_unit));
+ ui->maxDepthDoubleSpinBox->setSuffix(depth_unit);
+ ui->totalTimeSpinBox->setValue(deviceDetails->totalTime());
+ ui->numberOfDivesSpinBox->setValue(deviceDetails->numberOfDives());
+ ui->modelLineEdit->setText(deviceDetails->model());
+ ui->firmwareVersionLineEdit_1->setText(deviceDetails->firmwareVersion());
+ ui->serialNoLineEdit_1->setText(deviceDetails->serialNo());
+ ui->customTextLlineEdit_1->setText(deviceDetails->customText());
+ ui->samplingRateComboBox_1->setCurrentIndex(deviceDetails->samplingRate() == 60 ? 3 : (deviceDetails->samplingRate() / 10) - 1);
+ ui->altitudeRangeComboBox->setCurrentIndex(deviceDetails->altitude());
+ ui->personalSafetyComboBox->setCurrentIndex(deviceDetails->personalSafety());
+ ui->timeFormatComboBox->setCurrentIndex(deviceDetails->timeFormat());
+ ui->unitsComboBox_1->setCurrentIndex(deviceDetails->units());
+ ui->diveModeComboBox_1->setCurrentIndex(deviceDetails->diveMode());
+ ui->lightCheckBox->setChecked(deviceDetails->lightEnabled());
+ ui->lightSpinBox->setValue(deviceDetails->light());
+ ui->alarmDepthCheckBox->setChecked(deviceDetails->alarmDepthEnabled());
+ ui->alarmDepthDoubleSpinBox->setValue(get_depth_units(deviceDetails->alarmDepth(), NULL, &depth_unit));
+ ui->alarmDepthDoubleSpinBox->setSuffix(depth_unit);
+ ui->alarmTimeCheckBox->setChecked(deviceDetails->alarmTimeEnabled());
+ ui->alarmTimeSpinBox->setValue(deviceDetails->alarmTime());
+}
void ConfigureDiveComputerDialog::on_backupButton_clicked()
{