digiKam
gpsundocommand.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-04-25
7  * Description : A class to hold undo/redo commands.
8  *
9  * Copyright (C) 2010-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  * Copyright (C) 2010 by Michael G. Hansen <mike at mghansen dot de>
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_GPS_UNDO_COMMAND_H
26 #define DIGIKAM_GPS_UNDO_COMMAND_H
27 
28 // Qt includes
29 
30 #include <QUndoCommand>
31 
32 // Local includes
33 
34 #include "gpsitemcontainer.h"
35 #include "digikam_export.h"
36 
37 namespace Digikam
38 {
39 
40 class DIGIKAM_EXPORT GPSUndoCommand : public QUndoCommand
41 {
42 public:
43 
44  class UndoInfo
45  {
46  public:
47 
48  explicit UndoInfo(const QPersistentModelIndex& pModelIndex)
49  : modelIndex(pModelIndex)
50  {
51  }
52 
53  void readOldDataFromItem(const GPSItemContainer* const imageItem);
54  void readNewDataFromItem(const GPSItemContainer* const imageItem);
55 
56  public:
57 
58  QPersistentModelIndex modelIndex;
61 
64 
66  };
67 
68  explicit GPSUndoCommand(QUndoCommand* const parent = nullptr);
69 
70  void addUndoInfo(const UndoInfo& info);
71  void changeItemData(const bool redoIt);
72 
73  inline int affectedItemCount() const
74  {
75  return undoList.count();
76  }
77 
78  void redo() override;
79  void undo() override;
80 
81 private:
82 
83  UndoInfo::List undoList;
84 };
85 
86 } // namespace Digikam
87 
88 #endif // DIGIKAM_GPS_UNDO_COMMAND_H
Definition: gpsdatacontainer.h:36
Definition: gpsitemcontainer.h:96
Definition: gpsundocommand.h:45
QList< UndoInfo > List
Definition: gpsundocommand.h:65
QPersistentModelIndex modelIndex
Definition: gpsundocommand.h:58
GPSDataContainer dataBefore
Definition: gpsundocommand.h:59
GPSDataContainer dataAfter
Definition: gpsundocommand.h:60
UndoInfo(const QPersistentModelIndex &pModelIndex)
Definition: gpsundocommand.h:48
QList< QList< TagData > > oldTagList
Definition: gpsundocommand.h:62
QList< QList< TagData > > newTagList
Definition: gpsundocommand.h:63
Definition: gpsundocommand.h:41
int affectedItemCount() const
Definition: gpsundocommand.h:73
Definition: piwigotalker.h:48
Definition: datefolderview.cpp:43