aboutsummaryrefslogtreecommitdiffstats
path: root/map-widget
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-05-02 22:41:24 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-05-11 12:06:19 -0700
commit48b8129137ed3db1c4b0940301c8bfc9662bcee3 (patch)
tree7bea0c3260f7e8a85928a5791a8eaf04ce191752 /map-widget
parent79f3000630d62ccd242b2edca1b4dd412bc5a74b (diff)
downloadsubsurface-48b8129137ed3db1c4b0940301c8bfc9662bcee3.tar.gz
Cleanup: remove MapWidgetHelper::m_selectedDiveIds member
This member variable was only used locally in functions. Accordingly, make it a function-local variable. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'map-widget')
-rw-r--r--map-widget/qmlmapwidgethelper.cpp32
-rw-r--r--map-widget/qmlmapwidgethelper.h3
2 files changed, 17 insertions, 18 deletions
diff --git a/map-widget/qmlmapwidgethelper.cpp b/map-widget/qmlmapwidgethelper.cpp
index 5454f5858..e4c62ccd0 100644
--- a/map-widget/qmlmapwidgethelper.cpp
+++ b/map-widget/qmlmapwidgethelper.cpp
@@ -110,7 +110,7 @@ void MapWidgetHelper::selectedLocationChanged(MapLocation *location)
{
int idx;
struct dive *dive;
- m_selectedDiveIds.clear();
+ QList<int> selectedDiveIds;
QGeoCoordinate locationCoord = location->coordinate();
for_each_dive (idx, dive) {
struct dive_site *ds = get_dive_site_for_dive(dive);
@@ -121,27 +121,27 @@ void MapWidgetHelper::selectedLocationChanged(MapLocation *location)
const qreal longitude = ds->location.lon.udeg * 0.000001;
QGeoCoordinate dsCoord(latitude, longitude);
if (locationCoord.distanceTo(dsCoord) < m_smallCircleRadius)
- m_selectedDiveIds.append(idx);
+ selectedDiveIds.append(idx);
}
#else // the mobile version doesn't support multi-dive selection
if (ds == location->divesite())
- m_selectedDiveIds.append(dive->id); // use id here instead of index
+ selectedDiveIds.append(dive->id); // use id here instead of index
}
int last; // get latest dive chronologically
- if (!m_selectedDiveIds.isEmpty()) {
- last = m_selectedDiveIds.last();
- m_selectedDiveIds.clear();
- m_selectedDiveIds.append(last);
+ if (!selectedDiveIds.isEmpty()) {
+ last = selectedDiveIds.last();
+ selectedDiveIds.clear();
+ selectedDiveIds.append(last);
}
#endif
- emit selectedDivesChanged(m_selectedDiveIds);
+ emit selectedDivesChanged(selectedDiveIds);
}
void MapWidgetHelper::selectVisibleLocations()
{
int idx;
struct dive *dive;
- m_selectedDiveIds.clear();
+ QList<int> selectedDiveIds;
for_each_dive (idx, dive) {
struct dive_site *ds = get_dive_site_for_dive(dive);
if (!dive_site_has_gps_location(ds))
@@ -154,19 +154,19 @@ void MapWidgetHelper::selectVisibleLocations()
Q_ARG(QGeoCoordinate, dsCoord));
if (!qIsNaN(point.x()))
#ifndef SUBSURFACE_MOBILE // indexes on desktop
- m_selectedDiveIds.append(idx);
+ selectedDiveIds.append(idx);
}
#else // use id on mobile instead of index
- m_selectedDiveIds.append(dive->id);
+ selectedDiveIds.append(dive->id);
}
int last; // get latest dive chronologically
- if (!m_selectedDiveIds.isEmpty()) {
- last = m_selectedDiveIds.last();
- m_selectedDiveIds.clear();
- m_selectedDiveIds.append(last);
+ if (!selectedDiveIds.isEmpty()) {
+ last = selectedDiveIds.last();
+ selectedDiveIds.clear();
+ selectedDiveIds.append(last);
}
#endif
- emit selectedDivesChanged(m_selectedDiveIds);
+ emit selectedDivesChanged(selectedDiveIds);
}
/*
diff --git a/map-widget/qmlmapwidgethelper.h b/map-widget/qmlmapwidgethelper.h
index 2ea4959d6..d6dfa17a1 100644
--- a/map-widget/qmlmapwidgethelper.h
+++ b/map-widget/qmlmapwidgethelper.h
@@ -43,7 +43,6 @@ private:
QObject *m_map;
MapLocationModel *m_mapLocationModel;
qreal m_smallCircleRadius;
- QList<int> m_selectedDiveIds;
bool m_editMode;
private slots:
@@ -52,7 +51,7 @@ private slots:
signals:
void modelChanged();
void editModeChanged();
- void selectedDivesChanged(QList<int> list);
+ void selectedDivesChanged(const QList<int> &list);
void coordinatesChanged(struct dive_site *ds, const location_t &);
void pluginObjectChanged();
};