From 1bdf00b2b472078a0b24f1c269782d822cb96e02 Mon Sep 17 00:00:00 2001 From: willemferguson Date: Tue, 30 Apr 2019 12:42:33 +0200 Subject: Convert the atmospheric pressure in the Information Tab to an editable field The Information tab shows the atmospheric pressure. Make this value editable and also ensure that changes to it are undo-able. Signed-off-by: willemferguson --- desktop-widgets/command_edit.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'desktop-widgets/command_edit.cpp') diff --git a/desktop-widgets/command_edit.cpp b/desktop-widgets/command_edit.cpp index 3419749d7..5207d1ac1 100644 --- a/desktop-widgets/command_edit.cpp +++ b/desktop-widgets/command_edit.cpp @@ -248,6 +248,27 @@ DiveField EditWaterTemp::fieldId() const return DiveField::WATER_TEMP; } +// ***** Atmospheric pressure ***** +void EditAtmPress::set(struct dive *d, int value) const +{ + d->surface_pressure.mbar = value > 0 ? (uint32_t)value : 0u; +} + +int EditAtmPress::data(struct dive *d) const +{ + return (int)d->surface_pressure.mbar; +} + +QString EditAtmPress::fieldName() const +{ + return tr("Atm. pressure"); +} + +DiveField EditAtmPress::fieldId() const +{ + return DiveField::ATM_PRESS; +} + // ***** Duration ***** void EditDuration::set(struct dive *d, int value) const { -- cgit v1.2.3-70-g09d2