mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 13:10:19 +00:00
0962b504ce
Now we at least start out with the corret date, time and number. This still isn't functional as a lot of the data aren't used and the way you save the data is completely silly, but it's another step in the right direction. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
50 lines
1 KiB
C++
50 lines
1 KiB
C++
#ifndef DIVELISTMODEL_H
|
|
#define DIVELISTMODEL_H
|
|
|
|
#include <QAbstractListModel>
|
|
#include "dive.h"
|
|
#include "helpers.h"
|
|
|
|
class DiveListModel : public QAbstractListModel
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
|
|
enum DiveListRoles {
|
|
DiveNumberRole = Qt::UserRole + 1,
|
|
DiveTripRole,
|
|
DiveDateRole,
|
|
DiveDateStringRole,
|
|
DiveRatingRole,
|
|
DiveDepthRole,
|
|
DiveDurationRole,
|
|
DiveWaterTemperatureRole,
|
|
DiveAirTemperatureRole,
|
|
DiveWeightRole,
|
|
DiveSuitRole,
|
|
DiveCylinderRole,
|
|
DiveGasRole,
|
|
DiveSacRole,
|
|
DiveLocationRole,
|
|
DiveGPSRole,
|
|
DiveNotesRole,
|
|
DiveBuddyRole,
|
|
DiveMasterRole,
|
|
DiveIdRole
|
|
};
|
|
|
|
static DiveListModel *instance();
|
|
DiveListModel(QObject *parent = 0);
|
|
void addDive(dive *d);
|
|
void updateDive(dive *d);
|
|
void clear();
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
|
QHash<int, QByteArray> roleNames() const;
|
|
QString startAddDive();
|
|
private:
|
|
QList<Dive> m_dives;
|
|
static DiveListModel *m_instance;
|
|
};
|
|
|
|
#endif // DIVELISTMODEL_H
|