mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Filter: send filterReset via signal
The old code called directly into the DiveListModel. Instead, send a signal and hook into the signal from the model. This will allow us to remove the DiveListModel::instance() function. This, in turn, is a step towards supporting multiple models at the same time. However, currently the model manually sets the hidden_by_filter flag in the core and therefore only one active model is supported at a time. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
71307bce42
commit
358fddd24e
3 changed files with 19 additions and 12 deletions
|
|
@ -193,7 +193,7 @@ void DiveFilter::startFilterDiveSites(QVector<dive_site *> ds)
|
|||
// When switching into dive site mode, reload the dive sites.
|
||||
// We won't do this in myInvalidate() once we are in dive site mode.
|
||||
MapWidget::instance()->reload();
|
||||
DiveTripModelBase::instance()->recalculateFilter();
|
||||
emit diveListNotifier.filterReset();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -202,7 +202,7 @@ void DiveFilter::stopFilterDiveSites()
|
|||
if (--diveSiteRefCount > 0)
|
||||
return;
|
||||
dive_sites.clear();
|
||||
DiveTripModelBase::instance()->recalculateFilter();
|
||||
emit diveListNotifier.filterReset();
|
||||
MapWidget::instance()->reload();
|
||||
}
|
||||
|
||||
|
|
@ -215,7 +215,7 @@ void DiveFilter::setFilterDiveSite(QVector<dive_site *> ds)
|
|||
return;
|
||||
dive_sites = ds;
|
||||
|
||||
DiveTripModelBase::instance()->recalculateFilter();
|
||||
emit diveListNotifier.filterReset();
|
||||
MapWidget::instance()->setSelected(dive_sites);
|
||||
MainWindow::instance()->diveList->expandAll();
|
||||
}
|
||||
|
|
@ -233,6 +233,6 @@ bool DiveFilter::diveSiteMode() const
|
|||
void DiveFilter::setFilter(const FilterData &data)
|
||||
{
|
||||
filterData = data;
|
||||
DiveTripModelBase::instance()->recalculateFilter();
|
||||
emit diveListNotifier.filterReset();
|
||||
}
|
||||
#endif // SUBSURFACE_MOBILE
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue