digiKam
Digikam::ItemScanner Class Reference

Classes

class  Private
 

Public Types

enum  ScanMode { NewScan , ModifiedScan , Rescan }
 

Public Member Functions

const ItemScanInfoitemScanInfo () const
 
 ItemScanner (const QFileInfo &info)
 
 ItemScanner (const QFileInfo &info, const ItemScanInfo &Iteminfo)
 
 ItemScanner (qlonglong imageid)
 
void loadFromDisk ()
 
void setCategory (DatabaseItem::Category category)
 
 ~ItemScanner ()
 

Static Public Member Functions

static QString formatToString (const QString &format)
 

Operations on History Metadata

bool hasHistoryToResolve () const
 
void scanBalooInfo ()
 scanBalooInfo - retrieve tags, comments and rating from Baloo Desktop service. More...
 
static bool resolveImageHistory (qlonglong id, QList< qlonglong > *needTaggingIds=nullptr)
 
static bool resolveImageHistory (qlonglong imageId, const QString &historyXml, QList< qlonglong > *needTaggingIds=nullptr)
 
static void tagItemHistoryGraph (qlonglong id)
 
static DImageHistory resolvedImageHistory (const DImageHistory &history, bool mustBeAvailable=false)
 
static bool sameReferredImage (const HistoryImageId &id1, const HistoryImageId &id2)
 
static QList< qlonglong > resolveHistoryImageId (const HistoryImageId &historyId)
 
void scanImageHistory ()
 
void commitImageHistory ()
 
void scanImageHistoryIfModified ()
 
QString uniqueHash () const
 

Operations with Database

void newFile (int albumId)
 
void newFileFullScan (int albumId)
 
void rescan ()
 
void commit ()
 
qlonglong id () const
 
void copiedFrom (int albumId, qlonglong srcId)
 
static void sortByProximity (QList< ItemInfo > &infos, const ItemInfo &subject)
 
bool copyFromSource (qlonglong src)
 
void commitCopyImageAttributes ()
 
void prepareAddImage (int albumId)
 
bool commitAddImage ()
 

Operations on File Metadata

void fileModified ()
 
static void fillCommonContainer (qlonglong imageid, ImageCommonContainer *const container)
 
static QDateTime creationDateFromFilesystem (const QFileInfo &info)
 
void prepareUpdateImage ()
 
void commitUpdateImage ()
 
bool scanFromIdenticalFile ()
 
void scanFile (ScanMode mode)
 
void scanItemInformation ()
 
void commitItemInformation ()
 

Operations on Photo Metadata

static QString iptcCorePropertyName (MetadataInfo::Field field)
 
static MetadataFields allImageMetadataFields ()
 
QString detectImageFormat () const
 
void scanImageMetadata ()
 
void commitImageMetadata ()
 
void scanItemPosition ()
 
void commitItemPosition ()
 
void scanItemComments ()
 
void commitItemComments ()
 
void scanItemCopyright ()
 
void commitItemCopyright ()
 
void scanIPTCCore ()
 
void commitIPTCCore ()
 
void scanTags ()
 
void commitTags ()
 
void scanFaces ()
 
void commitFaces ()
 
bool checkRatingFromMetadata (const QVariant &ratingFromMetadata) const
 
void checkCreationDateFromMetadata (QVariant &dateFromMetadata) const
 

Operations on Video Metadata

static void fillVideoMetadataContainer (qlonglong imageid, VideoMetadataContainer *const container)
 
void scanVideoInformation ()
 
void scanVideoMetadata ()
 
void commitVideoMetadata ()
 
QString detectVideoFormat () const
 
QString detectAudioFormat () const
 
static MetadataFields allVideoMetadataFields ()
 

Member Enumeration Documentation

◆ ScanMode

Enumerator
NewScan 
ModifiedScan 
Rescan 

Constructor & Destructor Documentation

◆ ItemScanner() [1/3]

Digikam::ItemScanner::ItemScanner ( const QFileInfo &  info,
const ItemScanInfo Iteminfo 
)

Construct an ItemScanner object from an existing QFileInfo and ItemScanInfo object. This constructor shall be used with fileModified() or fullScan().

References Digikam::ItemScanner::Private::fileInfo, and Digikam::ItemScanner::Private::scanInfo.

◆ ItemScanner() [2/3]

Digikam::ItemScanner::ItemScanner ( const QFileInfo &  info)
explicit

Construct an ItemScanner from an existing QFileInfo object. Use this constructor if you intend to call newFile().

References Digikam::ItemScanner::Private::fileInfo.

