From 434644b381cb1dc8d2080b19a9725bfe2660a217 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Fri, 17 Apr 2020 23:18:58 +0200 Subject: undo: make picture (media) deletion undoable The code is rather complex. Firstly, we have different representations of pictures throughout the code. Secondly, this tries to do add the pictures in batches to the divepicture model and that is always rather tricky. Signed-off-by: Berthold Stoeger --- commands/command_pictures.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'commands/command_pictures.h') diff --git a/commands/command_pictures.h b/commands/command_pictures.h index f2381d111..802c63c6c 100644 --- a/commands/command_pictures.h +++ b/commands/command_pictures.h @@ -5,6 +5,7 @@ #define COMMAND_PICTURES_H #include "command_base.h" +#include "command.h" // for PictureListForDeletion/Addition // We put everything in a namespace, so that we can shorten names without polluting the global namespace namespace Command { @@ -22,5 +23,17 @@ private: bool workToBeDone() override; }; +class RemovePictures final : public Base { +public: + RemovePictures(const std::vector &pictures); +private: + std::vector picturesToRemove; // for redo + std::vector picturesToAdd; // for undo + + void undo() override; + void redo() override; + bool workToBeDone() override; +}; + } // namespace Command #endif -- cgit v1.2.3-70-g09d2