diff options
-rw-r--r-- | core/gpslocation.cpp | 17 | ||||
-rw-r--r-- | core/gpslocation.h | 1 | ||||
-rw-r--r-- | mobile-widgets/qmlmanager.cpp | 10 |
3 files changed, 5 insertions, 23 deletions
diff --git a/core/gpslocation.cpp b/core/gpslocation.cpp index 3f4fb887d..e4a9b5185 100644 --- a/core/gpslocation.cpp +++ b/core/gpslocation.cpp @@ -310,23 +310,6 @@ std::vector<DiveAndLocation> GpsLocation::getLocations() return fixes; } -int GpsLocation::applyLocations() -{ - std::vector<DiveAndLocation> fixes = getLocations(); - for (DiveAndLocation &dl: fixes) { - struct dive_site *ds = dl.d->dive_site; - if (!ds) { - ds = create_dive_site(qPrintable(dl.name), &dive_site_table); - add_dive_to_dive_site(dl.d, ds); - invalidate_dive_cache(dl.d); - } - ds->location = dl.location; - } - if (!fixes.empty()) - mark_divelist_changed(true); - return !fixes.empty(); -} - QMap<qint64, gpsTracker> GpsLocation::currentGPSInfo() const { return m_trackers; diff --git a/core/gpslocation.h b/core/gpslocation.h index 2e8f92b26..4cc7f200c 100644 --- a/core/gpslocation.h +++ b/core/gpslocation.h @@ -34,7 +34,6 @@ public: static GpsLocation *instance(); static bool hasInstance(); std::vector<DiveAndLocation> getLocations(); - int applyLocations(); int getGpsNum() const; bool hasLocationsSource(); QString currentPosition(); diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index 6243bc3ea..3cc8ed0c5 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -1572,11 +1572,11 @@ QString QMLManager::getCurrentPosition() void QMLManager::applyGpsData() { appendTextToLog("Applying GPS fiexs"); - int cnt = locationProvider->applyLocations(); - if (cnt == 0) - return; - appendTextToLog(QString("Attached %1 GPS fixes").arg(cnt)); - refreshDiveList(); + std::vector<DiveAndLocation> fixes = locationProvider->getLocations(); + Command::applyGPSFixes(fixes); + appendTextToLog(QString("Attached %1 GPS fixes").arg(fixes.size())); + if (fixes.size()) + changesNeedSaving(); } void QMLManager::populateGpsData() |