mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Undo: implement undo of dive site addition
Implement a dive site addition undo command and connect it to the add dive site button. The added dive site has a default name ("new dive site"). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
2dcc0a7d1e
commit
56dcbd9588
6 changed files with 55 additions and 0 deletions
|
@ -11,6 +11,23 @@
|
|||
// We put everything in a namespace, so that we can shorten names without polluting the global namespace
|
||||
namespace Command {
|
||||
|
||||
class AddDiveSite : public Base {
|
||||
public:
|
||||
AddDiveSite(const QString &name);
|
||||
private:
|
||||
bool workToBeDone() override;
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
|
||||
// Note: we only add one dive site. Nevertheless, we use vectors so that we
|
||||
// can reuse the dive site deletion code.
|
||||
// For redo
|
||||
std::vector<dive_site *> sitesToRemove;
|
||||
|
||||
// For undo
|
||||
std::vector<OwningDiveSitePtr> sitesToAdd;
|
||||
};
|
||||
|
||||
class DeleteDiveSites : public Base {
|
||||
public:
|
||||
DeleteDiveSites(const QVector<dive_site *> &sites);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue