From fea833b716aa389596b131b14d6f7d5052e9591f Mon Sep 17 00:00:00 2001 From: tetektoza Date: Thu, 23 Nov 2023 23:00:09 +0100 Subject: [PATCH] Undostack: Introduce undostack Right now we're using QUndoStack which is from Qt library, although it has limited usage which we want to expand since we want to handle errors in a proper way without any hacks regarding QUndoStack, so these series of patches will introduce customly made Undostack, as well as Command class which will replace QUndoCommand/QUndoStack classes. --- CMakeLists.txt | 4 ++++ source/command.cpp | 2 ++ source/command.h | 6 ++++++ source/undostack.cpp | 1 + source/undostack.h | 8 ++++++++ 5 files changed, 21 insertions(+) create mode 100644 source/command.cpp create mode 100644 source/command.h create mode 100644 source/undostack.cpp create mode 100644 source/undostack.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 7bb9d321c..d5995bce5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,6 +43,10 @@ set(PROJECT_SOURCES source/openasdialog.cpp source/palettewidget.cpp source/settingsdialog.cpp + source/undostack.cpp + source/undostack.h + source/command.cpp + source/command.h ) if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) diff --git a/source/command.cpp b/source/command.cpp new file mode 100644 index 000000000..22871f6f0 --- /dev/null +++ b/source/command.cpp @@ -0,0 +1,2 @@ +#include "command.h" + diff --git a/source/command.h b/source/command.h new file mode 100644 index 000000000..d4aacbc7c --- /dev/null +++ b/source/command.h @@ -0,0 +1,6 @@ +#pragma once + + +class Command { + +}; diff --git a/source/undostack.cpp b/source/undostack.cpp new file mode 100644 index 000000000..5314a002e --- /dev/null +++ b/source/undostack.cpp @@ -0,0 +1 @@ +#include "undostack.h" diff --git a/source/undostack.h b/source/undostack.h new file mode 100644 index 000000000..680645970 --- /dev/null +++ b/source/undostack.h @@ -0,0 +1,8 @@ +#pragma once + +#include "command.h" + +class UndoStack { +private: + std::vector cmds; +}; \ No newline at end of file