Profile: Allow Editing of Initial Gas.

Allow the initial gas of the dive to be edited through the context menu
in the dive profile, by right-clicking into the profile at the very
start of the dive.
Of course this will likely completely invalidate the decompression
calculation of any actually logged dives, but this is no different to
the addition and modification of gas changes during the dive that is
already possible.
Proposed by @harrydevil in #4291.

Signed-off-by: Michael Keller <github@ike.ch>
This commit is contained in:
Michael Keller 2024-09-09 23:53:06 +12:00
parent 7d215deaa1
commit 6c8f158569

View file

@ -558,9 +558,13 @@ void ProfileWidget2::contextMenuEvent(QContextMenuEvent *event)
// Add or edit Gas Change
if (d && item && item->ev.is_gaschange()) {
addGasChangeMenu(m, tr("Edit Gas Change"), *d, dc, item->ev.time.seconds);
addGasChangeMenu(m, tr("Edit gas change"), *d, dc, item->ev.time.seconds);
} else if (d && d->cylinders.size() > 1) {
// if we have more than one gas, offer to switch to another one
const struct divecomputer *currentdc = d->get_dc(dc);
if (seconds == 0 || (!currentdc->samples.empty() && seconds <= currentdc->samples[0].time.seconds))
addGasChangeMenu(m, tr("Set initial gas"), *d, dc, 0);
else
addGasChangeMenu(m, tr("Add gas change"), *d, dc, seconds);
}
m.addAction(tr("Add setpoint change"), [this, seconds]() { ProfileWidget2::addSetpointChange(seconds); });