2017-04-27 18:26:05 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2013-06-20 15:33:26 +00:00
|
|
|
#ifndef DIVEPLANNER_H
|
|
|
|
#define DIVEPLANNER_H
|
|
|
|
|
2022-11-08 07:26:06 +00:00
|
|
|
#include "core/divemode.h"
|
2022-11-05 19:27:49 +00:00
|
|
|
#include "core/owning_ptrs.h"
|
|
|
|
|
2013-08-26 12:14:19 +00:00
|
|
|
#include <QAbstractTableModel>
|
2014-11-04 11:15:27 +00:00
|
|
|
#include <QAbstractButton>
|
2014-06-28 15:07:28 +00:00
|
|
|
#include <QDateTime>
|
2013-08-26 16:18:21 +00:00
|
|
|
|
2015-05-28 19:23:49 +00:00
|
|
|
class DivePlannerPointsModel;
|
2022-11-07 18:50:37 +00:00
|
|
|
class GasSelectionModel;
|
|
|
|
class DiveTypeSelectionModel;
|
|
|
|
class PlannerWidgets;
|
2022-09-17 14:55:44 +00:00
|
|
|
struct dive;
|
2013-08-26 12:14:19 +00:00
|
|
|
|
2013-10-05 07:29:09 +00:00
|
|
|
#include "ui_diveplanner.h"
|
|
|
|
|
2013-08-26 11:43:37 +00:00
|
|
|
class DivePlannerWidget : public QWidget {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2022-11-05 19:27:49 +00:00
|
|
|
explicit DivePlannerWidget(dive &planned_dive, PlannerWidgets *parent);
|
2022-11-07 18:50:37 +00:00
|
|
|
~DivePlannerWidget();
|
2014-11-04 11:15:27 +00:00
|
|
|
void setReplanButton(bool replan);
|
2014-02-28 04:09:57 +00:00
|
|
|
public
|
|
|
|
slots:
|
2014-06-28 15:07:28 +00:00
|
|
|
void setupStartTime(QDateTime startTime);
|
2013-12-09 06:43:00 +00:00
|
|
|
void settingsChanged();
|
2014-06-26 15:04:39 +00:00
|
|
|
void atmPressureChanged(const int pressure);
|
|
|
|
void heightChanged(const int height);
|
2018-02-10 22:28:05 +00:00
|
|
|
void waterTypeChanged(const int index);
|
|
|
|
void customSalinityChanged(double density);
|
2016-12-15 22:02:32 +00:00
|
|
|
void setSurfacePressure(int surface_pressure);
|
|
|
|
void setSalinity(int salinity);
|
2013-08-26 11:43:37 +00:00
|
|
|
private:
|
2013-10-03 18:54:25 +00:00
|
|
|
Ui::DivePlanner ui;
|
2014-11-04 11:15:27 +00:00
|
|
|
QAbstractButton *replanButton;
|
2018-02-10 22:28:05 +00:00
|
|
|
void waterTypeUpdateTexts();
|
2013-08-26 11:43:37 +00:00
|
|
|
};
|
|
|
|
|
2014-06-10 15:40:02 +00:00
|
|
|
#include "ui_plannerSettings.h"
|
|
|
|
|
|
|
|
class PlannerSettingsWidget : public QWidget {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2022-11-08 07:26:06 +00:00
|
|
|
explicit PlannerSettingsWidget(PlannerWidgets *parent);
|
2018-07-31 05:41:19 +00:00
|
|
|
~PlannerSettingsWidget();
|
2014-06-10 15:40:02 +00:00
|
|
|
public
|
|
|
|
slots:
|
|
|
|
void settingsChanged();
|
2014-07-02 20:07:38 +00:00
|
|
|
void setBackgasBreaks(bool dobreaks);
|
2022-11-08 07:26:06 +00:00
|
|
|
void disableDecoElements(int mode, divemode_t rebreathermode);
|
2017-11-02 20:00:54 +00:00
|
|
|
void disableBackgasBreaks(bool enabled);
|
2017-04-19 06:05:28 +00:00
|
|
|
void setDiveMode(int mode);
|
2019-01-10 20:18:53 +00:00
|
|
|
void setBailoutVisibility(int mode);
|
2014-06-10 15:40:02 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
Ui::plannerSettingsWidget ui;
|
2014-07-17 15:03:52 +00:00
|
|
|
void updateUnitsUI();
|
2014-06-10 15:40:02 +00:00
|
|
|
};
|
|
|
|
|
2015-02-09 18:37:26 +00:00
|
|
|
#include "ui_plannerDetails.h"
|
|
|
|
|
|
|
|
class PlannerDetails : public QWidget {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit PlannerDetails(QWidget *parent = 0);
|
2015-02-09 22:14:08 +00:00
|
|
|
QPushButton *printPlan() const { return ui.printPlan; }
|
|
|
|
QTextEdit *divePlanOutput() const { return ui.divePlanOutput; }
|
2020-11-25 06:31:19 +00:00
|
|
|
public
|
|
|
|
slots:
|
|
|
|
void setPlanNotes(QString plan);
|
2015-02-09 22:14:08 +00:00
|
|
|
|
2015-02-09 18:37:26 +00:00
|
|
|
private:
|
|
|
|
Ui::plannerDetails ui;
|
|
|
|
};
|
|
|
|
|
2020-11-25 06:31:19 +00:00
|
|
|
// The planner widgets make up three quadrants
|
|
|
|
class PlannerWidgets : public QObject {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
PlannerWidgets();
|
2022-11-07 18:50:37 +00:00
|
|
|
~PlannerWidgets();
|
2022-11-05 19:27:49 +00:00
|
|
|
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
|
2022-09-17 14:55:44 +00:00
|
|
|
void replanDive(int currentDC);
|
2022-11-05 19:27:49 +00:00
|
|
|
struct dive *getDive() const;
|
2022-11-08 07:26:06 +00:00
|
|
|
divemode_t getRebreatherMode() const;
|
2020-11-25 06:31:19 +00:00
|
|
|
public
|
|
|
|
slots:
|
|
|
|
void printDecoPlan();
|
|
|
|
public:
|
2022-11-05 19:27:49 +00:00
|
|
|
void repopulateGasModel();
|
|
|
|
OwningDivePtr planned_dive;
|
2020-11-25 06:31:19 +00:00
|
|
|
DivePlannerWidget plannerWidget;
|
|
|
|
PlannerSettingsWidget plannerSettingsWidget;
|
|
|
|
PlannerDetails plannerDetails;
|
2022-11-07 18:50:37 +00:00
|
|
|
std::unique_ptr<GasSelectionModel> gasModel;
|
|
|
|
std::unique_ptr<DiveTypeSelectionModel> diveTypeModel;
|
2020-11-25 06:31:19 +00:00
|
|
|
};
|
|
|
|
|
2014-02-11 18:14:46 +00:00
|
|
|
#endif // DIVEPLANNER_H
|