diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-03-10 16:03:39 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-04-12 18:19:07 +0300 |
commit | 8dcc33d8ab4081310d2e18b2c3d6c95141999698 (patch) | |
tree | 019c74009720b7164f0a6c5edaaf98a780130897 /desktop-widgets/command_divelist.h | |
parent | dd12bdaf94c1ebc5d32598151aa96da12e61c146 (diff) | |
download | subsurface-8dcc33d8ab4081310d2e18b2c3d6c95141999698.tar.gz |
Undo: keep frontend informed of changes to dive site count
Add a new signal to DiveListNotifier. Send signal if dives are
added or removed and therefore the dive count of a dive site
changes. The dive sites are collected and the signal is sent
at the end of the command.
Add code to update the table view.
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 | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/desktop-widgets/command_divelist.h b/desktop-widgets/command_divelist.h index 9199a2e58..841799473 100644 --- a/desktop-widgets/command_divelist.h +++ b/desktop-widgets/command_divelist.h @@ -66,6 +66,9 @@ protected: DivesAndTripsToAdd removeDives(DivesAndSitesToRemove &divesAndSitesToDelete); DivesAndSitesToRemove addDives(DivesAndTripsToAdd &toAdd); + // Register dive sites where counts changed so that we can signal the frontend later. + void diveSiteCountChanged(struct dive_site *ds); + // Set the selection to a given state. Set the selectionChanged flag if anything changed. void restoreSelection(const std::vector<dive *> &selection, dive *currentDive); @@ -74,9 +77,12 @@ protected: // If this flag is set on first execution, a selectionChanged signal will // be sent. bool selectionChanged; + private: + // Keep track of dive sites where the number of dives changed + std::vector<dive_site *> sitesCountChanged; void initWork(); // reset selectionChanged flag - void finishWork(); // emit signal if selection changed + void finishWork(); // emit signals if selection or dive site counts changed void undo() override; void redo() override; virtual void redoit() = 0; |