digiKam Developer Documentation
Professional Photo Management with the Power of Open Source
Loading...
Searching...
No Matches
Digikam::ItemHistoryGraph Class Reference

Public Types

enum  HistoryLoadingFlag { LoadRelationCloud = 1 << 0 , LoadSubjectHistory = 1 << 1 , LoadLeavesHistory = 1 << 2 , LoadAll = LoadRelationCloud | LoadSubjectHistory | LoadLeavesHistory }
 
typedef QFlags< HistoryLoadingFlagHistoryLoadingMode
 
enum  ProcessingMode { NoProcessing , PrepareForDisplay }
 

Public Member Functions

 ItemHistoryGraph (const ItemHistoryGraph &other)
 
void addHistory (const DImageHistory &history, const HistoryImageId &historySubject=HistoryImageId())
 
void addHistory (const DImageHistory &history, const ItemInfo &historySubject=ItemInfo())
 Add the given history.
 
void addRelations (const QList< QPair< qlonglong, qlonglong > > &pairs)
 Add images and their relations from the given pairs.
 
void addScannedHistory (const DImageHistory &history, qlonglong historySubjectId)
 This is very similar to addHistory.
 
QList< qlonglong > allImageIds () const
 
QList< ItemInfoallImages () const
 Returns image infos / ids from all vertices in this graph.
 
QHash< ItemInfo, HistoryImageId::Typescategorize () const
 Attempts at a categorization of all images in the graph into the types defined by HistoryImageId.
 
void clear ()
 Clears this graph.
 
ItemHistoryGraphDatadata ()
 
const ItemHistoryGraphDatadata () const
 
void dropUnresolvedEntries ()
 Remove all vertices from the graph for which no existing ItemInfo could be found in the database.
 
bool hasEdges () const
 Returns if the graph contains any edges.
 
bool hasUnresolvedEntries () const
 Returns true if for any entry no ItemInfo could be located.
 
bool isEmpty () const
 
bool isNull () const
 
bool isSingleVertex () const
 
QList< ItemInfoleafImages () const
 Returns image infos / ids from all leaf vertices in this graph, i.e.
 
ItemHistoryGraphoperator= (const ItemHistoryGraph &other)
 
void prepareForDisplay (const ItemInfo &subject)
 Combines reduceEdges(), dropOrphans() and sortForInfo().
 
void reduceEdges ()
 Remove edges which provide only duplicate information (performs a transitive reduction).
 
QList< QPair< qlonglong, qlonglong > > relationCloud () const
 Returns all possible relations between images in this graph, the edges of the transitive closure.
 
QPair< QList< qlonglong >, QList< qlonglong > > relationCloudParallel () const
 
QList< ItemInforootImages () const
 Returns image infos / ids from all root vertices in this graph, i.e.
 
void sortForInfo (const ItemInfo &subject)
 Sort vertex information prioritizing for the given vertex.
 

Static Public Member Functions

static ItemHistoryGraph fromInfo (const ItemInfo &info, HistoryLoadingMode loadingMode=LoadAll, ProcessingMode processingMode=PrepareForDisplay)
 Convenience: Reads all available history for the given info from the database and returns the created graph.
 

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.

Member Function Documentation

◆ addHistory()

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

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.

◆ addRelations()

void Digikam::ItemHistoryGraph::addRelations ( const QList< QPair< qlonglong, qlonglong > > &  pairs)

Each pair (a,b) means "a is derived from b".

◆ addScannedHistory()

void Digikam::ItemHistoryGraph::addScannedHistory ( const DImageHistory history,
qlonglong  historySubjectId 
)

The only difference is that no attempt is made to retrieve an ItemInfo for the historySubjectId. Can be useful in the context of scanning

◆ categorize()

QHash< ItemInfo, HistoryImageId::Types > Digikam::ItemHistoryGraph::categorize ( ) const

The type will be invalid if no decision can be made due to conflicting data.

◆ fromInfo()

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

Depending on mode, the graph will be preparedForDisplay(). If no history is recorded and no relations found, a single-vertex graph is returned.

◆ hasEdges()

bool Digikam::ItemHistoryGraph::hasEdges ( ) const

Because loops are not allowed, this also means (!isEmpty() && !isSingleVertex()).

◆ leafImages()

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

vertices with no subsequent history.

◆ reduceEdges()

void Digikam::ItemHistoryGraph::reduceEdges ( )

Especially call this when addRelations() was used.

◆ relationCloud()

QList< QPair< qlonglong, qlonglong > > Digikam::ItemHistoryGraph::relationCloud ( ) const

The first variant returns (1,2),(3,4),(6,8), the second (1,3,6)(2,4,8).

◆ rootImages()

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

vertices with no precedent history.