diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-08-10 08:02:02 -0400 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-10-11 16:22:27 -0700 |
commit | 1afd295c413dad73293aac580ee854ea90f8fbd3 (patch) | |
tree | a84d2d4bd6e3f999b3c9f8c09cf2aa8f56ef9920 /desktop-widgets/command_divelist.h | |
parent | 7067e335964de97d51381ca9e9b09f7236ffc619 (diff) | |
download | subsurface-1afd295c413dad73293aac580ee854ea90f8fbd3.tar.gz |
Undo: use vectors for MergeDives and SplitDive
The MergeDives and SplitDive commands used addDive() and removeDive()
calls to manage their dives. Unfortunately, these calls don't send
the proper signals and thus the dive-list was not updated. Instead,
use one- and two-element vectors, which are passed to addDives()
and removeDives() [note the plural].
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/command_divelist.h')
-rw-r--r-- | desktop-widgets/command_divelist.h | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/desktop-widgets/command_divelist.h b/desktop-widgets/command_divelist.h index 01dd4db77..650a64ba4 100644 --- a/desktop-widgets/command_divelist.h +++ b/desktop-widgets/command_divelist.h @@ -182,13 +182,17 @@ private: // For redo // For each dive to split, we remove one from and put two dives into the backend - dive *diveToSplit; - DiveToAdd splitDives[2]; + // Note: we use a vector even though we split only a single dive, so + // that we can reuse the multi-dive functions of the other commands. + std::vector<dive *> diveToSplit; + std::vector<DiveToAdd> splitDives; // For undo // For each dive to unsplit, we remove two dives from and add one into the backend - DiveToAdd unsplitDive; - dive *divesToUnsplit[2]; + // Note: we use a vector even though we unsplit only a single dive, so + // that we can reuse the multi-dive functions of the other commands. + std::vector<DiveToAdd> unsplitDive; + std::vector<dive *> divesToUnsplit; }; class MergeDives : public DiveListBase { @@ -201,13 +205,17 @@ private: // For redo // Add one and remove a batch of dives - DiveToAdd mergedDive; - std::vector<dive *> divesToMerge; + // Note: we use a vector even though we add only a single dive, so + // that we can reuse the multi-dive functions of the other commands. + std::vector<DiveToAdd> mergedDive; + std::vector<dive *> divesToMerge; // For undo // Remove one and add a batch of dives - dive *diveToUnmerge; - std::vector<DiveToAdd> unmergedDives; + // Note: we use a vector even though we remove only a single dive, so + // that we can reuse the multi-dive functions of the other commands. + std::vector<dive *> diveToUnmerge; + std::vector<DiveToAdd> unmergedDives; // For undo and redo QVector<QPair<dive *, int>> divesToRenumber; |