mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 13:10:19 +00:00
494ad26540
See also e6e1473e6
. The construction of the locationlist
was not the same as the 3 previous lists, and it needs
the inclusion of a new model file (divelocationmodel.cpp)
in the mobile app. In addition, as the mobile app is mainly
interested in a simple stringList (model) to populate a HintsText
field (or maybe later a combobox), this stringlist is added
to the model, to easy interfacing with QML.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
48 lines
1.4 KiB
C++
48 lines
1.4 KiB
C++
// SPDX-License-Identifier: GPL-2.0
|
|
#ifndef DIVELOCATIONMODEL_H
|
|
#define DIVELOCATIONMODEL_H
|
|
|
|
#include <QAbstractTableModel>
|
|
#include <QStringListModel>
|
|
#include <stdint.h>
|
|
#include "core/units.h"
|
|
#include "ssrfsortfilterproxymodel.h"
|
|
|
|
class QLineEdit;
|
|
|
|
#define RECENTLY_ADDED_DIVESITE 1
|
|
|
|
bool filter_same_gps_cb (QAbstractItemModel *m, int sourceRow, const QModelIndex& parent);
|
|
|
|
class LocationInformationModel : public QAbstractTableModel {
|
|
Q_OBJECT
|
|
public:
|
|
LocationInformationModel(QObject *obj = 0);
|
|
enum Columns { UUID, NAME, LATITUDE, LONGITUDE, COORDS, DESCRIPTION, NOTES, TAXONOMY_1, TAXONOMY_2, TAXONOMY_3, COLUMNS};
|
|
enum Roles { UUID_ROLE = Qt::UserRole + 1 };
|
|
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;
|
|
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();
|
|
QStringList allSiteNames() const;
|
|
private:
|
|
int internalRowCount;
|
|
QStringList locationNames;
|
|
QLineEdit *textField;
|
|
};
|
|
|
|
class GeoReferencingOptionsModel : public QStringListModel {
|
|
Q_OBJECT
|
|
public:
|
|
static GeoReferencingOptionsModel *instance();
|
|
private:
|
|
GeoReferencingOptionsModel(QObject *parent = 0);
|
|
};
|
|
|
|
#endif
|