◆ ItemScanner() [3/3]

◆ ~ItemScanner()

Digikam::ItemScanner::~ItemScanner ( )

Member Function Documentation

◆ allImageMetadataFields()

◆ allVideoMetadataFields()

◆ checkCreationDateFromMetadata()

void Digikam::ItemScanner::checkCreationDateFromMetadata ( QVariant &  dateFromMetadata) const
protected

◆ checkRatingFromMetadata()

bool Digikam::ItemScanner::checkRatingFromMetadata ( const QVariant &  ratingFromMetadata) const
protected

◆ commit()

◆ commitAddImage()

◆ commitCopyImageAttributes()

◆ commitFaces()

◆ commitImageHistory()

◆ commitImageMetadata()

◆ commitIPTCCore()

◆ commitItemComments()

◆ commitItemCopyright()

◆ commitItemInformation()

◆ commitItemPosition()

◆ commitTags()

◆ commitUpdateImage()

◆ commitVideoMetadata()

◆ copiedFrom()

void Digikam::ItemScanner::copiedFrom ( int  albumId,
qlonglong  srcId 
)

Similar to newFile. Call this when you want ItemScanner to add a new file to the database which is a copy of another file, copying attributes from the src and rescanning other attributes as appropriate. Give the id of the album of the new file, and the id of the src file.

References copyFromSource(), loadFromDisk(), NewScan, prepareAddImage(), scanFile(), and scanFromIdenticalFile().

Referenced by Digikam::CollectionScanner::scanNewFile().

◆ copyFromSource()

◆ creationDateFromFilesystem()

QDateTime Digikam::ItemScanner::creationDateFromFilesystem ( const QFileInfo &  info)
static

Returns a suitable creation date from file system information. Use this as a fallback if metadata is not available.

Referenced by checkCreationDateFromMetadata(), Digikam::UMSCamera::getItemInfo(), and Digikam::UMSCamera::uploadItem().

◆ detectAudioFormat()

QString Digikam::ItemScanner::detectAudioFormat ( ) const
protected

◆ detectImageFormat()

◆ detectVideoFormat()

QString Digikam::ItemScanner::detectVideoFormat ( ) const
protected

◆ fileModified()

void Digikam::ItemScanner::fileModified ( )

Call this when you have detected that a file in the database has been modified on disk. Only two groups of fields will be updated in the database:

  • filesystem specific properties (those that signaled you that the file has been modified because their state on disk differed from the state in the database)
  • image specific properties, for which a difference in the database independent from the actual file does not make sense (width/height, bit depth, color model)

References loadFromDisk(), ModifiedScan, prepareUpdateImage(), and scanFile().

Referenced by Digikam::CollectionScanner::scanFileUpdateHashReuseThumbnail(), and Digikam::CollectionScanner::scanModifiedFile().

◆ fillCommonContainer()

void Digikam::ItemScanner::fillCommonContainer ( qlonglong  imageid,
ImageCommonContainer *const  container 
)
static

Returns File-metadata container with user-presentable information. These methods provide the reverse service: Not writing into the db, but reading from the db.

References Digikam::DatabaseFields::Category, Digikam::DatabaseFields::ColorDepth, Digikam::ImageCommonContainer::colorDepth, Digikam::DatabaseFields::ColorModel, Digikam::ImageCommonContainer::colorModel, Digikam::DImg::colorModelToString(), Digikam::DatabaseFields::CreationDate, Digikam::ImageCommonContainer::creationDate, Digikam::CoreDbAccess::db(), Digikam::DatabaseFields::DigitizationDate, Digikam::ImageCommonContainer::digitizationDate, Digikam::ImageCommonContainer::fileModificationDate, Digikam::ImageCommonContainer::fileName, Digikam::DatabaseFields::FileSize, Digikam::ImageCommonContainer::fileSize, Digikam::DatabaseFields::Format, Digikam::ImageCommonContainer::format, formatToString(), Digikam::CoreDB::getImagesFields(), Digikam::CoreDB::getItemInformation(), Digikam::DatabaseFields::Height, Digikam::ImageCommonContainer::height, Digikam::DatabaseFields::ModificationDate, Digikam::DatabaseFields::Name, Digikam::DatabaseFields::Orientation, Digikam::ImageCommonContainer::orientation, Digikam::MetadataInfo::Orientation, Digikam::DatabaseFields::Rating, Digikam::ImageCommonContainer::rating, Digikam::DMetadata::valueToString(), Digikam::DatabaseItem::Video, Digikam::DMetadata::videoColorModelToString(), Digikam::DatabaseFields::Width, and Digikam::ImageCommonContainer::width.

