Desktop: Fix time format in dive planner.

Make the time edit respect the configured time format. Also make the
date and time format change when the preferences are changed.

Fixes #3849.

Signed-off-by: Michael Keller <github@ike.ch>
This commit is contained in:
Michael Keller 2023-03-23 16:52:50 +13:00 committed by Dirk Hohndel
parent f05ec222ff
commit 468c1d8d61

View file

@ -28,7 +28,6 @@ DivePlannerWidget::DivePlannerWidget(QWidget *parent) : QWidget(parent, QFlag(0)
CylindersModel *cylinders = DivePlannerPointsModel::instance()->cylindersModel(); CylindersModel *cylinders = DivePlannerPointsModel::instance()->cylindersModel();
ui.setupUi(this); ui.setupUi(this);
ui.dateEdit->setDisplayFormat(prefs.date_format);
ui.tableWidget->setTitle(tr("Dive planner points")); ui.tableWidget->setTitle(tr("Dive planner points"));
ui.tableWidget->setModel(plannerModel); ui.tableWidget->setModel(plannerModel);
connect(ui.tableWidget, &TableView::itemClicked, plannerModel, &DivePlannerPointsModel::remove); connect(ui.tableWidget, &TableView::itemClicked, plannerModel, &DivePlannerPointsModel::remove);
@ -158,6 +157,9 @@ void DivePlannerWidget::settingsChanged()
ui.atmHeight->blockSignals(true); ui.atmHeight->blockSignals(true);
ui.atmHeight->setValue((int) get_depth_units((int) pressure_to_altitude(DivePlannerPointsModel::instance()->getSurfacePressure()), NULL,NULL)); ui.atmHeight->setValue((int) get_depth_units((int) pressure_to_altitude(DivePlannerPointsModel::instance()->getSurfacePressure()), NULL,NULL));
ui.atmHeight->blockSignals(false); ui.atmHeight->blockSignals(false);
ui.dateEdit->setDisplayFormat(prefs.date_format);
ui.startTime->setDisplayFormat(prefs.time_format);
} }
void DivePlannerWidget::atmPressureChanged(const int pressure) void DivePlannerWidget::atmPressureChanged(const int pressure)