digiKam
coredbchangesets.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 : 2007-12-01
7  * Description : Core database recording changes.
8  *
9  * Copyright (C) 2007-2008 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
10  *
11  * This program is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU General
13  * Public License as published by the Free Software Foundation;
14  * either version 2, or (at your option)
15  * any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef DIGIKAM_CORE_DB_CHANGESETS_H
25 #define DIGIKAM_CORE_DB_CHANGESETS_H
26 
27 #include "digikam_config.h"
28 
29 // Qt includes
30 
31 #include <QList>
32 #include <QMetaType>
33 
34 #ifdef HAVE_DBUS
35 # include <QDBusArgument>
36 # include "dbenginedbusutils.h"
37 #endif
38 
39 // Local includes
40 
41 #include "digikam_export.h"
42 #include "coredbfields.h"
43 
44 namespace Digikam
45 {
46 
47 class DIGIKAM_DATABASE_EXPORT ImageChangeset
48 {
49 public:
50 
57  ImageChangeset(const QList<qlonglong>& ids, const DatabaseFields::Set& changes);
58  ImageChangeset(qlonglong id, const DatabaseFields::Set& changes);
59 
60  QList<qlonglong> ids() const;
61  bool containsImage(qlonglong id) const;
62  DatabaseFields::Set changes() const;
63 
64 #ifdef HAVE_DBUS
65 
66  ImageChangeset& operator<<(const QDBusArgument& argument);
67  const ImageChangeset& operator>>(QDBusArgument& argument) const;
68 
69 #endif // HAVE_DBUS
70 
71 private:
72 
73  QList<qlonglong> m_ids;
74  DatabaseFields::Set m_changes;
75 };
76 
77 // ----------------------------------------------------------------------------
78 
79 class DIGIKAM_DATABASE_EXPORT ImageTagChangeset
80 {
81 public:
82 
89  enum Operation
90  {
96  PropertiesChanged
97  };
98 
99 public:
100 
102  ImageTagChangeset(const QList<qlonglong>& ids, const QList<int>& tags, Operation operation);
103  ImageTagChangeset(qlonglong id, const QList<int>& tags, Operation operation);
104  ImageTagChangeset(qlonglong id, int tag, Operation operation);
105 
113 
114 #ifdef HAVE_DBUS
115 
116  ImageTagChangeset& operator<<(const QDBusArgument& argument);
117  const ImageTagChangeset& operator>>(QDBusArgument& argument) const;
118 
119 #endif // HAVE_DBUS
120 
121  QList<qlonglong> ids() const;
122  bool containsImage(qlonglong id) const;
123  QList<int> tags() const;
124  bool containsTag(int id) const;
125  Operation operation() const;
126 
127  bool tagsWereAdded() const
128  {
129  return (operation() == Added);
130  }
131 
132  bool tagsWereRemoved() const
133  {
134  return ((operation() == Removed) || (operation() == RemovedAll));
135  }
136 
138  {
139  return (operation() == PropertiesChanged);
140  }
141 
142 private:
143 
144  QList<qlonglong> m_ids;
145  QList<int> m_tags;
146  Operation m_operation;
147 };
148 
149 // ----------------------------------------------------------------------------
150 
151 class DIGIKAM_DATABASE_EXPORT CollectionImageChangeset
152 {
153 public:
154 
156  {
158 
163 
170 
177 
184 
191 
198 
204  Copied
205  };
206 
207 public:
208 
222  CollectionImageChangeset(const QList<qlonglong>& ids, const QList<int>& albums, Operation operation);
223  CollectionImageChangeset(const QList<qlonglong>& ids, int album, Operation operation);
224  CollectionImageChangeset(qlonglong id, int album, Operation operation);
225 
233 
234 #ifdef HAVE_DBUS
235 
236  CollectionImageChangeset& operator<<(const QDBusArgument& argument);
237  const CollectionImageChangeset& operator>>(QDBusArgument& argument) const;
238 
239 #endif // HAVE_DBUS
240 
246  QList<qlonglong> ids() const;
247  bool containsImage(qlonglong id) const;
248  QList<int> albums() const;
249  bool containsAlbum(int id) const;
250  Operation operation() const;
251 
252 private:
253 
254  QList<qlonglong> m_ids;
255  QList<int> m_albums;
256  Operation m_operation;
257 };
258 
259 // ----------------------------------------------------------------------------
260 
261 class DIGIKAM_DATABASE_EXPORT AlbumChangeset
262 {
263 public:
264 
266  {
271  PropertiesChanged
272  };
273 
274 public:
275 
276  AlbumChangeset();
277  AlbumChangeset(int albumId, Operation operation);
278 
279  int albumId() const;
280  Operation operation() const;
281 
282 #ifdef HAVE_DBUS
283 
284  AlbumChangeset& operator<<(const QDBusArgument& argument);
285  const AlbumChangeset& operator>>(QDBusArgument& argument) const;
286 
287 #endif // HAVE_DBUS
288 
289 private:
290 
291  int m_id;
292  Operation m_operation;
293 };
294 
295 // ----------------------------------------------------------------------------
296 
297 class DIGIKAM_DATABASE_EXPORT TagChangeset
298 {
299 public:
300 
302  {
310  PropertiesChanged
311  };
312 
313 public:
314 
315  TagChangeset();
316  TagChangeset(int tagId, Operation operation);
317 
318  int tagId() const;
319  Operation operation() const;
320 
321 #ifdef HAVE_DBUS
322 
323  TagChangeset& operator<<(const QDBusArgument& argument);
324  const TagChangeset& operator>>(QDBusArgument& argument) const;
325 
326 #endif // HAVE_DBUS
327 
328 private:
329 
330  int m_id;
331  Operation m_operation;
332 };
333 
334 // ----------------------------------------------------------------------------
335 
336 class DIGIKAM_DATABASE_EXPORT AlbumRootChangeset
337 {
338 public:
339 
341  {
345  PropertiesChanged
346  };
347 
348 public:
349 
351  AlbumRootChangeset(int albumRootId, Operation operation);
352 
353  int albumRootId() const;
354  Operation operation() const;
355 
356 #ifdef HAVE_DBUS
357 
358  AlbumRootChangeset& operator<<(const QDBusArgument& argument);
359  const AlbumRootChangeset& operator>>(QDBusArgument& argument) const;
360 
361 #endif // HAVE_DBUS
362 
363 private:
364 
365  int m_id;
366  Operation m_operation;
367 };
368 
369 // ----------------------------------------------------------------------------
370 
371 class DIGIKAM_DATABASE_EXPORT SearchChangeset
372 {
373 public:
374 
376  {
380  Changed
381  };
382 
383 public:
384 
385  SearchChangeset();
386  SearchChangeset(int searchId, Operation operation);
387 
388  int searchId() const;
389  Operation operation() const;
390 
391 #ifdef HAVE_DBUS
392 
393  SearchChangeset& operator<<(const QDBusArgument& argument);
394  const SearchChangeset& operator>>(QDBusArgument& argument) const;
395 
396 #endif // HAVE_DBUS
397 
398 private:
399 
400  int m_id;
401  Operation m_operation;
402 };
403 
404 } // namespace Digikam
405 
406 #ifdef HAVE_DBUS
407 
408 // custom macro from our dbusutilities.h
417 
418 #endif // HAVE_DBUS
419 
420 #endif // DIGIKAM_CORE_DB_CHANGESETS_H
Definition: coredbchangesets.h:262
Operation
Definition: coredbchangesets.h:266
@ Unknown
Definition: coredbchangesets.h:267
@ Deleted
Definition: coredbchangesets.h:269
@ Added
Definition: coredbchangesets.h:268
@ Renamed
Definition: coredbchangesets.h:270
Definition: coredbchangesets.h:337
Operation
Definition: coredbchangesets.h:341
@ Deleted
Definition: coredbchangesets.h:344
@ Unknown
Definition: coredbchangesets.h:342
@ Added
Definition: coredbchangesets.h:343
Definition: coredbchangesets.h:152
Operation
Definition: coredbchangesets.h:156
@ Removed
Definition: coredbchangesets.h:169
@ Added
Definition: coredbchangesets.h:162
@ Deleted
Definition: coredbchangesets.h:183
@ Moved
Definition: coredbchangesets.h:197
@ RemovedDeleted
Definition: coredbchangesets.h:190
@ RemovedAll
Definition: coredbchangesets.h:176
@ Unknown
Definition: coredbchangesets.h:157
Definition: coredbfields.h:389
Definition: coredbchangesets.h:48
Definition: coredbchangesets.h:80
bool tagsWereAdded() const
Definition: coredbchangesets.h:127
bool tagsWereRemoved() const
Definition: coredbchangesets.h:132
Operation
Definition: coredbchangesets.h:90
@ Added
Definition: coredbchangesets.h:92
@ RemovedAll
Definition: coredbchangesets.h:95
@ Removed
Definition: coredbchangesets.h:94
@ Moved
Definition: coredbchangesets.h:93
@ Unknown
Definition: coredbchangesets.h:91
bool propertiesWereChanged() const
Definition: coredbchangesets.h:137
Definition: coredbchangesets.h:372
Operation
Definition: coredbchangesets.h:376
@ Deleted
Definition: coredbchangesets.h:379
@ Unknown
Definition: coredbchangesets.h:377
@ Added
Definition: coredbchangesets.h:378
Definition: coredbchangesets.h:298
Operation
Definition: coredbchangesets.h:302
@ Added
Definition: coredbchangesets.h:304
@ Unknown
Definition: coredbchangesets.h:303
@ IconChanged
Definition: coredbchangesets.h:309
@ Moved
Definition: coredbchangesets.h:305
@ Deleted
Definition: coredbchangesets.h:306
@ Reparented
Definition: coredbchangesets.h:308
@ Renamed
Definition: coredbchangesets.h:307
#define DECLARE_METATYPE_FOR_DBUS(x)
Definition: dbenginedbusutils.h:29
Definition: datefolderview.cpp:43
QDebug operator<<(QDebug dbg, const DbEngineParameters &p)
Definition: dbengineparameters.cpp:863
QDataStream & operator>>(QDataStream &ds, PhotoInfoContainer &info)
Definition: photoinfocontainer.cpp:117