mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
filter: implement filtering for divemode
This only checks the first divecomputer as the semantics for multiple dive computers with different dive modes are not clear. Should we check them all? The implementation is a bit hackish: the indexes [0...n] of the combobox are mapped onto [-1...n-1], where -1 means don't filter and n-1 is the last valid dive mode. Implements #2329 Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
9b8eed7821
commit
89784a176e
4 changed files with 34 additions and 5 deletions
|
@ -349,6 +349,10 @@ bool DiveFilter::showDive(const struct dive *d) const
|
|||
if (!filterData.planned && !has_planned(d, false))
|
||||
return false;
|
||||
|
||||
// Dive mode
|
||||
if (filterData.diveMode >= 0 && d->dc.divemode != (divemode_t)filterData.diveMode)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -101,6 +101,7 @@ struct FilterData {
|
|||
StringFilterMode equipmentStringMode = StringFilterMode::SUBSTRING;
|
||||
bool logged = true;
|
||||
bool planned = true;
|
||||
int diveMode = -1; // -1: don't filter, >= 0: corresponds to divemode_t
|
||||
};
|
||||
|
||||
class DiveFilter {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue