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

The ItemInfo class contains provides access to the database for a single item. More...

Public Types

typedef DatabaseFields::Hash< QVariant > DatabaseFieldsHashRaw

Public Member Functions

 ItemInfo ()
 Constructor Creates a null item info.
 ItemInfo (const ItemInfo &info)
 Copy constructor.
 ItemInfo (const ItemListerRecord &record)
 Constructor.
 ItemInfo (qlonglong ID)
 Constructor.
 ~ItemInfo ()
 Destructor.
ItemInfo copyItem (int dstAlbumID, const QString &dstFileName)
 Copy database information of this item to a newly created item.
bool isLocationAvailable () const
bool operator!= (const ItemInfo &info) const
bool operator< (const ItemInfo &info) const
ItemInfo & operator= (const ItemInfo &info)
bool operator== (const ItemInfo &info) const
Operations with Properties
bool isNull () const
QString name () const
QDateTime dateTime () const
QDateTime modDateTime () const
qlonglong fileSize () const
QSize dimensions () const
QUrl fileUrl () const
QString filePath () const
QString relativePath () const
qlonglong id () const
int albumId () const
int albumRootId () const
double aspectRatio () const
qlonglong manualOrder () const
DatabaseItem::Category category () const
QString format () const
bool isVisible () const
bool isRemoved () const
int orientation () const
QString title () const
QString comment () const
int faceCount () const
int unconfirmedFaceCount () const
QMap< QString, QString > getSuggestedNames () const
void setName (const QString &newName)
 Set the name (write it to database).
void setDateTime (const QDateTime &_dateTime)
 Set the date and time (write it to database).
void setModDateTime (const QDateTime &dateTime)
 Set the modification date and time (write it to database).
void setManualOrder (qlonglong value)
 Set the manual sorting order for the item.
void setOrientation (int value)
 Set the orientation for the item.
void setVisible (bool _isVisible)
 Set the visibility flag - triggers between Visible and Hidden.
DatabaseFieldsHashRaw getDatabaseFieldsRaw (const DatabaseFields::Set &requestedSet) const
QVariant getDatabaseFieldRaw (const DatabaseFields::Set &requestedField) const
Operations with Geolocation
ItemPosition imagePosition () const
 Retrieve the ItemPosition object for this item.
double longitudeNumber () const
 Retrieves the coordinates and the altitude.
double latitudeNumber () const
double altitudeNumber () const
bool hasCoordinates () const
bool hasAltitude () const
Operations with History
DImageHistory imageHistory () const
 Retrieves and sets the item history from the database.
void setItemHistory (const DImageHistory &history)
bool hasImageHistory () const
QString uuid () const
 Retrieves and sets this' item UUID.
void setUuid (const QString &_uuid)
HistoryImageId historyImageId () const
 Constructs a HistoryImageId with all available information for this item.
bool hasDerivedImages () const
 Retrieve information about items from which this item is derived (ancestorImages) and items that have been derived from this items (derivedImages).
bool hasAncestorImages () const
QList< ItemInfo > derivedImages () const
QList< ItemInfo > ancestorImages () const
QList< QPair< qlonglong, qlonglong > > relationCloud () const
void markDerivedFrom (const ItemInfo &ancestorImage)
 Add a relation to the database: This item is derived from the ancestorImage.
Operations with Groups
bool isGrouped () const
 The item is grouped in the group of another (leading) item.
bool hasGroupedImages () const
 The item is the leading item of a group, there are other items grouped behind this one.
int numberOfGroupedImages () const
ItemInfo groupImage () const
qlonglong groupImageId () const
QList< ItemInfo > groupedImages () const
void addToGroup (const ItemInfo &info)
 Group this item behind the given item.
void removeFromGroup ()
 This item is grouped behind another item: Remove this item from its group.
void clearGroup ()
 This item hasGroupedImages(): Split up the group, remove all groupedImages() from this item's group.
Operations with Containers
ImageCommonContainer imageCommonContainer () const
 Retrieve information about the item, in form of numbers and user presentable strings, for certain defined fields of information (see databaseinfocontainers.h).
ImageMetadataContainer imageMetadataContainer () const
VideoMetadataContainer videoMetadataContainer () const
PhotoInfoContainer photoInfoContainer () const
VideoInfoContainer videoInfoContainer () const
Template metadataTemplate () const
 Retrieve metadata template information about the item.
void setMetadataTemplate (const Template &t)
 Set metadata template information (write it to database).
void removeMetadataTemplate ()
 Remove all template info about the item from database.
ItemComments imageComments (const CoreDbAccess &access) const
 Retrieve the ItemComments object for this item.
ItemCopyright imageCopyright () const
 Retrieve the ItemCopyright object for this item.
ItemExtendedProperties imageExtendedProperties () const
 Retrieve the ItemExtendedProperties object for this item.
Operations with Labels
int pickLabel () const
int colorLabel () const
int rating () const
void setPickLabel (int value)
 Set the pick Label Id for the item (see PickLabel values from globals.h).
