aboutsummaryrefslogtreecommitdiffstats
path: root/commands/command.h
AgeCommit message (Collapse)Author
2020-04-07undo: more fine-grained editing of cylinderGravatar Berthold Stoeger
Don't overwrite the full cylinder when editing a single field. Implement three "modes": editing of type, pressure and gasmix. Don't consider individual fields, because some of them are related. E.g. you can change the gasmix by setting the MOD. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07undo: implement gas switchGravatar Berthold Stoeger
This is a bit hairy as - in theory - one gas switch can remove other gas switch(es) at the same timestamp. However, I did not find a way to test it. Moreover, it is not clear whether the dive-tabs are properly updated on undo/redo. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07undo: add event removal undo commandGravatar Berthold Stoeger
This was a trivial copy & past of the event-adding undo command with a switch of the undo() and redo() actions. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07undo: implement renaming of eventsGravatar Berthold Stoeger
There is a slight complexity here owing to the fact that the profile works on a copy of the current dive: We get a copy of the event and have to search for the original event in the current dive. This could be done in the undo command. Nevertheless, here we do it in the profile so that when in the future the profile can work on a non-copied dive we can simply remove this function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07undo: implement set point change undo commandGravatar Berthold Stoeger
This is a simple copy of the other add-event commands. It could be made more friendly by stating the pO2 value in the text. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07undo: add undo command for dive-mode switchGravatar Berthold Stoeger
This basically copies the bookmark code, with the addition that the dive mode is recorded in the text of the undo command. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07undo: implement addBookmark undo commandGravatar Berthold Stoeger
Create a new translation unit for event-related undo commands. Create a base class of commands that add events and one subclass that adds a bookmark event. Use this command in the profile-widget. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07undo: add cylinder undo commands by copy & pasteGravatar Berthold Stoeger
Do a simple copy & paste followed by a simple search & replace to generate cylinder undo commands from weight undo commands. Obviously, this is still missing the necessary code to keep the dive-data consistent after cylinder editing. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-20Undo: implement invalidate-dive commandGravatar Berthold Stoeger
Connect command to context menu. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-17undo: remove EditNumber commandGravatar Berthold Stoeger
Number editing works via the RenumberDives command. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-10undo infrastructure: collect the texts for the executed commandsGravatar Dirk Hohndel
This creates a single string with all the undo texts that are on the stack. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10mobile/undo: create EditDive commandGravatar Berthold Stoeger
Command that just swaps two dives. This is rather complex, as for example a dive site might be created. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-09undo: implement ApplyGPSFixes undo commandGravatar Berthold Stoeger
This gets a list of dives with GPS fixes and 1) Adds new dive sites if the dive hasn't a dive site set 2) Edits the location of the dive site Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-06Cleanup: use getDiveSelection() for shifting timeGravatar Berthold Stoeger
There are two cases where dive-times are shifted: in an explicit dialog and when editing the date/time of a dive. In each of these cases, the selected dives were collected manually. Instead use the getDiveSelection() function. Since this returns a std::vector, change the argument of Command::ShiftTime() to such a std::vector. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-09Cleanup: remove const bool parameters and return typesGravatar Berthold Stoeger
These just make no sense. Since the value is copied, it has no meaning to the caller whether the function can change the value (and vice versa for return types). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-01-06core: read and write the user-specified salinityGravatar willemferguson
Both XML and git storage are added. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-05Undo: make weight editing undoableGravatar Berthold Stoeger
Implement the EditWeight undo command. Since there is common code (storage of the old weight), this creates a common base class for RemoveWeight and EditWeight. The model calls directly into the undo command, which is somewhat unfortunate as it feels like a layering violation. It's the easy thing to do for now. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-05Undo: make weight-deletion an undoable actionGravatar Berthold Stoeger
This one is a bit more complicated than weight adding, because the multiple-dive case is not well defined. If multiple dives are selected, this implementation will search for weights that are identical to the weight deleted in the currently shown dive. The position of the weight in the list is ignored. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-05Undo: make adding of weights an undoable actionGravatar Berthold Stoeger
Introduce an AddWeight undo command. This is modelled after the numerous dive-edit undo commands. The redo and undo actions are connected to the WeightModel via two new signals, weightAdded and weightRemoved. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-03Undo: make profile-editing undoableGravatar Berthold Stoeger
Recently, undo of dive-replanning was introduced. Therefore, it appears logical to do the same thing for editing of the profile of manually added dives. For now, use the same undo-command, just change the displayed text from "replan dive" to "edit profile". Move the fixup dive call into the undo-command. Eventually, every action on the profile should be made undoable. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-03Desktop: add additional star widgets to Information tabGravatar willemferguson
Connect the UI to the underlying dive structure. Enable proper initialisation and management of star widgets while Information tab is active. Enable undo for the addtional star widgets. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-14Refactoring: move undo commands to top levelGravatar Berthold Stoeger
In the future we might want to use undo-commands for mobile as well (even if not implementing undo). Therefore, move the undo-command source from desktop-widgets to their own commands top-level folder. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>