summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/divefilter.cpp17
-rw-r--r--core/divefilter.h1
2 files changed, 18 insertions, 0 deletions
diff --git a/core/divefilter.cpp b/core/divefilter.cpp
index ddb77e9fc..87b5846f8 100644
--- a/core/divefilter.cpp
+++ b/core/divefilter.cpp
@@ -209,3 +209,20 @@ void DiveFilter::setFilter(const FilterData &data)
filterData = data;
emit diveListNotifier.filterReset();
}
+
+std::vector<dive *> DiveFilter::visibleDives() const
+{
+ if (shown_dives <= 0)
+ return {};
+
+ std::vector<dive *> res;
+ res.reserve(shown_dives);
+
+ int i;
+ dive *d;
+ for_each_dive(i, d) {
+ if (!d->hidden_by_filter)
+ res.push_back(d);
+ }
+ return res;
+}
diff --git a/core/divefilter.h b/core/divefilter.h
index 49503cca0..ef0ec4408 100644
--- a/core/divefilter.h
+++ b/core/divefilter.h
@@ -43,6 +43,7 @@ public:
QString shownText() const;
int shownDives() const;
bool diveSiteMode() const; // returns true if we're filtering on dive site (on mobile always returns false)
+ std::vector<dive *> visibleDives() const;
#ifndef SUBSURFACE_MOBILE
const QVector<dive_site *> &filteredDiveSites() const;
void startFilterDiveSites(QVector<dive_site *> ds);