aboutsummaryrefslogtreecommitdiffstats
path: root/commands/command_edit.cpp
AgeCommit message (Collapse)Author
2020-03-06Cleanup: Move stringToList to core/qthelper.cppGravatar Berthold Stoeger
The same code was used in desktop and undo commands. Let's unify. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-01-10code cleanup: remove unused member variableGravatar Dirk Hohndel
It was initialized, but never referenced. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-10code cleanup: replace deprecated fromStdVector() methodGravatar Dirk Hohndel
Replacement was only introduced in Qt 5.14 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-10code cleanup: ensure all fields are initializedGravatar Dirk Hohndel
In a total abundance of caution, make sure we don't exit the constructor leaving fields uninitialized. Fixes CID 351437 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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-05Translation: explicitly show no dive-count if only one dive editedGravatar Berthold Stoeger
We relied upon the translators to remove the parenthesis in cases like "Edited notes (%n dives)" for n = 1 dives. Dirk doesn't want that. Therefore, do it in the C++-code. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
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-05Cleanup: use free_weightsystem function instead of explicit freeGravatar Berthold Stoeger
Instead of freeing internal data of the weightsystem structure, call the free_weightsystem function (which has to be made extern at first). This makes things more future-proof, should the weightsystem struct ever be extended. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-05Cleanup: introduce empty_weightsystem constantGravatar Berthold Stoeger
To make things more future-proof, introduce an empty_weightsystem constant. Replace explicit aggragate initialization of empty weightsystems by this constant. 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-04Selection: move commands/command_private.* to core/selection.*Gravatar Berthold Stoeger
The file command_private.cpp had functions concerning selections only. To make these functions accessible from outside the undo machinery, turn it into a part of the core-library. Currently, only C++ functions are exported. We might think about also exporting a C interface. 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>