digiKam
dimagehistory.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 : 2010-06-02
7  * Description : class for manipulating modifications changeset for non-destruct. editing
8  *
9  * Copyright (C) 2010 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
10  * Copyright (C) 2010 by Martin Klapetek <martin dot klapetek at gmail dot com>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option)
16  * any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_DIMAGE_HISTORY_H
26 #define DIGIKAM_DIMAGE_HISTORY_H
27 
28 // Qt includes
29 
30 #include <QXmlStreamWriter>
31 #include <QXmlStreamReader>
32 #include <QHash>
33 #include <QList>
34 #include <QMetaType>
35 #include <QSharedDataPointer>
36 #include <QString>
37 #include <QVariant>
38 
39 // Local includes
40 
41 #include "digikam_export.h"
42 #include "filteraction.h"
43 #include "historyimageid.h"
44 
45 namespace Digikam
46 {
47 
48 class DIGIKAM_EXPORT DImageHistory
49 {
50 public:
51 
52  class Entry
53  {
54  public:
55 
70  };
71 
72 public:
73 
74  DImageHistory();
75  DImageHistory(const DImageHistory& other);
76  ~DImageHistory();
77 
78  DImageHistory& operator=(const DImageHistory& other);
79 
83  bool isNull() const;
84 
88  bool isEmpty() const;
89 
96  bool isValid() const;
97 
99  int size() const;
100 
101  bool operator==(const DImageHistory& other) const;
102 
103  bool operator!=(const DImageHistory& other) const
104  {
105  return !operator==(other);
106  }
107 
108  bool operator<(const DImageHistory& other) const;
109  bool operator>(const DImageHistory& other) const;
110 
114  DImageHistory& operator<<(const FilterAction& action);
115 
121  DImageHistory& operator<<(const HistoryImageId& imageId);
122 
123  void appendReferredImage(const HistoryImageId& id);
124  void insertReferredImage(int entryIndex, const HistoryImageId& id);
125 
127  void removeLast();
128 
133  QList<DImageHistory::Entry>& entries();
134  const QList<DImageHistory::Entry>& entries() const;
135  Entry& operator[](int i);
136  const Entry& operator[](int i) const;
137 
146  bool hasActions() const;
147  bool hasFilters() const
148  {
149  return hasActions();
150  }
151 
153  int actionCount() const;
154 
156  QList<FilterAction> allActions() const;
157  const FilterAction& action(int i) const;
158 
162  QList<HistoryImageId>& referredImages(int i);
163  const QList<HistoryImageId>& referredImages(int i) const;
164  QList<HistoryImageId> allReferredImages() const;
165  HistoryImageId currentReferredImage() const;
166  HistoryImageId originalReferredImage() const;
167  QList<HistoryImageId> referredImagesOfType(HistoryImageId::Type type) const;
168  bool hasReferredImages() const;
169  bool hasReferredImageOfType(HistoryImageId::Type type) const;
170  bool hasCurrentReferredImage() const;
171  bool hasOriginalReferredImage() const;
172 
178  void clearReferredImages();
179 
186  void adjustReferredImages();
187 
189  void adjustCurrentUuid(const QString& uuid);
190 
198  void purgePathFromReferredImages(const QString& path, const QString& fileName);
199 
203  void moveCurrentReferredImage(const QString& newPath, const QString& newFileName);
204 
212  QString toXml() const;
213  static DImageHistory fromXml(const QString& xml);
214 
215 public:
216 
218  class Private;
219 
220 private:
221 
222  QSharedDataPointer<Private> d;
223 };
224 
225 } // namespace Digikam
226 
227 Q_DECLARE_METATYPE(Digikam::DImageHistory)
228 
229 #endif // DIGIKAM_DIMAGE_HISTORY_H
Definition: dimagehistory.h:53
QList< HistoryImageId > referredImages
Definition: dimagehistory.h:69
FilterAction action
Definition: dimagehistory.h:68
Definition: dimagehistory.h:49
bool operator!=(const DImageHistory &other) const
Definition: dimagehistory.h:103
bool hasFilters() const
Definition: dimagehistory.h:147
Definition: filteraction.h:43
Definition: historyimageid.h:42
Type
Definition: historyimageid.h:46
Definition: piwigotalker.h:48
Definition: datefolderview.cpp:43
QDebug operator<<(QDebug dbg, const DbEngineParameters &p)
Definition: dbengineparameters.cpp:863
bool operator==(const SearchTextSettings &a, const SearchTextSettings &b)
Definition: searchtextbar.cpp:49
FileReadWriteLockPriv Entry
Definition: filereadwritelock.cpp:79
bool operator<(const WSAlbum &first, const WSAlbum &second)
Definition: wstalker.cpp:47