void setColorLabel (int value)
 Set the color Label Id for the item (see ColorLabel values from globals.h).
void setRating (int value)
 Set the rating for the item.

Static Public Member Functions

static ItemInfo fromLocalFile (const QString &path)
 Creates an ItemInfo object from a file url.
static ItemInfo fromLocationAlbumAndName (int locationId, const QString &album, const QString &_name)
 Create an ItemInfo object from the given combination, which must be cleaned and corresponding to the values in the database.
static ItemInfo fromUrl (const QUrl &url)

Operations with Similarity

class ItemInfoCache
class ItemInfoList
double similarityTo (const qlonglong imageId) const
double currentSimilarity () const
qlonglong currentReferenceImage () const
size_t hash () const
QList< ItemInfo > fromUniqueHash (const QString &uniqueHash, qlonglong fileSize)
 Scans the database for items with the given signature.
QString uniqueHash () const

Operations with Tags

void setTag (int tagID)
 Adds a tag to the item (writes it to database).
void addTagPaths (const QStringList &tagPaths)
 Adds tags in the list to the item.
void removeTag (int tagID)
 Remove a tag from the item (removes it from database).
void removeAllTags ()
 Remove all tags from the item (removes it from database).
ItemTagPair imageTagPair (int tagId) const
 Retrieve an ItemTagPair object for a single tag, or for all item/tag pairs for which properties are available (not necessarily the assigned tags).
QList< ItemTagPair > availableItemTagPairs () const
QList< int > tagIds () const

Operations with Thumbnails

ThumbnailIdentifier thumbnailIdentifier () const
 Fills a ThumbnailIdentifier / ThumbnailInfo from this ItemInfo.
ThumbnailInfo thumbnailInfo () const
static ThumbnailIdentifier thumbnailIdentifier (qlonglong id)

Detailed Description

The properties can be read and written. Information will be cached.

Note
access rules for all methods in this class: ItemInfoData members shall be accessed only under CoreDbAccess lock. The id and albumId are the exception to this rule, as they are primitive and will never change during the lifetime of an object.

Constructor & Destructor Documentation

◆ ItemInfo() [1/2]

Digikam::ItemInfo::ItemInfo ( qlonglong ID)
explicit

Creates an ItemInfo object without any cached data initially.

Parameters
IDthe unique ID for this item

◆ ItemInfo() [2/2]

Digikam::ItemInfo::ItemInfo ( const ItemListerRecord & record)
explicit

Creates an ItemInfo object where the provided information will initially be available cached, without database access.

Member Function Documentation

◆ addTagPaths()

void Digikam::ItemInfo::addTagPaths ( const QStringList & tagPaths)

Tags are created if they do not yet exist

◆ albumId()

int Digikam::ItemInfo::albumId ( ) const
Returns
the id of the PAlbum to which this item belongs

◆ albumRootId()

int Digikam::ItemInfo::albumRootId ( ) const
Returns
The album root id

◆ aspectRatio()

double Digikam::ItemInfo::aspectRatio ( ) const
Returns
the id of the Aspect Ratio for this item

◆ category()

DatabaseItem::Category Digikam::ItemInfo::category ( ) const
Returns
the category of the item: Image, Audio, Video

◆ colorLabel()

int Digikam::ItemInfo::colorLabel ( ) const
Returns
the Color Label Id (see ColorLabel values in globals.h)

◆ comment()

QString Digikam::ItemInfo::comment ( ) const
Returns
the default comment for this item

◆ copyItem()

ItemInfo Digikam::ItemInfo::copyItem ( int dstAlbumID,
const QString & dstFileName )
Parameters
dstAlbumIDdestination album id
dstFileNamenew filename
Returns
an ItemInfo object of the new item

◆ currentReferenceImage()

qlonglong Digikam::ItemInfo::currentReferenceImage ( ) const
Returns
the id of the current fuzzy search reference item.

◆ dateTime()

QDateTime Digikam::ItemInfo::dateTime ( ) const
Returns
the datetime of the item

◆ dimensions()

QSize Digikam::ItemInfo::dimensions ( ) const
Returns
the dimensions of the item (valid only if dimensions have been requested)

◆ faceCount()

int Digikam::ItemInfo::faceCount ( ) const
Returns
the number of Faces in this item.

◆ filePath()

QString Digikam::ItemInfo::filePath ( ) const
Returns
the file path to the item

◆ fileSize()

qlonglong Digikam::ItemInfo::fileSize ( ) const
Returns
the filesize of the item

◆ fileUrl()

QUrl Digikam::ItemInfo::fileUrl ( ) const
Returns
the file:// url. This is equivalent to QUrl::fromLocalFile(filePath())

◆ format()

QString Digikam::ItemInfo::format ( ) const
Returns
the item format / mimetype as a standardized string (see project/documents/DBSCHEMA.ODS).

◆ getDatabaseFieldsRaw()

ItemInfo::DatabaseFieldsHashRaw Digikam::ItemInfo::getDatabaseFieldsRaw ( const DatabaseFields::Set & requestedSet) const

