core: move functions into struct dive

Nothing against free-standing functions, but in the case
of dc_watertemp(), dc_airtemp(), endtime() and totaltime(),
it seems natural to move this into the dive class and avoid
polution of the global name space.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-06-05 17:02:40 +02:00 committed by bstoeger
parent b9df26066e
commit a1e6df46d9
13 changed files with 63 additions and 64 deletions

View file

@ -548,12 +548,12 @@ static bool can_merge(const struct dive *a, const struct dive *b, enum asked_use
if (a->when > b->when)
return false;
/* Don't merge dives if there's more than half an hour between them */
if (dive_endtime(a) + 30 * 60 < b->when) {
if (a->endtime() + 30 * 60 < b->when) {
if (*have_asked == NOTYET) {
if (QMessageBox::warning(MainWindow::instance(),
MainWindow::tr("Warning"),
MainWindow::tr("Trying to merge dives with %1min interval in between").arg(
(b->when - dive_endtime(a)) / 60),
(b->when - a->endtime()) / 60),
QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Cancel) {
*have_asked = DONTMERGE;
return false;