diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-03-31 10:20:13 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-04-04 09:38:12 -0700 |
commit | 145f70aab59a5ebd1b4ca82432caf38b4821b055 (patch) | |
tree | 2527f595c552559ffe74e6cce39f3c52283762d9 /desktop-widgets/command.cpp | |
parent | 8c9e5becb20d2d8c8aa1f7108775cc520b08fae1 (diff) | |
download | subsurface-145f70aab59a5ebd1b4ca82432caf38b4821b055.tar.gz |
Undo: implement split-out of dive computer
Allow splitting out a dive computer into a distinct dive. This
is realized by generating a base class from SplitDive.
This turned out to be more cumbersome than expected: we don't
know a-priori which of the split dives will come first. Since
the undo-command saves the indices where the dives will be insert,
these have to be calculated. This is an premature optimization,
which makes more pain than necessary. Let's remove it and
simply determine the insertion index when executing the command.
Original code by Linus Torvalds <torvalds@linux-foundation.org>.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets/command.cpp')
-rw-r--r-- | desktop-widgets/command.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/desktop-widgets/command.cpp b/desktop-widgets/command.cpp index 84f21265d..638be74d1 100644 --- a/desktop-widgets/command.cpp +++ b/desktop-widgets/command.cpp @@ -66,6 +66,11 @@ void splitDives(dive *d, duration_t time) execute(new SplitDives(d, time)); } +void splitDiveComputer(dive *d, int dc_num) +{ + execute(new SplitDiveComputer(d, dc_num)); +} + void mergeDives(const QVector <dive *> &dives) { execute(new MergeDives(dives)); |