digiKam
Loading...
Searching...
No Matches
itemhistorygraph.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-10-23
7 * Description : Graph data class for item history
8 *
9 * SPDX-FileCopyrightText: 2010-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
10 *
11 * SPDX-License-Identifier: GPL-2.0-or-later
12 *
13 * ============================================================ */
14
15#pragma once
16
17// Qt includes
18
19#include <QFlags>
20#include <QSharedDataPointer>
21#include <QDebug>
22
23// Local includes
24
25#include "iteminfo.h"
26#include "historyimageid.h"
27#include "digikam_export.h"
28
29namespace Digikam
30{
31
32class ItemHistoryGraphData;
33class DImageHistory;
34
35class DIGIKAM_DATABASE_EXPORT ItemHistoryGraph
36{
37public:
38
40 {
42 LoadRelationCloud = 1 << 0,
43
45 LoadSubjectHistory = 1 << 1,
46
48 LoadLeavesHistory = 1 << 2,
49
50 LoadAll = LoadRelationCloud | LoadSubjectHistory | LoadLeavesHistory
51 };
52 Q_DECLARE_FLAGS(HistoryLoadingMode, HistoryLoadingFlag)
53
55 {
57 PrepareForDisplay
58 };
59
60public:
61
65
66 ItemHistoryGraph& operator=(const ItemHistoryGraph& other);
67
68 bool isNull() const;
69 bool isEmpty() const;
70 bool isSingleVertex() const;
71
76 bool hasEdges() const;
77
79 const ItemHistoryGraphData& data() const;
80
87 static ItemHistoryGraph fromInfo(const ItemInfo& info,
88 HistoryLoadingMode loadingMode = LoadAll,
89 ProcessingMode processingMode = PrepareForDisplay);
90
97 void addHistory(const DImageHistory& history, const ItemInfo& historySubject = ItemInfo());
98 void addHistory(const DImageHistory& history, const HistoryImageId& historySubject = HistoryImageId());
99
105 void addScannedHistory(const DImageHistory& history, qlonglong historySubjectId);
106
111 void addRelations(const QList<QPair<qlonglong, qlonglong> >& pairs);
112
116 void clear();
117
123 void reduceEdges();
124
128 bool hasUnresolvedEntries() const;
129
134 void dropUnresolvedEntries();
135
139 void sortForInfo(const ItemInfo& subject);
140
144 void prepareForDisplay(const ItemInfo& subject);
145
151 QList<QPair<qlonglong, qlonglong> > relationCloud() const;
152 QPair<QList<qlonglong>, QList<qlonglong> > relationCloudParallel() const;
153
157 QList<ItemInfo> allImages() const;
158 QList<qlonglong> allImageIds() const;
159
164 QList<ItemInfo> rootImages() const;
165
170 QList<ItemInfo> leafImages() const;
171
177 QHash<ItemInfo, HistoryImageId::Types> categorize() const;
178
179private:
180
181 QSharedDataPointer<ItemHistoryGraphData> d;
182};
183
184QDebug DIGIKAM_DATABASE_EXPORT operator<<(QDebug dbg, const ItemHistoryGraph& g);
185
186} // namespace Digikam
187
188Q_DECLARE_OPERATORS_FOR_FLAGS(Digikam::ItemHistoryGraph::HistoryLoadingMode)
Definition dimagehistory.h:39
Definition historyimageid.h:32
Definition itemhistorygraphdata.h:96
Definition itemhistorygraph.h:36
HistoryLoadingFlag
Definition itemhistorygraph.h:40
ProcessingMode
Definition itemhistorygraph.h:55
@ NoProcessing
Definition itemhistorygraph.h:56
Definition iteminfo.h:68
Definition datefolderview.cpp:34
QDebug operator<<(QDebug dbg, const DbEngineParameters &p)
Definition dbengineparameters.cpp:930