digiKam
Digikam::DateAlbumModel Class Reference
+ Inheritance diagram for Digikam::DateAlbumModel:

Public Types

enum  AlbumDataRole {
  AlbumTitleRole = Qt::UserRole , AlbumTypeRole = Qt::UserRole + 1 , AlbumPointerRole = Qt::UserRole + 2 , AlbumIdRole = Qt::UserRole + 3 ,
  AlbumGlobalIdRole = Qt::UserRole + 4 , AlbumSortRole = Qt::UserRole + 5
}
 
enum  RootAlbumBehavior { IncludeRootAlbum , IgnoreRootAlbum }
 

Public Slots

void excludeChildrenCount (const QModelIndex &index)
 
void includeChildrenCount (const QModelIndex &index)
 
void setCountMap (const QMap< int, int > &idCountMap)
 
void setShowCount (bool show)
 Call to enable or disable showing the count. Default is false. More...
 
void setYearMonthMap (const QMap< YearMonth, int > &yearMonthMap)
 

Signals

void rootAlbumAvailable ()
 

Public Member Functions

virtual int albumCount (Album *album) const
 
DAlbumalbumForIndex (const QModelIndex &index) const
 
Album::Type albumType () const
 
int columnCount (const QModelIndex &parent=QModelIndex()) const override
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 
 DateAlbumModel (QObject *const parent=nullptr)
 
AlbumModelDragDropHandlerdragDropHandler () const
 
bool dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override
 
Qt::ItemFlags flags (const QModelIndex &index) const override
 
bool hasChildren (const QModelIndex &parent=QModelIndex()) const override
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
 
QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const override
 
QModelIndex indexForAlbum (Album *album) const
 
bool isFaceTagModel () const
 
QMimeData * mimeData (const QModelIndexList &indexes) const override
 
QStringList mimeTypes () const override
 
QModelIndex monthIndexForDate (const QDate &date) const
 
QModelIndex parent (const QModelIndex &index) const override
 
AlbumrootAlbum () const
 
RootAlbumBehavior rootAlbumBehavior () const
 
QModelIndex rootAlbumIndex () const
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 
void setDragDropHandler (AlbumModelDragDropHandler *handler)
 
void setPixmaps (const QPixmap &forYearAlbums, const QPixmap &forMonthAlbums)
 
bool showCount () const
 
Qt::DropActions supportedDropActions () const override
 

Static Public Member Functions

static AlbumretrieveAlbum (const QModelIndex &index)
 

Protected Slots

void slotAlbumAboutToBeAdded (Album *album, Album *parent, Album *prev)
 
void slotAlbumAboutToBeDeleted (Album *album)
 
void slotAlbumAdded (Album *)
 
void slotAlbumHasBeenDeleted (quintptr)
 
void slotAlbumIconChanged (Album *album)
 
void slotAlbumMoved (Album *album)
 
void slotAlbumRenamed (Album *album)
 
void slotAlbumsCleared ()
 
void slotGotThumbnailFromIcon (Album *album, const QPixmap &thumbnail)
 
void slotReloadThumbnails ()
 
void slotThumbnailLost (Album *album)
 

Protected Member Functions

void albumCleared (Album *album) override
 Notification when an entry is removed. More...
 
QVariant albumData (Album *a, int role) const override
 Reimplemented from parent classes. More...
 
AlbumalbumForId (int id) const override
 need to implement in subclass More...
 
QString albumName (Album *a) const override
 Can reimplement in subclass. More...
 
void allAlbumsCleared () override
 Notification when all entries are removed. More...
 
QString columnHeader () const override
 For subclassing convenience: A part of the implementation of headerData() More...
 
QVariant decorationRoleData (Album *a) const override
 For subclassing convenience: A part of the implementation of data() More...
 
void emitDataChangedForChildren (Album *album)
 
virtual bool filterAlbum (Album *album) const
 
virtual QVariant fontRoleData (Album *a) const
 For subclassing convenience: A part of the implementation of data() More...
 
virtual Qt::ItemFlags itemFlags (Album *album) const
 For subclassing convenience: A part of the implementation of itemFlags() More...
 
void setColumnHeader (const QString &header)
 
void setCount (Album *album, int count)
 If you do not use setCountMap, excludeChildrenCount and includeChildrenCount, you can set a count here. More...
 
void setEnableDrag (bool enable)
 
void setEnableDrop (bool enable)
 
void setFaceTagModel (bool enable)
 
void setup ()
 
void setupThumbnailLoading ()
 You need to call this from your constructor if you intend to load the thumbnail facilities of this class. More...
 
QVariant sortRoleData (Album *a) const override
 For subclassing convenience: A part of the implementation of data() More...
 

Protected Attributes

QString m_columnHeader
 
QPixmap m_monthPixmap
 
QPixmap m_yearPixmap
 

Detailed Description

A model for date based albums.

Member Enumeration Documentation

◆ AlbumDataRole

Enumerator
AlbumTitleRole 

Returns the album title. Principally the same as display role, but without any additions.

AlbumTypeRole 

Returns the Album::Type of the associated album.

AlbumPointerRole 

Returns a pointer to the associated Album object.

AlbumIdRole 

Returns the id of the associated Album object.

AlbumGlobalIdRole 

Returns the global id (unique across all album types)

AlbumSortRole 

Returns the data to sort on.

◆ RootAlbumBehavior

AbstractAlbumModel is the abstract base class for all models that present Album objects as managed by AlbumManager. You will want to create an instance of the base classes.

Enumerator
IncludeRootAlbum 

The root album will be included as a single parent item with all top-level album as children

IgnoreRootAlbum 

The root album will not be included, but all top-level album are represented as top-level items in this view

Constructor & Destructor Documentation

◆ DateAlbumModel()

Digikam::DateAlbumModel::DateAlbumModel ( QObject *const  parent = nullptr)
explicit

Constructor.

Parameters
parentthe parent for Qt's parent child mechanism

References Digikam::AlbumManager::instance(), Digikam::AbstractSpecificAlbumModel::m_columnHeader, Digikam::AbstractCountingAlbumModel::setup(), and setYearMonthMap().

Member Function Documentation

◆ albumCleared()

void Digikam::AbstractCountingAlbumModel::albumCleared ( Album )
overrideprotectedvirtualinherited

Notification when an entry is removed.

Reimplemented from Digikam::AbstractAlbumModel.

Reimplemented in Digikam::AbstractCheckableAlbumModel.

References Digikam::Album::id(), and Digikam::AlbumManager::instance().

Referenced by Digikam::AbstractCheckableAlbumModel::albumCleared().

◆ albumCount()

int Digikam::AbstractCountingAlbumModel::albumCount ( Album album) const
virtualinherited

Returns the number of included items for this album.

Returns
positive value or -1 if unknown

References Digikam::Album::id().

◆ albumData()

QVariant Digikam::AbstractCountingAlbumModel::albumData ( Album a,
int  role 
) const
overrideprotectedvirtualinherited

◆ albumForId()

Album * Digikam::DateAlbumModel::albumForId ( int  id) const
overrideprotectedvirtual

◆ albumForIndex()

DAlbum * Digikam::DateAlbumModel::albumForIndex ( const QModelIndex &  index) const

◆ albumName()

QString Digikam::DateAlbumModel::albumName ( Album a) const
overrideprotectedvirtual

Can reimplement in subclass.

Reimplemented from Digikam::AbstractCountingAlbumModel.

References Digikam::DAlbum::date(), Digikam::DAlbum::range(), and Digikam::DAlbum::Year.

◆ albumType()

Album::Type Digikam::AbstractAlbumModel::albumType ( ) const
inherited

Returns the Album::Type of the contained albums

Referenced by Digikam::AbstractAlbumModel::AbstractAlbumModel().

◆ allAlbumsCleared()

void Digikam::AbstractCountingAlbumModel::allAlbumsCleared ( )
overrideprotectedvirtualinherited

Notification when all entries are removed.