Referenced by Digikam::ItemInfo::imageCommonContainer().

◆ fillVideoMetadataContainer()

◆ formatToString()

QString Digikam::ItemScanner::formatToString ( const QString &  format)
static

Helper method to translate enum values to user presentable strings

Referenced by Digikam::ItemViewImportDelegate::drawImageFormat(), and fillCommonContainer().

◆ hasHistoryToResolve()

bool Digikam::ItemScanner::hasHistoryToResolve ( ) const

Returns true if this file has been marked as needing history resolution at a later stage

References Digikam::ItemScanner::Private::hasHistoryToResolve.

Referenced by Digikam::CollectionScanner::Private::finishScanner().

◆ id()

qlonglong Digikam::ItemScanner::id ( ) const

◆ iptcCorePropertyName()

QString Digikam::ItemScanner::iptcCorePropertyName ( MetadataInfo::Field  field)
static

Helper method to return official property name by which IPTC core properties are stored in the database (ItemCopyright and ImageProperties table). Allowed arguments: All MetadataInfo::Fields starting with "IptcCore..."

References Digikam::MetadataInfo::IptcCoreCity, Digikam::MetadataInfo::IptcCoreContactInfoAddress, Digikam::MetadataInfo::IptcCoreContactInfoCity, Digikam::MetadataInfo::IptcCoreContactInfoCountry, Digikam::MetadataInfo::IptcCoreContactInfoEmail, Digikam::MetadataInfo::IptcCoreContactInfoPhone, Digikam::MetadataInfo::IptcCoreContactInfoPostalCode, Digikam::MetadataInfo::IptcCoreContactInfoProvinceState, Digikam::MetadataInfo::IptcCoreContactInfoWebUrl, Digikam::MetadataInfo::IptcCoreCopyrightNotice, Digikam::MetadataInfo::IptcCoreCountry, Digikam::MetadataInfo::IptcCoreCountryCode, Digikam::MetadataInfo::IptcCoreCreator, Digikam::MetadataInfo::IptcCoreCreatorJobTitle, Digikam::MetadataInfo::IptcCoreInstructions, Digikam::MetadataInfo::IptcCoreIntellectualGenre, Digikam::MetadataInfo::IptcCoreJobID, Digikam::MetadataInfo::IptcCoreLocation, Digikam::MetadataInfo::IptcCoreProvider, Digikam::MetadataInfo::IptcCoreProvinceState, Digikam::MetadataInfo::IptcCoreRightsUsageTerms, Digikam::MetadataInfo::IptcCoreScene, Digikam::MetadataInfo::IptcCoreSource, and Digikam::MetadataInfo::IptcCoreSubjectCode.

Referenced by Digikam::ItemCopyright::allCopyrightNotices(), Digikam::ItemCopyright::allRightsUsageTerms(), Digikam::ItemCopyright::contactInfo(), Digikam::ItemCopyright::copyrightNotice(), Digikam::ItemCopyright::creator(), Digikam::ItemCopyright::creatorJobTitle(), Digikam::ItemCopyright::instructions(), Digikam::ItemExtendedProperties::intellectualGenre(), Digikam::ItemExtendedProperties::jobId(), Digikam::ItemExtendedProperties::location(), Digikam::ItemCopyright::provider(), Digikam::ItemCopyright::removeContactInfo(), Digikam::ItemCopyright::removeCopyrightNotices(), Digikam::ItemCopyright::removeCreatorJobTitle(), Digikam::ItemCopyright::removeCreators(), Digikam::ItemCopyright::removeInstructions(), Digikam::ItemCopyright::removeProvider(), Digikam::ItemCopyright::removeRightsUsageTerms(), Digikam::ItemCopyright::removeSource(), Digikam::ItemCopyright::rightsUsageTerms(), Digikam::ItemExtendedProperties::scene(), Digikam::ItemCopyright::setContactInfo(), Digikam::ItemCopyright::setCopyrightNotice(), Digikam::ItemCopyright::setCreator(), Digikam::ItemCopyright::setCreatorJobTitle(), Digikam::ItemCopyright::setInstructions(), Digikam::ItemExtendedProperties::setIntellectualGenre(), Digikam::ItemExtendedProperties::setJobId(), Digikam::ItemExtendedProperties::setLocation(), Digikam::ItemCopyright::setProvider(), Digikam::ItemCopyright::setRightsUsageTerms(), Digikam::ItemExtendedProperties::setScene(), Digikam::ItemCopyright::setSource(), Digikam::ItemExtendedProperties::setSubjectCode(), Digikam::ItemCopyright::source(), and Digikam::ItemExtendedProperties::subjectCode().

