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

Public Types

enum  ImportItemModelRoles {
  ImportItemModelPointerRole = Qt::UserRole , ImportItemModelInternalId = Qt::UserRole + 1 , ThumbnailRole = Qt::UserRole + 2 , ExtraDataRole = Qt::UserRole + 3 ,
  ExtraDataDuplicateCount = Qt::UserRole + 6 , FilterModelRoles = Qt::UserRole + 100
}
 

Public Slots

void addCamItemInfo (const CamItemInfo &info)
 
void addCamItemInfos (const CamItemInfoList &infos)
 
void reAddCamItemInfos (const CamItemInfoList &infos)
 
void reAddingFinished ()
 
void slotFileDeleted (const QString &folder, const QString &file, bool status)
 
void slotFileUploaded (const CamItemInfo &info)
 

Signals

void allRefreshingFinished ()
 
void itemInfosAboutToBeAdded (const QList< CamItemInfo > &infos)
 
void itemInfosAboutToBeRemoved (const QList< CamItemInfo > &infos)
 
void itemInfosAdded (const QList< CamItemInfo > &infos)
 
void itemInfosRemoved (const QList< CamItemInfo > &infos)
 
void preprocess (const QList< CamItemInfo > &infos)
 
void processAdded (const QList< CamItemInfo > &infos)
 
void readyForIncrementalRefresh ()
 
void thumbnailAvailable (const QModelIndex &index, int requestedSize)
 
void thumbnailFailed (const QModelIndex &index, int requestedSize)
 

Public Member Functions

void addCamItemInfosSynchronously (const Digikam::CamItemInfoList &infos)
 
void addCamItemInfoSynchronously (const CamItemInfo &info)
 
qlonglong camItemId (const QModelIndex &index) const
 
qlonglong camItemId (int row) const
 
QList< qlonglong > camItemIds () const
 
QList< qlonglong > camItemIds (const QList< QModelIndex > &indexes) const
 
CamItemInfo camItemInfo (const QModelIndex &index) const
 
CamItemInfo camItemInfo (const QUrl &fileUrl) const
 
CamItemInfo camItemInfo (int row) const
 
CamItemInfocamItemInfoRef (const QModelIndex &index) const
 
CamItemInfocamItemInfoRef (int row) const
 
QList< CamItemInfocamItemInfos () const
 
CamItemInfoList camItemInfos (const QList< QModelIndex > &indexes) const
 
QList< CamItemInfocamItemInfos (const QUrl &fileUrl) const
 
void clearCamItemInfos ()
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 
virtual Qt::ItemFlags dragDropFlags (const QModelIndex &index) const
 
Qt::ItemFlags dragDropFlagsV2 (const QModelIndex &index) const
 
AbstractItemDragDropHandlerdragDropHandler () const
 
bool dropMimeData (const QMimeData *, Qt::DropAction, int, int, const QModelIndex &)
 
Qt::ItemFlags flags (const QModelIndex &index) const override
 
bool hasImage (const CamItemInfo &info) const
 
bool hasImage (qlonglong id) const
 
QVariant headerData (int section, Qt::Orientation orientation, int role) const override
 
 ImportThumbnailModel (QObject *const parent)
 
QModelIndex index (int row, int column, const QModelIndex &parent) const override
 
QList< QModelIndex > indexesForCamItemId (qlonglong id) const
 
QList< QModelIndex > indexesForCamItemInfo (const CamItemInfo &info) const
 
QList< QModelIndex > indexesForUrl (const QUrl &fileUrl) const
 
QModelIndex indexForCamItemId (qlonglong id) const
 
QModelIndex indexForCamItemInfo (const CamItemInfo &info) const
 
QModelIndex indexForUrl (const QUrl &fileUrl) const
 
virtual bool isDragEnabled (const QModelIndex &index) const
 
virtual bool isDropEnabled (const QModelIndex &index) const
 
bool isEmpty () const
 
bool isRefreshing () const
 
bool keepsFileUrlCache () const
 
QMimeData * mimeData (const QModelIndexList &indexes) const
 
QStringList mimeTypes () const
 