Reimplemented from Digikam::AbstractAlbumModel.

Reimplemented in Digikam::AbstractCheckableAlbumModel.

Referenced by Digikam::AbstractCheckableAlbumModel::allAlbumsCleared().

◆ columnCount()

int Digikam::AbstractAlbumModel::columnCount ( const QModelIndex &  parent = QModelIndex()) const
overrideinherited

◆ columnHeader()

QString Digikam::AbstractSpecificAlbumModel::columnHeader ( ) const
overrideprotectedvirtualinherited

For subclassing convenience: A part of the implementation of headerData()

Reimplemented from Digikam::AbstractAlbumModel.

References Digikam::AbstractSpecificAlbumModel::m_columnHeader.

◆ data()

QVariant Digikam::AbstractAlbumModel::data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const
overrideinherited

◆ decorationRoleData()

QVariant Digikam::DateAlbumModel::decorationRoleData ( Album a) const
overrideprotectedvirtual

For subclassing convenience: A part of the implementation of data()

Reimplemented from Digikam::AbstractAlbumModel.

References m_monthPixmap, m_yearPixmap, Digikam::DAlbum::range(), and Digikam::DAlbum::Year.

◆ dragDropHandler()

◆ dropMimeData()

bool Digikam::AbstractAlbumModel::dropMimeData ( const QMimeData *  data,
Qt::DropAction  action,
int  row,
int  column,
const QModelIndex &  parent 
)
overrideinherited

◆ emitDataChangedForChildren()

◆ excludeChildrenCount

void Digikam::AbstractCountingAlbumModel::excludeChildrenCount ( const QModelIndex &  index)
slotinherited

Displays only the count of the album, without adding child albums' counts. This is the default. Can connect to QTreeView's expanded() signal.

References Digikam::AbstractAlbumModel::albumForIndex(), Digikam::Album::id(), and Digikam::AbstractAlbumModel::index().

◆ filterAlbum()

bool Digikam::AbstractAlbumModel::filterAlbum ( Album album) const
protectedvirtualinherited

◆ flags()

Qt::ItemFlags Digikam::AbstractAlbumModel::flags ( const QModelIndex &  index) const
overrideinherited

◆ fontRoleData()

QVariant Digikam::AbstractAlbumModel::fontRoleData ( Album a) const
protectedvirtualinherited

For subclassing convenience: A part of the implementation of data()

Reimplemented in Digikam::TagModel.

Referenced by Digikam::AbstractAlbumModel::albumData().

◆ hasChildren()

bool Digikam::AbstractAlbumModel::hasChildren ( const QModelIndex &  parent = QModelIndex()) const
overrideinherited

◆ headerData()

QVariant Digikam::AbstractAlbumModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const
overrideinherited

◆ includeChildrenCount

void Digikam::AbstractCountingAlbumModel::includeChildrenCount ( const QModelIndex &  index)
slotinherited

Displays sum of the count of the album and child albums' counts. Can connect to QTreeView's collapsed() signal.

References Digikam::AbstractAlbumModel::albumForIndex(), Digikam::Album::id(), and Digikam::AbstractAlbumModel::index().

◆ index()

QModelIndex Digikam::AbstractAlbumModel::index ( int  row,
int  column,
const QModelIndex &  parent = QModelIndex() 
) const
overrideinherited

◆ indexForAlbum()

◆ isFaceTagModel()

bool Digikam::AbstractAlbumModel::isFaceTagModel ( ) const
inherited

Returns true if the album model a face tag model

Referenced by Digikam::TagModel::decorationRoleData(), and Digikam::AlbumFilterModel::lessThan().

◆ itemFlags()

Qt::ItemFlags Digikam::AbstractAlbumModel::itemFlags ( Album album) const
protectedvirtualinherited

For subclassing convenience: A part of the implementation of itemFlags()

Referenced by Digikam::AbstractAlbumModel::flags().

◆ mimeData()

QMimeData * Digikam::AbstractAlbumModel::mimeData ( const QModelIndexList &  indexes) const
overrideinherited