◆ getSuggestedNames()

QMap< QString, QString > Digikam::ItemInfo::getSuggestedNames ( ) const
Returns
the map of Tag Region (in XML form) to Suggested Names for all Faces in the Image. Used to categorize items based on Face Suggestions.

◆ groupedImages()

QList< ItemInfo > Digikam::ItemInfo::groupedImages ( ) const
Returns
the list of items grouped behind this item (not including this item itself) and an empty list if there is none.

◆ groupImage()

ItemInfo Digikam::ItemInfo::groupImage ( ) const
Returns
the leading item of the group.
a null item if this item is not grouped (isGrouped())

◆ hash()

size_t Digikam::ItemInfo::hash ( ) const
Returns
a signature for the item.

◆ id()

qlonglong Digikam::ItemInfo::id ( ) const
Returns
the unique id for this item

◆ imageComments()

ItemComments Digikam::ItemInfo::imageComments ( const CoreDbAccess & access) const

This object allows full read and write access to all comments and their properties. You need to hold CoreDbAccess to ensure the validity. For simple, cached read access see comment().

◆ imageCopyright()

ItemCopyright Digikam::ItemInfo::imageCopyright ( ) const

This object allows full read and write access to all copyright values.

◆ imageExtendedProperties()

ItemExtendedProperties Digikam::ItemInfo::imageExtendedProperties ( ) const

This object allows full read and write access to all extended properties values.

◆ imageHistory()

DImageHistory Digikam::ItemInfo::imageHistory ( ) const
Note
: The item history retrieved here does typically include all steps from the original to this item, but does not reference this item itself.

◆ isLocationAvailable()

bool Digikam::ItemInfo::isLocationAvailable ( ) const
Returns
true if this is a valid ItemInfo, and the location of the item is currently available (information freshly obtained from CollectionManager)

◆ isNull()

bool Digikam::ItemInfo::isNull ( ) const
Returns
true if this objects contains valid data

◆ isRemoved()

bool Digikam::ItemInfo::isRemoved ( ) const
Returns
true if the corresponding file was not deleted.

◆ isVisible()

bool Digikam::ItemInfo::isVisible ( ) const
Returns
true if the item is marked as visible in the database.

◆ longitudeNumber()

double Digikam::ItemInfo::longitudeNumber ( ) const
Returns
0 if hasCoordinates(), or hasAltitude resp, is false.

◆ manualOrder()

qlonglong Digikam::ItemInfo::manualOrder ( ) const
Returns
the manual sort order

◆ modDateTime()

QDateTime Digikam::ItemInfo::modDateTime ( ) const
Returns
the modification datetime of the item

◆ name()

QString Digikam::ItemInfo::name ( ) const
Returns
the name of the item

◆ orientation()

int Digikam::ItemInfo::orientation ( ) const
Returns
the orientation of the item, (MetaEngine::ImageOrientation, EXIF standard)

◆ pickLabel()

int Digikam::ItemInfo::pickLabel ( ) const
Returns
the Pick Label Id (see PickLabel values in globals.h)

◆ rating()

int Digikam::ItemInfo::rating ( ) const
Returns
the rating

◆ relationCloud()

QList< QPair< qlonglong, qlonglong > > Digikam::ItemInfo::relationCloud ( ) const
Returns
the cloud of all directly or indirectly related items, derived items or ancestors, in from of "a derived from b" pairs.

◆ relativePath()

QString Digikam::ItemInfo::relativePath ( ) const
Returns
the relative path part to the item

◆ removeTag()

void Digikam::ItemInfo::removeTag ( int tagID)
Parameters
tagIDthe ID of the tag to remove

◆ setDateTime()

void Digikam::ItemInfo::setDateTime ( const QDateTime & _dateTime)
Parameters
dateTimethe new date and time.

◆ setMetadataTemplate()

void Digikam::ItemInfo::setMetadataTemplate ( const Template & t)
Parameters
tthe new template data.

◆ setModDateTime()

void Digikam::ItemInfo::setModDateTime ( const QDateTime & dateTime)
Parameters
dateTimethe new modification date and time.

◆ setName()

void Digikam::ItemInfo::setName ( const QString & newName)
Parameters
newNamethe new name.

◆ setTag()

void Digikam::ItemInfo::setTag ( int tagID)
Parameters
tagIDthe ID of the tag to add

◆ tagIds()

QList< int > Digikam::ItemInfo::tagIds ( ) const
Returns
a list of IDs of tags assigned to this item
See also
tagNames
tagPaths
Album::id()

◆ title()

QString Digikam::ItemInfo::title ( ) const
Returns
the default title for this item

◆ unconfirmedFaceCount()

int Digikam::ItemInfo::unconfirmedFaceCount ( ) const
Returns
the number of Unconfirmed Faces in this item.

◆ uniqueHash()

QString Digikam::ItemInfo::uniqueHash ( ) const
Returns
the unique hash signature as string of the item.