summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/filterwidget2.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-01-22 09:32:39 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-01-26 11:13:01 -0800
commitde4e6792c67992747d3deecd080ca95a7b15e81d (patch)
tree33c28460a0e9ca8eda0f8e99f462f40d002f2ef7 /desktop-widgets/filterwidget2.cpp
parentc383079626178269bf0a3afefe6828a1c44d4d76 (diff)
downloadsubsurface-de4e6792c67992747d3deecd080ca95a7b15e81d.tar.gz
Filter: quick implementation of negation
Add negate buttons to the Tags, People, Location and Equipment filters. Currently, if nothing is entered the filter is ignored whether negate is on or off. One might think about filtering all dives without tags, etc. instead. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/filterwidget2.cpp')
-rw-r--r--desktop-widgets/filterwidget2.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/desktop-widgets/filterwidget2.cpp b/desktop-widgets/filterwidget2.cpp
index c27d22062..71e7de83d 100644
--- a/desktop-widgets/filterwidget2.cpp
+++ b/desktop-widgets/filterwidget2.cpp
@@ -20,8 +20,8 @@ FilterWidget2::FilterWidget2(QWidget* parent) : QWidget(parent), ignoreSignal(fa
// TODO: unhide this when we discover how to search for equipment.
ui.equipment->hide();
+ ui.equipmentNegate->hide();
ui.labelEquipment->hide();
- ui.invertFilter->hide();
ui.fromDate->setDisplayFormat(prefs.date_format);
ui.fromTime->setDisplayFormat(prefs.time_format);
@@ -77,12 +77,21 @@ FilterWidget2::FilterWidget2(QWidget* parent) : QWidget(parent), ignoreSignal(fa
connect(ui.tags, &QLineEdit::textChanged,
this, &FilterWidget2::updateFilter);
+ connect(ui.tagsNegate, &QToolButton::toggled,
+ this, &FilterWidget2::updateFilter);
+
connect(ui.people, &QLineEdit::textChanged,
this, &FilterWidget2::updateFilter);
+ connect(ui.peopleNegate, &QToolButton::toggled,
+ this, &FilterWidget2::updateFilter);
+
connect(ui.location, &QLineEdit::textChanged,
this, &FilterWidget2::updateFilter);
+ connect(ui.locationNegate, &QToolButton::toggled,
+ this, &FilterWidget2::updateFilter);
+
connect(ui.logged, SIGNAL(stateChanged(int)), this, SLOT(updateLogged(int)));
connect(ui.planned, SIGNAL(stateChanged(int)), this, SLOT(updatePlanned(int)));
@@ -121,6 +130,10 @@ void FilterWidget2::clearFilter()
ui.fromTime->setTime(filterData.fromTime);
ui.toDate->setDate(filterData.toDate.date());
ui.toTime->setTime(filterData.toTime);
+ ui.tagsNegate->setChecked(filterData.tagsNegate);
+ ui.peopleNegate->setChecked(filterData.peopleNegate);
+ ui.locationNegate->setChecked(filterData.locationNegate);
+ ui.equipmentNegate->setChecked(filterData.equipmentNegate);
ignoreSignal = false;
filterDataChanged(filterData);
@@ -162,7 +175,10 @@ void FilterWidget2::updateFilter()
filterData.people = ui.people->text().split(",", QString::SkipEmptyParts);
filterData.location = ui.location->text().split(",", QString::SkipEmptyParts);
filterData.equipment = ui.equipment->text().split(",", QString::SkipEmptyParts);
- filterData.invertFilter = ui.invertFilter->isChecked();
+ filterData.tagsNegate = ui.tagsNegate->isChecked();
+ filterData.peopleNegate = ui.peopleNegate->isChecked();
+ filterData.locationNegate = ui.locationNegate->isChecked();
+ filterData.equipmentNegate = ui.equipmentNegate->isChecked();
filterData.logged = ui.logged->isChecked();
filterData.planned = ui.planned->isChecked();