summaryrefslogtreecommitdiffstats
path: root/subsurface-core/gpslocation.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2016-01-08 13:11:49 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-01-08 08:04:04 -0800
commit89eed5d36e611f882dbf1e2686ad389f65688fa1 (patch)
treeb7e185df6424d46c9d992ea388a03d4a6b19fd7e /subsurface-core/gpslocation.cpp
parent7b155774c5105f84303e869317fc946b11b3e78b (diff)
downloadsubsurface-89eed5d36e611f882dbf1e2686ad389f65688fa1.tar.gz
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 <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'subsurface-core/gpslocation.cpp')
-rw-r--r--subsurface-core/gpslocation.cpp20
1 files changed, 8 insertions, 12 deletions
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<gpsTracker> 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(&gt);
+ trackers.append(gt);
}
- qDebug() << "added" << cnt << "gps fixes to model";
+ return trackers;
}
-#endif
void GpsLocation::clearGpsData()
{