digiKam
itemhistorygraphdata.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  * Copyright (C) 2010-2011 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_ITEM_HISTORY_GRAPH_DATA_H
25 #define DIGIKAM_ITEM_HISTORY_GRAPH_DATA_H
26 
27 // Qt includes
28 
29 #include <QSharedData>
30 
31 // Local includes
32 
33 #include "filteraction.h"
34 #include "historyimageid.h"
35 #include "itemhistorygraph_boost.h"
36 
37 namespace Digikam
38 {
39 
40 class ItemInfo;
41 
54 class DIGIKAM_DATABASE_EXPORT HistoryVertexProperties
55 {
56 public:
57 
58  ItemInfo firstItemInfo() const;
59 
60  bool markedAs(HistoryImageId::Type) const;
61  bool alwaysMarkedAs(HistoryImageId::Type) const;
62 
63  bool operator==(const QString& uuid) const;
64  bool operator==(const ItemInfo& info) const;
65  bool operator==(qlonglong id) const;
66  bool operator==(const HistoryImageId& info) const;
67 
68  HistoryVertexProperties& operator+=(const QString& uuid);
69  HistoryVertexProperties& operator+=(const ItemInfo& info);
70  HistoryVertexProperties& operator+=(const HistoryImageId& info);
71 
72 public:
73 
74  QString uuid;
77 };
78 
79 QDebug operator<<(QDebug dbg, const HistoryVertexProperties& props);
80 QDebug operator<<(QDebug dbg, const HistoryImageId& id);
81 
82 // ------------------------------------------------------------------------------
83 
91 class DIGIKAM_DATABASE_EXPORT HistoryEdgeProperties
92 {
93 public:
94 
96 
97  HistoryEdgeProperties& operator+=(const FilterAction& action);
98 };
99 
101 
102 // ------------------------------------------------------------------------------
103 
104 class DIGIKAM_DATABASE_EXPORT ItemHistoryGraphData : public HistoryGraph, // clazy:exclude=copyable-polymorphic
105  public QSharedData
106 {
107 public:
108 
111  {
112  }
113 
115  : HistoryGraph(g)
116  {
117  }
118 
120  {
122 
123  return *this;
124  }
125 
126  Vertex addVertex(const HistoryImageId& id);
127  Vertex addVertex(const QList<HistoryImageId>& imageIds);
128  Vertex addVertex(qlonglong id);
129  Vertex addVertexScanned(qlonglong id);
130  Vertex addVertex(const ItemInfo& info);
131 
132  void addHistory(const DImageHistory& givenHistory, qlonglong extraCurrent = 0);
133 
134  int removeNextUnresolvedVertex(int begin);
135 
136  inline QList<ItemInfo> toInfoList(const QList<Vertex>& vertices) const
137  {
138  QList<ItemInfo> infos;
139 
140  foreach (const HistoryGraph::Vertex& v, vertices)
141  {
142  infos << properties(v).infos;
143  }
144 
145  return infos;
146  }
147 
148  QHash<Vertex, HistoryImageId::Types> categorize() const;
149 
150 protected:
151 
152  void applyProperties(Vertex& v, const QList<ItemInfo>& infos, const QList<HistoryImageId>& ids);
153 };
154 
155 } // namespace Digikam
156 
157 #endif // DIGIKAM_ITEM_HISTORY_GRAPH_DATA_H
Definition: dimagehistory.h:49
Definition: filteraction.h:43
Definition: itemhistorygraph_boost.h:179
Definition: itemhistorygraph_boost.h:130
Graph & operator=(const Graph &other)
Definition: itemhistorygraph_boost.h:315
Definition: itemhistorygraphdata.h:92
QList< FilterAction > actions
Definition: itemhistorygraphdata.h:95
Definition: historyimageid.h:42
Type
Definition: historyimageid.h:46
Definition: itemhistorygraphdata.h:55
QList< HistoryImageId > referredImages
Definition: itemhistorygraphdata.h:75
QList< ItemInfo > infos
Definition: itemhistorygraphdata.h:76
QString uuid
Definition: itemhistorygraphdata.h:74
Definition: itemhistorygraphdata.h:106
ItemHistoryGraphData & operator=(const HistoryGraph &g)
Definition: itemhistorygraphdata.h:119
ItemHistoryGraphData(const HistoryGraph &g)
Definition: itemhistorygraphdata.h:114
QList< ItemInfo > toInfoList(const QList< Vertex > &vertices) const
Definition: itemhistorygraphdata.h:136
ItemHistoryGraphData()
Definition: itemhistorygraphdata.h:109
Definition: iteminfo.h:78
Definition: piwigotalker.h:48
Definition: datefolderview.cpp:43
QDebug operator<<(QDebug dbg, const DbEngineParameters &p)
Definition: dbengineparameters.cpp:863
@ ChildToParent
Edges are direct from a child to its parent.
Definition: itemhistorygraph_boost.h:122
bool operator==(const SearchTextSettings &a, const SearchTextSettings &b)
Definition: searchtextbar.cpp:49
Graph< HistoryVertexProperties, HistoryEdgeProperties > HistoryGraph
Definition: itemhistorygraphdata.h:100