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

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) 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
 
 ImportItemModel (QObject *const parent=nullptr)
 
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...
 
virtual void setCameraThumbsController (CameraThumbsCtrl *const controller)
 
void setCamItemInfos (const CamItemInfoList &infos)
 
void setDragDropHandler (AbstractItemDragDropHandler *handler)
 
void setKeepsFileUrlCache (bool keepCache)
 
DECLARE_MODEL_DRAG_DROP_METHODS void setSendRemovalSignals (bool send)
 DragDrop methods. More...
 
Qt::DropActions supportedDropActions () const
 
QList< CamItemInfouniqueCamItemInfos () const
 
 ~ImportItemModel () 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

◆ ImportItemModel()

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

◆ ~ImportItemModel()

Digikam::ImportItemModel::~ImportItemModel ( )
override

Member Function Documentation

◆ addCamItemInfo

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

References addCamItemInfos().

Referenced by slotFileUploaded().

◆ addCamItemInfos

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

◆ addCamItemInfosSynchronously()

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

References processAdded().

Referenced by addCamItemInfoSynchronously().

◆ addCamItemInfoSynchronously()

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

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

◆ allRefreshingFinished

void Digikam::ImportItemModel::allRefreshingFinished ( )
signal

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

◆ camItemId() [2/2]

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

◆ camItemIds() [1/2]

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

◆ camItemIds() [2/2]

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

References camItemId(), and index().

◆ camItemInfo() [1/3]

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.

References index().

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

◆ camItemInfo() [2/3]

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

◆ camItemInfo() [3/3]

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.

◆ camItemInfoRef() [1/2]

◆ camItemInfoRef() [2/2]

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

◆ camItemInfos() [1/3]

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

◆ camItemInfos() [2/3]

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

◆ camItemInfos() [3/3]

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

◆ camItemInfosCleared()

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

Called when the internal storage is cleared.

Referenced by clearCamItemInfos().

◆ clearCamItemInfos()

void Digikam::ImportItemModel::clearCamItemInfos ( )

Clears the CamItemInfos and resets the model.

References camItemInfosCleared().

Referenced by setCamItemInfos().

◆ data()

QVariant Digikam::ImportItemModel::data ( const QModelIndex &  index,
int  role 
) const
override

◆ 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 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 ( )
protected

◆ emitDataChangedForSelections()

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

◆ finishIncrementalRefresh()

void Digikam::ImportItemModel::finishIncrementalRefresh ( )
protected

◆ finishRefresh()

void Digikam::ImportItemModel::finishRefresh ( )
protected

◆ flags()

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

◆ hasImage() [1/2]

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

◆ hasImage() [2/2]

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

◆ hasIncrementalRefreshPending()

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

◆ headerData()

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

◆ index()

◆ indexesForCamItemId()

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

◆ indexesForCamItemInfo()

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

◆ indexesForUrl()

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

References indexesForCamItemId().

◆ indexForCamItemId()

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

◆ indexForCamItemInfo()

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

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

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

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

References 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

◆ 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

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)
signal

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   
)
inlineprotectedvirtual

Called before rowsAboutToBeRemoved

◆ itemInfosAdded

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

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)
signal

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

◆ 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

◆ numberOfIndexesForCamItemInfo()

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

◆ preprocess

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

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

◆ processAdded

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

◆ reAddCamItemInfos

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

◆ reAddingFinished

void Digikam::ImportItemModel::reAddingFinished ( )
slot

◆ readyForIncrementalRefresh

void Digikam::ImportItemModel::readyForIncrementalRefresh ( )
signal

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

◆ removeCamItemInfo()

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

References removeCamItemInfos().

Referenced by slotFileDeleted().

◆ removeCamItemInfos()

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

◆ removeIndex()

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

Remove the given infos or indexes directly from the model.

References index(), and removeIndexs().

◆ removeIndexs()

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

References index().

Referenced by removeIndex().

◆ requestIncrementalRefresh()

void Digikam::ImportItemModel::requestIncrementalRefresh ( )
protected

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

◆ retrieveCamItemId()

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

◆ retrieveCamItemInfo()

CamItemInfo Digikam::ImportItemModel::retrieveCamItemInfo ( const QModelIndex &  index)
static

◆ rowCount()

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

QAbstractListModel implementation.

◆ setCameraThumbsController()

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

◆ setCamItemInfos()

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

Clears and adds infos.

References addCamItemInfos(), and clearCamItemInfos().

◆ setDragDropHandler()

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

◆ setKeepsFileUrlCache()

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

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

Referenced by Digikam::ImportThumbnailModel::ImportThumbnailModel().

◆ setSendRemovalSignals()

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

DragDrop methods.

Enable sending of itemInfosAboutToBeRemoved and itemsInfosRemoved signals. Default: false

◆ slotFileDeleted

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

◆ slotFileUploaded

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

References addCamItemInfo().

Referenced by setCameraThumbsController().

◆ startIncrementalRefresh()

void Digikam::ImportItemModel::startIncrementalRefresh ( )
protected

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

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.

◆ uniqueCamItemInfos()

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

Member Data Documentation

◆ m_dragDropHandler


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