summaryrefslogtreecommitdiffstats
path: root/commands/command_divesite.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-11-16 21:35:26 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-03-09 12:41:57 -0700
commit93bdaa9bb5be80115dc80af569a2c64e0136c5f5 (patch)
tree816d4a03387d211d65b5003d022b8298e87ec0d2 /commands/command_divesite.h
parent89047b3541618383ab5b39eeadff7dfcb60e1295 (diff)
downloadsubsurface-93bdaa9bb5be80115dc80af569a2c64e0136c5f5.tar.gz
undo: implement ApplyGPSFixes undo command
This gets a list of dives with GPS fixes and 1) Adds new dive sites if the dive hasn't a dive site set 2) Edits the location of the dive site Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'commands/command_divesite.h')
-rw-r--r--commands/command_divesite.h26
1 files changed, 25 insertions, 1 deletions
diff --git a/commands/command_divesite.h b/commands/command_divesite.h
index 3fcf085ae..db0c5c73e 100644
--- a/commands/command_divesite.h
+++ b/commands/command_divesite.h
@@ -5,6 +5,7 @@
#define COMMAND_DIVESITE_H
#include "command_base.h"
+#include "core/gpslocation.h"
#include <QVector>
@@ -110,7 +111,6 @@ private:
QString value; // Value to be set
};
-
class EditDiveSiteCountry : public Base {
public:
EditDiveSiteCountry(dive_site *ds, const QString &country);
@@ -165,6 +165,30 @@ private:
std::vector<OwningDiveSitePtr> sitesToAdd;
};
+class ApplyGPSFixes : public Base {
+public:
+ // Note: the dive site table is consumed after the call it will be empty.
+ ApplyGPSFixes(const std::vector<DiveAndLocation> &fixes);
+private:
+ bool workToBeDone() override;
+ void undo() override;
+ void redo() override;
+
+ // For undo
+ std::vector<dive_site *> sitesToRemove;
+
+ // For redo
+ std::vector<OwningDiveSitePtr> sitesToAdd;
+
+ // For redo and undo
+ struct SiteAndLocation {
+ dive_site *ds;
+ location_t location;
+ };
+ std::vector<SiteAndLocation> siteLocations;
+ void editDiveSites();
+};
+
} // namespace Command
#endif // COMMAND_DIVESITE_H