int numberOfIndexesForCamItemId (qlonglong id) const
 
int numberOfIndexesForCamItemInfo (const CamItemInfo &info) const
 
void removeCamItemInfo (const CamItemInfo &info)
 
void removeCamItemInfos (const QList< CamItemInfo > &infos)
 
void removeIndex (const QModelIndex &index)
 
void removeIndexs (const QList< QModelIndex > &indexes)
 
int rowCount (const QModelIndex &parent) const override
 QAbstractListModel implementation. More...
 
void setCameraThumbsController (CameraThumbsCtrl *const thumbsCtrl) override
 Sets the camera thumbs controller which is used to get the thumbnails for item infos. More...
 
void setCamItemInfos (const CamItemInfoList &infos)
 
bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::DisplayRole) override
 
void setDragDropHandler (AbstractItemDragDropHandler *handler)
 
void setEmitDataChanged (bool emitSignal)
 
void setKeepsFileUrlCache (bool keepCache)
 
DECLARE_MODEL_DRAG_DROP_METHODS void setSendRemovalSignals (bool send)
 DragDrop methods. More...
 
Qt::DropActions supportedDropActions () const
 
ThumbnailSize thumbnailSize () const
 Get the thumbnail size. More...
 
QList< CamItemInfouniqueCamItemInfos () const
 
 ~ImportThumbnailModel () override
 

Static Public Member Functions

static qlonglong retrieveCamItemId (const QModelIndex &index)
 
static CamItemInfo retrieveCamItemInfo (const QModelIndex &index)
 

Protected Member Functions

virtual void camItemInfosCleared ()
 
void emitDataChangedForAll ()
 
void emitDataChangedForSelections (const QItemSelection &selection)
 
void finishIncrementalRefresh ()
 
void finishRefresh ()
 
bool hasIncrementalRefreshPending () const
 
virtual void itemInfosAboutToBeRemoved (int, int)
 
void requestIncrementalRefresh ()
 
void startIncrementalRefresh ()
 
void startRefresh ()
 

Protected Attributes

AbstractItemDragDropHandlerm_dragDropHandler
 

Member Enumeration Documentation

◆ ImportItemModelRoles

Enumerator
ImportItemModelPointerRole 

An ImportItemModel* pointer to this model

ImportItemModelInternalId 
ThumbnailRole 

Returns a thumbnail pixmap. May be implemented by subclasses. Returns either a valid pixmap or a null QVariant.

ExtraDataRole 

Return (optional) extraData field

ExtraDataDuplicateCount 

Returns the number of duplicate indexes for the same image id

FilterModelRoles 

Constructor & Destructor Documentation

◆ ImportThumbnailModel()

Digikam::ImportThumbnailModel::ImportThumbnailModel ( QObject *const  parent)
explicit

This model provides thumbnail loading, it uses the Camera Controller to retrieve thumbnails for CamItemInfos. It also provides preloading of thumbnails, and caching facility. Thumbnails size can be adjusted.

References Digikam::ImportItemModel::setKeepsFileUrlCache().

◆ ~ImportThumbnailModel()

Digikam::ImportThumbnailModel::~ImportThumbnailModel ( )
override

Member Function Documentation

◆ addCamItemInfo

void Digikam::ImportItemModel::addCamItemInfo ( const CamItemInfo info)
slotinherited

◆ addCamItemInfos

void Digikam::ImportItemModel::addCamItemInfos ( const CamItemInfoList infos)
slotinherited

◆ addCamItemInfosSynchronously()

void Digikam::ImportItemModel::addCamItemInfosSynchronously ( const Digikam::CamItemInfoList infos)
inherited

◆ addCamItemInfoSynchronously()

void Digikam::ImportItemModel::addCamItemInfoSynchronously ( const CamItemInfo info)
inherited

addCamItemInfo() is asynchronous if a prepocessor is set. This method first adds the info, synchronously. Only afterwards, the preprocessor will have the opportunity to process it. This method also bypasses any incremental updates.

References Digikam::ImportItemModel::addCamItemInfosSynchronously().

◆ allRefreshingFinished

void Digikam::ImportItemModel::allRefreshingFinished ( )
signalinherited

