digiKam Developer Documentation
Professional Photo Management with the Power of Open Source
Loading...
Searching...
No Matches
Digikam::ImportItemModel Class Reference
Inheritance diagram for Digikam::ImportItemModel:

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 ()
 Signals that the model has finished currently with all scheduled refreshing, full or incremental, and all preprocessing.
void itemInfosAboutToBeAdded (const QList< CamItemInfo > &infos)
 Informs that ItemInfos will be added to the model.
void itemInfosAboutToBeRemoved (const QList< CamItemInfo > &infos)
 Informs that CamItemInfos will be removed from the model.
void itemInfosAdded (const QList< CamItemInfo > &infos)
 Informs that ItemInfos have been added to the model.
void itemInfosRemoved (const QList< CamItemInfo > &infos)
 Informs that CamItemInfos have been removed from the model.
void preprocess (const QList< CamItemInfo > &infos)
 Connect to this signal only if you are the current preprocessor.
void processAdded (const QList< CamItemInfo > &infos)
void readyForIncrementalRefresh ()
 Signals that the model is right now ready to start an incremental refresh.

Public Member Functions

 ImportItemModel (QObject *const parent=nullptr)
void addCamItemInfosSynchronously (const Digikam::CamItemInfoList &infos)
void addCamItemInfoSynchronously (const CamItemInfo &info)
 addCamItemInfo() is asynchronous if a prepocessor is set.
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
CamItemInfo & camItemInfoRef (const QModelIndex &index) const
CamItemInfo & camItemInfoRef (int row) const
QList< CamItemInfo > camItemInfos () const
CamItemInfoList camItemInfos (const QList< QModelIndex > &indexes) const
QList< CamItemInfo > camItemInfos (const QUrl &fileUrl) const
void clearCamItemInfos ()
 Clears the CamItemInfos and resets the model.
QVariant data (const QModelIndex &index, int role) const override
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
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
bool isEmpty () const
bool isRefreshing () const
bool keepsFileUrlCache () 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)
 Remove the given infos or indexes directly from the model.
void removeIndexs (const QList< QModelIndex > &indexes)
int rowCount (const QModelIndex &parent) const override
 QAbstractListModel implementation.
virtual void setCameraThumbsController (CameraThumbsCtrl *const controller)
 Used to set the camera controller, and connect with it.
void setCamItemInfos (const CamItemInfoList &infos)
 Clears and adds infos.
void setKeepsFileUrlCache (bool keepCache)
 If a cache is kept, lookup by file path is fast, without a cache it is O(n).
DECLARE_MODEL_DRAG_DROP_METHODS void setSendRemovalSignals (bool send)
 DragDrop methods.
QList< CamItemInfo > uniqueCamItemInfos () const
Public Member Functions inherited from Digikam::DragDropModelImplementation
 DragDropModelImplementation ()=default
 A class providing a sample implementation for a QAbstractItemModel redirecting drag-and-drop support to a handler.
virtual Qt::ItemFlags dragDropFlags (const QModelIndex &index) const
 Call from your flags() method, adding the relevant drag drop flags.
Qt::ItemFlags dragDropFlagsV2 (const QModelIndex &index) const
 This is an alternative approach to dragDropFlags().
AbstractItemDragDropHandler * dragDropHandler () const
bool dropMimeData (const QMimeData *, Qt::DropAction, int, int, const QModelIndex &)
virtual bool isDragEnabled (const QModelIndex &index) const
virtual bool isDropEnabled (const QModelIndex &index) const
QMimeData * mimeData (const QModelIndexList &indexes) const
QStringList mimeTypes () const
void setDragDropHandler (AbstractItemDragDropHandler *handler)
 Set a drag drop handler.
Qt::DropActions supportedDropActions () const
 Implements the relevant QAbstractItemModel methods for drag and drop.

Static Public Member Functions

