mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
2d8e343221
This has become a bit of a catch-all overhaul of a large portion of the planner - I started out wanting to improve the CCR mode, but then as I started pulling all the other threads that needed addressing started to come with it. Improve how the gas selection is handled when planning dives in CCR mode, by making the type (OC / CCR) of segments dependent on the gas use type that was set for the selected gas. Add a preference to allow the user to chose to use OC gases as diluent, in a similar fashion to the original implementation. Hide gases that cannot be used in the currently selected dive mode in all drop downs. Include usage type in gas names if this is needed. Hide columns and disable elements in the 'Dive planner points' table if they can they can not be edited in the curently selected dive mode. Visually identify gases and usage types that are not appropriate for the currently selected dive mode. Move the 'Dive mode' selection to the top of the planner view, to accommodate the fact that this is a property of the dive and not a planner setting. Show a warning instead of the dive plan if the plan contains gases that are not usable in the selected dive mode. Fix the data entry for the setpoint in the 'Dive planner points' table. Fix problems with enabling / disabling planner settings when switching between dive modes. Refactor some names to make them more appropriate for their current usage. One point that is still open is to hide gas usage graphs in the planner profile if the gas isn't used for OC, as there is no way to meaningfully interpolate such usage. Signed-off-by: Michael Keller <github@ike.ch>
105 lines
2.5 KiB
C++
105 lines
2.5 KiB
C++
// SPDX-License-Identifier: GPL-2.0
|
|
#ifndef DIVEPLANNER_H
|
|
#define DIVEPLANNER_H
|
|
|
|
#include "core/divemode.h"
|
|
|
|
#include <memory>
|
|
#include <QAbstractTableModel>
|
|
#include <QAbstractButton>
|
|
#include <QDateTime>
|
|
|
|
class DivePlannerPointsModel;
|
|
class PlannerWidgets;
|
|
struct dive;
|
|
|
|
#include "ui_diveplanner.h"
|
|
|
|
class DivePlannerWidget : public QWidget {
|
|
Q_OBJECT
|
|
public:
|
|
explicit DivePlannerWidget(const dive &planned_dive, int &dcNr, PlannerWidgets *parent);
|
|
~DivePlannerWidget();
|
|
void setReplanButton(bool replan);
|
|
void setColumnVisibility(int mode);
|
|
void setDiveMode(int mode);
|
|
public
|
|
slots:
|
|
void setupStartTime(QDateTime startTime);
|
|
void settingsChanged();
|
|
void atmPressureChanged(const int pressure);
|
|
void heightChanged(const int height);
|
|
void waterTypeChanged(const int index);
|
|
void customSalinityChanged(double density);
|
|
void setSurfacePressure(int surface_pressure);
|
|
void setSalinity(int salinity);
|
|
private:
|
|
Ui::DivePlanner ui;
|
|
QAbstractButton *replanButton;
|
|
void waterTypeUpdateTexts();
|
|
};
|
|
|
|
#include "ui_plannerSettings.h"
|
|
|
|
class PlannerSettingsWidget : public QWidget {
|
|
Q_OBJECT
|
|
public:
|
|
explicit PlannerSettingsWidget(PlannerWidgets *parent);
|
|
~PlannerSettingsWidget();
|
|
public
|
|
slots:
|
|
void settingsChanged();
|
|
void setBackgasBreaks(bool dobreaks);
|
|
void disableDecoElements(int mode, divemode_t divemode);
|
|
void disableBackgasBreaks(bool enabled);
|
|
void setBailoutVisibility(int mode);
|
|
|
|
private:
|
|
Ui::plannerSettingsWidget ui;
|
|
void updateUnitsUI();
|
|
};
|
|
|
|
#include "ui_plannerDetails.h"
|
|
|
|
class PlannerDetails : public QWidget {
|
|
Q_OBJECT
|
|
public:
|
|
explicit PlannerDetails(QWidget *parent = 0);
|
|
QPushButton *printPlan() const { return ui.printPlan; }
|
|
QTextEdit *divePlanOutput() const { return ui.divePlanOutput; }
|
|
public
|
|
slots:
|
|
void setPlanNotes(QString plan);
|
|
|
|
private:
|
|
Ui::plannerDetails ui;
|
|
};
|
|
|
|
// The planner widgets make up three quadrants
|
|
class PlannerWidgets : public QObject {
|
|
Q_OBJECT
|
|
public:
|
|
PlannerWidgets();
|
|
~PlannerWidgets();
|
|
void preparePlanDive(const dive *currentDive, int currentDc); // Create a new planned dive
|
|
void planDive();
|
|
void prepareReplanDive(const dive *currentDive, int currentDc); // Make a copy of the dive to be replanned
|
|
void replanDive();
|
|
struct dive *getDive() const;
|
|
int getDcNr();
|
|
divemode_t getDiveMode() const;
|
|
void settingsChanged();
|
|
public
|
|
slots:
|
|
void printDecoPlan();
|
|
void setDiveMode(int mode);
|
|
private:
|
|
std::unique_ptr<dive> planned_dive;
|
|
int dcNr;
|
|
public:
|
|
DivePlannerWidget plannerWidget;
|
|
PlannerSettingsWidget plannerSettingsWidget;
|
|
PlannerDetails plannerDetails;
|
|
};
|
|
|
|
#endif // DIVEPLANNER_H
|