mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Reimplement the internal repesentation of GPS fixes
Instead of using the Settings as our data structure and constantly accessing them, we now have a QMap for the GPS fixes and only access the Settings to keep them in sync with the QMap. This should significantly speed things up. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
7701975d98
commit
33142ed7f8
3 changed files with 110 additions and 129 deletions
|
|
@ -8,12 +8,14 @@
|
|||
#include <QGeoPositionInfo>
|
||||
#include <QSettings>
|
||||
#include <QNetworkReply>
|
||||
#include <QMap>
|
||||
|
||||
struct gpsTracker {
|
||||
degrees_t latitude;
|
||||
degrees_t longitude;
|
||||
quint64 when;
|
||||
qint64 when;
|
||||
QString name;
|
||||
int idx;
|
||||
};
|
||||
|
||||
class GpsLocation : QObject
|
||||
|
|
@ -29,7 +31,7 @@ public:
|
|||
bool hasLocationsSource();
|
||||
QString currentPosition();
|
||||
|
||||
QVector<gpsTracker> currentGPSInfo() const;
|
||||
QMap<qint64, gpsTracker> currentGPSInfo() const;
|
||||
|
||||
private:
|
||||
QGeoPositionInfo lastPos;
|
||||
|
|
@ -42,6 +44,9 @@ private:
|
|||
void (*showMessageCB)(const char *msg);
|
||||
static GpsLocation *m_Instance;
|
||||
bool waitingForPosition;
|
||||
QMap<qint64, gpsTracker> m_trackers;
|
||||
void addFixToStorage(gpsTracker >);
|
||||
void deleteFixFromStorage(gpsTracker >);
|
||||
|
||||
public slots:
|
||||
void serviceEnable(bool toggle);
|
||||
|
|
@ -52,7 +57,7 @@ public slots:
|
|||
void postError(QNetworkReply::NetworkError error);
|
||||
void getUseridError(QNetworkReply::NetworkError error);
|
||||
void clearGpsData();
|
||||
void deleteGpsFix(quint64 when);
|
||||
void deleteGpsFix(qint64 when);
|
||||
};
|
||||
|
||||
#endif // GPSLOCATION_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue