mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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:
parent
b5682369f8
commit
4c02d1c279
9 changed files with 251 additions and 233 deletions
|
@ -544,7 +544,7 @@ void DivePlannerPointsModel::setRebreatherMode(int mode)
|
|||
|
||||
divemode_t DivePlannerPointsModel::getRebreatherMode() const
|
||||
{
|
||||
return d->dc.divemode;
|
||||
return d ? d->dc.divemode : OC;
|
||||
}
|
||||
|
||||
void DivePlannerPointsModel::setVpmbConservatism(int level)
|
||||
|
|
|
@ -18,9 +18,9 @@ Qt::ItemFlags GasSelectionModel::flags(const QModelIndex&) const
|
|||
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
||||
}
|
||||
|
||||
void GasSelectionModel::repopulate()
|
||||
void GasSelectionModel::repopulate(const dive *d)
|
||||
{
|
||||
setStringList(get_dive_gas_list(&displayed_dive));
|
||||
setStringList(get_dive_gas_list(d));
|
||||
}
|
||||
|
||||
QVariant GasSelectionModel::data(const QModelIndex &index, int role) const
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#include "cleanertablemodel.h"
|
||||
#include "treemodel.h"
|
||||
|
||||
struct dive;
|
||||
|
||||
class GasSelectionModel : public QStringListModel {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -26,7 +28,7 @@ public:
|
|||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
public
|
||||
slots:
|
||||
void repopulate();
|
||||
void repopulate(const dive *d);
|
||||
};
|
||||
|
||||
class DiveTypeSelectionModel : public QStringListModel {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue