mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-11 03:21:29 +00:00
528532572f
Currently editing of planned dives that have been merged with actual (logged) dives only works if the 'Planned dive' divecomputer is the first divecomputer, and this divecomputer is selected when clicking 'Edit planned dive'. In other cases the profile of the first divecomputer is overlaid with the profile of the planned dive, and the first divecomputer's profile is overwritten when saving the dive plan. Fix this problem. Triggered by @SeppoTakalo's comment (https://github.com/subsurface/subsurface/issues/1913#issuecomment-2075562119): Users don't like that planned dives show up as their own entries in the dive list, so being able to merge them with the actual dive after it has been executed is a good feature - but this wasn't working well until now. Signed-off-by: Michael Keller <github@ike.ch>
102 lines
2.4 KiB
C++
102 lines
2.4 KiB
C++
// SPDX-License-Identifier: GPL-2.0
|
|
#ifndef DIVEPLANNER_H
|
|
#define DIVEPLANNER_H
|
|
|
|
#include "core/divemode.h"
|
|
#include "core/owning_ptrs.h"
|
|
|
|
#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(dive &planned_dive, int dcNr, PlannerWidgets *parent);
|
|
~DivePlannerWidget();
|
|
void setReplanButton(bool replan);
|
|
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 rebreathermode);
|
|
void disableBackgasBreaks(bool enabled);
|
|
void setDiveMode(int mode);
|
|
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 getRebreatherMode() const;
|
|
public
|
|
slots:
|
|
void printDecoPlan();
|
|
private:
|
|
OwningDivePtr planned_dive;
|
|
int dcNr;
|
|
public:
|
|
DivePlannerWidget plannerWidget;
|
|
PlannerSettingsWidget plannerSettingsWidget;
|
|
PlannerDetails plannerDetails;
|
|
};
|
|
|
|
#endif // DIVEPLANNER_H
|