Dive site: use an array of pointers in reloadMapLocations()

MapWidgetHelper::reloadMapLocations() used an array of uuids to
add dive sites to the map only once. Replace this by an array
of pointers. This is a small piece of a larger effort to remove
dive site UUIDs.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-10-25 20:58:54 +02:00 committed by Dirk Hohndel
parent 75b5d61522
commit f41bb32428
2 changed files with 4 additions and 4 deletions

View file

@ -129,7 +129,7 @@ QString DiveObjectHelper::gps_decimal() const
QVariant DiveObjectHelper::dive_site() const QVariant DiveObjectHelper::dive_site() const
{ {
return QVariant::fromValue((void *)get_dive_site_by_uuid(m_dive->dive_site_uuid)); return QVariant::fromValue((uintptr_t)get_dive_site_by_uuid(m_dive->dive_site_uuid));
} }
QString DiveObjectHelper::duration() const QString DiveObjectHelper::duration() const

View file

@ -120,7 +120,7 @@ void MapWidgetHelper::reloadMapLocations()
m_mapLocationModel->clear(); m_mapLocationModel->clear();
MapLocation *location; MapLocation *location;
QVector<MapLocation *> locationList; QVector<MapLocation *> locationList;
QVector<uint32_t> locationUuids; QVector<struct dive_site *> locations;
qreal latitude, longitude; qreal latitude, longitude;
for_each_dive(idx, dive) { for_each_dive(idx, dive) {
@ -129,7 +129,7 @@ void MapWidgetHelper::reloadMapLocations()
if (dive->hidden_by_filter && dive != current_dive) if (dive->hidden_by_filter && dive != current_dive)
continue; continue;
struct dive_site *ds = get_dive_site_for_dive(dive); struct dive_site *ds = get_dive_site_for_dive(dive);
if (!dive_site_has_gps_location(ds) || locationUuids.contains(ds->uuid)) if (!dive_site_has_gps_location(ds) || locations.contains(ds))
continue; continue;
latitude = ds->location.lat.udeg * 0.000001; latitude = ds->location.lat.udeg * 0.000001;
longitude = ds->location.lon.udeg * 0.000001; longitude = ds->location.lon.udeg * 0.000001;
@ -145,7 +145,7 @@ void MapWidgetHelper::reloadMapLocations()
} }
location = new MapLocation(ds->uuid, dsCoord, name); location = new MapLocation(ds->uuid, dsCoord, name);
locationList.append(location); locationList.append(location);
locationUuids.append(ds->uuid); locations.append(ds);
locationNameMap[name] = location; locationNameMap[name] = location;
} }
m_mapLocationModel->addList(locationList); m_mapLocationModel->addList(locationList);