mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
mobile: use undo-command to apply gps fixes
The goal is to send the signal for the correct dives / divesites and thus not having to reload the whole model. Right now the mobile UI does not yet catch the diveSiteChanged signals. [Dirk Hohndel: small fix to ensure that we trigger a save to storage] Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
93bdaa9bb5
commit
c8ec2f5b1c
3 changed files with 5 additions and 23 deletions
|
@ -310,23 +310,6 @@ std::vector<DiveAndLocation> GpsLocation::getLocations()
|
||||||
return fixes;
|
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
|
QMap<qint64, gpsTracker> GpsLocation::currentGPSInfo() const
|
||||||
{
|
{
|
||||||
return m_trackers;
|
return m_trackers;
|
||||||
|
|
|
@ -34,7 +34,6 @@ public:
|
||||||
static GpsLocation *instance();
|
static GpsLocation *instance();
|
||||||
static bool hasInstance();
|
static bool hasInstance();
|
||||||
std::vector<DiveAndLocation> getLocations();
|
std::vector<DiveAndLocation> getLocations();
|
||||||
int applyLocations();
|
|
||||||
int getGpsNum() const;
|
int getGpsNum() const;
|
||||||
bool hasLocationsSource();
|
bool hasLocationsSource();
|
||||||
QString currentPosition();
|
QString currentPosition();
|
||||||
|
|
|
@ -1572,11 +1572,11 @@ QString QMLManager::getCurrentPosition()
|
||||||
void QMLManager::applyGpsData()
|
void QMLManager::applyGpsData()
|
||||||
{
|
{
|
||||||
appendTextToLog("Applying GPS fiexs");
|
appendTextToLog("Applying GPS fiexs");
|
||||||
int cnt = locationProvider->applyLocations();
|
std::vector<DiveAndLocation> fixes = locationProvider->getLocations();
|
||||||
if (cnt == 0)
|
Command::applyGPSFixes(fixes);
|
||||||
return;
|
appendTextToLog(QString("Attached %1 GPS fixes").arg(fixes.size()));
|
||||||
appendTextToLog(QString("Attached %1 GPS fixes").arg(cnt));
|
if (fixes.size())
|
||||||
refreshDiveList();
|
changesNeedSaving();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QMLManager::populateGpsData()
|
void QMLManager::populateGpsData()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue