subsurface/qt-models/divelocationmodel.h
Tomaz Canabrava fc6d819616 Create a new dive site and edit it automatically
If the user clicks on the first or second option of the drop
down list, subsurface will move him to the dive site edit panel
automatically, since it's a new dive site and there's no information
about it yet.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-25 18:00:15 -07:00

41 lines
1.2 KiB
C++

#ifndef DIVELOCATIONMODEL_H
#define DIVELOCATIONMODEL_H
#include <QAbstractTableModel>
#include <QStringListModel>
#include <stdint.h>
class QLineEdit;
#define RECENTLY_ADDED_DIVESITE 1
class LocationInformationModel : public QAbstractTableModel {
Q_OBJECT
public:
enum Columns { UUID, NAME, LATITUDE, LONGITUDE, COORDS, DESCRIPTION, NOTES, TAXONOMY_1, TAXONOMY_2, TAXONOMY_3, COLUMNS};
static LocationInformationModel *instance();
int columnCount(const QModelIndex &parent) const;
int rowCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index = QModelIndex(), int role = Qt::DisplayRole) const;
int32_t addDiveSite(const QString& name, timestamp_t divetime, int lat = 0, int lon = 0);
bool setData(const QModelIndex &index, const QVariant &value, int role);
bool removeRows(int row, int count, const QModelIndex & parent = QModelIndex());
void setFirstRowTextField(QLineEdit *textField);
public slots:
void update();
private:
LocationInformationModel(QObject *obj = 0);
int internalRowCount;
QLineEdit *textField;
};
class GeoReferencingOptionsModel : public QStringListModel {
Q_OBJECT
public:
static GeoReferencingOptionsModel *instance();
private:
GeoReferencingOptionsModel(QObject *parent = 0);
};
#endif