digiKam
Loading...
Searching...
No Matches
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 * SPDX-FileCopyrightText: 2010-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
10 * SPDX-FileCopyrightText: 2010 by Michael G. Hansen <mike at mghansen dot de>
11 *
12 * SPDX-License-Identifier: GPL-2.0-or-later
13 *
14 * ============================================================ */
15
16#pragma once
17
18// Qt includes
19
20#include <QUndoCommand>
21
22// Local includes
23
24#include "gpsitemcontainer.h"
25#include "digikam_export.h"
26
27namespace Digikam
28{
29
30class DIGIKAM_EXPORT GPSUndoCommand : public QUndoCommand
31{
32public:
33
35 {
36 public:
37
38 explicit UndoInfo(const QPersistentModelIndex& pModelIndex)
39 : modelIndex(pModelIndex)
40 {
41 }
42
43 void readOldDataFromItem(const GPSItemContainer* const imageItem);
44 void readNewDataFromItem(const GPSItemContainer* const imageItem);
45
46 public:
47
48 QPersistentModelIndex modelIndex;
51
52 QList<QList<TagData> > oldTagList;
53 QList<QList<TagData> > newTagList;
54
55 typedef QList<UndoInfo> List;
56 };
57
58 explicit GPSUndoCommand(QUndoCommand* const parent = nullptr);
59
60 void addUndoInfo(const UndoInfo& info);
61 void changeItemData(const bool redoIt);
62
63 inline int affectedItemCount() const
64 {
65 return undoList.count();
66 }
67
68 void redo() override;
69 void undo() override;
70
71private:
72
73 UndoInfo::List undoList;
74};
75
76} // namespace Digikam
Definition gpsdatacontainer.h:26
Definition gpsitemcontainer.h:75
Definition gpsundocommand.h:35
QList< UndoInfo > List
Definition gpsundocommand.h:55
QPersistentModelIndex modelIndex
Definition gpsundocommand.h:48
GPSDataContainer dataBefore
Definition gpsundocommand.h:49
GPSDataContainer dataAfter
Definition gpsundocommand.h:50
UndoInfo(const QPersistentModelIndex &pModelIndex)
Definition gpsundocommand.h:38
QList< QList< TagData > > oldTagList
Definition gpsundocommand.h:52
QList< QList< TagData > > newTagList
Definition gpsundocommand.h:53
Definition gpsundocommand.h:31
int affectedItemCount() const
Definition gpsundocommand.h:63
Definition datefolderview.cpp:34