2017-04-27 20:25:32 +02:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2015-05-28 16:23:49 -03:00
|
|
|
#ifndef CYLINDERMODEL_H
|
|
|
|
#define CYLINDERMODEL_H
|
|
|
|
|
|
|
|
#include "cleanertablemodel.h"
|
2016-04-04 22:02:03 -07:00
|
|
|
#include "core/dive.h"
|
2015-05-28 16:23:49 -03:00
|
|
|
|
|
|
|
/* Encapsulation of the Cylinder Model, that presents the
|
|
|
|
* Current cylinders that are used on a dive. */
|
|
|
|
class CylindersModel : public CleanerTableModel {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
enum Column {
|
|
|
|
REMOVE,
|
|
|
|
TYPE,
|
|
|
|
SIZE,
|
|
|
|
WORKINGPRESS,
|
|
|
|
START,
|
|
|
|
END,
|
|
|
|
O2,
|
|
|
|
HE,
|
|
|
|
DEPTH,
|
2016-07-06 22:40:32 +10:00
|
|
|
MOD,
|
|
|
|
MND,
|
2015-05-28 16:23:49 -03:00
|
|
|
USE,
|
|
|
|
COLUMNS
|
|
|
|
};
|
|
|
|
|
|
|
|
explicit CylindersModel(QObject *parent = 0);
|
|
|
|
static CylindersModel *instance();
|
2018-08-01 11:01:26 +02:00
|
|
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
|
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
|
|
|
Qt::ItemFlags flags(const QModelIndex &index) const;
|
|
|
|
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
|
2015-05-28 16:23:49 -03:00
|
|
|
|
|
|
|
void passInData(const QModelIndex &index, const QVariant &value);
|
|
|
|
void add();
|
|
|
|
void clear();
|
|
|
|
void updateDive();
|
|
|
|
void copyFromDive(struct dive *d);
|
2016-07-06 22:40:30 +10:00
|
|
|
void updateDecoDepths(pressure_t olddecopo2);
|
2017-03-13 08:25:32 +01:00
|
|
|
void updateTrashIcon();
|
2017-10-11 21:29:47 +02:00
|
|
|
void moveAtFirst(int cylid);
|
2015-05-28 16:23:49 -03:00
|
|
|
cylinder_t *cylinderAt(const QModelIndex &index);
|
|
|
|
bool changed;
|
2018-08-01 11:01:26 +02:00
|
|
|
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
2015-05-28 16:23:49 -03:00
|
|
|
|
|
|
|
public
|
|
|
|
slots:
|
|
|
|
void remove(const QModelIndex &index);
|
2016-07-06 22:40:37 +10:00
|
|
|
bool updateBestMixes();
|
2015-05-28 16:23:49 -03:00
|
|
|
|
|
|
|
private:
|
|
|
|
int rows;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|