◆ itemScanInfo()

const ItemScanInfo & Digikam::ItemScanner::itemScanInfo ( ) const

Provides access to the information retrieved by scanning. The validity depends on the previously executed scan.

References Digikam::ItemScanner::Private::scanInfo.

Referenced by Digikam::CollectionScanner::scanFileUpdateHashReuseThumbnail().

◆ loadFromDisk()

◆ newFile()

void Digikam::ItemScanner::newFile ( int  albumId)

Call this when you want ItemScanner to add a new file to the database and read all information into the database.

References loadFromDisk(), NewScan, prepareAddImage(), scanFile(), and scanFromIdenticalFile().

Referenced by Digikam::CollectionScanner::scanNewFile().

◆ newFileFullScan()

void Digikam::ItemScanner::newFileFullScan ( int  albumId)

Call this when you want ItemScanner to add a new file to the database and read all information into the database. This variant will not use the unique hash to establish identify with an existing entry, but read all information newly from the file.

References loadFromDisk(), NewScan, prepareAddImage(), and scanFile().

Referenced by Digikam::CollectionScanner::scanNewFileFullScan().

◆ prepareAddImage()

◆ prepareUpdateImage()

void Digikam::ItemScanner::prepareUpdateImage ( )
protected

◆ rescan()

void Digikam::ItemScanner::rescan ( )

Call this to take an existing image in the database, but re-read all information from the file into the database, possibly overwriting information there.

References loadFromDisk(), prepareUpdateImage(), Rescan, and scanFile().

Referenced by Digikam::CollectionScanner::rescanFile().

◆ resolvedImageHistory()

DImageHistory Digikam::ItemScanner::resolvedImageHistory ( const DImageHistory history,
bool  mustBeAvailable = false 
)
static

All referred images of the given history will be resolved. In the returned history, the actions are the same, while each referred image actually exists in the collection (if mustBeAvailable is true, it is even in a currently available collection). That means the number of referred images may be less or greater than initially. Note that this history may have peculiar properties, like multiple Original or Current entries (if the source entry resolves to multiple collection images), so this history is only for internal use, not for storage.

References Digikam::DImageHistory::Entry::action, Digikam::ItemInfo::albumRootId(), Digikam::DImageHistory::entries(), Digikam::ItemInfo::historyImageId(), Digikam::CollectionManager::instance(), Digikam::ItemInfo::isNull(), Digikam::RedEye::location(), Digikam::CollectionManager::locationForAlbumRootId(), Digikam::DImageHistory::Entry::referredImages, resolveHistoryImageId(), and Digikam::HistoryImageId::setType().

◆ resolveHistoryImageId()

◆ resolveImageHistory() [1/2]

bool Digikam::ItemScanner::resolveImageHistory ( qlonglong  id,
QList< qlonglong > *  needTaggingIds = nullptr 
)
static

Resolves the image history of the image id by filling the ImageRelations table for all contained referred images. If needTaggingIds is given, all ids marked for needing tagging of the history graph are added.

References Digikam::CoreDbAccess::db(), Digikam::CoreDB::getItemHistory(), and Digikam::ImageHistoryEntry::history.

Referenced by Digikam::CollectionScanner::historyScanningStage2().

◆ resolveImageHistory() [2/2]

◆ sameReferredImage()

◆ scanBalooInfo()

◆ scanFaces()

◆ scanFile()

◆ scanFromIdenticalFile()

◆ scanImageHistory()

◆ scanImageHistoryIfModified()

◆ scanImageMetadata()

◆ scanIPTCCore()

◆ scanItemComments()

◆ scanItemCopyright()

◆ scanItemInformation()

◆ scanItemPosition()

◆ scanTags()

◆ scanVideoInformation()

◆ scanVideoMetadata()

◆ setCategory()

void Digikam::ItemScanner::setCategory ( DatabaseItem::Category  category)

◆ sortByProximity()

void Digikam::ItemScanner::sortByProximity ( QList< ItemInfo > &  infos,
const ItemInfo subject 
)
static

Sort a list of infos by proximity to the given subject. Infos are near if they are e.g. in the same album. They are not near if they are e.g. in different collections.

References Digikam::ItemInfo::isNull().

Referenced by Digikam::ItemHistoryGraph::sortForInfo().

◆ tagItemHistoryGraph()

◆ uniqueHash()


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