digiKam Developer Documentation: Digikam::Album Class Reference

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

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
Digikam::Album Class Referenceabstract

Abstract base class for all album types. More...

Inheritance diagram for Digikam::Album:

## Public Types
enum | Type { PHYSICAL = 0 , TAG , DATE , SEARCH , FACE }

## Public Member Functions
QList< int > | childAlbumIds (bool recursive=false)
AlbumList | childAlbums (bool recursive=false)
Album * | childAtRow (int row) const
int | childCount () const
virtual CoreDbUrl | databaseUrl () const =0
void * | extraData (const void *const key) const
| Retrieve the associated extra data associated with `key`.
Album * | firstChild () const
int | globalID () const
| An album ID is only unique among the set of all Albums of its Type.
int | id () const
| Each album has a `ID` uniquely identifying it in the set of Albums of a Type.
bool | isAncestorOf (Album *const album) const
bool | isRoot () const
bool | isTrashAlbum () const
bool | isUsedByLabelsTree () const
Album * | lastChild () const
Album * | next () const
Album * | parent () const
void | prepareForDeletion ()
| For secure deletion in an album model, call this function beforehand.
Album * | prev () const
void | removeExtraData (const void *const key)
| Remove the associated extra data associated with `key`.
int | rowFromAlbum () const
void | setExtraData (const void *const key, void *const value)
| This allows to associate some "extra" data to a Album.
void | setUsedByLabelsTree (bool isUsed)
| Sets the property m_usedByLabelsTree to true if the search album was created using the Colors and labels tree view.
QString | title () const
Type | type () const

## Static Public Member Functions
static int | globalID (Type type, int id)
| Produces the global id.

## Protected Member Functions
| Album (Album::Type type, int id, bool root)
| Constructor.
virtual | ~Album ()
| Destructor.
void | clear ()
| Delete all child albums and also remove any associated extra data.
void | insertChild (Album *const child)
void | removeChild (Album *const child)
void | setParent (Album *const parent)
void | setTitle (const QString &title)

## Friends
class | AlbumManager

## Detailed Description

A class which provides an abstraction for a type Album. This class is meant to be derived and every time a new Album Type is defined add a enum corresponding to that to Album::Type

This class provides a means of building a tree representation for Albums

See also
  Album::setParent().

## Member Enumeration Documentation

## ◆ Type

enum Digikam::Album::Type

Enumerator
PHYSICAL | A physical album type. See also PAlbum
TAG | A tag album type. See also TAlbum
DATE | A date album type. See also DAlbum
SEARCH | A search album type. See also SAlbum
FACE | A faces album type. See also FAlbum

## Constructor & Destructor Documentation

## ◆ ~Album()

Digikam::Album::~Album | ( |  | ) |
| protectedvirtual

this will also recursively delete all child Albums

## Member Function Documentation

## ◆ childAlbumIds()

QList< int > Digikam::Album::childAlbumIds | ( | bool | recursive = `false` | ) |

Returns
  a list of all child Albums

## ◆ childAlbums()

AlbumList Digikam::Album::childAlbums | ( | bool | recursive = `false` | ) |

Returns
  a list of all child Albums

## ◆ childAtRow()

Album * Digikam::Album::childAtRow | ( | int | row | ) | const

Returns
  the child of this album at row

## ◆ childCount()

int Digikam::Album::childCount | ( |  | ) | const

Returns
  the `childCount` of the album

## ◆ databaseUrl()

virtual CoreDbUrl Digikam::Album::databaseUrl | ( |  | ) | const
| pure virtual

Returns
  the kde url of the album

Implemented in Digikam::PAlbum, Digikam::TAlbum, Digikam::DAlbum, and Digikam::SAlbum.

## ◆ extraData()

void * Digikam::Album::extraData | ( | const void *const | key | ) | const

Parameters

  key | the key of the extra data

See also
  setExtraData
  extraData

## ◆ firstChild()

Album * Digikam::Album::firstChild | ( |  | ) | const

Returns
  the first child of this album or 0 if no children

## ◆ globalID() [1/2]

int Digikam::Album::globalID | ( |  | ) | const

This is a global Identifier which will uniquely identifying the Album among all Albums

Note
  If you are adding a new Album Type make sure to update this implementation.

You can always get the `ID` of the album using something like

int albumID = rootAlbum->globalID() - album->globalID();

Returns
  the `globalID` of the album

See also
  id()

## ◆ globalID() [2/2]

int Digikam::Album::globalID | ( | Type | type,
|  | int | id
| ) |  |
| static

Parameters

  type | The type of the album
  id | the (type-specific) id of the album

Returns
  the global id

## ◆ id()

int Digikam::Album::id | ( |  | ) | const

Note
  The `ID` for a root Album is always 0

Returns
  the `ID` of the album

See also
  globalID()

## ◆ isAncestorOf()

bool Digikam::Album::isAncestorOf | ( | Album *const | album | ) | const

Returns
  true if the `album` is in the parent hierarchy

Parameters

  album | the album to check whether it belongs in the child hierarchy

## ◆ isRoot()

bool Digikam::Album::isRoot | ( |  | ) | const

Returns
  true is the album is a Root Album

## ◆ isTrashAlbum()

bool Digikam::Album::isTrashAlbum | ( |  | ) | const

Returns
  true if the album was created to be a trash virtual album

## ◆ isUsedByLabelsTree()

bool Digikam::Album::isUsedByLabelsTree | ( |  | ) | const

Returns
  true if the Album was created by Labels Tree

## ◆ lastChild()

Album * Digikam::Album::lastChild | ( |  | ) | const

Returns
  the last child of this album or 0 if no children

## ◆ next()

Album * Digikam::Album::next | ( |  | ) | const

Returns
  the next sibling of this album of this album or 0 if no next sibling

See also
  AlbumIterator

## ◆ parent()

Album * Digikam::Album::parent | ( |  | ) | const

Returns
  the parent album for this album

## ◆ prev()

Album * Digikam::Album::prev | ( |  | ) | const

Returns
  the previous sibling of this album of this album or 0 if no previous sibling

See also
  AlbumIterator

## ◆ removeExtraData()

void Digikam::Album::removeExtraData | ( | const void *const | key | ) |

Parameters

  key | the key of the extra data

See also
  setExtraData
  extraData

## ◆ rowFromAlbum()

int Digikam::Album::rowFromAlbum | ( |  | ) | const

Returns
  the `rowFromAlbum` of the album

## ◆ setExtraData()

void Digikam::Album::setExtraData | ( | const void *const | key,
|  | void *const | value
| ) |  |

As one Album can be used by several objects (often views) which all need to add some data, you have to use a key to reference your extra data within the Album.

That way a Album can hold and provide access to all those views separately.

for eg,

album->setExtraData( this, searchFolderItem );

and can later access the searchFolderItem by doing

SearchFolderItem *item = static_cast<SearchFolderItem*>(album->extraData(this));

Note: you have to remove and destroy the data you associated yourself when you don't need it anymore!

Parameters

  key | the key of the extra data
  value | the value of the extra data

See also
  extraData
  removeExtraData

## ◆ setUsedByLabelsTree()

void Digikam::Album::setUsedByLabelsTree | ( | bool | isUsed | ) |

Parameters

  isUsed | => the status of the usage

## ◆ title()

QString Digikam::Album::title | ( |  | ) | const

Returns
  the `title` aka name of the album

## ◆ type()

Album::Type Digikam::Album::type | ( |  | ) | const

Returns
  the type of album

See also
  Type