aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/divefilter.cpp10
-rw-r--r--core/divefilter.h1
-rw-r--r--core/divelist.c8
-rw-r--r--qt-models/divetripmodel.cpp4
4 files changed, 15 insertions, 8 deletions
diff --git a/core/divefilter.cpp b/core/divefilter.cpp
index 0aa78e53b..4c40869f5 100644
--- a/core/divefilter.cpp
+++ b/core/divefilter.cpp
@@ -52,6 +52,16 @@ ShownChange DiveFilter::update(const QVector<dive *> &dives) const
return res;
}
+void DiveFilter::reset()
+{
+ int i;
+ dive *d;
+ shown_dives = dive_table.nr;
+ for_each_dive(i, d)
+ d->hidden_by_filter = false;
+ updateAll();
+}
+
ShownChange DiveFilter::updateAll() const
{
dive *old_current = current_dive;
diff --git a/core/divefilter.h b/core/divefilter.h
index d8d28ab04..608cf4843 100644
--- a/core/divefilter.h
+++ b/core/divefilter.h
@@ -39,6 +39,7 @@ class DiveFilter {
public:
static DiveFilter *instance();
+ void reset();
QString shownText() const;
bool diveSiteMode() const; // returns true if we're filtering on dive site (on mobile always returns false)
#ifndef SUBSURFACE_MOBILE
diff --git a/core/divelist.c b/core/divelist.c
index a15c40d83..9e67e55c2 100644
--- a/core/divelist.c
+++ b/core/divelist.c
@@ -807,13 +807,9 @@ void process_loaded_dives()
int i;
struct dive *dive;
- /* Register dive computer nick names and count shown dives. */
- shown_dives = 0;
- for_each_dive(i, dive) {
- if (!dive->hidden_by_filter)
- shown_dives++;
+ /* Register dive computer nick names. */
+ for_each_dive(i, dive)
add_devices_of_dive(dive, &device_table);
- }
sort_dive_table(&dive_table);
sort_trip_table(&trip_table);
diff --git a/qt-models/divetripmodel.cpp b/qt-models/divetripmodel.cpp
index a0385822c..358d032a6 100644
--- a/qt-models/divetripmodel.cpp
+++ b/qt-models/divetripmodel.cpp
@@ -706,7 +706,7 @@ DiveTripModelTree::DiveTripModelTree(QObject *parent) : DiveTripModelBase(parent
void DiveTripModelTree::populate()
{
- DiveFilter::instance()->updateAll(); // The data was reset - update filter status. TODO: should this really be done here?
+ DiveFilter::instance()->reset(); // The data was reset - update filter status. TODO: should this really be done here?
// we want this to be two calls as the second text is overwritten below by the lines starting with "\r"
uiNotification(QObject::tr("populate data model"));
@@ -1475,7 +1475,7 @@ DiveTripModelList::DiveTripModelList(QObject *parent) : DiveTripModelBase(parent
void DiveTripModelList::populate()
{
- DiveFilter::instance()->updateAll(); // The data was reset - update filter status. TODO: should this really be done here?
+ DiveFilter::instance()->reset(); // The data was reset - update filter status. TODO: should this really be done here?
// Fill model
items.reserve(dive_table.nr);