summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-10-30 22:29:58 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-12-29 08:34:09 -0800
commit8758b95881ac65c95a1dcd1c6b419e538b38fbf0 (patch)
tree9354fbb8bf757432ba0f0c803f8ee692cec2ccb1 /core
parentc53bab8965a2d5332df55a442a999714b5f700dc (diff)
downloadsubsurface-8758b95881ac65c95a1dcd1c6b419e538b38fbf0.tar.gz
filter: provide function that returns all shown dives
This will be used by the statistics widget. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core')
-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);