mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
89047b3541
commit
93bdaa9bb5
4 changed files with 81 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue