summaryrefslogtreecommitdiffstats
path: root/qt-models/filtermodels.cpp
diff options
context:
space:
mode:
authorGravatar Jan Mulder <jlmulder@xs4all.nl>2019-01-20 17:00:56 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-01-21 17:22:24 +1200
commite8b0d165a78e802c09edc7dd0ea4ae5bed1d46d6 (patch)
tree2c2ee51bc48f074f69003a3d7897c310684e1813 /qt-models/filtermodels.cpp
parent5986225fcec159a9fa4d18cc89e54ae18d97e333 (diff)
downloadsubsurface-e8b0d165a78e802c09edc7dd0ea4ae5bed1d46d6.tar.gz
Desktop, Filter UI: make date/time consistent
On all (most?) places we use separate date/time fields for the time of a dive, and we follow the setting from the preferences to format those. Make the new filter widget consistent, with respect to the to and from interval. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Diffstat (limited to 'qt-models/filtermodels.cpp')
-rw-r--r--qt-models/filtermodels.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/qt-models/filtermodels.cpp b/qt-models/filtermodels.cpp
index 2f3ce99a8..6efac8348 100644
--- a/qt-models/filtermodels.cpp
+++ b/qt-models/filtermodels.cpp
@@ -114,10 +114,16 @@ bool MultiFilterSortModel::showDive(const struct dive *d) const
(d->airtemp.mkelvin < C_to_mkelvin(filterData.minAirTemp) || d->airtemp.mkelvin > C_to_mkelvin(filterData.maxAirTemp)))
return false;
- if (filterData.from.isValid() && d->when < filterData.from.toTime_t())
+ QDateTime t = filterData.fromDate;
+ t.setTime(filterData.fromTime);
+ if (filterData.fromDate.isValid() && filterData.fromTime.isValid() &&
+ d->when < t.toMSecsSinceEpoch()/1000 + t.offsetFromUtc())
return false;
- if (filterData.to.isValid() && d->when > filterData.to.toTime_t())
+ t = filterData.toDate;
+ t.setTime(filterData.toTime);
+ if (filterData.toDate.isValid() && filterData.toTime.isValid() &&
+ d->when > t.toMSecsSinceEpoch()/1000 + t.offsetFromUtc())
return false;
// tags.