From 89eed5d36e611f882dbf1e2686ad389f65688fa1 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Fri, 8 Jan 2016 13:11:49 -0200 Subject: Untangle Library Linkage with the adittion of gpslistmodel/location, the libraries qt-models had a direct dependency on subsurface-core, and subsurface-core had a direct dependency on qt-models, this is bad. Moving a bit of code around I'v managed to clean this out, and also to clear a bit of uneeded code (GpsTracker and gpsTracker where basically the same thing.) Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- subsurface-core/gpslocation.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'subsurface-core/gpslocation.cpp') diff --git a/subsurface-core/gpslocation.cpp b/subsurface-core/gpslocation.cpp index 59cd97900..79fb9a088 100644 --- a/subsurface-core/gpslocation.cpp +++ b/subsurface-core/gpslocation.cpp @@ -327,33 +327,29 @@ void GpsLocation::applyLocations() mark_divelist_changed(true); } -#ifdef SUBSURFACE_MOBILE -void GpsLocation::updateModel() +QVector< gpsTracker > GpsLocation::currentGPSInfo() const { - GpsListModel *gpsListModel = GpsListModel::instance(); - if (!gpsListModel) { - qDebug() << "no gpsListModel"; - return; - } + QVector trackers; + int cnt = geoSettings->value("count", 0).toInt(); if (cnt == 0) { qDebug() << "no gps fixes"; - gpsListModel->clear(); - return; + return trackers; } // create a table with the GPS information + trackers.reserve(cnt); + struct gpsTracker gt; for (int i = 0; i < cnt; i++) { gt.latitude.udeg = geoSettings->value(QString("gpsFix%1_lat").arg(i)).toInt(); gt.longitude.udeg = geoSettings->value(QString("gpsFix%1_lon").arg(i)).toInt(); gt.when = geoSettings->value(QString("gpsFix%1_time").arg(i)).toULongLong(); gt.name = geoSettings->value(QString("gpsFix%1_name").arg(i)).toString(); - gpsListModel->addGpsFix(>); + trackers.append(gt); } - qDebug() << "added" << cnt << "gps fixes to model"; + return trackers; } -#endif void GpsLocation::clearGpsData() { -- cgit v1.2.3-70-g09d2