digiKam
|
Public Types | |
enum | HistoryLoadingFlag { LoadRelationCloud = 1 << 0 , LoadSubjectHistory = 1 << 1 , LoadLeavesHistory = 1 << 2 , LoadAll = LoadRelationCloud | LoadSubjectHistory | LoadLeavesHistory } |
enum | ProcessingMode { NoProcessing , PrepareForDisplay } |
Public Member Functions | |
void | addHistory (const DImageHistory &history, const HistoryImageId &historySubject=HistoryImageId()) |
void | addHistory (const DImageHistory &history, const ItemInfo &historySubject=ItemInfo()) |
void | addRelations (const QList< QPair< qlonglong, qlonglong > > &pairs) |
void | addScannedHistory (const DImageHistory &history, qlonglong historySubjectId) |
QList< qlonglong > | allImageIds () const |
QList< ItemInfo > | allImages () const |
QHash< ItemInfo, HistoryImageId::Types > | categorize () const |
void | clear () |
ItemHistoryGraphData & | data () |
const ItemHistoryGraphData & | data () const |
void | dropUnresolvedEntries () |
bool | hasEdges () const |
bool | hasUnresolvedEntries () const |
bool | isEmpty () const |
bool | isNull () const |
bool | isSingleVertex () const |
ItemHistoryGraph () | |
ItemHistoryGraph (const ItemHistoryGraph &other) | |
QList< ItemInfo > | leafImages () const |
ItemHistoryGraph & | operator= (const ItemHistoryGraph &other) |
void | prepareForDisplay (const ItemInfo &subject) |
void | reduceEdges () |
QList< QPair< qlonglong, qlonglong > > | relationCloud () const |
QPair< QList< qlonglong >, QList< qlonglong > > | relationCloudParallel () const |
QList< ItemInfo > | rootImages () const |
void | sortForInfo (const ItemInfo &subject) |
~ItemHistoryGraph () | |
Static Public Member Functions | |
static ItemHistoryGraph | fromInfo (const ItemInfo &info, HistoryLoadingMode loadingMode=LoadAll, ProcessingMode processingMode=PrepareForDisplay) |
Enumerator | |
---|---|
LoadRelationCloud | Load the relation cloud to the graph. Will give all edges, but no further info. |
LoadSubjectHistory | Will load the DImageHistory of the given subject. |
LoadLeavesHistory | Will load the DImageHistory of all leave vertices of the graph. |
LoadAll |
Digikam::ItemHistoryGraph::ItemHistoryGraph | ( | ) |
Digikam::ItemHistoryGraph::ItemHistoryGraph | ( | const ItemHistoryGraph & | other | ) |
Digikam::ItemHistoryGraph::~ItemHistoryGraph | ( | ) |
void Digikam::ItemHistoryGraph::addHistory | ( | const DImageHistory & | history, |
const HistoryImageId & | historySubject = HistoryImageId() |
||
) |
References Digikam::HistoryImageId::isValid().
void Digikam::ItemHistoryGraph::addHistory | ( | const DImageHistory & | history, |
const ItemInfo & | historySubject = ItemInfo() |
||
) |
Add the given history. The optionally given info or id is used as the "current" image of the history. If you read a history from a file's metadata or the database, you shall give the relevant subject.
References Digikam::ItemInfo::historyImageId().
Referenced by fromInfo().
void Digikam::ItemHistoryGraph::addRelations | ( | const QList< QPair< qlonglong, qlonglong > > & | pairs | ) |
Add images and their relations from the given pairs. Each pair (a,b) means "a is derived from b".
Referenced by fromInfo().
void Digikam::ItemHistoryGraph::addScannedHistory | ( | const DImageHistory & | history, |
qlonglong | historySubjectId | ||
) |
This is very similar to addHistory. The only difference is that no attempt is made to retrieve an ItemInfo for the historySubjectId. Can be useful in the context of scanning
Referenced by Digikam::ItemScanner::resolveImageHistory().
QList< qlonglong > Digikam::ItemHistoryGraph::allImageIds | ( | ) | const |
References Digikam::ItemInfo::id().
Referenced by Digikam::ItemScanner::resolveImageHistory(), and Digikam::ItemScanner::tagItemHistoryGraph().
Returns image infos / ids from all vertices in this graph
QHash< ItemInfo, HistoryImageId::Types > Digikam::ItemHistoryGraph::categorize | ( | ) | const |
Attempts at a categorization of all images in the graph into the types defined by HistoryImageId. The type will be invalid if no decision can be made due to conflicting data.
References Digikam::HistoryVertexProperties::infos.
Referenced by Digikam::ItemScanner::tagItemHistoryGraph().
void Digikam::ItemHistoryGraph::clear | ( | ) |
Clears this graph.
ItemHistoryGraphData & Digikam::ItemHistoryGraph::data | ( | ) |
Referenced by Digikam::operator<<().
const ItemHistoryGraphData & Digikam::ItemHistoryGraph::data | ( | ) | const |
void Digikam::ItemHistoryGraph::dropUnresolvedEntries | ( | ) |
Remove all vertices from the graph for which no existing ItemInfo could be found in the database
Referenced by prepareForDisplay().
|
static |
Convenience: Reads all available history for the given info from the database and returns the created graph. Depending on mode, the graph will be preparedForDisplay(). If no history is recorded and no relations found, a single-vertex graph is returned.
References addHistory(), addRelations(), Digikam::ItemInfo::imageHistory(), leafImages(), LoadLeavesHistory, LoadRelationCloud, LoadSubjectHistory, PrepareForDisplay, prepareForDisplay(), and Digikam::ItemInfo::relationCloud().
Referenced by Digikam::ItemHistoryGraphModel::setHistory(), and Digikam::ItemScanner::tagItemHistoryGraph().
bool Digikam::ItemHistoryGraph::hasEdges | ( | ) | const |
Returns if the graph contains any edges. Because loops are not allowed, this also means (!isEmpty() && !isSingleVertex()).
Referenced by Digikam::ItemScanner::resolveImageHistory(), and Digikam::ItemScanner::tagItemHistoryGraph().
bool Digikam::ItemHistoryGraph::hasUnresolvedEntries | ( | ) | const |
Returns true if for any entry no ItemInfo could be located.
Referenced by Digikam::ItemScanner::resolveImageHistory().
bool Digikam::ItemHistoryGraph::isEmpty | ( | ) | const |
bool Digikam::ItemHistoryGraph::isNull | ( | ) | const |
Referenced by Digikam::ItemHistoryGraphModel::setHistory().
bool Digikam::ItemHistoryGraph::isSingleVertex | ( | ) | const |
Returns image infos / ids from all leaf vertices in this graph, i.e. vertices with no subsequent history.
Referenced by fromInfo().
ItemHistoryGraph & Digikam::ItemHistoryGraph::operator= | ( | const ItemHistoryGraph & | other | ) |
void Digikam::ItemHistoryGraph::prepareForDisplay | ( | const ItemInfo & | subject | ) |
Combines reduceEdges(), dropOrphans() and sortForInfo()
References dropUnresolvedEntries(), reduceEdges(), and sortForInfo().
Referenced by fromInfo().
void Digikam::ItemHistoryGraph::reduceEdges | ( | ) |
Remove edges which provide only duplicate information (performs a transitive reduction). Especially call this when addRelations() was used.
References Digikam::Graph< VertexProperties, EdgeProperties >::isEmpty().
Referenced by prepareForDisplay().
QList< QPair< qlonglong, qlonglong > > Digikam::ItemHistoryGraph::relationCloud | ( | ) | const |
Returns all possible relations between images in this graph, the edges of the transitive closure. The first variant returns (1,2),(3,4),(6,8), the second (1,3,6)(2,4,8).
References Digikam::Graph< VertexProperties, EdgeProperties >::edgePairs(), Digikam::ItemInfo::id(), and Digikam::Graph< VertexProperties, EdgeProperties >::properties().
Returns image infos / ids from all root vertices in this graph, i.e. vertices with no precedent history.
Referenced by Digikam::ItemScanner::resolveImageHistory().
void Digikam::ItemHistoryGraph::sortForInfo | ( | const ItemInfo & | subject | ) |
Sort vertex information prioritizing for the given vertex
References Digikam::HistoryVertexProperties::infos, and Digikam::ItemScanner::sortByProximity().
Referenced by prepareForDisplay().