digiKam
undoaction.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2005-02-06
7  * Description : undo actions manager for image editor.
8  *
9  * Copyright (C) 2005 by Renchi Raju <renchi dot raju at gmail dot com>
10  * Copyright (C) 2005 by Joern Ahrens <joern dot ahrens at kdemail dot net>
11  * Copyright (C) 2006-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
12  *
13  * This program is free software; you can redistribute it
14  * and/or modify it under the terms of the GNU General
15  * Public License as published by the Free Software Foundation;
16  * either version 2, or (at your option)
17  * any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * ============================================================ */
25 
26 #ifndef DIGIKAM_UNDO_ACTION_H
27 #define DIGIKAM_UNDO_ACTION_H
28 
29 // Local includes
30 
31 #include "digikam_export.h"
32 #include "dimagehistory.h"
33 #include "dimg.h"
34 #include "dimgbuiltinfilter.h"
35 
36 namespace Digikam
37 {
38 
39 class EditorCore;
40 
41 class DIGIKAM_EXPORT UndoMetadataContainer
42 {
43 public:
44 
48  static UndoMetadataContainer fromImage(const DImg& img);
49 
53  void toImage(DImg& img) const;
54 
55  bool changesIccProfile(const DImg& target) const;
56 
57 public:
58 
61 };
62 
63 // -------------------------------------------------------------------
64 
65 class DIGIKAM_EXPORT UndoAction
66 {
67 
68 public:
69 
70  explicit UndoAction(EditorCore* const core);
71  virtual ~UndoAction();
72 
73  void setTitle(const QString& title);
74  QString getTitle() const;
75 
76  void setMetadata(const UndoMetadataContainer&);
77  UndoMetadataContainer getMetadata() const;
78 
79  void setFileOriginData(const QVariant& data,
80  const DImageHistory& resolvedInitialHistory);
81  bool hasFileOriginData() const;
82  QVariant fileOriginData() const;
83  DImageHistory fileOriginResolvedHistory() const;
84 
85 private:
86 
87  // Disable
88  UndoAction(const UndoAction&) = delete;
89  UndoAction& operator=(const UndoAction&) = delete;
90 
91 private:
92 
93  class Private;
94  Private* const d;
95 };
96 
97 // --------------------------------------------------------------------
98 
99 class DIGIKAM_EXPORT UndoActionReversible : public UndoAction
100 {
101 
102 public:
103 
104  explicit UndoActionReversible(EditorCore* const core,
105  const DImgBuiltinFilter& reversibleFilter);
106 
107  DImgBuiltinFilter getFilter() const;
108  DImgBuiltinFilter getReverseFilter() const;
109 
110 protected:
111 
113 };
114 
115 // --------------------------------------------------------------------
116 
117 class DIGIKAM_EXPORT UndoActionIrreversible : public UndoAction
118 {
119 
120 public:
121 
122  explicit UndoActionIrreversible(EditorCore* const core,
123  const QString& title = QString());
124  ~UndoActionIrreversible() override;
125 };
126 
127 } // namespace Digikam
128 
129 #endif // DIGIKAM_UNDOACTION_H
Definition: dimagehistory.h:49
Definition: dimgbuiltinfilter.h:44
Definition: dimg.h:62
Definition: editorcore.h:58
Definition: iccprofile.h:43
Definition: undoaction.h:118
Definition: undoaction.h:100
DImgBuiltinFilter m_filter
Definition: undoaction.h:112
Definition: undoaction.h:66
Definition: undoaction.h:42
DImageHistory history
Definition: undoaction.h:59
IccProfile profile
Definition: undoaction.h:60
Definition: datefolderview.cpp:43