Signals that the model has finished currently with all scheduled refreshing, full or incremental, and all preprocessing. The model is in polished, clean situation right now.

◆ camItemId() [1/2]

qlonglong Digikam::ImportItemModel::camItemId ( const QModelIndex &  index) const
inherited

◆ camItemId() [2/2]

qlonglong Digikam::ImportItemModel::camItemId ( int  row) const
inherited

◆ camItemIds() [1/2]

QList< qlonglong > Digikam::ImportItemModel::camItemIds ( ) const
inherited

◆ camItemIds() [2/2]

QList< qlonglong > Digikam::ImportItemModel::camItemIds ( const QList< QModelIndex > &  indexes) const
inherited

◆ camItemInfo() [1/3]

CamItemInfo Digikam::ImportItemModel::camItemInfo ( const QModelIndex &  index) const
inherited

Returns the CamItemInfo object, reference from the underlying data pointed to by the index. For camItemInfo and camItemInfoId If the index is not valid they will return a null CamItemInfo, and 0 respectively, camItemInfoRef must not be called with an invalid index as it will crash.

References Digikam::ImportItemModel::index().

Referenced by Digikam::ImportSortFilterModel::camItemInfo(), Digikam::ImportItemModel::camItemInfos(), data(), Digikam::ImportItemModel::retrieveCamItemInfo(), and Digikam::ImportItemModel::slotFileDeleted().

◆ camItemInfo() [2/3]

CamItemInfo Digikam::ImportItemModel::camItemInfo ( const QUrl &  fileUrl) const
inherited

◆ camItemInfo() [3/3]

CamItemInfo Digikam::ImportItemModel::camItemInfo ( int  row) const
inherited

Returns the CamItemInfo object, reference from the underlying data of the given row (parent is the invalid QModelIndex, column is 0). Note that camItemInfoRef must not be called with an invalid index as it will crash.

◆ camItemInfoRef() [1/2]

◆ camItemInfoRef() [2/2]

CamItemInfo & Digikam::ImportItemModel::camItemInfoRef ( int  row) const
inherited

◆ camItemInfos() [1/3]

QList< CamItemInfo > Digikam::ImportItemModel::camItemInfos ( ) const
inherited

◆ camItemInfos() [2/3]

QList< CamItemInfo > Digikam::ImportItemModel::camItemInfos ( const QList< QModelIndex > &  indexes) const
inherited

◆ camItemInfos() [3/3]

QList< CamItemInfo > Digikam::ImportItemModel::camItemInfos ( const QUrl &  fileUrl) const
inherited

◆ camItemInfosCleared()

virtual void Digikam::ImportItemModel::camItemInfosCleared ( )
inlineprotectedvirtualinherited

Called when the internal storage is cleared.

Referenced by Digikam::ImportItemModel::clearCamItemInfos().

◆ clearCamItemInfos()

void Digikam::ImportItemModel::clearCamItemInfos ( )
inherited

Clears the CamItemInfos and resets the model.

References Digikam::ImportItemModel::camItemInfosCleared().

Referenced by Digikam::ImportItemModel::setCamItemInfos().

◆ data()

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

Handles the ThumbnailRole. If the pixmap is available, returns it in the QVariant. If it still needs to be loaded, returns a null QVariant and emits thumbnailAvailable() as soon as it is available.

References Digikam::ImportItemModel::camItemInfo(), Digikam::ImportItemModel::data(), Digikam::ImportItemModel::index(), Digikam::CamItemInfo::isNull(), Digikam::CamItemInfo::previewPossible, Digikam::ImportItemModel::ThumbnailRole, and Digikam::CamItemInfo::url().

◆ dragDropFlags()

Qt::ItemFlags Digikam::DragDropModelImplementation::dragDropFlags ( const QModelIndex &  index) const
virtualinherited

Call from your flags() method, adding the relevant drag drop flags. Default implementation enables both drag and drop on the index if a drag drop handler is set. Reimplement to fine-tune. Note: There is an alternative below.

References Digikam::DragDropModelImplementation::m_dragDropHandler.

Referenced by Digikam::ItemModel::flags(), ShowFoto::ShowfotoItemModel::flags(), and Digikam::ImportItemModel::flags().

◆ dragDropFlagsV2()

Qt::ItemFlags Digikam::DragDropModelImplementation::dragDropFlagsV2 ( const QModelIndex &  index) const
inherited

This is an alternative approach to dragDropFlags(). dragDropFlagsV2 calls the virtual methods isDragEnabled() and isDropEnabled() which you then reimplement. Use simple dragDropFlags() if you need not customization, or reimplement dragDropFlags() if you fine-tune it yourself.

References Digikam::DragDropModelImplementation::isDragEnabled(), and Digikam::DragDropModelImplementation::isDropEnabled().

◆ dragDropHandler()

◆ dropMimeData()

bool Digikam::DragDropModelImplementation::dropMimeData ( const QMimeData *  ,
Qt::DropAction  ,
int  ,
int  ,
const QModelIndex &   
)
inherited

◆ emitDataChangedForAll()

void Digikam::ImportItemModel::emitDataChangedForAll ( )
protectedinherited

◆ emitDataChangedForSelections()

void Digikam::ImportItemModel::emitDataChangedForSelections ( const QItemSelection &  selection)
protectedinherited

◆ finishIncrementalRefresh()

void Digikam::ImportItemModel::finishIncrementalRefresh ( )
protectedinherited

◆ finishRefresh()

void Digikam::ImportItemModel::finishRefresh ( )
protectedinherited

◆ flags()

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

◆ hasImage() [1/2]

bool Digikam::ImportItemModel::hasImage ( const CamItemInfo info) const
inherited

◆ hasImage() [2/2]

bool Digikam::ImportItemModel::hasImage ( qlonglong  id) const
inherited

◆ hasIncrementalRefreshPending()

bool Digikam::ImportItemModel::hasIncrementalRefreshPending ( ) const
protectedinherited

◆ headerData()

QVariant Digikam::ImportItemModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role 
) const
overrideinherited

◆ index()

◆ indexesForCamItemId()

QList< QModelIndex > Digikam::ImportItemModel::indexesForCamItemId ( qlonglong  id) const
inherited

◆ indexesForCamItemInfo()

QList< QModelIndex > Digikam::ImportItemModel::indexesForCamItemInfo ( const CamItemInfo info) const
inherited

◆ indexesForUrl()

QList< QModelIndex > Digikam::ImportItemModel::indexesForUrl ( const QUrl &  fileUrl) const
inherited

◆ indexForCamItemId()

QModelIndex Digikam::ImportItemModel::indexForCamItemId ( qlonglong  id) const
inherited

◆ indexForCamItemInfo()

QModelIndex Digikam::ImportItemModel::indexForCamItemInfo ( const CamItemInfo info) const
inherited

Return the index of a given CamItemInfo, if it exists in the model.

References Digikam::CamItemInfo::id, and Digikam::ImportItemModel::indexForCamItemId().

◆ indexForUrl()

QModelIndex Digikam::ImportItemModel::indexForUrl ( const QUrl &  fileUrl) const
inherited

Returns the index or CamItemInfo object from the underlying data for the given file url. In case of multiple occurrences of the same file, the simpler overrides returns any one found first, use the QList methods to retrieve all occurrences.

References Digikam::ImportItemModel::indexForCamItemId().

◆ isDragEnabled()

bool Digikam::DragDropModelImplementation::isDragEnabled ( const QModelIndex &  index) const
virtualinherited

◆ isDropEnabled()

bool Digikam::DragDropModelImplementation::isDropEnabled ( const QModelIndex &  index) const
virtualinherited

◆ isEmpty()

bool Digikam::ImportItemModel::isEmpty ( ) const
inherited

◆ isRefreshing()

bool Digikam::ImportItemModel::isRefreshing ( ) const
inherited

Returns true if this model is currently refreshing. For a preprocessor this means that, although the preprocessor may currently have processed all it got, more batches are to be expected.

◆ itemInfosAboutToBeAdded

void Digikam::ImportItemModel::itemInfosAboutToBeAdded ( const QList< CamItemInfo > &  infos)
signalinherited

