selection: remove current_dive and dc_number access from tabwidgets

An attempt at limitting accesses to the globals current_dive and
dc_number. These globals do not make sense on mobile.

The parent widget of the tab-widgets remembers the currently
displayer dive and dive computer and the individual widgets
access these values from there.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2022-09-17 16:21:17 +02:00 committed by bstoeger
parent 8cd191c271
commit 6f03fc9689
8 changed files with 125 additions and 96 deletions

View file

@ -114,12 +114,11 @@ TabDiveEquipment::~TabDiveEquipment()
// Refresh the corresponding UI field.
void TabDiveEquipment::divesChanged(const QVector<dive *> &dives, DiveField field)
{
// If the current dive is not in list of changed dives, do nothing
if (!current_dive || !dives.contains(current_dive))
if (!parent.includesCurrentDive(dives))
return;
if (field.suit)
ui.suit->setText(QString(current_dive->suit));
ui.suit->setText(QString(parent.currentDive->suit));
}
void TabDiveEquipment::toggleTriggeredColumn()
@ -209,7 +208,7 @@ void TabDiveEquipment::divesEdited(int i)
void TabDiveEquipment::on_suit_editingFinished()
{
if (!current_dive)
if (!parent.currentDive)
return;
divesEdited(Command::editSuit(ui.suit->text(), false));
}

View file

@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include "TabDiveInformation.h"
#include "maintab.h"
#include "ui_TabDiveInformation.h"
#include "desktop-widgets/mainwindow.h" // TODO: Only used temporarilly for edit mode changes
#include "profile-widget/profilewidget2.h"
#include "../tagwidget.h"
#include "commands/command.h"
@ -108,32 +108,33 @@ void TabDiveInformation::updateWaterTypeWidget()
// Update fields that depend on the dive profile
void TabDiveInformation::updateProfile()
{
ui->maxcnsText->setText(QString("%L1\%").arg(current_dive->maxcns));
ui->otuText->setText(QString("%L1").arg(current_dive->otu));
ui->maximumDepthText->setText(get_depth_string(current_dive->maxdepth, true));
ui->averageDepthText->setText(get_depth_string(current_dive->meandepth, true));
dive *currentDive = parent.currentDive;
ui->maxcnsText->setText(QString("%L1\%").arg(currentDive->maxcns));
ui->otuText->setText(QString("%L1").arg(currentDive->otu));
ui->maximumDepthText->setText(get_depth_string(currentDive->maxdepth, true));
ui->averageDepthText->setText(get_depth_string(currentDive->meandepth, true));
volume_t *gases = get_gas_used(current_dive);
volume_t *gases = get_gas_used(currentDive);
QString volumes;
std::vector<int> mean(current_dive->cylinders.nr), duration(current_dive->cylinders.nr);
struct divecomputer *currentdc = get_dive_dc(current_dive, dc_number);
if (currentdc && current_dive->cylinders.nr >= 0)
per_cylinder_mean_depth(current_dive, currentdc, mean.data(), duration.data());
std::vector<int> mean(currentDive->cylinders.nr), duration(currentDive->cylinders.nr);
struct divecomputer *currentdc = parent.getCurrentDC();
if (currentdc && currentDive->cylinders.nr >= 0)
per_cylinder_mean_depth(currentDive, currentdc, mean.data(), duration.data());
volume_t sac;
QString gaslist, SACs, separator;
for (int i = 0; i < current_dive->cylinders.nr; i++) {
if (!is_cylinder_used(current_dive, i))
for (int i = 0; i < currentDive->cylinders.nr; i++) {
if (!is_cylinder_used(currentDive, i))
continue;
gaslist.append(separator); volumes.append(separator); SACs.append(separator);
separator = "\n";
gaslist.append(gasname(get_cylinder(current_dive, i)->gasmix));
gaslist.append(gasname(get_cylinder(currentDive, i)->gasmix));
if (!gases[i].mliter)
continue;
volumes.append(get_volume_string(gases[i], true));
if (duration[i]) {
sac.mliter = lrint(gases[i].mliter / (depth_to_atm(mean[i], current_dive) * duration[i] / 60));
sac.mliter = lrint(gases[i].mliter / (depth_to_atm(mean[i], currentDive) * duration[i] / 60));
SACs.append(get_volume_string(sac, true).append(tr("/min")));
}
}
@ -141,23 +142,23 @@ void TabDiveInformation::updateProfile()
ui->gasUsedText->setText(volumes);
ui->oxygenHeliumText->setText(gaslist);
ui->diveTimeText->setText(get_dive_duration_string(current_dive->duration.seconds, tr("h"), tr("min"), tr("sec"),
" ", current_dive->dc.divemode == FREEDIVE));
ui->diveTimeText->setText(get_dive_duration_string(currentDive->duration.seconds, tr("h"), tr("min"), tr("sec"),
" ", currentDive->dc.divemode == FREEDIVE));
ui->sacText->setText(current_dive->cylinders.nr > 0 && mean[0] && current_dive->dc.divemode != CCR ? SACs : QString());
ui->sacText->setText(currentDive->cylinders.nr > 0 && mean[0] && currentDive->dc.divemode != CCR ? SACs : QString());
if (current_dive->surface_pressure.mbar == 0) {
if (currentDive->surface_pressure.mbar == 0) {
ui->atmPressVal->clear(); // If no atm pressure for dive then clear text box
} else {
ui->atmPressVal->setEnabled(true);
ui->atmPressVal->setText(QString::number(current_dive->surface_pressure.mbar)); // else display atm pressure
ui->atmPressVal->setText(QString::number(currentDive->surface_pressure.mbar)); // else display atm pressure
}
}
// Update fields that depend on start of dive
void TabDiveInformation::updateWhen()
{
timestamp_t surface_interval = get_surface_interval(current_dive->when);
timestamp_t surface_interval = get_surface_interval(parent.currentDive->when);
if (surface_interval >= 0)
ui->surfaceIntervalText->setText(get_dive_surfint_string(surface_interval, tr("d"), tr("h"), tr("min")));
else
@ -182,11 +183,11 @@ int TabDiveInformation::updateSalinityComboIndex(int salinity)
// If dive->user_salinity != dive->salinity (i.e. dc value) then show the salinity-overwrite indicator
void TabDiveInformation::checkDcSalinityOverWritten()
{
const struct divecomputer *currentdc = get_dive_dc(current_dive, dc_number);
if (!current_dive || !currentdc)
const struct divecomputer *currentdc = parent.getCurrentDC();
if (!currentdc)
return;
int dc_value = currentdc->salinity;
int user_value = current_dive->user_salinity;
int user_value = parent.currentDive->user_salinity;
bool show_indicator = false;
if (!manualDive && user_value != 0 && user_value != dc_value)
show_indicator = true;
@ -229,7 +230,7 @@ void TabDiveInformation::updateData(const std::vector<dive *> &, dive *currentDi
}
checkDcSalinityOverWritten(); // If exclamation is needed (i.e. salinity overwrite by user), then show it
updateMode(currentDive);
updateMode();
ui->visibility->setCurrentStars(currentDive->visibility);
ui->wavesize->setCurrentStars(currentDive->wavesize);
ui->current->setCurrentStars(currentDive->current);
@ -259,7 +260,7 @@ void TabDiveInformation::on_waterTypeCombo_activated(int index)
{
Q_UNUSED(index)
int combobox_salinity = 0;
const struct divecomputer *currentdc = get_dive_dc(current_dive, dc_number);
const struct divecomputer *currentdc = parent.getCurrentDC();
if (!currentdc)
return;
int dc_salinity = currentdc->salinity;
@ -301,7 +302,7 @@ void TabDiveInformation::on_waterTypeCombo_activated(int index)
void TabDiveInformation::cylinderChanged(dive *d)
{
// If this isn't the current dive, do nothing
if (current_dive != d)
if (parent.currentDive != d)
return;
updateProfile();
}
@ -313,78 +314,81 @@ void TabDiveInformation::divesChanged(const QVector<dive *> &dives, DiveField fi
int salinity_value;
// If the current dive is not in list of changed dives, do nothing
if (!current_dive || !dives.contains(current_dive))
if (!parent.includesCurrentDive(dives))
return;
dive *currentDive = parent.currentDive;
if (field.visibility)
ui->visibility->setCurrentStars(current_dive->visibility);
ui->visibility->setCurrentStars(currentDive->visibility);
if (field.wavesize)
ui->wavesize->setCurrentStars(current_dive->wavesize);
ui->wavesize->setCurrentStars(currentDive->wavesize);
if (field.current)
ui->current->setCurrentStars(current_dive->current);
ui->current->setCurrentStars(currentDive->current);
if (field.surge)
ui->surge->setCurrentStars(current_dive->surge);
ui->surge->setCurrentStars(currentDive->surge);
if (field.chill)
ui->chill->setCurrentStars(current_dive->chill);
ui->chill->setCurrentStars(currentDive->chill);
if (field.mode)
updateMode(current_dive);
updateMode();
if (field.duration || field.depth || field.mode)
updateProfile();
if (field.air_temp)
ui->airtemp->setText(get_temperature_string(current_dive->airtemp, true));
ui->airtemp->setText(get_temperature_string(currentDive->airtemp, true));
if (field.water_temp)
ui->watertemp->setText(get_temperature_string(current_dive->watertemp, true));
ui->watertemp->setText(get_temperature_string(currentDive->watertemp, true));
if (field.atm_press)
ui->atmPressVal->setText(QString::number(current_dive->surface_pressure.mbar));
ui->atmPressVal->setText(QString::number(currentDive->surface_pressure.mbar));
if (field.salinity)
checkDcSalinityOverWritten();
if (current_dive->user_salinity)
salinity_value = current_dive->user_salinity;
if (currentDive->user_salinity)
salinity_value = currentDive->user_salinity;
else
salinity_value = current_dive->salinity;
salinity_value = currentDive->salinity;
ui->waterTypeCombo->setCurrentIndex(updateSalinityComboIndex(salinity_value));
ui->salinityText->setText(QString("%L1g/").arg(salinity_value / 10.0));
}
void TabDiveInformation::on_visibility_valueChanged(int value)
{
if (current_dive)
if (parent.currentDive)
divesEdited(Command::editVisibility(value, false));
}
void TabDiveInformation::on_wavesize_valueChanged(int value)
{
if (current_dive)
if (parent.currentDive)
divesEdited(Command::editWaveSize(value, false));
}
void TabDiveInformation::on_current_valueChanged(int value)
{
if (current_dive)
if (parent.currentDive)
divesEdited(Command::editCurrent(value, false));
}
void TabDiveInformation::on_surge_valueChanged(int value)
{
if (current_dive)
if (parent.currentDive)
divesEdited(Command::editSurge(value, false));
}
void TabDiveInformation::on_chill_valueChanged(int value)
{
if (current_dive)
if (parent.currentDive)
divesEdited(Command::editChill(value, false));
}
void TabDiveInformation::updateMode(struct dive *d)
void TabDiveInformation::updateMode()
{
ui->diveType->setCurrentIndex(get_dive_dc(d, dc_number)->divemode);
divecomputer *currentDC = parent.getCurrentDC();
if (currentDC)
ui->diveType->setCurrentIndex(currentDC->divemode);
}
void TabDiveInformation::diveModeChanged(int index)
{
if (current_dive)
divesEdited(Command::editMode(dc_number, (enum divemode_t)index, false));
if (parent.currentDive)
divesEdited(Command::editMode(parent.currentDC, (enum divemode_t)index, false));
}
void TabDiveInformation::on_airtemp_editingFinished()
@ -392,7 +396,7 @@ void TabDiveInformation::on_airtemp_editingFinished()
// If the field wasn't modified by the user, don't post a new undo command.
// Owing to rounding errors, this might lead to undo commands that have
// no user visible effects. These can be very confusing.
if (ui->airtemp->isModified() && current_dive)
if (ui->airtemp->isModified() && parent.currentDive)
divesEdited(Command::editAirTemp(parseTemperatureToMkelvin(ui->airtemp->text()), false));
}
@ -401,7 +405,7 @@ void TabDiveInformation::on_watertemp_editingFinished()
// If the field wasn't modified by the user, don't post a new undo command.
// Owing to rounding errors, this might lead to undo commands that have
// no user visible effects. These can be very confusing.
if (ui->watertemp->isModified() && current_dive)
if (ui->watertemp->isModified() && parent.currentDive)
divesEdited(Command::editWaterTemp(parseTemperatureToMkelvin(ui->watertemp->text()), false));
}
@ -420,13 +424,14 @@ void TabDiveInformation::updateTextBox(int event) // Either the text box has bee
{ // Either way this gets a numeric value and puts it on the text box atmPressVal,
pressure_t atmpress = { 0 }; // then stores it in dive->surface_pressure.The undo stack for the text box content is
double altitudeVal; // maintained even though two independent events trigger saving the text box contents.
if (current_dive) {
dive *currentDive = parent.currentDive;
if (currentDive) {
switch (ui->atmPressType->currentIndex()) {
case 0: // If atm pressure in mbar has been selected:
if (event == TEXT_EDITED) // this is only triggered by on_atmPressVal_editingFinished()
atmpress.mbar = ui->atmPressVal->text().toInt(); // use the specified mbar pressure
else // if no pressure has been typed, then show existing dive pressure
ui->atmPressVal->setText(QString::number(current_dive->surface_pressure.mbar));
ui->atmPressVal->setText(QString::number(currentDive->surface_pressure.mbar));
break;
case 1: // If an altitude has been specified:
if (event == TEXT_EDITED) { // this is only triggered by on_atmPressVal_editingFinished()
@ -451,7 +456,7 @@ void TabDiveInformation::updateTextBox(int event) // Either the text box has bee
}
break;
case 2: // i.e. event = COMBO_CHANGED, that is, the option "Use dc" was selected from combobox
atmpress = calculate_surface_pressure(current_dive); // re-calculate air pressure from dc data
atmpress = calculate_surface_pressure(currentDive); // re-calculate air pressure from dc data
ui->atmPressVal->setText(QString::number(atmpress.mbar)); // display it in text box
ui->atmPressType->setCurrentIndex(0); // reset combobox to mbar
break;

View file

@ -41,7 +41,7 @@ private:
int pressTypeIndex;
void updateWaterTypeWidget();
void updateTextBox(int event);
void updateMode(struct dive *d);
void updateMode();
void divesEdited(int);
void closeWarning();
void showCurrentWidget(bool show, int position);

View file

@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "TabDiveNotes.h"
#include "maintab.h"
#include "core/divesite.h"
#include "core/qthelper.h"
#include "core/selection.h"
@ -97,35 +98,36 @@ void TabDiveNotes::closeWarning()
void TabDiveNotes::divesChanged(const QVector<dive *> &dives, DiveField field)
{
// If the current dive is not in list of changed dives, do nothing
if (!current_dive || !dives.contains(current_dive))
if (!parent.includesCurrentDive(dives))
return;
dive *currentDive = parent.currentDive;
if (field.duration)
ui.duration->setText(render_seconds_to_string(current_dive->duration.seconds));
ui.duration->setText(render_seconds_to_string(currentDive->duration.seconds));
if (field.depth)
ui.depth->setText(get_depth_string(current_dive->maxdepth, true));
ui.depth->setText(get_depth_string(currentDive->maxdepth, true));
if (field.rating)
ui.rating->setCurrentStars(current_dive->rating);
ui.rating->setCurrentStars(currentDive->rating);
if (field.notes)
updateNotes(current_dive);
updateNotes(currentDive);
if (field.datetime) {
updateDateTime(current_dive);
DivePlannerPointsModel::instance()->getDiveplan().when = current_dive->when;
updateDateTime(currentDive);
DivePlannerPointsModel::instance()->getDiveplan().when = currentDive->when;
}
if (field.divesite)
updateDiveSite(current_dive);
updateDiveSite(currentDive);
if (field.tags)
ui.tagWidget->setText(get_taglist_string(current_dive->tag_list));
ui.tagWidget->setText(get_taglist_string(currentDive->tag_list));
if (field.buddy)
ui.buddy->setText(current_dive->buddy);
ui.buddy->setText(currentDive->buddy);
if (field.diveguide)
ui.diveguide->setText(current_dive->diveguide);
ui.diveguide->setText(currentDive->diveguide);
}
void TabDiveNotes::diveSiteEdited(dive_site *ds, int)
{
if (current_dive && current_dive->dive_site == ds)
updateDiveSite(current_dive);
if (parent.currentDive && parent.currentDive->dive_site == ds)
updateDiveSite(parent.currentDive);
}
// This function gets called if a trip-field gets updated by an undo command.
@ -303,7 +305,7 @@ void TabDiveNotes::divesEdited(int i)
void TabDiveNotes::on_buddy_editingFinished()
{
if (ignoreInput || !current_dive)
if (ignoreInput || !parent.currentDive)
return;
divesEdited(Command::editBuddies(stringToList(ui.buddy->toPlainText()), false));
@ -311,7 +313,7 @@ void TabDiveNotes::on_buddy_editingFinished()
void TabDiveNotes::on_diveguide_editingFinished()
{
if (ignoreInput || !current_dive)
if (ignoreInput || !parent.currentDive)
return;
divesEdited(Command::editDiveGuide(stringToList(ui.diveguide->toPlainText()), false));
@ -319,7 +321,7 @@ void TabDiveNotes::on_diveguide_editingFinished()
void TabDiveNotes::on_duration_editingFinished()
{
if (ignoreInput || !current_dive)
if (ignoreInput || !parent.currentDive)
return;
// Duration editing is special: we only edit the current dive.
@ -328,7 +330,7 @@ void TabDiveNotes::on_duration_editingFinished()
void TabDiveNotes::on_depth_editingFinished()
{
if (ignoreInput || !current_dive)
if (ignoreInput || !parent.currentDive)
return;
// Depth editing is special: we only edit the current dive.
@ -337,36 +339,36 @@ void TabDiveNotes::on_depth_editingFinished()
// Editing of the dive time is different. If multiple dives are edited,
// all dives are shifted by an offset.
static void shiftTime(QDateTime &dateTime)
static void shiftTime(QDateTime &dateTime, dive *currentDive)
{
timestamp_t when = dateTimeToTimestamp(dateTime);
if (current_dive && current_dive->when != when) {
timestamp_t offset = when - current_dive->when;
if (currentDive->when != when) {
timestamp_t offset = when - currentDive->when;
Command::shiftTime(getDiveSelection(), (int)offset);
}
}
void TabDiveNotes::on_dateEdit_editingFinished()
{
if (ignoreInput || !current_dive)
if (ignoreInput || !parent.currentDive)
return;
QDateTime dateTime = timestampToDateTime(current_dive->when);
QDateTime dateTime = timestampToDateTime(parent.currentDive->when);
dateTime.setDate(ui.dateEdit->date());
shiftTime(dateTime);
shiftTime(dateTime, parent.currentDive);
}
void TabDiveNotes::on_timeEdit_editingFinished()
{
if (ignoreInput || !current_dive)
if (ignoreInput || !parent.currentDive)
return;
QDateTime dateTime = timestampToDateTime(current_dive->when);
QDateTime dateTime = timestampToDateTime(parent.currentDive->when);
dateTime.setTime(ui.timeEdit->time());
shiftTime(dateTime);
shiftTime(dateTime, parent.currentDive);
}
void TabDiveNotes::on_tagWidget_editingFinished()
{
if (ignoreInput || !current_dive)
if (ignoreInput || !parent.currentDive)
return;
divesEdited(Command::editTags(ui.tagWidget->getBlockStringList(), false));
@ -374,7 +376,7 @@ void TabDiveNotes::on_tagWidget_editingFinished()
void TabDiveNotes::on_location_diveSiteSelected()
{
if (ignoreInput || !current_dive)
if (ignoreInput || !parent.currentDive)
return;
struct dive_site *newDs = ui.location->currDiveSite();
@ -398,7 +400,7 @@ void TabDiveNotes::on_diveTripLocation_editingFinished()
void TabDiveNotes::on_notes_editingFinished()
{
if (!currentTrip && !current_dive)
if (!currentTrip && !parent.currentDive)
return;
QString html = ui.notes->toHtml();
@ -412,7 +414,7 @@ void TabDiveNotes::on_notes_editingFinished()
void TabDiveNotes::on_rating_valueChanged(int value)
{
if (ignoreInput || !current_dive)
if (ignoreInput || !parent.currentDive)
return;
divesEdited(Command::editRating(value, false));

View file

@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "TabDivePhotos.h"
#include "maintab.h"
#include "ui_TabDivePhotos.h"
#include "core/imagedownloader.h"
@ -113,7 +114,7 @@ void TabDivePhotos::recalculateSelectedThumbnails()
void TabDivePhotos::saveSubtitles()
{
if (!current_dive)
if (!parent.currentDive)
return;
if (!ui->photosView->selectionModel()->hasSelection())
return;
@ -131,7 +132,7 @@ void TabDivePhotos::saveSubtitles()
if (!duration)
continue;
struct membufferpp b;
save_subtitles_buffer(&b, current_dive, offset, duration);
save_subtitles_buffer(&b, parent.currentDive, offset, duration);
const char *data = mb_cstring(&b);
subtitlefile.open(QIODevice::WriteOnly);
subtitlefile.write(data, strlen(data));

View file

@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "TabDiveStatistics.h"
#include "maintab.h"
#include "ui_TabDiveStatistics.h"
#include "core/qthelper.h"
@ -29,9 +30,8 @@ TabDiveStatistics::TabDiveStatistics(MainTab *parent) : TabBase(parent), ui(new
connect(&diveListNotifier, &DiveListNotifier::cylinderEdited, this, &TabDiveStatistics::cylinderChanged);
const auto l = findChildren<QLabel *>(QString(), Qt::FindDirectChildrenOnly);
for (QLabel *label: l) {
for (QLabel *label: l)
label->setAlignment(Qt::AlignHCenter);
}
}
TabDiveStatistics::~TabDiveStatistics()
@ -59,7 +59,7 @@ void TabDiveStatistics::divesChanged(const QVector<dive *> &dives, DiveField fie
// TODO: make this more fine grained. Currently, the core can only calculate *all* statistics.
if (field.duration || field.depth || field.mode || field.air_temp || field.water_temp)
updateData(getDiveSelection(), current_dive, dc_number); // TODO: remember these data
updateData(getDiveSelection(), parent.currentDive, parent.currentDC); // TODO: remember dive selection
}
void TabDiveStatistics::cylinderChanged(dive *d)
@ -67,7 +67,7 @@ void TabDiveStatistics::cylinderChanged(dive *d)
// If the changed dive is not selected, do nothing
if (!d->selected)
return;
updateData(getDiveSelection(), current_dive, dc_number); // TODO: remember these data
updateData(getDiveSelection(), parent.currentDive, parent.currentDC); // TODO: remember dive selection
}
void TabDiveStatistics::updateData(const std::vector<dive *> &, dive *currentDive, int)

View file

@ -26,6 +26,7 @@ static bool paletteIsDark(const QPalette &p)
}
MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
currentDive(nullptr),
lastSelectedDive(true),
lastTabSelectedDive(0),
lastTabSelectedDiveTrip(0)
@ -73,11 +74,16 @@ void MainTab::nextInputField(QKeyEvent *event)
void MainTab::settingsChanged()
{
// TODO: remember these
updateDiveInfo(getDiveSelection(), current_dive, dc_number);
updateDiveInfo(getDiveSelection(), currentDive, currentDC);
}
void MainTab::updateDiveInfo(const std::vector<dive *> &selection, dive *currentDive, int currentDC)
void MainTab::updateDiveInfo(const std::vector<dive *> &selection, dive *currentDiveIn, int currentDCIn)
{
// Remember current dive and divecomputer. This is needed to refresh the
// display, for example when the settings change.
currentDive = currentDiveIn;
currentDC = currentDCIn;
// don't execute this while planning a dive
if (DivePlannerPointsModel::instance()->isPlanner())
return;
@ -172,3 +178,15 @@ void MainTab::colorsChanged()
for (TabBase *widget: extraWidgets)
widget->updateUi(colorText);
}
// Called when dives changed. Checks whether the currently displayed
// dive is affected by the change.
bool MainTab::includesCurrentDive(const QVector<dive *> &dives) const
{
return currentDive && dives.contains(currentDive);
}
divecomputer *MainTab::getCurrentDC() const
{
return get_dive_dc(currentDive, currentDC);
}

View file

@ -21,7 +21,11 @@ public:
void clearTabs();
void nextInputField(QKeyEvent *event);
void stealFocus();
bool includesCurrentDive(const QVector<dive *> &dives) const;
divecomputer *getCurrentDC() const;
dive *currentDive;
int currentDC;
public
slots:
// Always called with non-null currentDive