From eb38a641490752578e3dddc7b7959cfd52e0be74 Mon Sep 17 00:00:00 2001 From: Oliver Schwaneberg Date: Sun, 4 Feb 2018 20:07:32 +0100 Subject: Do not remove seconds from duration input field This change deals with issue #554. If you enter a dive duration manually, the cell renderer cuts the seconds away when the changes are saved. I added the helper "render_seconds_to_string" as a counterpart to "parseDurationToSeconds". The helper keeps the seconds, if not null. The rendering of the cell is done at two places in the code, so I think it is cleaner to add a dedicated method for it. Signed-off-by: Oliver Schwaneberg --- desktop-widgets/tab-widgets/maintab.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'desktop-widgets/tab-widgets/maintab.cpp') diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp index 2f5dd990e..2e21a1655 100644 --- a/desktop-widgets/tab-widgets/maintab.cpp +++ b/desktop-widgets/tab-widgets/maintab.cpp @@ -393,7 +393,7 @@ void MainTab::updateDepthDuration() ui.depthLabel->setVisible(true); ui.duration->setVisible(true); ui.durationLabel->setVisible(true); - ui.duration->setText(QDateTime::fromTime_t(displayed_dive.duration.seconds).toUTC().toString("h:mm")); + ui.duration->setText(render_seconds_to_string(displayed_dive.duration.seconds)); ui.depth->setText(get_depth_string(displayed_dive.maxdepth, true)); } @@ -579,7 +579,7 @@ void MainTab::updateDiveInfo(bool clear) ui.durationLabel->setVisible(isManual); } } - ui.duration->setText(QDateTime::fromTime_t(displayed_dive.duration.seconds).toUTC().toString("h:mm")); + ui.duration->setText(render_seconds_to_string(displayed_dive.duration.seconds)); ui.depth->setText(get_depth_string(displayed_dive.maxdepth, true)); ui.DiveType->setCurrentIndex(get_dive_dc(&displayed_dive, dc_number)->divemode); -- cgit v1.2.3-70-g09d2