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 image. More...

Public Types

typedef DatabaseFields::Hash< QVariant > DatabaseFieldsHashRaw
 

Public Member Functions

 ItemInfo ()
 Constructor Creates a null image 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
 Returns true if this is a valid ItemInfo, and the location of the image is currently available (information freshly obtained from CollectionManager)
 
bool operator!= (const ItemInfo &info) const
 
bool operator< (const ItemInfo &info) const
 
ItemInfooperator= (const ItemInfo &info)
 
bool operator== (const ItemInfo &info) const
 
Operations with Properties
bool isNull () const
 Returns if this objects contains valid data.
 
QString name () const
 
QDateTime dateTime () const
 
QDateTime modDateTime () const
 
qlonglong fileSize () const
 
QSize dimensions () const
 
QUrl fileUrl () const
 Returns the file:// url.
 
QString filePath () const
 Returns the file path to the image.
 
QString relativePath () const
 Returns the relative path part to the image.
 
qlonglong id () const
 
int albumId () const
 
int albumRootId () const
 The album root id.
 
double aspectRatio () const
 
qlonglong manualOrder () const
 Returns the manual sort order.
 
DatabaseItem::Category category () const
 Returns the category of the item: Image, Audio, Video.
 
QString format () const
 Returns the image format / mimetype as a standardized string (see project/documents/DBSCHEMA.ODS).
 
bool isVisible () const
 Returns true if the image is marked as visible in the database.
 
bool isRemoved () const
 Returns true if the corresponding file was not deleted.
 
int orientation () const
 Returns the orientation of the image, (MetaEngine::ImageOrientation, EXIF standard)
 
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 image history from the database.
 
void setItemHistory (const DImageHistory &history)
 
bool hasImageHistory () const
 
QString uuid () const
 Retrieves and sets this' images UUID.
 
void setUuid (const QString &uuid)
 
HistoryImageId historyImageId () const
 Constructs a HistoryImageId with all available information for this image.
 
bool hasDerivedImages () const
 Retrieve information about images from which this image is derived (ancestorImages) and images that have been derived from this images (derivedImages).
 
bool hasAncestorImages () const
 
QList< ItemInfoderivedImages () const
 
QList< ItemInfoancestorImages () const
 
QList< QPair< qlonglong, qlonglong > > relationCloud () const
 Returns the cloud of all directly or indirectly related images, derived images or ancestors, in from of "a derived from b" pairs.
 
void markDerivedFrom (const ItemInfo &ancestorImage)
 Add a relation to the database: This image is derived from the ancestorImage.
 
Operations with Groups
bool isGrouped () const
 The image is grouped in the group of another (leading) image.
 
bool hasGroupedImages () const
 The image is the leading image of a group, there are other images grouped behind this one.
 
int numberOfGroupedImages () const
 
ItemInfo groupImage () const
 Returns the leading image of the group.
 
qlonglong groupImageId () const
 
QList< ItemInfogroupedImages () const
 Returns the list of images grouped behind this image (not including this image itself) and an empty list if there is none.
 
void addToGroup (const ItemInfo &info)
 Group this image behind the given image.
 
void removeFromGroup ()
 This image is grouped behind another image: Remove this image from its group.
 
void clearGroup ()
 This image hasGroupedImages(): Split up the group, remove all groupedImages() from this image's group.
 
Operations with Containers
ImageCommonContainer imageCommonContainer () const
 Retrieve information about the image, 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 image.
 
void setMetadataTemplate (const Template &t)
 Set metadata template information (write it to database)
 
void removeMetadataTemplate ()
 Remove all template info about the image 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
 Returns the Pick Label Id (see PickLabel values in globals.h)
 
int colorLabel () const
 Returns the Color Label Id (see ColorLabel values in globals.h)
 
int rating () const
 Returns the rating.
 
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
 Returns the id of the current fuzzy search reference image.
 
size_t hash () const
 Return a signature for the item.
 
QList< ItemInfofromUniqueHash (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 image/tag pairs for which properties are available (not necessarily the assigned tags)
 
QList< ItemTagPairavailableItemTagPairs () 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 image

◆ 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

◆ aspectRatio()

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

◆ 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

◆ dateTime()

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

◆ dimensions()

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

◆ faceCount()

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

◆ fileSize()

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

◆ fileUrl()

QUrl Digikam::ItemInfo::fileUrl ( ) const

This is equivalent to QUrl::fromLocalFile(filePath())

◆ 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 images based on Face Suggestions.

◆ groupImage()

ItemInfo Digikam::ItemInfo::groupImage ( ) const

Returns a null image if this image is not grouped (isGrouped())

◆ id()

qlonglong Digikam::ItemInfo::id ( ) const
Returns
the unique image 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 image history retrieved here does typically include all steps from the original to this image, but does not reference this image itself.

◆ longitudeNumber()

double Digikam::ItemInfo::longitudeNumber ( ) const

Returns 0 if hasCoordinates(), or hasAltitude resp, is false.

◆ modDateTime()

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

◆ name()

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

◆ 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 image.