summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/command_divesite.h
diff options
context:
space:
mode:
authorGravatar Doug Junkins <junkins@foghead.com>2019-05-04 20:40:27 -0700
committerGravatar bstoeger <32835590+bstoeger@users.noreply.github.com>2019-05-06 10:48:44 +0200
commit704ff9f82e35699dcd5ba260cda798195b0860a5 (patch)
tree590a3456015417a582f1de06051b864e0a109e3e /desktop-widgets/command_divesite.h
parentc38a86bebf5d031d8c830813d0e4107bcd9e098c (diff)
downloadsubsurface-704ff9f82e35699dcd5ba260cda798195b0860a5.tar.gz
Add undo/redo commands for importing dive sites
ImportDiveSites adds the provided dive sites to the core dive site table and stores the source data so it can be undone. Signed-off-by: Doug Junkins <junkins@foghead.com>
Diffstat (limited to 'desktop-widgets/command_divesite.h')
-rw-r--r--desktop-widgets/command_divesite.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/desktop-widgets/command_divesite.h b/desktop-widgets/command_divesite.h
index 9661bbffd..3fcf085ae 100644
--- a/desktop-widgets/command_divesite.h
+++ b/desktop-widgets/command_divesite.h
@@ -21,10 +21,26 @@ private:
// Note: we only add one dive site. Nevertheless, we use vectors so that we
// can reuse the dive site deletion code.
- // For redo
+ // For undo
std::vector<dive_site *> sitesToRemove;
+ // For redo
+ std::vector<OwningDiveSitePtr> sitesToAdd;
+};
+
+class ImportDiveSites : public Base {
+public:
+ // Note: the dive site table is consumed after the call it will be empty.
+ ImportDiveSites(struct dive_site_table *sites, const QString &source);
+private:
+ bool workToBeDone() override;
+ void undo() override;
+ void redo() override;
+
// For undo
+ std::vector<dive_site *> sitesToRemove;
+
+ // For redo
std::vector<OwningDiveSitePtr> sitesToAdd;
};