Copy the configure OSTC3 ui to the OSTC UI

Just renumber the ui components. _3 for OSTC.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Anton Lundin 2014-10-27 21:54:57 +01:00 committed by Dirk Hohndel
parent a2f9f0c8bf
commit eacf8fc623
3 changed files with 1331 additions and 2 deletions

View file

@ -76,6 +76,28 @@ ConfigureDiveComputerDialog::ConfigureDiveComputerDialog(QWidget *parent) :
ui.ostc3SetPointTable->setColumnWidth(i, width.toInt()); ui.ostc3SetPointTable->setColumnWidth(i, width.toInt());
} }
settings.endGroup(); settings.endGroup();
settings.beginGroup("ostcGasTable");
for (int i = 0; i < ui.ostcGasTable->columnCount(); i++) {
QVariant width = settings.value(QString("colwidth%1").arg(i));
if (width.isValid())
ui.ostcGasTable->setColumnWidth(i, width.toInt());
}
settings.endGroup();
settings.beginGroup("ostcDilTable");
for (int i = 0; i < ui.ostcDilTable->columnCount(); i++) {
QVariant width = settings.value(QString("colwidth%1").arg(i));
if (width.isValid())
ui.ostcDilTable->setColumnWidth(i, width.toInt());
}
settings.endGroup();
settings.beginGroup("ostcSetPointTable");
for (int i = 0; i < ui.ostcSetPointTable->columnCount(); i++) {
QVariant width = settings.value(QString("colwidth%1").arg(i));
if (width.isValid())
ui.ostcSetPointTable->setColumnWidth(i, width.toInt());
}
settings.endGroup();
settings.endGroup(); settings.endGroup();
} }
@ -95,6 +117,19 @@ ConfigureDiveComputerDialog::~ConfigureDiveComputerDialog()
for (int i = 0; i < ui.ostc3SetPointTable->columnCount(); i++) for (int i = 0; i < ui.ostc3SetPointTable->columnCount(); i++)
settings.setValue(QString("colwidth%1").arg(i), ui.ostc3SetPointTable->columnWidth(i)); settings.setValue(QString("colwidth%1").arg(i), ui.ostc3SetPointTable->columnWidth(i));
settings.endGroup(); settings.endGroup();
settings.beginGroup("ostcGasTable");
for (int i = 0; i < ui.ostcGasTable->columnCount(); i++)
settings.setValue(QString("colwidth%1").arg(i), ui.ostcGasTable->columnWidth(i));
settings.endGroup();
settings.beginGroup("ostcDilTable");
for (int i = 0; i < ui.ostcDilTable->columnCount(); i++)
settings.setValue(QString("colwidth%1").arg(i), ui.ostcDilTable->columnWidth(i));
settings.endGroup();
settings.beginGroup("ostcSetPointTable");
for (int i = 0; i < ui.ostcSetPointTable->columnCount(); i++)
settings.setValue(QString("colwidth%1").arg(i), ui.ostcSetPointTable->columnWidth(i));
settings.endGroup();
settings.endGroup(); settings.endGroup();
} }
@ -162,6 +197,9 @@ void ConfigureDiveComputerDialog::populateDeviceDetails()
case 1: case 1:
populateDeviceDetailsSuuntoVyper(); populateDeviceDetailsSuuntoVyper();
break; break;
case 2:
populateDeviceDetailsOSTC();
break;
} }
} }
@ -304,6 +342,143 @@ void ConfigureDiveComputerDialog::populateDeviceDetailsOSTC3()
deviceDetails->setSp5(sp5); deviceDetails->setSp5(sp5);
} }
void ConfigureDiveComputerDialog::populateDeviceDetailsOSTC()
{
deviceDetails->setCustomText(ui.customTextLlineEdit_3->text());
deviceDetails->setDiveMode(ui.diveModeComboBox_3->currentIndex());
deviceDetails->setSaturation(ui.saturationSpinBox_3->value());
deviceDetails->setDesaturation(ui.desaturationSpinBox_3->value());
deviceDetails->setLastDeco(ui.lastDecoSpinBox_3->value());
deviceDetails->setBrightness(ui.brightnessComboBox_3->currentIndex());
deviceDetails->setUnits(ui.unitsComboBox_3->currentIndex());
deviceDetails->setSamplingRate(ui.samplingRateComboBox_3->currentIndex());
deviceDetails->setSalinity(ui.salinitySpinBox_3->value());
deviceDetails->setDiveModeColor(ui.diveModeColour_3->currentIndex());
deviceDetails->setLanguage(ui.languageComboBox_3->currentIndex());
deviceDetails->setDateFormat(ui.dateFormatComboBox_3->currentIndex());
deviceDetails->setCompassGain(ui.compassGainComboBox_3->currentIndex());
deviceDetails->setSyncTime(ui.dateTimeSyncCheckBox_3->isChecked());
deviceDetails->setSafetyStop(ui.safetyStopCheckBox_3->isChecked());
deviceDetails->setGfHigh(ui.gfHighSpinBox_3->value());
deviceDetails->setGfLow(ui.gfLowSpinBox_3->value());
deviceDetails->setPressureSensorOffset(ui.pressureSensorOffsetSpinBox_3->value());
deviceDetails->setPpO2Min(ui.ppO2MinSpinBox_3->value());
deviceDetails->setPpO2Max(ui.ppO2MaxSpinBox_3->value());
deviceDetails->setFutureTTS(ui.futureTTSSpinBox_3->value());
deviceDetails->setCcrMode(ui.ccrModeComboBox_3->currentIndex());
deviceDetails->setDecoType(ui.decoTypeComboBox_3->currentIndex());
deviceDetails->setAGFSelectable(ui.aGFSelectableCheckBox_3->isChecked());
deviceDetails->setAGFHigh(ui.aGFHighSpinBox_3->value());
deviceDetails->setAGFLow(ui.aGFLowSpinBox_3->value());
deviceDetails->setCalibrationGas(ui.calibrationGasSpinBox_3->value());
deviceDetails->setFlipScreen(ui.flipScreenCheckBox_3->isChecked());
deviceDetails->setSetPointFallback(ui.setPointFallbackCheckBox_3->isChecked());
//set gas values
gas gas1;
gas gas2;
gas gas3;
gas gas4;
gas gas5;
gas1.oxygen = GET_INT_FROM(ui.ostcGasTable->item(0, 1), 21);
gas1.helium = GET_INT_FROM(ui.ostcGasTable->item(0, 2), 0);
gas1.type = GET_INT_FROM(ui.ostcGasTable->item(0, 3), 0);
gas1.depth = GET_INT_FROM(ui.ostcGasTable->item(0, 4), 0);
gas2.oxygen = GET_INT_FROM(ui.ostcGasTable->item(1, 1), 21);
gas2.helium = GET_INT_FROM(ui.ostcGasTable->item(1, 2), 0);
gas2.type = GET_INT_FROM(ui.ostcGasTable->item(1, 3), 0);
gas2.depth = GET_INT_FROM(ui.ostcGasTable->item(1, 4), 0);
gas3.oxygen = GET_INT_FROM(ui.ostcGasTable->item(2, 1), 21);
gas3.helium = GET_INT_FROM(ui.ostcGasTable->item(2, 2), 0);
gas3.type = GET_INT_FROM(ui.ostcGasTable->item(2, 3), 0);
gas3.depth = GET_INT_FROM(ui.ostcGasTable->item(2, 4), 0);
gas4.oxygen = GET_INT_FROM(ui.ostcGasTable->item(3, 1), 21);
gas4.helium = GET_INT_FROM(ui.ostcGasTable->item(3, 2), 0);
gas4.type = GET_INT_FROM(ui.ostcGasTable->item(3, 3), 0);
gas4.depth = GET_INT_FROM(ui.ostcGasTable->item(3, 4), 0);
gas5.oxygen = GET_INT_FROM(ui.ostcGasTable->item(4, 1), 21);
gas5.helium = GET_INT_FROM(ui.ostcGasTable->item(4, 2), 0);
gas5.type = GET_INT_FROM(ui.ostcGasTable->item(4, 3), 0);
gas5.depth = GET_INT_FROM(ui.ostcGasTable->item(4, 4), 0);
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 = GET_INT_FROM(ui.ostcDilTable->item(0, 1), 21);
dil1.helium = GET_INT_FROM(ui.ostcDilTable->item(0, 2), 0);
dil1.type = GET_INT_FROM(ui.ostcDilTable->item(0, 3), 0);
dil1.depth = GET_INT_FROM(ui.ostcDilTable->item(0, 4), 0);
dil2.oxygen = GET_INT_FROM(ui.ostcDilTable->item(1, 1), 21);
dil2.helium = GET_INT_FROM(ui.ostcDilTable->item(1, 2), 0);
dil2.type = GET_INT_FROM(ui.ostcDilTable->item(1, 3), 0);
dil2.depth = GET_INT_FROM(ui.ostcDilTable->item(1, 4),0);
dil3.oxygen = GET_INT_FROM(ui.ostcDilTable->item(2, 1), 21);
dil3.helium = GET_INT_FROM(ui.ostcDilTable->item(2, 2), 0);
dil3.type = GET_INT_FROM(ui.ostcDilTable->item(2, 3), 0);
dil3.depth = GET_INT_FROM(ui.ostcDilTable->item(2, 4), 0);
dil4.oxygen = GET_INT_FROM(ui.ostcDilTable->item(3, 1), 21);
dil4.helium = GET_INT_FROM(ui.ostcDilTable->item(3, 2), 0);
dil4.type = GET_INT_FROM(ui.ostcDilTable->item(3, 3), 0);
dil4.depth = GET_INT_FROM(ui.ostcDilTable->item(3, 4), 0);
dil5.oxygen = GET_INT_FROM(ui.ostcDilTable->item(4, 1), 21);
dil5.helium = GET_INT_FROM(ui.ostcDilTable->item(4, 2), 0);
dil5.type = GET_INT_FROM(ui.ostcDilTable->item(4, 3), 0);
dil5.depth = GET_INT_FROM(ui.ostcDilTable->item(4, 4), 0);
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 = GET_INT_FROM(ui.ostcSetPointTable->item(0, 1), 70);
sp1.depth = GET_INT_FROM(ui.ostcSetPointTable->item(0, 2), 0);
sp2.sp = GET_INT_FROM(ui.ostcSetPointTable->item(1, 1), 90);
sp2.depth = GET_INT_FROM(ui.ostcSetPointTable->item(1, 2), 20);
sp3.sp = GET_INT_FROM(ui.ostcSetPointTable->item(2, 1), 100);
sp3.depth = GET_INT_FROM(ui.ostcSetPointTable->item(2, 2), 33);
sp4.sp = GET_INT_FROM(ui.ostcSetPointTable->item(3, 1), 120);
sp4.depth = GET_INT_FROM(ui.ostcSetPointTable->item(3, 2), 50);
sp5.sp = GET_INT_FROM(ui.ostcSetPointTable->item(4, 1), 140);
sp5.depth = GET_INT_FROM(ui.ostcSetPointTable->item(4, 2), 70);
deviceDetails->setSp1(sp1);
deviceDetails->setSp2(sp2);
deviceDetails->setSp3(sp3);
deviceDetails->setSp4(sp4);
deviceDetails->setSp5(sp5);
}
void ConfigureDiveComputerDialog::populateDeviceDetailsSuuntoVyper() void ConfigureDiveComputerDialog::populateDeviceDetailsSuuntoVyper()
{ {
deviceDetails->setCustomText(ui.customTextLlineEdit_1->text()); deviceDetails->setCustomText(ui.customTextLlineEdit_1->text());
@ -398,6 +573,9 @@ void ConfigureDiveComputerDialog::reloadValues()
case 1: case 1:
reloadValuesSuuntoVyper(); reloadValuesSuuntoVyper();
break; break;
case 2:
reloadValuesOSTC();
break;
} }
} }
@ -515,6 +693,120 @@ void ConfigureDiveComputerDialog::reloadValuesOSTC3()
ui.ostc3SetPointTable->setItem(4, 2, new QTableWidgetItem(QString::number(deviceDetails->sp5().depth))); ui.ostc3SetPointTable->setItem(4, 2, new QTableWidgetItem(QString::number(deviceDetails->sp5().depth)));
} }
void ConfigureDiveComputerDialog::reloadValuesOSTC()
{
ui.serialNoLineEdit_3->setText(deviceDetails->serialNo());
ui.firmwareVersionLineEdit_3->setText(deviceDetails->firmwareVersion());
ui.customTextLlineEdit_3->setText(deviceDetails->customText());
ui.diveModeComboBox_3->setCurrentIndex(deviceDetails->diveMode());
ui.saturationSpinBox_3->setValue(deviceDetails->saturation());
ui.desaturationSpinBox_3->setValue(deviceDetails->desaturation());
ui.lastDecoSpinBox_3->setValue(deviceDetails->lastDeco());
ui.brightnessComboBox_3->setCurrentIndex(deviceDetails->brightness());
ui.unitsComboBox_3->setCurrentIndex(deviceDetails->units());
ui.samplingRateComboBox_3->setCurrentIndex(deviceDetails->samplingRate());
ui.salinitySpinBox_3->setValue(deviceDetails->salinity());
ui.diveModeColour_3->setCurrentIndex(deviceDetails->diveModeColor());
ui.languageComboBox_3->setCurrentIndex(deviceDetails->language());
ui.dateFormatComboBox_3->setCurrentIndex(deviceDetails->dateFormat());
ui.compassGainComboBox_3->setCurrentIndex(deviceDetails->compassGain());
ui.safetyStopCheckBox_3->setChecked(deviceDetails->safetyStop());
ui.gfHighSpinBox_3->setValue(deviceDetails->gfHigh());
ui.gfLowSpinBox_3->setValue(deviceDetails->gfLow());
ui.pressureSensorOffsetSpinBox_3->setValue(deviceDetails->pressureSensorOffset());
ui.ppO2MinSpinBox_3->setValue(deviceDetails->ppO2Min());
ui.ppO2MaxSpinBox_3->setValue(deviceDetails->ppO2Max());
ui.futureTTSSpinBox_3->setValue(deviceDetails->futureTTS());
ui.ccrModeComboBox_3->setCurrentIndex(deviceDetails->ccrMode());
ui.decoTypeComboBox_3->setCurrentIndex(deviceDetails->decoType());
ui.aGFSelectableCheckBox_3->setChecked(deviceDetails->aGFSelectable());
ui.aGFHighSpinBox_3->setValue(deviceDetails->aGFHigh());
ui.aGFLowSpinBox_3->setValue(deviceDetails->aGFLow());
ui.calibrationGasSpinBox_3->setValue(deviceDetails->calibrationGas());
ui.flipScreenCheckBox_3->setChecked(deviceDetails->flipScreen());
ui.setPointFallbackCheckBox_3->setChecked(deviceDetails->setPointFallback());
//load gas 1 values
ui.ostcGasTable->setItem(0,1, new QTableWidgetItem(QString::number(deviceDetails->gas1().oxygen)));
ui.ostcGasTable->setItem(0,2, new QTableWidgetItem(QString::number(deviceDetails->gas1().helium)));
ui.ostcGasTable->setItem(0,3, new QTableWidgetItem(QString::number(deviceDetails->gas1().type)));
ui.ostcGasTable->setItem(0,4, new QTableWidgetItem(QString::number(deviceDetails->gas1().depth)));
//load gas 2 values
ui.ostcGasTable->setItem(1,1, new QTableWidgetItem(QString::number(deviceDetails->gas2().oxygen)));
ui.ostcGasTable->setItem(1,2, new QTableWidgetItem(QString::number(deviceDetails->gas2().helium)));
ui.ostcGasTable->setItem(1,3, new QTableWidgetItem(QString::number(deviceDetails->gas2().type)));
ui.ostcGasTable->setItem(1,4, new QTableWidgetItem(QString::number(deviceDetails->gas2().depth)));
//load gas 3 values
ui.ostcGasTable->setItem(2,1, new QTableWidgetItem(QString::number(deviceDetails->gas3().oxygen)));
ui.ostcGasTable->setItem(2,2, new QTableWidgetItem(QString::number(deviceDetails->gas3().helium)));
ui.ostcGasTable->setItem(2,3, new QTableWidgetItem(QString::number(deviceDetails->gas3().type)));
ui.ostcGasTable->setItem(2,4, new QTableWidgetItem(QString::number(deviceDetails->gas3().depth)));
//load gas 4 values
ui.ostcGasTable->setItem(3,1, new QTableWidgetItem(QString::number(deviceDetails->gas4().oxygen)));
ui.ostcGasTable->setItem(3,2, new QTableWidgetItem(QString::number(deviceDetails->gas4().helium)));
ui.ostcGasTable->setItem(3,3, new QTableWidgetItem(QString::number(deviceDetails->gas4().type)));
ui.ostcGasTable->setItem(3,4, new QTableWidgetItem(QString::number(deviceDetails->gas4().depth)));
//load gas 5 values
ui.ostcGasTable->setItem(4,1, new QTableWidgetItem(QString::number(deviceDetails->gas5().oxygen)));
ui.ostcGasTable->setItem(4,2, new QTableWidgetItem(QString::number(deviceDetails->gas5().helium)));
ui.ostcGasTable->setItem(4,3, new QTableWidgetItem(QString::number(deviceDetails->gas5().type)));
ui.ostcGasTable->setItem(4,4, new QTableWidgetItem(QString::number(deviceDetails->gas5().depth)));
//load dil 1 values
ui.ostcDilTable->setItem(0,1, new QTableWidgetItem(QString::number(deviceDetails->dil1().oxygen)));
ui.ostcDilTable->setItem(0,2, new QTableWidgetItem(QString::number(deviceDetails->dil1().helium)));
ui.ostcDilTable->setItem(0,3, new QTableWidgetItem(QString::number(deviceDetails->dil1().type)));
ui.ostcDilTable->setItem(0,4, new QTableWidgetItem(QString::number(deviceDetails->dil1().depth)));
//load dil 2 values
ui.ostcDilTable->setItem(1,1, new QTableWidgetItem(QString::number(deviceDetails->dil2().oxygen)));
ui.ostcDilTable->setItem(1,2, new QTableWidgetItem(QString::number(deviceDetails->dil2().helium)));
ui.ostcDilTable->setItem(1,3, new QTableWidgetItem(QString::number(deviceDetails->dil2().type)));
ui.ostcDilTable->setItem(1,4, new QTableWidgetItem(QString::number(deviceDetails->dil2().depth)));
//load dil 3 values
ui.ostcDilTable->setItem(2,1, new QTableWidgetItem(QString::number(deviceDetails->dil3().oxygen)));
ui.ostcDilTable->setItem(2,2, new QTableWidgetItem(QString::number(deviceDetails->dil3().helium)));
ui.ostcDilTable->setItem(2,3, new QTableWidgetItem(QString::number(deviceDetails->dil3().type)));
ui.ostcDilTable->setItem(2,4, new QTableWidgetItem(QString::number(deviceDetails->dil3().depth)));
//load dil 4 values
ui.ostcDilTable->setItem(3,1, new QTableWidgetItem(QString::number(deviceDetails->dil4().oxygen)));
ui.ostcDilTable->setItem(3,2, new QTableWidgetItem(QString::number(deviceDetails->dil4().helium)));
ui.ostcDilTable->setItem(3,3, new QTableWidgetItem(QString::number(deviceDetails->dil4().type)));
ui.ostcDilTable->setItem(3,4, new QTableWidgetItem(QString::number(deviceDetails->dil4().depth)));
//load dil 5 values
ui.ostcDilTable->setItem(4,1, new QTableWidgetItem(QString::number(deviceDetails->dil5().oxygen)));
ui.ostcDilTable->setItem(4,2, new QTableWidgetItem(QString::number(deviceDetails->dil5().helium)));
ui.ostcDilTable->setItem(4,3, new QTableWidgetItem(QString::number(deviceDetails->dil5().type)));
ui.ostcDilTable->setItem(4,4, new QTableWidgetItem(QString::number(deviceDetails->dil5().depth)));
//load set point 1 values
ui.ostcSetPointTable->setItem(0, 1, new QTableWidgetItem(QString::number(deviceDetails->sp1().sp)));
ui.ostcSetPointTable->setItem(0, 2, new QTableWidgetItem(QString::number(deviceDetails->sp1().depth)));
//load set point 2 values
ui.ostcSetPointTable->setItem(1, 1, new QTableWidgetItem(QString::number(deviceDetails->sp2().sp)));
ui.ostcSetPointTable->setItem(1, 2, new QTableWidgetItem(QString::number(deviceDetails->sp2().depth)));
//load set point 3 values
ui.ostcSetPointTable->setItem(2, 1, new QTableWidgetItem(QString::number(deviceDetails->sp3().sp)));
ui.ostcSetPointTable->setItem(2, 2, new QTableWidgetItem(QString::number(deviceDetails->sp3().depth)));
//load set point 4 values
ui.ostcSetPointTable->setItem(3, 1, new QTableWidgetItem(QString::number(deviceDetails->sp4().sp)));
ui.ostcSetPointTable->setItem(3, 2, new QTableWidgetItem(QString::number(deviceDetails->sp4().depth)));
//load set point 5 values
ui.ostcSetPointTable->setItem(4, 1, new QTableWidgetItem(QString::number(deviceDetails->sp5().sp)));
ui.ostcSetPointTable->setItem(4, 2, new QTableWidgetItem(QString::number(deviceDetails->sp5().depth)));
}
void ConfigureDiveComputerDialog::reloadValuesSuuntoVyper() void ConfigureDiveComputerDialog::reloadValuesSuuntoVyper()
{ {
const char *depth_unit; const char *depth_unit;

View file

@ -51,8 +51,10 @@ private:
DeviceDetails *deviceDetails; DeviceDetails *deviceDetails;
void populateDeviceDetails(); void populateDeviceDetails();
void populateDeviceDetailsOSTC3(); void populateDeviceDetailsOSTC3();
void populateDeviceDetailsOSTC();
void populateDeviceDetailsSuuntoVyper(); void populateDeviceDetailsSuuntoVyper();
void reloadValuesOSTC3(); void reloadValuesOSTC3();
void reloadValuesOSTC();
void reloadValuesSuuntoVyper(); void reloadValuesSuuntoVyper();
QString selected_vendor; QString selected_vendor;

File diff suppressed because it is too large Load diff