aboutsummaryrefslogtreecommitdiffstats
path: root/qt-models/gpslistmodel.h
blob: 14145d0659f7a8c2fe45de809a1cce00fe4f6bda (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// 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();
private:
	QVector<gpsTracker> m_gpsFixes;
};

#endif // GPSLISTMODEL_H