From 3e05d61eb95f5b26d0382ff87451cbe5b59fc9ec Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Mon, 29 Apr 2019 08:17:41 +0200 Subject: Map: show all dive sites when in dive-site filter mode When on the dive site tab or editing a dive site, we want to show all dive sites so that the user can related different dive sites. Therefore export a "in dive site mode" flag from the filter model and don't filter in that case in MapWidgetHelper. Signed-off-by: Berthold Stoeger --- map-widget/qmlmapwidgethelper.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'map-widget/qmlmapwidgethelper.cpp') diff --git a/map-widget/qmlmapwidgethelper.cpp b/map-widget/qmlmapwidgethelper.cpp index b4b64b4d8..da3e6963e 100644 --- a/map-widget/qmlmapwidgethelper.cpp +++ b/map-widget/qmlmapwidgethelper.cpp @@ -8,6 +8,9 @@ #include "core/divesite.h" #include "core/qthelper.h" #include "qt-models/maplocationmodel.h" +#ifndef SUBSURFACE_MOBILE +#include "qt-models/filtermodels.h" +#endif #define MIN_DISTANCE_BETWEEN_DIVE_SITES_M 50.0 #define SMALL_CIRCLE_RADIUS_PX 26.0 @@ -114,10 +117,18 @@ void MapWidgetHelper::reloadMapLocations() QVector locations; qreal latitude, longitude; +#ifdef SUBSURFACE_MOBILE + bool diveSiteMode = false; +#else + // In dive site mode (that is when either editing a dive site or on + // the dive site tab), we want to show all dive sites, not only those + // of the non-hidden dives. + bool diveSiteMode = MultiFilterSortModel::instance()->diveSiteMode(); +#endif for_each_dive(idx, dive) { // Don't show dive sites of hidden dives, unless this is the currently - // displayed (edited) dive. - if (dive->hidden_by_filter && dive != current_dive) + // displayed (edited) dive or we're in dive site edit mode. + if (!diveSiteMode && dive->hidden_by_filter && dive != current_dive) continue; struct dive_site *ds = get_dive_site_for_dive(dive); if (!dive_site_has_gps_location(ds) || locations.contains(ds)) -- cgit v1.2.3-70-g09d2