digiKam
historyimageid.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 holding properties of referenced files used in non-dest. 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_HISTORY_IMAGE_ID_H
26 #define DIGIKAM_HISTORY_IMAGE_ID_H
27 
28 // Qt includes
29 
30 #include <QDateTime>
31 #include <QMetaType>
32 #include <QString>
33 
34 // Local includes
35 
36 #include "digikam_export.h"
37 
38 namespace Digikam
39 {
40 
41 class DIGIKAM_EXPORT HistoryImageId
42 {
43 public:
44 
45  enum Type
46  {
47  InvalidType = 0,
48 
52  Original = 1 << 0,
53 
58  Intermediate = 1 << 1,
59 
66  Source = 1 << 2,
67 
75  Current = 1 << 3
76  };
77 
82  Q_DECLARE_FLAGS(Types, Type)
83 
84 public:
85 
88 
90  explicit HistoryImageId(const QString& uuid, Type type = Current);
91 
93  bool isValid() const;
94 
95  Type type() const;
96 
97  bool isOriginalFile() const
98  {
99  return (type() == Original);
100  }
101 
102  bool isSourceFile() const
103  {
104  return (type() == Source);
105  }
106 
107  bool isIntermediateFile() const
108  {
109  return (type() == Intermediate);
110  }
111 
112  bool isCurrentFile() const
113  {
114  return (type() == Current);
115  }
116 
117  bool operator==(const HistoryImageId& other) const;
118 
119  void setType(HistoryImageId::Type type);
120  void setUuid(const QString& uuid);
121  void setFileName(const QString& fileName);
122  void setCreationDate(const QDateTime& creationDate);
123  void setPathOnDisk(const QString& filePath);
124  void setPath(const QString& path);
125  void setUniqueHash(const QString& uniqueHash, qlonglong fileSize);
126 
127  bool hasFileOnDisk() const;
128 
130  QString path() const;
131 
133  QString filePath() const;
134 
135  bool hasFileName() const;
136 
138  QString fileName() const;
139 
140  bool hasUuid() const;
141  QString uuid() const;
142  bool hasCreationDate() const;
143  QDateTime creationDate() const;
144  bool hasUniqueHashIdentifier() const;
145  QString uniqueHash() const;
146  qlonglong fileSize() const;
147  QString originalUuid() const;
148 
149 public:
150 
153 
158  QString m_uuid;
159 
161  QString m_fileName;
162 
164  QDateTime m_creationDate;
165 
167  QString m_filePath;
168 
170  QString m_uniqueHash;
171 
173  qlonglong m_fileSize;
174 
180  QString m_originalUUID;
181 };
182 
183 } // namespace Digikam
184 
185 Q_DECLARE_METATYPE(Digikam::HistoryImageId)
186 Q_DECLARE_OPERATORS_FOR_FLAGS(Digikam::HistoryImageId::Types)
187 
188 #endif // DIGIKAM_HISTORY_IMAGE_ID_H
Definition: historyimageid.h:42
QString m_filePath
The path of the referred file (NOTE: without file name!, including trailing slash)
Definition: historyimageid.h:167
bool isSourceFile() const
Definition: historyimageid.h:102
Type
Definition: historyimageid.h:46
QString m_uniqueHash
The uniqueHash of the referred file.
Definition: historyimageid.h:170
Type m_type
Type of this History Image Id.
Definition: historyimageid.h:152
QString m_uuid
Definition: historyimageid.h:158
qlonglong m_fileSize
The file size of the referred file.
Definition: historyimageid.h:173
QString m_fileName
The filename of the referred file.
Definition: historyimageid.h:161
bool isCurrentFile() const
Definition: historyimageid.h:112
bool isIntermediateFile() const
Definition: historyimageid.h:107
QDateTime m_creationDate
The creationDate of the original image.
Definition: historyimageid.h:164
bool isOriginalFile() const
Definition: historyimageid.h:97
QString m_originalUUID
Definition: historyimageid.h:180
Definition: datefolderview.cpp:43
bool operator==(const SearchTextSettings &a, const SearchTextSettings &b)
Definition: searchtextbar.cpp:49
Type
Definition: gpsitemcontainer.h:45