static qlonglong retrieveCamItemId (const QModelIndex &index)
static CamItemInfo retrieveCamItemInfo (const QModelIndex &index)
 Retrieve the CamItemInfo object from the data() function of the given index The index may be from a QSortFilterProxyModel as long as an ImportItemModel is at the end.

Protected Member Functions

virtual void camItemInfosCleared ()
 Called when the internal storage is cleared.
void emitDataChangedForAll ()
void emitDataChangedForSelections (const QItemSelection &selection)
void finishIncrementalRefresh ()
void finishRefresh ()
bool hasIncrementalRefreshPending () const
virtual void prepareItemInfosAboutToBeRemoved (int, int)
 Called before rowsAboutToBeRemoved.
void requestIncrementalRefresh ()
 As soon as the model is ready to start an incremental refresh, the signal readyForIncrementalRefresh() will be emitted.
void startIncrementalRefresh ()
 Starts an incremental refresh operation.
void startRefresh ()
 Subclasses that add CamItemInfos in batches shall call startRefresh() when they start sending batches and finishRefresh() when they have finished.

Additional Inherited Members

Protected Attributes inherited from Digikam::DragDropModelImplementation
AbstractItemDragDropHandler * m_dragDropHandler = nullptr

Member Enumeration Documentation

◆ ImportItemModelRoles

Enumerator
ImportItemModelPointerRole 

An ImportItemModel pointer to this model.

ThumbnailRole 
Returns
a thumbnail pixmap. May be implemented by subclasses.
either a valid pixmap or a null QVariant.
ExtraDataRole 
Returns
(optional) extraData field
ExtraDataDuplicateCount 
Returns
the number of duplicate indexes for the same image id

Member Function Documentation

◆ addCamItemInfoSynchronously()

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

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.

◆ allRefreshingFinished

void Digikam::ImportItemModel::allRefreshingFinished ( )
signal

The model is in polished, clean situation right now.

◆ camItemInfo() [1/2]

CamItemInfo Digikam::ImportItemModel::camItemInfo ( const QModelIndex & index) const
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.

◆ camItemInfo() [2/2]

CamItemInfo Digikam::ImportItemModel::camItemInfo ( int row) const
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.

◆ indexForCamItemInfo()

QModelIndex Digikam::ImportItemModel::indexForCamItemInfo ( const CamItemInfo & info) const
Returns
the index of a given CamItemInfo, if it exists in the model.

◆ indexForUrl()

QModelIndex Digikam::ImportItemModel::indexForUrl ( const QUrl & fileUrl) const
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.

◆ isRefreshing()

bool Digikam::ImportItemModel::isRefreshing ( ) const
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)
signal

This signal is sent before the model data is changed and views are informed.

◆ itemInfosAboutToBeRemoved

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

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().

◆ itemInfosAdded

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

This signal is sent after the model data is changed and views are informed.

◆ itemInfosRemoved

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

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().

◆ readyForIncrementalRefresh

void Digikam::ImportItemModel::readyForIncrementalRefresh ( )
signal

This is guaranteed only for the scope of emitting this signal.

◆ requestIncrementalRefresh()

void Digikam::ImportItemModel::requestIncrementalRefresh ( )
protected

The signal will be emitted inline if the model is ready right now.

◆ setCameraThumbsController()

void Digikam::ImportItemModel::setCameraThumbsController ( CameraThumbsCtrl *const controller)
virtual

Reimplemented in Digikam::ImportThumbnailModel.

◆ setKeepsFileUrlCache()

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

Default is false.

◆ setSendRemovalSignals()

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

Enable sending of itemInfosAboutToBeRemoved and itemsInfosRemoved signals. Default: false

◆ startIncrementalRefresh()

void Digikam::ImportItemModel::startIncrementalRefresh ( )
protected

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

◆ startRefresh()

void Digikam::ImportItemModel::startRefresh ( )
protected

No incremental refreshes will be started while listing. A clearCamItemInfos() always stops listing, calling finishRefresh() is then not necessary.