digiKam
|
Public Types | |
enum | Status { MetadataInvalid , MetadataAvailable } |
enum | WriteComponents { WRITE_DATETIME = 1 , WRITE_TITLE = 2 , WRITE_COMMENTS = 4 , WRITE_PICKLABEL = 8 , WRITE_COLORLABEL = 16 , WRITE_RATING = 32 , WRITE_TEMPLATE = 64 , WRITE_TAGS = 128 , WRITE_POSITION = 256 , WRITE_ALL = 511 } |
enum | WriteMode { FullWrite , FullWriteIfChanged , PartialWrite } |
Public Member Functions | |
QStringList | cleanupTags (const QStringList &toClean) |
cleanupTags - remove duplicates and obsolete tags before setting metadata More... | |
QMultiMap< QString, QVariant > | getFaceTags () |
void | load (const ItemInfo &info) |
void | loadFaceTags (const ItemInfo &info, const QSize &size) |
MetadataHub () | |
void | reset () |
void | setFaceTags (QMultiMap< QString, QVariant > newFaceTags, QSize size) |
bool | willWriteMetadata (Digikam::MetadataHub::WriteComponent writeMode=WRITE_ALL, const MetaEngineSettingsContainer &settings=MetaEngineSettings::instance() ->settings()) const |
bool | write (const DImg &image, WriteComponent writeMode=WRITE_ALL, bool ignoreLazySync=false, const MetaEngineSettingsContainer &settings=MetaEngineSettings::instance() ->settings()) |
bool | write (const QString &filePath, WriteComponent writeMode=WRITE_ALL, bool ignoreLazySync=false, const MetaEngineSettingsContainer &settings=MetaEngineSettings::instance() ->settings()) |
bool | writeTags (const DMetadata &metadata, bool saveTags) |
writeTags - used to deduplicate code from writeTags and usual write, all write to tags operations must be done here More... | |
bool | writeTags (const QString &filePath, WriteComponent writeMode=WRITE_ALL, const MetaEngineSettingsContainer &settings=MetaEngineSettings::instance() ->settings()) |
void | writeToBaloo (const QString &filePath, const MetaEngineSettingsContainer &settings=MetaEngineSettings::instance() ->settings()) |
writeToBaloo - write tags, comments and rating to KDE Nepomuk replacement: Baloo More... | |
bool | writeToMetadata (const ItemInfo &info, WriteComponent writeMode=WRITE_ALL, bool ignoreLazySync=false, const MetaEngineSettingsContainer &settings=MetaEngineSettings::instance() ->settings()) |
writeToMetadata - write to metadata using image info to retrieve tags and filepath use this method when multiple image infos are loaded in hub More... | |
~MetadataHub () | |
Protected Member Functions | |
void | applyChangeNotifications () |
void | load (const QDateTime &dateTime, const CaptionsMap &titles, const CaptionsMap &comment, int colorLabel, int pickLabel, int rating, const Template &t) |
void | loadTags (const QList< int > &loadedTagIds) |
void | loadTags (const QStringList &loadedTagPaths) |
void | notifyTagDeleted (int id) |
bool | write (DMetadata &metadata, WriteComponent writeMode=WRITE_ALL, const MetaEngineSettingsContainer &settings=MetaEngineSettings::instance() ->settings()) |
The status enum describes the result of joining several metadata sets. If only one set has been added, the status is always MetadataAvailable. If no set has been added, the status is always MetadataInvalid
Enumerator | |
---|---|
MetadataInvalid | not yet filled with any value |
MetadataAvailable | only one data set has been added, or a common value is available |
Enumerator | |
---|---|
FullWrite | Write all available information |
FullWriteIfChanged | Do a full write if and only if
|
PartialWrite | Write only the changed parts. Metadata fields which cannot be changed from MetadataHub (photographer ID etc.) will never be written |
Digikam::MetadataHub::MetadataHub | ( | ) |
Constructs a MetadataHub.
Digikam::MetadataHub::~MetadataHub | ( | ) |
|
protected |
Referenced by write(), writeTags(), and writeToMetadata().
QStringList Digikam::MetadataHub::cleanupTags | ( | const QStringList & | toClean | ) |
cleanupTags - remove duplicates and obsolete tags before setting metadata
toClean | - tag list to be cleared and de-duplicated |
Referenced by writeTags(), and writeToBaloo().
QMultiMap< QString, QVariant > Digikam::MetadataHub::getFaceTags | ( | ) |
Get face tag names and face tag regions. This is used for metadata synchronization in Image Editor
void Digikam::MetadataHub::load | ( | const ItemInfo & | info | ) |
Add metadata information contained in the ItemInfo object. This method (or in combination with the other load methods) can be called multiple times on the same MetadataHub object. In this case, the metadata will be combined.
References Digikam::ItemInfo::colorLabel(), Digikam::ItemInfo::dateTime(), Digikam::TemplateManager::defaultManager(), Digikam::ItemInfo::dimensions(), Digikam::TemplateManager::findByContents(), Digikam::ItemInfo::imageComments(), Digikam::ItemInfo::imagePosition(), Digikam::Template::isNull(), loadFaceTags(), loadTags(), Digikam::ItemInfo::metadataTemplate(), Digikam::ItemInfo::pickLabel(), Digikam::ItemInfo::rating(), Digikam::ItemInfo::tagIds(), Digikam::DatabaseComment::Title, and Digikam::ItemComments::toCaptionsMap().
Referenced by Digikam::FaceGroup::rejectAll(), Digikam::MetadataTask::run(), Digikam::TagModificationHelper::slotMultipleFaceTagDel(), Digikam::FileActionMngrFileWorker::transform(), Digikam::FileActionMngrFileWorker::writeMetadata(), and Digikam::FileActionMngrFileWorker::writeMetadataToFiles().
|
protected |
private common code to load dateTime, comment, color label, pick label, rating
void Digikam::MetadataHub::loadFaceTags | ( | const ItemInfo & | info, |
const QSize & | size | ||
) |
Dedicated method to set face rectangles from database When called from outside the metadatahub and ItemInfo is cached, method dimension() can return wrong values, QSize must be specified manually
References Digikam::TagRegion::absoluteToRelative(), Digikam::FaceTagsEditor::confirmedFaceTagsIfaces(), Digikam::FaceTags::faceNameForTag(), Digikam::ItemInfo::id(), Digikam::FaceTagsEditor::ignoredFaceTagsIfaces(), Digikam::ItemInfo::orientation(), Digikam::FaceTagsIface::region(), Digikam::TagRegion::reverseToOrientation(), Digikam::FaceTagsIface::tagId(), and Digikam::TagRegion::toRect().
Referenced by load(), Digikam::FaceGroup::rejectAll(), and Digikam::FileActionMngrFileWorker::transform().
|
protected |
private common code to merge tags
References Digikam::TagsCache::instance(), and MetadataAvailable.
Referenced by load().
|
protected |
|
protected |
void Digikam::MetadataHub::reset | ( | ) |
void Digikam::MetadataHub::setFaceTags | ( | QMultiMap< QString, QVariant > | newFaceTags, |
QSize | size | ||
) |
Set new face tags
References Digikam::TagRegion::absoluteToRelative().
bool Digikam::MetadataHub::willWriteMetadata | ( | Digikam::MetadataHub::WriteComponent | writeMode = WRITE_ALL , |
const MetaEngineSettingsContainer & | settings = MetaEngineSettings::instance()->settings() |
||
) | const |
With the currently applied changes, the given writeMode and settings, returns if write(DMetadata), write(QString) or write(DImg) will actually apply any changes.
References MetadataAvailable, Digikam::MetaEngineSettingsContainer::saveColorLabel, Digikam::MetaEngineSettingsContainer::saveComments, Digikam::MetaEngineSettingsContainer::saveDateTime, Digikam::MetaEngineSettingsContainer::saveFaceTags, Digikam::MetaEngineSettingsContainer::savePickLabel, Digikam::MetaEngineSettingsContainer::savePosition, Digikam::MetaEngineSettingsContainer::saveRating, Digikam::MetaEngineSettingsContainer::saveTags, Digikam::MetaEngineSettingsContainer::saveTemplate, WRITE_COLORLABEL, WRITE_COMMENTS, WRITE_DATETIME, WRITE_PICKLABEL, WRITE_POSITION, WRITE_RATING, WRITE_TAGS, WRITE_TEMPLATE, and WRITE_TITLE.
Referenced by write(), writeTags(), and writeToMetadata().
bool Digikam::MetadataHub::write | ( | const DImg & | image, |
WriteComponent | writeMode = WRITE_ALL , |
||
bool | ignoreLazySync = false , |
||
const MetaEngineSettingsContainer & | settings = MetaEngineSettings::instance()->settings() |
||
) |
Constructs a meta engine object from the metadata stored in the given DImg object, calls the above method, and changes the stored metadata in the DImg object.
References Digikam::MetadataHubMngr::addPending(), applyChangeNotifications(), Digikam::ItemInfo::fromLocalFile(), Digikam::DImg::getMetadata(), Digikam::MetadataHubMngr::instance(), Digikam::DImg::lastSavedFilePath(), Digikam::DImg::originalFilePath(), Digikam::MetaEngineSettingsContainer::useLazySync, willWriteMetadata(), write(), and writeToBaloo().
bool Digikam::MetadataHub::write | ( | const QString & | filePath, |
WriteComponent | writeMode = WRITE_ALL , |
||
bool | ignoreLazySync = false , |
||
const MetaEngineSettingsContainer & | settings = MetaEngineSettings::instance()->settings() |
||
) |
Constructs a meta engine object for given filePath, calls the above method, writes the changes out to the file, and notifies the ItemAttributesWatch. WARNING: Do not use this method when multiple image infos are loaded It will result in disjoint tags not being written Use writeToMetadata(Image info ...) instead
References Digikam::MetadataHubMngr::addPending(), applyChangeNotifications(), Digikam::ItemAttributesWatch::fileMetadataChanged(), Digikam::ItemInfo::fromLocalFile(), Digikam::ItemAttributesWatch::instance(), Digikam::MetadataHubMngr::instance(), Digikam::MetaEngineSettingsContainer::useLazySync, willWriteMetadata(), and writeToBaloo().
Referenced by Digikam::FaceGroup::rejectAll(), Digikam::MetadataTask::run(), Digikam::FileActionMngrFileWorker::transform(), write(), Digikam::FileActionMngrFileWorker::writeMetadataToFiles(), and writeToMetadata().
|
protected |
Applies the set of metadata contained in this MetadataHub to the given meta engine object. The MetaEngineSettingsContainer determine whether data is actually set or not. The following metadata fields may be set (depending on settings):
The data fields taken from this MetadataHub object are only set if their status is MetadataAvailable. If the status is MetadataInvalid or MetadataDisjoint, the respective metadata field is not touched.
References applyChangeNotifications(), MetadataAvailable, Digikam::MetaEngine::removeGPSInfo(), Digikam::DMetadata::removeMetadataTemplate(), Digikam::Template::removeTemplateTitle(), Digikam::MetaEngineSettingsContainer::saveColorLabel, Digikam::MetaEngineSettingsContainer::saveComments, Digikam::MetaEngineSettingsContainer::saveDateTime, Digikam::MetaEngineSettingsContainer::saveFaceTags, Digikam::MetaEngineSettingsContainer::savePickLabel, Digikam::MetaEngineSettingsContainer::savePosition, Digikam::MetaEngineSettingsContainer::saveRating, Digikam::MetaEngineSettingsContainer::saveTags, Digikam::MetaEngineSettingsContainer::saveTemplate, Digikam::MetaEngine::setGPSInfo(), Digikam::MetaEngine::setImageDateTime(), Digikam::DMetadata::setItemColorLabel(), Digikam::DMetadata::setItemComments(), Digikam::DMetadata::setItemPickLabel(), Digikam::DMetadata::setItemRating(), Digikam::DMetadata::setItemTitles(), Digikam::DMetadata::setMetadataTemplate(), Digikam::DMetadata::setSettings(), WRITE_COLORLABEL, WRITE_COMMENTS, WRITE_DATETIME, WRITE_PICKLABEL, WRITE_POSITION, WRITE_RATING, WRITE_TAGS, WRITE_TEMPLATE, WRITE_TITLE, and writeTags().
bool Digikam::MetadataHub::writeTags | ( | const DMetadata & | metadata, |
bool | saveTags | ||
) |
writeTags - used to deduplicate code from writeTags and usual write, all write to tags operations must be done here
metadata | - meta engine object that apply changes |
saveTags | - save switch |
References cleanupTags(), Digikam::TagsCache::instance(), MetadataAvailable, Digikam::TagsCache::NoLeadingSlash, Digikam::DMetadata::setItemTagsPath(), Digikam::TagsCache::tagName(), and Digikam::TagsCache::tagPath().
bool Digikam::MetadataHub::writeTags | ( | const QString & | filePath, |
WriteComponent | writeMode = WRITE_ALL , |
||
const MetaEngineSettingsContainer & | settings = MetaEngineSettings::instance()->settings() |
||
) |
Will write only Tags to image. Used by TagsManager to write tags to image Other metadata are not updated.
References applyChangeNotifications(), Digikam::ItemAttributesWatch::fileMetadataChanged(), Digikam::ItemAttributesWatch::instance(), Digikam::MetaEngineSettingsContainer::saveFaceTags, Digikam::MetaEngineSettingsContainer::saveTags, willWriteMetadata(), and writeToBaloo().
Referenced by Digikam::MetadataTask::run(), and write().
void Digikam::MetadataHub::writeToBaloo | ( | const QString & | filePath, |
const MetaEngineSettingsContainer & | settings = MetaEngineSettings::instance()->settings() |
||
) |
writeToBaloo - write tags, comments and rating to KDE Nepomuk replacement: Baloo
filePath | - path to file to add comments, tags and rating |
settings | - metadata settings to be set |
References Digikam::TagsCache::canBeWrittenToMetadata(), cleanupTags(), Digikam::BalooInfo::comment, Digikam::BalooWrap::getSyncToBaloo(), Digikam::TagsCache::instance(), Digikam::BalooWrap::instance(), MetadataAvailable, Digikam::TagsCache::NoLeadingSlash, Digikam::BalooInfo::rating, Digikam::MetaEngineSettingsContainer::saveComments, Digikam::MetaEngineSettingsContainer::saveRating, Digikam::BalooWrap::setSemanticInfo(), Digikam::TagsCache::tagPath(), and Digikam::BalooInfo::tags.
Referenced by write(), writeTags(), and writeToMetadata().
bool Digikam::MetadataHub::writeToMetadata | ( | const ItemInfo & | info, |
WriteComponent | writeMode = WRITE_ALL , |
||
bool | ignoreLazySync = false , |
||
const MetaEngineSettingsContainer & | settings = MetaEngineSettings::instance()->settings() |
||
) |
writeToMetadata - write to metadata using image info to retrieve tags and filepath use this method when multiple image infos are loaded in hub
info | - image info to retrieve current tags |
writeMode | |
settings |
safe method
References Digikam::MetadataHubMngr::addPending(), applyChangeNotifications(), Digikam::ItemAttributesWatch::fileMetadataChanged(), Digikam::ItemInfo::filePath(), Digikam::ItemAttributesWatch::instance(), Digikam::MetadataHubMngr::instance(), Digikam::MetaEngineSettingsContainer::useLazySync, willWriteMetadata(), write(), and writeToBaloo().
Referenced by Digikam::TagModificationHelper::slotMultipleFaceTagDel(), and Digikam::FileActionMngrFileWorker::writeMetadata().