◆ mimeTypes()

QStringList Digikam::AbstractAlbumModel::mimeTypes ( ) const
overrideinherited

◆ monthIndexForDate()

QModelIndex Digikam::DateAlbumModel::monthIndexForDate ( const QDate &  date) const

Finds an album index based on a date. The given date is therefore normalized to year-month-form. The day is ignored. This means the returned index always points to a month DAlbum.

Parameters
datethe date to search for (year and month)
Returns
model index corresponding to the album with the given date or an empty index if not found

References albumForIndex(), Digikam::DAlbum::date(), Digikam::AbstractAlbumModel::index(), Digikam::DAlbum::Month, Digikam::DAlbum::range(), Digikam::AbstractAlbumModel::rowCount(), and Digikam::DAlbum::Year.

◆ parent()

◆ retrieveAlbum()

Album * Digikam::AbstractAlbumModel::retrieveAlbum ( const QModelIndex &  index)
staticinherited

Returns the album represented by the index. In contrast to albumForIndex(), the index can be from any proxy model, as long as an AbstractAlbumModel is at the end.

References Digikam::AbstractAlbumModel::AlbumPointerRole, and Digikam::AbstractAlbumModel::index().

Referenced by Digikam::AlbumFilterModel::albumForIndex(), and Digikam::AlbumFilterModel::filterAcceptsRow().

◆ rootAlbum()

◆ rootAlbumAvailable

void Digikam::AbstractAlbumModel::rootAlbumAvailable ( )
signalinherited

This is initialized once after creation, if the root album becomes available, if it was not already available at time of construction. This is emitted regardless of root album policy.

Referenced by Digikam::AbstractAlbumModel::slotAlbumAdded().

◆ rootAlbumBehavior()

AbstractAlbumModel::RootAlbumBehavior Digikam::AbstractAlbumModel::rootAlbumBehavior ( ) const
inherited

Returns the root album behavior set for this model

Referenced by Digikam::TagTreeView::setAlbumModel().

◆ rootAlbumIndex()

QModelIndex Digikam::AbstractAlbumModel::rootAlbumIndex ( ) const
inherited

Return the index corresponding to the root album. If the policy is IgnoreRootAlbum, this is an invalid index.

References Digikam::AbstractAlbumModel::indexForAlbum().

Referenced by Digikam::AbstractCheckableAlbumModel::flags(), Digikam::AbstractCheckableAlbumModel::resetCheckedAlbums(), and Digikam::AlbumFilterModel::rootAlbumIndex().

◆ rowCount()

int Digikam::AbstractAlbumModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const
overrideinherited

◆ setColumnHeader()

void Digikam::AbstractSpecificAlbumModel::setColumnHeader ( const QString &  header)
protectedinherited

◆ setCount()

void Digikam::AbstractCountingAlbumModel::setCount ( Album album,
int  count 
)
protectedinherited

If you do not use setCountMap, excludeChildrenCount and includeChildrenCount, you can set a count here.

References Digikam::Album::id(), Digikam::AbstractAlbumModel::index(), and Digikam::AbstractAlbumModel::indexForAlbum().

◆ setCountMap

void Digikam::AbstractCountingAlbumModel::setCountMap ( const QMap< int, int > &  idCountMap)
slotinherited

Enable displaying the count. Set a map of album id -> count (excluding children). If an album is not contained, no count is displayed. To display a count of 0, there must be an entry album id -> 0.

References Digikam::AbstractCountingAlbumModel::albumForId().

Referenced by Digikam::TagModel::activateFaceTagModel(), Digikam::AlbumModel::AlbumModel(), setYearMonthMap(), Digikam::AbstractCountingAlbumModel::slotAlbumMoved(), and Digikam::TagModel::TagModel().

◆ setDragDropHandler()

void Digikam::AbstractAlbumModel::setDragDropHandler ( AlbumModelDragDropHandler handler)
inherited

◆ setEnableDrag()

void Digikam::AbstractAlbumModel::setEnableDrag ( bool  enable)
protectedinherited

