summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/filterwidget2.cpp
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2019-01-01 18:49:56 +0100
committerGravatar Robert C. Helling <helling@atdotde.de>2019-01-08 10:39:06 +0100
commit123f3ef7ec8f977c9949c3ac24008163c722e208 (patch)
treee71fae75814d32e249cb5e99d8eb231ffc88cb07 /desktop-widgets/filterwidget2.cpp
parentc349692d984f417bf56f5fecb8f733d8fb007518 (diff)
downloadsubsurface-123f3ef7ec8f977c9949c3ac24008163c722e208.tar.gz
Filter for logged/planned dives
Add filter for dives having a planned dive computer or a logged dive computer. Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'desktop-widgets/filterwidget2.cpp')
-rw-r--r--desktop-widgets/filterwidget2.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/desktop-widgets/filterwidget2.cpp b/desktop-widgets/filterwidget2.cpp
index d120ffe4d..b2f74d742 100644
--- a/desktop-widgets/filterwidget2.cpp
+++ b/desktop-widgets/filterwidget2.cpp
@@ -18,6 +18,8 @@ FilterWidget2::FilterWidget2(QWidget* parent)
ui->maxAirTemp->setValue(data.maxAirTemp);
ui->minWaterTemp->setValue(data.minWaterTemp);
ui->maxWaterTemp->setValue(data.maxWaterTemp);
+ ui->planned->setChecked(data.logged);
+ ui->planned->setChecked(data.planned);
// TODO: unhide this when we discover how to search for equipment.
ui->equipment->hide();
@@ -64,6 +66,11 @@ FilterWidget2::FilterWidget2(QWidget* parent)
connect(ui->location, &QLineEdit::textChanged,
this, &FilterWidget2::updateFilter);
+
+ connect(ui->logged, SIGNAL(stateChanged(int)), this, SLOT(updateLogged(int)));
+
+ connect(ui->planned, SIGNAL(stateChanged(int)), this, SLOT(updatePlanned(int)));
+
}
void FilterWidget2::updateFilter()
@@ -86,11 +93,26 @@ void FilterWidget2::updateFilter()
data.location = ui->location->text().split(",", QString::SkipEmptyParts);
data.equipment = ui->equipment->text().split(",", QString::SkipEmptyParts);
data.invertFilter = ui->invertFilter->isChecked();
+ data.logged = ui->logged->isChecked();
+ data.planned = ui->planned->isChecked();
filterData = data;
emit filterDataChanged(data);
}
+void FilterWidget2::updateLogged(int value) {
+ if (value == Qt::Unchecked)
+ ui->planned->setChecked(true);
+ updateFilter();
+}
+
+void FilterWidget2::updatePlanned(int value) {
+ if (value == Qt::Unchecked)
+ ui->logged->setChecked(true);
+ updateFilter();
+}
+
+
void FilterWidget2::showEvent(QShowEvent *event)
{
QWidget::showEvent(event);