aboutsummaryrefslogtreecommitdiffstats
path: root/qt-models/filtermodels.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-02-19 16:31:21 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-02-19 12:02:15 -0800
commite550a788f01275b04c95e8a8eb9f390b1d5ffe7b (patch)
treeba34e845631e33663fed845f7d193bf403eb2fb8 /qt-models/filtermodels.h
parentce669adc53656fec1a7d77ee6ff8d82489bebbd7 (diff)
downloadsubsurface-e550a788f01275b04c95e8a8eb9f390b1d5ffe7b.tar.gz
Filter: implement any-of mode
Add an additional mode to the tags, people and location filters: any_of. Replace the original invert-bool by an enum. Move the common code into a distinct function. Reported-by: Willem Ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models/filtermodels.h')
-rw-r--r--qt-models/filtermodels.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/qt-models/filtermodels.h b/qt-models/filtermodels.h
index 39f6f83e4..7370b8d5f 100644
--- a/qt-models/filtermodels.h
+++ b/qt-models/filtermodels.h
@@ -15,6 +15,13 @@ struct dive;
struct dive_trip;
struct FilterData {
+ // The mode ids are chosen such that they can be directly converted from / to combobox indices.
+ enum class Mode {
+ ALL_OF = 0,
+ ANY_OF = 1,
+ NONE_OF = 2
+ };
+
bool validFilter = false;
int minVisibility = 0;
int maxVisibility = 5;
@@ -35,10 +42,10 @@ struct FilterData {
QStringList people;
QStringList location;
QStringList equipment;
- bool tagsNegate = false;
- bool peopleNegate = false;
- bool locationNegate = false;
- bool equipmentNegate = false;
+ Mode tagsMode = Mode::ALL_OF;
+ Mode peopleMode = Mode::ALL_OF;
+ Mode locationMode = Mode::ALL_OF;
+ Mode equipmentMode = Mode::ALL_OF;
bool logged = true;
bool planned = true;
};