planner: get rid of global displayed_dive variable

Allocate the dive in the planner. This is all a bit convoluted
and needs more cleanup.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2022-11-05 20:27:49 +01:00 committed by bstoeger
parent b5682369f8
commit 4c02d1c279
9 changed files with 251 additions and 233 deletions

View file

@ -2,13 +2,12 @@
#ifndef DIVEPLANNER_H
#define DIVEPLANNER_H
#include <memory>
#include "core/owning_ptrs.h"
#include <QAbstractTableModel>
#include <QAbstractButton>
#include <QDateTime>
class QListView;
class QModelIndex;
class DivePlannerPointsModel;
class GasSelectionModel;
class DiveTypeSelectionModel;
@ -20,7 +19,7 @@ struct dive;
class DivePlannerWidget : public QWidget {
Q_OBJECT
public:
explicit DivePlannerWidget(PlannerWidgets *parent);
explicit DivePlannerWidget(dive &planned_dive, PlannerWidgets *parent);
~DivePlannerWidget();
void setReplanButton(bool replan);
public
@ -82,12 +81,17 @@ class PlannerWidgets : public QObject {
public:
PlannerWidgets();
~PlannerWidgets();
void planDive(dive *currentDive);
void preparePlanDive(const dive *currentDive); // Create a new planned dive
void planDive();
void prepareReplanDive(const dive *d); // Make a copy of the dive to be replanned
void replanDive(int currentDC);
struct dive *getDive() const;
public
slots:
void printDecoPlan();
public:
void repopulateGasModel();
OwningDivePtr planned_dive;
DivePlannerWidget plannerWidget;
PlannerSettingsWidget plannerSettingsWidget;
PlannerDetails plannerDetails;