Informs that ItemInfos will be added to the model. This signal is sent before the model data is changed and views are informed.

◆ itemInfosAboutToBeRemoved [1/2]

void Digikam::ImportItemModel::itemInfosAboutToBeRemoved ( const QList< CamItemInfo > &  infos)
signalinherited

Informs that CamItemInfos will be removed from the model. This signal is sent before the model data is changed and views are informed. Note: You need to explicitly enable sending of this signal. It is not sent in clearCamItemInfos().

◆ itemInfosAboutToBeRemoved() [2/2]

virtual void Digikam::ImportItemModel::itemInfosAboutToBeRemoved ( int  ,
int   
)
inlineprotectedvirtualinherited

Called before rowsAboutToBeRemoved

◆ itemInfosAdded

void Digikam::ImportItemModel::itemInfosAdded ( const QList< CamItemInfo > &  infos)
signalinherited

Informs that ItemInfos have been added to the model. This signal is sent after the model data is changed and views are informed.

◆ itemInfosRemoved

void Digikam::ImportItemModel::itemInfosRemoved ( const QList< CamItemInfo > &  infos)
signalinherited

Informs that CamItemInfos have been removed from the model. This signal is sent after the model data is changed and views are informed. Note: You need to explicitly enable sending of this signal. It is not sent in clearCamItemInfos().

◆ keepsFileUrlCache()

bool Digikam::ImportItemModel::keepsFileUrlCache ( ) const
inherited

◆ mimeData()

QMimeData * Digikam::DragDropModelImplementation::mimeData ( const QModelIndexList &  indexes) const
inherited

◆ mimeTypes()

QStringList Digikam::DragDropModelImplementation::mimeTypes ( ) const
inherited

◆ numberOfIndexesForCamItemId()

int Digikam::ImportItemModel::numberOfIndexesForCamItemId ( qlonglong  id) const
inherited

◆ numberOfIndexesForCamItemInfo()

int Digikam::ImportItemModel::numberOfIndexesForCamItemInfo ( const CamItemInfo info) const
inherited

◆ preprocess

void Digikam::ImportItemModel::preprocess ( const QList< CamItemInfo > &  infos)
signalinherited

Connect to this signal only if you are the current preprocessor.

◆ processAdded

void Digikam::ImportItemModel::processAdded ( const QList< CamItemInfo > &  infos)
signalinherited

◆ reAddCamItemInfos

void Digikam::ImportItemModel::reAddCamItemInfos ( const CamItemInfoList infos)
slotinherited

◆ reAddingFinished

void Digikam::ImportItemModel::reAddingFinished ( )
slotinherited

◆ readyForIncrementalRefresh

void Digikam::ImportItemModel::readyForIncrementalRefresh ( )
signalinherited

Signals that the model is right now ready to start an incremental refresh. This is guaranteed only for the scope of emitting this signal.

Referenced by Digikam::ImportItemModel::requestIncrementalRefresh().

◆ removeCamItemInfo()

void Digikam::ImportItemModel::removeCamItemInfo ( const CamItemInfo info)
inherited

◆ removeCamItemInfos()

void Digikam::ImportItemModel::removeCamItemInfos ( const QList< CamItemInfo > &  infos)
inherited

◆ removeIndex()

void Digikam::ImportItemModel::removeIndex ( const QModelIndex &  index)
inherited

Remove the given infos or indexes directly from the model.

References Digikam::ImportItemModel::index(), and Digikam::ImportItemModel::removeIndexs().

◆ removeIndexs()

void Digikam::ImportItemModel::removeIndexs ( const QList< QModelIndex > &  indexes)
inherited

◆ requestIncrementalRefresh()

void Digikam::ImportItemModel::requestIncrementalRefresh ( )
protectedinherited

As soon as the model is ready to start an incremental refresh, the signal readyForIncrementalRefresh() will be emitted. The signal will be emitted inline if the model is ready right now.

References Digikam::ImportItemModel::readyForIncrementalRefresh().

◆ retrieveCamItemId()

qlonglong Digikam::ImportItemModel::retrieveCamItemId ( const QModelIndex &  index)
staticinherited