Switch on drag and drop globally for all items. Default is true. For per-item cases reimplement itemFlags().

◆ setEnableDrop()

void Digikam::AbstractAlbumModel::setEnableDrop ( bool  enable)
protectedinherited

◆ setFaceTagModel()

void Digikam::AbstractAlbumModel::setFaceTagModel ( bool  enable)
protectedinherited

◆ setPixmaps()

void Digikam::DateAlbumModel::setPixmaps ( const QPixmap &  forYearAlbums,
const QPixmap &  forMonthAlbums 
)

Set pixmaps for the DecorationRole

References m_monthPixmap, and m_yearPixmap.

◆ setShowCount

void Digikam::AbstractCountingAlbumModel::setShowCount ( bool  show)
slotinherited

Call to enable or disable showing the count. Default is false.

References Digikam::AbstractSpecificAlbumModel::emitDataChangedForChildren(), and Digikam::AbstractAlbumModel::rootAlbum().

Referenced by Digikam::SearchModel::SearchModel().

◆ setup()

void Digikam::AbstractCountingAlbumModel::setup ( )
protectedinherited

Call this method in children class constructors to init signal/slots connections.

References Digikam::AlbumManager::instance(), and Digikam::AbstractCountingAlbumModel::slotAlbumMoved().

Referenced by Digikam::AbstractCheckableAlbumModel::AbstractCheckableAlbumModel(), and DateAlbumModel().

◆ setupThumbnailLoading()

void Digikam::AbstractSpecificAlbumModel::setupThumbnailLoading ( )
protectedinherited

◆ setYearMonthMap

◆ showCount()

bool Digikam::AbstractCountingAlbumModel::showCount ( ) const
inherited

◆ slotAlbumAboutToBeAdded

◆ slotAlbumAboutToBeDeleted

◆ slotAlbumAdded

void Digikam::AbstractAlbumModel::slotAlbumAdded ( Album album)
protectedslotinherited

◆ slotAlbumHasBeenDeleted

void Digikam::AbstractAlbumModel::slotAlbumHasBeenDeleted ( quintptr  p)
protectedslotinherited

◆ slotAlbumIconChanged

void Digikam::AbstractAlbumModel::slotAlbumIconChanged ( Album album)
protectedslotinherited

◆ slotAlbumMoved

void Digikam::AbstractCountingAlbumModel::slotAlbumMoved ( Album album)
protectedslotinherited

◆ slotAlbumRenamed

void Digikam::AbstractAlbumModel::slotAlbumRenamed ( Album album)
protectedslotinherited

◆ slotAlbumsCleared

void Digikam::AbstractAlbumModel::slotAlbumsCleared ( )
protectedslotinherited

◆ slotGotThumbnailFromIcon

void Digikam::AbstractSpecificAlbumModel::slotGotThumbnailFromIcon ( Album album,
const QPixmap &  thumbnail 
)
protectedslotinherited

◆ slotReloadThumbnails

void Digikam::AbstractSpecificAlbumModel::slotReloadThumbnails ( )
protectedslotinherited

◆ slotThumbnailLost

void Digikam::AbstractSpecificAlbumModel::slotThumbnailLost ( Album album)
protectedslotinherited

◆ sortRoleData()

QVariant Digikam::DateAlbumModel::sortRoleData ( Album a) const
overrideprotectedvirtual

For subclassing convenience: A part of the implementation of data()

Reimplemented from Digikam::AbstractAlbumModel.

References Digikam::DAlbum::date().

◆ supportedDropActions()

Qt::DropActions Digikam::AbstractAlbumModel::supportedDropActions ( ) const
overrideinherited

Member Data Documentation

◆ m_columnHeader

◆ m_monthPixmap

QPixmap Digikam::DateAlbumModel::m_monthPixmap
protected

Referenced by decorationRoleData(), and setPixmaps().

◆ m_yearPixmap

QPixmap Digikam::DateAlbumModel::m_yearPixmap
protected

Referenced by decorationRoleData(), and setPixmaps().


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