mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Instead of using the GpsLocation singleton in GpsListModel::update() to extract the gpsTrackers, pass the gpsTrackers as function argument. The caller has direct access to the GpsLocation object anyway and this make things less entangled. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
32 lines
754 B
C++
32 lines
754 B
C++
// SPDX-License-Identifier: GPL-2.0
|
|
#ifndef GPSLISTMODEL_H
|
|
#define GPSLISTMODEL_H
|
|
|
|
#include "core/gpslocation.h"
|
|
#include "core/singleton.h"
|
|
#include <QAbstractListModel>
|
|
|
|
class GpsListModel : public QAbstractListModel, public SillySingleton<GpsListModel>
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
|
|
enum GpsListRoles {
|
|
GpsDateRole = Qt::UserRole + 1,
|
|
GpsNameRole,
|
|
GpsLatitudeRole,
|
|
GpsLongitudeRole,
|
|
GpsWhenRole
|
|
};
|
|
|
|
GpsListModel(QObject *parent = 0);
|
|
void clear();
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
|
QHash<int, QByteArray> roleNames() const;
|
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
|
void update(QVector<gpsTracker> trackers);
|
|
private:
|
|
QVector<gpsTracker> m_gpsFixes;
|
|
};
|
|
|
|
#endif // GPSLISTMODEL_H
|