digiKam
Digikam::ItemHistoryGraph Class Reference

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< ItemInfoallImages () const
 
QHash< ItemInfo, HistoryImageId::Types > categorize () const
 
void clear ()
 
ItemHistoryGraphDatadata ()
 
const ItemHistoryGraphDatadata () const
 
void dropUnresolvedEntries ()
 
bool hasEdges () const
 
bool hasUnresolvedEntries () const
 
bool isEmpty () const
 
bool isNull () const
 
bool isSingleVertex () const
 
 ItemHistoryGraph ()
 
 ItemHistoryGraph (const ItemHistoryGraph &other)
 
QList< ItemInfoleafImages () const
 
ItemHistoryGraphoperator= (const ItemHistoryGraph &other)
 
void prepareForDisplay (const ItemInfo &subject)
 
void reduceEdges ()
 
QList< QPair< qlonglong, qlonglong > > relationCloud () const
 
QPair< QList< qlonglong >, QList< qlonglong > > relationCloudParallel () const
 
QList< ItemInforootImages () const
 
void sortForInfo (const ItemInfo &subject)
 
 ~ItemHistoryGraph ()
 

Static Public Member Functions

static ItemHistoryGraph fromInfo (const ItemInfo &info, HistoryLoadingMode loadingMode=LoadAll, ProcessingMode processingMode=PrepareForDisplay)
 

Member Enumeration Documentation

◆ HistoryLoadingFlag

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 

◆ ProcessingMode

Enumerator
NoProcessing 
PrepareForDisplay 

Constructor & Destructor Documentation

◆ ItemHistoryGraph() [1/2]

Digikam::ItemHistoryGraph::ItemHistoryGraph ( )

◆ ItemHistoryGraph() [2/2]

Digikam::ItemHistoryGraph::ItemHistoryGraph ( const ItemHistoryGraph other)

◆ ~ItemHistoryGraph()

Digikam::ItemHistoryGraph::~ItemHistoryGraph ( )

Member Function Documentation

◆ addHistory() [1/2]

void Digikam::ItemHistoryGraph::addHistory ( const DImageHistory history,
const HistoryImageId historySubject = HistoryImageId() 
)

◆ addHistory() [2/2]

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().

◆ addRelations()

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().

◆ addScannedHistory()

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().

◆ allImageIds()

QList< qlonglong > Digikam::ItemHistoryGraph::allImageIds ( ) const

◆ allImages()

QList< ItemInfo > Digikam::ItemHistoryGraph::allImages ( ) const

Returns image infos / ids from all vertices in this graph

◆ categorize()

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().

◆ clear()

void Digikam::ItemHistoryGraph::clear ( )

Clears this graph.

◆ data() [1/2]

ItemHistoryGraphData & Digikam::ItemHistoryGraph::data ( )

Referenced by Digikam::operator<<().

◆ data() [2/2]

const ItemHistoryGraphData & Digikam::ItemHistoryGraph::data ( ) const

◆ dropUnresolvedEntries()

void Digikam::ItemHistoryGraph::dropUnresolvedEntries ( )

Remove all vertices from the graph for which no existing ItemInfo could be found in the database

Referenced by prepareForDisplay().

◆ fromInfo()

ItemHistoryGraph Digikam::ItemHistoryGraph::fromInfo ( const ItemInfo info,
HistoryLoadingMode  loadingMode = LoadAll,
ProcessingMode  processingMode = 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().

◆ hasEdges()

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().

◆ hasUnresolvedEntries()

bool Digikam::ItemHistoryGraph::hasUnresolvedEntries ( ) const

Returns true if for any entry no ItemInfo could be located.

Referenced by Digikam::ItemScanner::resolveImageHistory().

◆ isEmpty()

bool Digikam::ItemHistoryGraph::isEmpty ( ) const

◆ isNull()

bool Digikam::ItemHistoryGraph::isNull ( ) const

◆ isSingleVertex()

bool Digikam::ItemHistoryGraph::isSingleVertex ( ) const

◆ leafImages()

QList< ItemInfo > Digikam::ItemHistoryGraph::leafImages ( ) const

Returns image infos / ids from all leaf vertices in this graph, i.e. vertices with no subsequent history.

Referenced by fromInfo().

◆ operator=()

ItemHistoryGraph & Digikam::ItemHistoryGraph::operator= ( const ItemHistoryGraph other)

◆ prepareForDisplay()

void Digikam::ItemHistoryGraph::prepareForDisplay ( const ItemInfo subject)

Combines reduceEdges(), dropOrphans() and sortForInfo()

References dropUnresolvedEntries(), reduceEdges(), and sortForInfo().

Referenced by fromInfo().

◆ reduceEdges()

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().

◆ relationCloud()

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().

◆ relationCloudParallel()

◆ rootImages()

QList< ItemInfo > Digikam::ItemHistoryGraph::rootImages ( ) const

Returns image infos / ids from all root vertices in this graph, i.e. vertices with no precedent history.

Referenced by Digikam::ItemScanner::resolveImageHistory().

◆ sortForInfo()

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().


The documentation for this class was generated from the following files: