summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/locationinformation.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-04-25 00:26:48 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-05-11 12:35:11 -0700
commitc7e1c40b0e9ff1c9152f06b7f1c134f232297fe7 (patch)
tree78d2116b217d64518176d23e2b435afa9983eed2 /desktop-widgets/locationinformation.h
parentbab7033ccba8840eb661feed0750e60404d06fc0 (diff)
downloadsubsurface-c7e1c40b0e9ff1c9152f06b7f1c134f232297fe7.tar.gz
Dive site: sort by distance to current dive
When presenting the list of dive sites on the dive-info tab, sort the dive sites by distance to the current dive. The idea is that when the user wants to select a dive site, close dive sites should be prioritized. The location of the dive is determined with the dive_get_gps_location() function introduced in the previous commit. This actual GPS data get precedence over the currently set dive site for that dive. On change of dive, the current location is updated in the DiveLocationFilterProxyModel so that a potentially expensive search for GPS data is not repeated for every comparison. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/locationinformation.h')
-rw-r--r--desktop-widgets/locationinformation.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/desktop-widgets/locationinformation.h b/desktop-widgets/locationinformation.h
index 434da29ae..f3f9f9eea 100644
--- a/desktop-widgets/locationinformation.h
+++ b/desktop-widgets/locationinformation.h
@@ -51,6 +51,9 @@ public:
bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const override;
bool lessThan(const QModelIndex& source_left, const QModelIndex& source_right) const override;
void setFilter(const QString &filter);
+ void setCurrentLocation(location_t loc);
+private:
+ location_t currentLocation; // Sort by distance to that location
};
class DiveLocationModel : public QAbstractTableModel {
@@ -88,7 +91,7 @@ public:
DiveSiteType currDiveSiteType() const;
struct dive_site *currDiveSite() const;
void fixPopupPosition();
- void setCurrentDiveSite(struct dive_site *ds);
+ void setCurrentDiveSite(struct dive *d);
signals:
void diveSiteSelected();