From e8b0d165a78e802c09edc7dd0ea4ae5bed1d46d6 Mon Sep 17 00:00:00 2001 From: Jan Mulder Date: Sun, 20 Jan 2019 17:00:56 +0100 Subject: 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 --- desktop-widgets/filterwidget2.cpp | 24 +++++++++++++++++++----- desktop-widgets/filterwidget2.ui | 34 ++++++++++++++++++++++++++-------- 2 files changed, 45 insertions(+), 13 deletions(-) (limited to 'desktop-widgets') diff --git a/desktop-widgets/filterwidget2.cpp b/desktop-widgets/filterwidget2.cpp index 4a1d2e807..d6a8acad5 100644 --- a/desktop-widgets/filterwidget2.cpp +++ b/desktop-widgets/filterwidget2.cpp @@ -24,7 +24,13 @@ FilterWidget2::FilterWidget2(QWidget* parent) : QWidget(parent) ui.labelEquipment->hide(); ui.invertFilter->hide(); - ui.to->setDate(data.to.date()); + ui.fromDate->setDisplayFormat(prefs.date_format); + ui.fromTime->setDisplayFormat(prefs.time_format); + + ui.toDate->setDisplayFormat(prefs.date_format); + ui.toTime->setDisplayFormat(prefs.time_format); + ui.toDate->setDate(data.toDate.date()); + ui.toTime->setTime(data.toTime); connect(ui.maxRating, &StarWidget::valueChanged, this, &FilterWidget2::updateFilter); @@ -50,10 +56,16 @@ FilterWidget2::FilterWidget2(QWidget* parent) : QWidget(parent) connect(ui.minWaterTemp, static_cast(&QDoubleSpinBox::valueChanged), this, &FilterWidget2::updateFilter); - connect(ui.from, &QDateTimeEdit::dateTimeChanged, + connect(ui.fromDate, &QDateTimeEdit::dateChanged, + this, &FilterWidget2::updateFilter); + + connect(ui.fromTime, &QDateTimeEdit::timeChanged, + this, &FilterWidget2::updateFilter); + + connect(ui.toDate, &QDateTimeEdit::dateChanged, this, &FilterWidget2::updateFilter); - connect(ui.to, &QDateTimeEdit::dateTimeChanged, + connect(ui.toTime, &QDateTimeEdit::timeChanged, this, &FilterWidget2::updateFilter); connect(ui.tags, &QLineEdit::textChanged, @@ -81,8 +93,10 @@ void FilterWidget2::updateFilter() filterData.maxWaterTemp = ui.maxWaterTemp->value(); filterData.minAirTemp = ui.minAirTemp->value(); filterData.maxWaterTemp = ui.maxWaterTemp->value(); - filterData.from = ui.from->dateTime(); - filterData.to = ui.to->dateTime(); + filterData.fromDate = ui.fromDate->dateTime(); + filterData.fromTime = ui.fromTime->time(); + filterData.toDate = ui.toDate->dateTime(); + filterData.toTime = ui.toTime->time(); filterData.tags = ui.tags->text().split(",", QString::SkipEmptyParts); filterData.people = ui.people->text().split(",", QString::SkipEmptyParts); filterData.location = ui.location->text().split(",", QString::SkipEmptyParts); diff --git a/desktop-widgets/filterwidget2.ui b/desktop-widgets/filterwidget2.ui index 8cee672e8..7ed52ef4e 100644 --- a/desktop-widgets/filterwidget2.ui +++ b/desktop-widgets/filterwidget2.ui @@ -160,9 +160,6 @@ - - - @@ -170,9 +167,6 @@ - - - @@ -252,6 +246,26 @@ + + + + + + + true + + + + + + + true + + + + + + @@ -267,8 +281,12 @@ maxRating minVisibility maxVisibility - from - to + fromDate + fromTime + toDate + toTime + logged + planned tags people location -- cgit v1.2.3-70-g09d2