Filter: replace checked-state by struct

In the future, we might be smarter about the dive-counts and calculate
them only once and incrementally (if e.g. new dives are added).
Prepare for more complex caching by turning the checked boolean into
a struct, which can then be extended by a count and other things
(e.g. the name).

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-08-27 11:49:16 +02:00 committed by Dirk Hohndel
parent 80fe8fb331
commit ec586d0e0a
2 changed files with 51 additions and 34 deletions

View file

@ -11,12 +11,16 @@ struct dive;
class FilterModelBase : public QStringListModel {
Q_OBJECT
protected:
struct Item {
bool checked;
};
std::vector<Item> items;
public:
virtual bool doFilter(const dive *d) const = 0;
void clearFilter();
void selectAll();
void invertSelection();
std::vector<char> checkState;
bool anyChecked;
bool negate;
public