| digiKam Developer Documentation Professional Photo Management with the Power of Open Source

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | List of all members
Digikam::MetadataHub Class Reference

## Public Types
enum | Status { MetadataInvalid , MetadataAvailable }
| The status enum describes the result of joining several metadata sets. More...
typedef QFlags< WriteComponents > | WriteComponent
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
| MetadataHub ()
| Constructs a MetadataHub.
QStringList | cleanupTags (const QStringList &toClean)
| cleanupTags remove duplicates and obsolete tags before setting metadata
void | load (const ItemInfo &info)
| Add metadata information contained in the ItemInfo object.
void | reset ()
bool | willWriteMetadata (Digikam::MetadataHub::WriteComponent writeMode=WRITE_ALL, const MetaEngineSettingsContainer &settings=MetaEngineSettings::instance() ->settings()) const
| With the currently applied changes, the given writeMode and settings,.
bool | 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.
bool | 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.
bool | writeTags (const DMetadata &metadata, bool saveTags)
| Used to deduplicate code from writeTags and usual write, all write to tags operations must be done here.
bool | writeTags (const QString &filePath, WriteComponent writeMode=WRITE_ALL, const MetaEngineSettingsContainer &settings=MetaEngineSettings::instance() ->settings())
| Will write only Tags to image.
void | writeToBaloo (const QString &filePath, const MetaEngineSettingsContainer &settings=MetaEngineSettings::instance() ->settings())
| write tags, comments and rating to KDE Nepomuk replacement: Baloo
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

## 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)
| private common code to load dateTime, comment, color label, pick label, rating
void | loadFaceTags (const ItemInfo &info)
void | loadTags (const QList< int > &loadedTagIds)
| private common code to merge tags
void | notifyTagDeleted (int id)
bool | write (DMetadata &metadata, WriteComponent writeMode=WRITE_ALL, const MetaEngineSettingsContainer &settings=MetaEngineSettings::instance() ->settings())
| Applies the set of metadata contained in this MetadataHub to the given meta engine object.

## Member Enumeration Documentation

## ◆ Status

enum Digikam::MetadataHub::Status

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

## ◆ WriteMode

enum Digikam::MetadataHub::WriteMode

Enumerator
FullWrite | Write all available information.
FullWriteIfChanged | Do a full write if and only if. metadata fields changed the changed fields shall be written according to write settings "Changed" in this context means changed by one of the set... methods, the load() methods are ignored for this attribute. This mode allows to avoid write operations when e.g. the user does not want keywords to be written and only changes keywords.
PartialWrite | Write only the changed parts. Metadata fields which cannot be changed from MetadataHub (photographer ID etc.) will never be written

## Member Function Documentation

## ◆ cleanupTags()

QStringList Digikam::MetadataHub::cleanupTags | ( | const QStringList & | toClean | ) |

Parameters

  toClean | tag list to be cleared and de-duplicated

Returns
  clean tag list

## ◆ load()

void Digikam::MetadataHub::load | ( | const ItemInfo & | info | ) |

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.

## ◆ willWriteMetadata()

bool Digikam::MetadataHub::willWriteMetadata | ( | Digikam::MetadataHub::WriteComponent | writeMode = `WRITE_ALL`,
|  | const MetaEngineSettingsContainer & | settings = `MetaEngineSettings::instance()->settings()`
| ) |  | const

Parameters

  writeMode | The mode to write metadata
  settings | The metadata settings to be set

Returns
  if write(DMetadata), write(QString) or write(DImg) will actually apply any changes.

## ◆ write() [1/3]

bool Digikam::MetadataHub::write | ( | const DImg & | image,
|  | WriteComponent | writeMode = `WRITE_ALL`,
|  | bool | ignoreLazySync = `false`,
|  | const MetaEngineSettingsContainer & | settings = `MetaEngineSettings::instance()->settings()`
| ) |  |

Parameters

  image | The DImg container to retrieve current tags
  writeMode | The mode to write metadata
  ignoreLazySync | The flag to ignore the lazy sync metadata stage
  settings | The metadata settings to be set

Returns
  Returns if the DImg object has been touched

## ◆ write() [2/3]

bool Digikam::MetadataHub::write | ( | const QString & | filePath,
|  | WriteComponent | writeMode = `WRITE_ALL`,
|  | bool | ignoreLazySync = `false`,
|  | const MetaEngineSettingsContainer & | settings = `MetaEngineSettings::instance()->settings()`
| ) |  |

Parameters

  filePath | The file path to retrieve current tags
  writeMode | The mode to write metadata
  ignoreLazySync | The flag to ignore the lazy sync metadata stage
  settings | The metadata settings to be set

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

Returns
  Returns if the file has been touched

## ◆ write() [3/3]

bool Digikam::MetadataHub::write | ( | DMetadata & | metadata,
|  | WriteComponent | writeMode = `WRITE_ALL`,
|  | const MetaEngineSettingsContainer & | settings = `MetaEngineSettings::instance()->settings()`
| ) |  |
| protected

Parameters

  metadata | The metadata backend instance.
  writeMode | The mode to write metadata.
  settings | The MetaEngineSettingsContainer determine whether data is actually set or not. The following metadata fields may be set (depending on settings): Comment Date Rating Tags Photographer ID (data from settings) Credits (data from settings)

Note
  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.

Returns
  Returns true if the metadata object has been touched.

## ◆ writeTags() [1/2]

bool Digikam::MetadataHub::writeTags | ( | const DMetadata & | metadata,
|  | bool | saveTags
| ) |  |

Parameters

  metadata | meta engine object that apply changes
  saveTags | save switch

Returns
  if tags were successfully set

## ◆ writeTags() [2/2]

bool Digikam::MetadataHub::writeTags | ( | const QString & | filePath,
|  | WriteComponent | writeMode = `WRITE_ALL`,
|  | const MetaEngineSettingsContainer & | settings = `MetaEngineSettings::instance()->settings()`
| ) |  |

Used by TagsManager to write tags to image Other metadata are not updated.

Parameters

  filePath | The file path to update current tags
  writeMode | The mode to write metadata
  settings | The metadata settings to be set

Returns
  if tags were successfully written.

## ◆ writeToBaloo()

void Digikam::MetadataHub::writeToBaloo | ( | const QString & | filePath,
|  | const MetaEngineSettingsContainer & | settings = `MetaEngineSettings::instance()->settings()`
| ) |  |

Parameters

  filePath | path to file to add comments, tags and rating
  settings | metadata settings to be set

## ◆ writeToMetadata()

bool Digikam::MetadataHub::writeToMetadata | ( | const ItemInfo & | info,
|  | WriteComponent | writeMode = `WRITE_ALL`,
|  | bool | ignoreLazySync = `false`,
|  | const MetaEngineSettingsContainer & | settings = `MetaEngineSettings::instance()->settings()`
| ) |  |

safe method

Parameters

  info | The image info to retrieve current tags
  writeMode | The mode to write metadata
  ignoreLazySync | The flag to ignore the lazy sync metadata stage
  settings | The metadata settings to be set

Returns
  true if everything is successful