mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: move get_dive_dc() to struct dive
Feels natural in a C++ code base. This removes a nullptr-check so some care has to be taken. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
731052c776
commit
f1f082d86a
15 changed files with 59 additions and 55 deletions
|
@ -52,7 +52,7 @@ DivePlannerWidget::DivePlannerWidget(dive &planned_dive, int dcNr, PlannerWidget
|
|||
view->setColumnHidden(CylindersModel::SENSORS, true);
|
||||
view->setItemDelegateForColumn(CylindersModel::TYPE, new TankInfoDelegate(this));
|
||||
auto tankUseDelegate = new TankUseDelegate(this);
|
||||
tankUseDelegate->setCurrentDC(get_dive_dc(&planned_dive, dcNr));
|
||||
tankUseDelegate->setCurrentDC(planned_dive.get_dc(dcNr));
|
||||
view->setItemDelegateForColumn(CylindersModel::USE, tankUseDelegate);
|
||||
connect(ui.cylinderTableWidget, &TableView::addButtonClicked, plannerModel, &DivePlannerPointsModel::addCylinder_clicked);
|
||||
connect(ui.tableWidget, &TableView::addButtonClicked, plannerModel, &DivePlannerPointsModel::addDefaultStop);
|
||||
|
@ -563,7 +563,7 @@ int PlannerWidgets::getDcNr()
|
|||
|
||||
divemode_t PlannerWidgets::getRebreatherMode() const
|
||||
{
|
||||
return get_dive_dc(planned_dive.get(), dcNr)->divemode;
|
||||
return planned_dive->get_dc(dcNr)->divemode;
|
||||
}
|
||||
|
||||
void PlannerWidgets::preparePlanDive(const dive *currentDive, int currentDcNr)
|
||||
|
@ -575,8 +575,8 @@ void PlannerWidgets::preparePlanDive(const dive *currentDive, int currentDcNr)
|
|||
|
||||
// plan the dive in the same mode as the currently selected one
|
||||
if (currentDive) {
|
||||
plannerSettingsWidget.setDiveMode(get_dive_dc(currentDive, currentDcNr)->divemode);
|
||||
plannerSettingsWidget.setBailoutVisibility(get_dive_dc(currentDive, currentDcNr)->divemode);
|
||||
plannerSettingsWidget.setDiveMode(currentDive->get_dc(currentDcNr)->divemode);
|
||||
plannerSettingsWidget.setBailoutVisibility(currentDive->get_dc(currentDcNr)->divemode);
|
||||
if (currentDive->salinity)
|
||||
plannerWidget.setSalinity(currentDive->salinity);
|
||||
else // No salinity means salt water
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue