11/*
22 * This file is part of the GreasePad distribution (https://github.com/FraunhoferIOSB/GreasePad).
3- * Copyright (c) 2022-2023 Jochen Meidow, Fraunhofer IOSB
3+ * Copyright (c) 2022-2025 Jochen Meidow, Fraunhofer IOSB
44 *
55 * This program is free software: you can redistribute it and/or modify
66 * it under the terms of the GNU General Public License as published by
2222#include < memory>
2323
2424#include < QGraphicsScene>
25+ #include < QString>
2526#include < QUndoCommand>
2627
2728class State ;
2829namespace GUI {
2930class MainScene ;
30- }
31+ } // namespace GUI
3132
3233
3334// ! Namespace for commands (und/redo)
@@ -42,20 +43,19 @@ class Undo : public QUndoCommand
4243 Undo & operator = (const Undo & other) = delete ; // !< Copy assignment operator
4344 Undo & operator = (Undo && other) = delete ; // !< Move assignment operator
4445
46+ // ! Set pointer to scene
47+ static void setScene ( GUI::MainScene * sc) { s_scene = sc; }
48+ // ! Get pointer to scene
49+ static GUI::MainScene * scene () { return s_scene; }
50+
4551protected:
46- Undo ( QUndoCommand *parent= nullptr ); // !< Standard constructor
47- ~Undo () override = default ;
52+ explicit Undo ( QUndoCommand *parent); // !< Standard constructor
53+ ~Undo () = default ;
4854
4955 State *current_state_{}; // !< Pointer to current state
5056 std::unique_ptr<State> next_state_; // !< Pointer to next state (redo)
5157 std::unique_ptr<State> prev_state_; // !< Pointer to previous state (undo)
5258
53- public:
54- // ! Set pointer to scene
55- static void setScene ( GUI::MainScene * sc) { s_scene = sc; }
56- // ! Get pointer to scene
57- static GUI::MainScene * scene () { return s_scene; }
58-
5959private:
6060 static GUI::MainScene *s_scene;
6161};
@@ -69,7 +69,7 @@ class AddStroke : public Undo
6969 AddStroke ( State *curr,
7070 std::unique_ptr<State> & p,
7171 std::unique_ptr<State> & n,
72- QUndoCommand *parent= nullptr );
72+ QUndoCommand *parent);
7373 AddStroke ( const AddStroke &) = delete ;
7474 AddStroke ( AddStroke &&) = delete ;
7575 AddStroke operator = (const AddStroke &) = delete ;
@@ -90,8 +90,7 @@ class DeleteSelection : public Undo
9090 DeleteSelection ( State *st,
9191 std::unique_ptr<State> &p,
9292 std::unique_ptr<State> &n,
93- QUndoCommand *parent=nullptr );
94-
93+ QUndoCommand *parent);
9594private:
9695 void redo () override ;
9796 void undo () override ;
@@ -103,8 +102,7 @@ class TabulaRasa : public Undo
103102{
104103public:
105104 // ! Value constructor
106- TabulaRasa ( State *st,
107- QUndoCommand *parent=nullptr );
105+ TabulaRasa ( State *st, QUndoCommand *parent);
108106private:
109107 void redo () override ;
110108 void undo () override ;
@@ -119,7 +117,7 @@ class ReplaceStateWithFileContent : public Undo
119117 State *curr,
120118 std::unique_ptr<State> &p,
121119 std::unique_ptr<State> &n,
122- QUndoCommand *parent= nullptr );
120+ QUndoCommand *parent);
123121private:
124122 void redo () override ;
125123 void undo () override ;
0 commit comments