mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-27 20:58:47 +00:00
filter: keep track on shown_dive on dive removal in DiveFilter
When removing dives, the UndoCommands would keep track of the shown dives. When adding, they were calling into the filter instead. Let's remove this asymmetry. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
e80c0d2c60
commit
9e84fd935b
3 changed files with 8 additions and 2 deletions
|
@ -48,8 +48,7 @@ DiveToAdd DiveListBase::removeDive(struct dive *d, std::vector<OwningTripPtr> &t
|
|||
if (idx < 0)
|
||||
qWarning("Deletion of unknown dive!");
|
||||
|
||||
if (!d->hidden_by_filter)
|
||||
--shown_dives;
|
||||
DiveFilter::instance()->diveRemoved(d);
|
||||
|
||||
res.dive.reset(unregister_dive(idx)); // Remove dive from backend
|
||||
|
||||
|
|
|
@ -101,6 +101,12 @@ DiveFilter::DiveFilter() : diveSiteRefCount(0)
|
|||
{
|
||||
}
|
||||
|
||||
void DiveFilter::diveRemoved(const dive *d) const
|
||||
{
|
||||
if (!d->hidden_by_filter)
|
||||
--shown_dives;
|
||||
}
|
||||
|
||||
bool DiveFilter::showDive(const struct dive *d) const
|
||||
{
|
||||
if (d->invalid && !prefs.display_invalid_dives)
|
||||
|
|
|
@ -51,6 +51,7 @@ public:
|
|||
void setFilter(const FilterData &data);
|
||||
ShownChange update(const QVector<dive *> &dives) const; // Update filter status of given dives and return dives whose status changed
|
||||
ShownChange updateAll() const; // Update filter status of all dives and return dives whose status changed
|
||||
void diveRemoved(const dive *dive) const; // Dive was removed; update count accordingly
|
||||
private:
|
||||
DiveFilter();
|
||||
bool showDive(const struct dive *d) const; // Should that dive be shown?
|
||||
|
|
Loading…
Reference in a new issue