◆ retrieveCamItemInfo()

◆ rowCount()

int Digikam::ImportItemModel::rowCount ( const QModelIndex &  parent) const
overrideinherited

QAbstractListModel implementation.

◆ setCameraThumbsController()

void Digikam::ImportThumbnailModel::setCameraThumbsController ( CameraThumbsCtrl *const  thumbsCtrl)
overridevirtual

Sets the camera thumbs controller which is used to get the thumbnails for item infos.

Reimplemented from Digikam::ImportItemModel.

References Digikam::ImportItemModel::setCameraThumbsController().

◆ setCamItemInfos()

void Digikam::ImportItemModel::setCamItemInfos ( const CamItemInfoList infos)
inherited

◆ setData()

bool Digikam::ImportThumbnailModel::setData ( const QModelIndex &  index,
const QVariant &  value,
int  role = Qt::DisplayRole 
)
override

You can override the current thumbnail size by giving an integer value for ThumbnailRole. Set a null QVariant to use the thumbnail size set by setThumbnailSize() again. The index given here is ignored for this purpose.

References Digikam::ImportItemModel::index(), Digikam::ImportItemModel::ThumbnailRole, and value.

◆ setDragDropHandler()

void Digikam::DragDropModelImplementation::setDragDropHandler ( AbstractItemDragDropHandler handler)
inherited

◆ setEmitDataChanged()

void Digikam::ImportThumbnailModel::setEmitDataChanged ( bool  emitSignal)

Enable emitting dataChanged() when a thumbnail becomes available. The thumbnailAvailable() signal will be emitted in any case. Default is true.

◆ setKeepsFileUrlCache()

void Digikam::ImportItemModel::setKeepsFileUrlCache ( bool  keepCache)
inherited

If a cache is kept, lookup by file path is fast, without a cache it is O(n). Default is false.

Referenced by ImportThumbnailModel().

◆ setSendRemovalSignals()

void Digikam::ImportItemModel::setSendRemovalSignals ( bool  send)
inherited

DragDrop methods.

Enable sending of itemInfosAboutToBeRemoved and itemsInfosRemoved signals. Default: false

◆ slotFileDeleted

void Digikam::ImportItemModel::slotFileDeleted ( const QString &  folder,
const QString &  file,
bool  status 
)
slotinherited

◆ slotFileUploaded

void Digikam::ImportItemModel::slotFileUploaded ( const CamItemInfo info)
slotinherited

◆ startIncrementalRefresh()

void Digikam::ImportItemModel::startIncrementalRefresh ( )
protectedinherited

Starts an incremental refresh operation. You shall only call this method from a slot connected to readyForIncrementalRefresh(). To initiate an incremental refresh, call requestIncrementalRefresh().

◆ startRefresh()

void Digikam::ImportItemModel::startRefresh ( )
protectedinherited

Subclasses that add CamItemInfos in batches shall call startRefresh() when they start sending batches and finishRefresh() when they have finished. No incremental refreshes will be started while listing. A clearCamItemInfos() always stops listing, calling finishRefresh() is then not necessary.

◆ supportedDropActions()

Qt::DropActions Digikam::DragDropModelImplementation::supportedDropActions ( ) const
inherited

Implements the relevant QAbstractItemModel methods for drag and drop. All functionality is redirected to the handler. dropMimeData() always returns false, leaving implementation to the view.

References Digikam::CopyAction, and Digikam::MoveAction.

◆ thumbnailAvailable

void Digikam::ImportThumbnailModel::thumbnailAvailable ( const QModelIndex &  index,
int  requestedSize 
)
signal

◆ thumbnailFailed

void Digikam::ImportThumbnailModel::thumbnailFailed ( const QModelIndex &  index,
int  requestedSize 
)
signal

◆ thumbnailSize()

ThumbnailSize Digikam::ImportThumbnailModel::thumbnailSize ( ) const

Get the thumbnail size.

◆ uniqueCamItemInfos()

QList< CamItemInfo > Digikam::ImportItemModel::uniqueCamItemInfos ( ) const
inherited

Member Data Documentation

◆ m_dragDropHandler


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