mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
undo: set dive mode to CCR in undo command, not profile code
When setting a CCR setpoint, the profile code(!) would turn the dive into a CCR dive. Not only should the display layer not alter dives, this also means that the action is not undoable. Move that to the appropriate undo command, where it makes more sense, but obviously also makes things more complicated. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
cd32c280ae
commit
1a0f6f53ed
4 changed files with 23 additions and 5 deletions
|
@ -74,11 +74,24 @@ AddEventDivemodeSwitch::AddEventDivemodeSwitch(struct dive *d, int dcNr, int sec
|
|||
}
|
||||
|
||||
AddEventSetpointChange::AddEventSetpointChange(struct dive *d, int dcNr, int seconds, pressure_t pO2) :
|
||||
AddEventBase(d, dcNr, create_event(seconds, SAMPLE_EVENT_PO2, 0, pO2.mbar, QT_TRANSLATE_NOOP("gettextFromC", "SP change")))
|
||||
AddEventBase(d, dcNr, create_event(seconds, SAMPLE_EVENT_PO2, 0, pO2.mbar, QT_TRANSLATE_NOOP("gettextFromC", "SP change"))),
|
||||
divemode(CCR)
|
||||
{
|
||||
setText(Command::Base::tr("Add set point change")); // TODO: format pO2 value in bar or psi.
|
||||
}
|
||||
|
||||
void AddEventSetpointChange::undoit()
|
||||
{
|
||||
AddEventBase::undoit();
|
||||
std::swap(get_dive_dc(d, dcNr)->divemode, divemode);
|
||||
}
|
||||
|
||||
void AddEventSetpointChange::redoit()
|
||||
{
|
||||
AddEventBase::redoit();
|
||||
std::swap(get_dive_dc(d, dcNr)->divemode, divemode);
|
||||
}
|
||||
|
||||
RenameEvent::RenameEvent(struct dive *d, int dcNr, struct event *ev, const char *name) : EventBase(d, dcNr),
|
||||
eventToAdd(clone_event_rename(ev, name)),
|
||||
eventToRemove(ev)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue