diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-05-27 09:31:26 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-09-29 16:13:03 -0700 |
commit | 2f5223035a9d43b933b0baf64823dab84b5d8cea (patch) | |
tree | 91a75c82f307076079e247f68f19b04ea0ccc529 /commands/command_filter.h | |
parent | 536fc05dd6acd67a459fe6decbd67071ad388df0 (diff) | |
download | subsurface-2f5223035a9d43b933b0baf64823dab84b5d8cea.tar.gz |
filter: add filter preset undo commands
Add undo commands to add / edit / delete filter presets.
These are styled after the other undo commands: On changes,
the UI is informed by DiveListNotifier signals. Editing is
a simple std::swap of values.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'commands/command_filter.h')
-rw-r--r-- | commands/command_filter.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/commands/command_filter.h b/commands/command_filter.h new file mode 100644 index 000000000..e09753edf --- /dev/null +++ b/commands/command_filter.h @@ -0,0 +1,61 @@ +// SPDX-License-Identifier: GPL-2.0 +// Note: this header file is used by the undo-machinery and should not be included elsewhere. + +#ifndef COMMAND_FILTER_H +#define COMMAND_FILTER_H + +#include "command_base.h" +#include "core/divefilter.h" + +struct FilterData; + +// We put everything in a namespace, so that we can shorten names without polluting the global namespace +namespace Command { + +class CreateFilterPreset final : public Base { +public: + CreateFilterPreset(const QString &name, const FilterData &data); +private: + // for redo + QString name; + FilterData data; + + // for undo + int index; + + void undo() override; + void redo() override; + bool workToBeDone() override; +}; + +class RemoveFilterPreset final : public Base { +public: + RemoveFilterPreset(int index); +private: + // for undo + QString name; + FilterData data; + + // for redo + int index; + + void undo() override; + void redo() override; + bool workToBeDone() override; +}; + +class EditFilterPreset final : public Base { +public: + EditFilterPreset(int index, const FilterData &data); +private: + // for redo and undo + int index; + FilterData data; + + void undo() override; + void redo() override; + bool workToBeDone() override; +}; + +} // namespace Command +#endif |