From 89047b3541618383ab5b39eeadff7dfcb60e1295 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 16 Nov 2019 15:36:10 +0100 Subject: GPS fixes: split collecting GPS fixes into own function This finishes the spliting of the GPS fix application: One function for collecting the fixes, one for application. Signed-off-by: Berthold Stoeger --- core/gpslocation.cpp | 13 +++++++++---- core/gpslocation.h | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'core') diff --git a/core/gpslocation.cpp b/core/gpslocation.cpp index dccfeb3b2..3f4fb887d 100644 --- a/core/gpslocation.cpp +++ b/core/gpslocation.cpp @@ -218,15 +218,14 @@ int GpsLocation::getGpsNum() const last = _mark; \ } -int GpsLocation::applyLocations() +std::vector GpsLocation::getLocations() { int i; int last = 0; int cnt = m_trackers.count(); - if (cnt == 0) - return false; - std::vector fixes; + if (cnt == 0) + return fixes; // create a table with the GPS information QList gpsTable = m_trackers.values(); @@ -308,6 +307,12 @@ int GpsLocation::applyLocations() } } + return fixes; +} + +int GpsLocation::applyLocations() +{ + std::vector fixes = getLocations(); for (DiveAndLocation &dl: fixes) { struct dive_site *ds = dl.d->dive_site; if (!ds) { diff --git a/core/gpslocation.h b/core/gpslocation.h index 88fdb813c..2e8f92b26 100644 --- a/core/gpslocation.h +++ b/core/gpslocation.h @@ -33,6 +33,7 @@ public: ~GpsLocation(); static GpsLocation *instance(); static bool hasInstance(); + std::vector getLocations(); int applyLocations(); int getGpsNum() const; bool hasLocationsSource(); -- cgit v1.2.3-70-g09d2