mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-12 14:16:15 +00:00
Populate the model with the GPS fixes
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
8a98dd485a
commit
06dcc9ab8d
2 changed files with 27 additions and 0 deletions
|
@ -324,6 +324,32 @@ void GpsLocation::applyLocations()
|
||||||
mark_divelist_changed(true);
|
mark_divelist_changed(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GpsLocation::updateModel()
|
||||||
|
{
|
||||||
|
GpsListModel *gpsListModel = GpsListModel::instance();
|
||||||
|
if (!gpsListModel) {
|
||||||
|
qDebug() << "no gpsListModel";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int cnt = geoSettings->value("count", 0).toInt();
|
||||||
|
if (cnt == 0) {
|
||||||
|
qDebug() << "no gps fixes";
|
||||||
|
gpsListModel->clear();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// create a table with the GPS information
|
||||||
|
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(>);
|
||||||
|
}
|
||||||
|
qDebug() << "added" << cnt << "gps fixes to model";
|
||||||
|
}
|
||||||
|
|
||||||
void GpsLocation::clearGpsData()
|
void GpsLocation::clearGpsData()
|
||||||
{
|
{
|
||||||
geoSettings->clear();
|
geoSettings->clear();
|
||||||
|
|
|
@ -49,6 +49,7 @@ public slots:
|
||||||
void downloadFromServer();
|
void downloadFromServer();
|
||||||
void postError(QNetworkReply::NetworkError error);
|
void postError(QNetworkReply::NetworkError error);
|
||||||
void getUseridError(QNetworkReply::NetworkError error);
|
void getUseridError(QNetworkReply::NetworkError error);
|
||||||
|
void updateModel();
|
||||||
void clearGpsData();
|
void clearGpsData();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue