mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-03 15:43:09 +00:00
Mobile: provide better tracking of applied GPS fixes
Also reset the page stack to make sure we don't end up with stale data. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
4c55074bd7
commit
bf6a644fc6
4 changed files with 15 additions and 7 deletions
|
@ -225,14 +225,14 @@ static void copy_gps_location(struct gpsTracker &gps, struct dive *d)
|
||||||
#define SET_LOCATION(_dive, _gpsfix, _mark) \
|
#define SET_LOCATION(_dive, _gpsfix, _mark) \
|
||||||
{ \
|
{ \
|
||||||
copy_gps_location(_gpsfix, _dive); \
|
copy_gps_location(_gpsfix, _dive); \
|
||||||
changed = true; \
|
changed++; \
|
||||||
last = _mark; \
|
last = _mark; \
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GpsLocation::applyLocations()
|
int GpsLocation::applyLocations()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
bool changed = false;
|
int changed = 0;
|
||||||
int last = 0;
|
int last = 0;
|
||||||
int cnt = m_trackers.count();
|
int cnt = m_trackers.count();
|
||||||
if (cnt == 0)
|
if (cnt == 0)
|
||||||
|
@ -317,7 +317,7 @@ bool GpsLocation::applyLocations()
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (changed)
|
if (changed > 0)
|
||||||
mark_divelist_changed(true);
|
mark_divelist_changed(true);
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ public:
|
||||||
~GpsLocation();
|
~GpsLocation();
|
||||||
static GpsLocation *instance();
|
static GpsLocation *instance();
|
||||||
static bool hasInstance();
|
static bool hasInstance();
|
||||||
bool applyLocations();
|
int applyLocations();
|
||||||
int getGpsNum() const;
|
int getGpsNum() const;
|
||||||
bool hasLocationsSource();
|
bool hasLocationsSource();
|
||||||
QString currentPosition();
|
QString currentPosition();
|
||||||
|
|
|
@ -292,6 +292,10 @@ Kirigami.ApplicationWindow {
|
||||||
globalDrawer.close()
|
globalDrawer.close()
|
||||||
diveModel.resetInternalData()
|
diveModel.resetInternalData()
|
||||||
manager.refreshDiveList()
|
manager.refreshDiveList()
|
||||||
|
while (pageStack.depth > 1) {
|
||||||
|
pageStack.pop()
|
||||||
|
}
|
||||||
|
pageStack.push(diveList)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
|
|
|
@ -1577,7 +1577,11 @@ QString QMLManager::getCurrentPosition()
|
||||||
|
|
||||||
void QMLManager::applyGpsData()
|
void QMLManager::applyGpsData()
|
||||||
{
|
{
|
||||||
if (locationProvider->applyLocations())
|
appendTextToLog("Applying GPS fiexs");
|
||||||
|
int cnt = locationProvider->applyLocations();
|
||||||
|
if (cnt == 0)
|
||||||
|
return;
|
||||||
|
appendTextToLog(QString("Attached %1 GPS fixes").arg(cnt));
|
||||||
refreshDiveList();
|
refreshDiveList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue