digiKam
ShowFoto::ShowfotoItemModel Class Reference
+ Inheritance diagram for ShowFoto::ShowfotoItemModel:

Public Types

enum  ShowfotoItemModelRoles {
  ShowfotoItemModelPointerRole = Qt::UserRole , ShowfotoItemModelInternalId = Qt::UserRole + 1 , ThumbnailRole = Qt::UserRole + 2 , ExtraDataRole = Qt::UserRole + 3 ,
  ExtraDataDuplicateCount = Qt::UserRole + 6 , FilterModelRoles = Qt::UserRole + 100
}
 

Public Slots

void reAddingFinished ()
 
void reAddShowfotoItemInfos (const ShowfotoItemInfoList &infos)
 
void slotFileDeleted (const QString &folder, const QString &file, bool status)
 
void slotFileUploaded (const ShowfotoItemInfo &info)
 

Signals

void allRefreshingFinished ()
 
void itemInfosAboutToBeAdded (const QList< ShowfotoItemInfo > &infos)
 
void itemInfosAboutToBeRemoved (const QList< ShowfotoItemInfo > &infos)
 
void itemInfosAdded (const QList< ShowfotoItemInfo > &infos)
 
void itemInfosRemoved (const QList< ShowfotoItemInfo > &infos)
 
void preprocess (const QList< ShowfotoItemInfo > &infos)
 
void processAdded (const QList< ShowfotoItemInfo > &infos)
 
void readyForIncrementalRefresh ()
 

Public Member Functions

void addShowfotoItemInfo (const ShowfotoItemInfo &info)
 
void addShowfotoItemInfos (const QList< ShowfotoItemInfo > &infos)
 
void addShowfotoItemInfosSynchronously (const QList< ShowfotoItemInfo > &infos)
 
void addShowfotoItemInfoSynchronously (const ShowfotoItemInfo &info)
 
void clearShowfotoItemInfos ()
 
QVariant data (const QModelIndex &index, int role) const override
 
virtual Qt::ItemFlags dragDropFlags (const QModelIndex &index) const
 
Qt::ItemFlags dragDropFlagsV2 (const QModelIndex &index) const
 
AbstractItemDragDropHandler * dragDropHandler () const
 
bool dropMimeData (const QMimeData *, Qt::DropAction, int, int, const QModelIndex &)
 
Qt::ItemFlags flags (const QModelIndex &index) const override
 
bool hasImage (const ShowfotoItemInfo &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 > indexesForShowfotoItemId (qlonglong id) const
 
QList< QModelIndex > indexesForShowfotoItemInfo (const ShowfotoItemInfo &info) const
 
QList< QModelIndex > indexesForUrl (const QUrl &fileUrl) const
 
QModelIndex indexForShowfotoItemId (qlonglong id) const
 
QModelIndex indexForShowfotoItemInfo (const ShowfotoItemInfo &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
 
QMimeData * mimeData (const QModelIndexList &indexes) const
 
QStringList mimeTypes () const
 
int numberOfIndexesForShowfotoItemId (qlonglong id) const
 
int numberOfIndexesForShowfotoItemInfo (const ShowfotoItemInfo &info) const
 
void removeIndex (const QModelIndex &index)
 
void removeIndexs (const QList< QModelIndex > &indexes)
 
void removeShowfotoItemInfo (const ShowfotoItemInfo &info)
 
void removeShowfotoItemInfos (const QList< ShowfotoItemInfo > &infos)
 
int rowCount (const QModelIndex &parent) const override
 
void setDragDropHandler (AbstractItemDragDropHandler *handler)
 
void setKeepsFileUrlCache (bool keepCache)
 
DECLARE_MODEL_DRAG_DROP_METHODS void setSendRemovalSignals (bool send)
 
void setShowfotoItemInfos (const QList< ShowfotoItemInfo > &infos)
 
qlonglong showfotoItemId (const QModelIndex &index) const
 
qlonglong showfotoItemId (int row) const
 
QList< qlonglong > showfotoItemIds () const
 
QList< qlonglong > showfotoItemIds (const QList< QModelIndex > &indexes) const
 
ShowfotoItemInfo showfotoItemInfo (const QModelIndex &index) const
 
ShowfotoItemInfo showfotoItemInfo (const QUrl &fileUrl) const
 
ShowfotoItemInfo showfotoItemInfo (int row) const
 
ShowfotoItemInfoshowfotoItemInfoRef (const QModelIndex &index) const
 
ShowfotoItemInfoshowfotoItemInfoRef (int row) const
 
QList< ShowfotoItemInfoshowfotoItemInfos () const
 
ShowfotoItemInfoList showfotoItemInfos (const QList< QModelIndex > &indexes) const
 
QList< ShowfotoItemInfoshowfotoItemInfos (const QUrl &fileUrl) const
 
 ShowfotoItemModel (QObject *const parent)
 
Qt::DropActions supportedDropActions () const
 
QList< ShowfotoItemInfouniqueShowfotoItemInfos () const
 
 ~ShowfotoItemModel () override
 

Static Public Member Functions

static qlonglong retrieveShowfotoItemId (const QModelIndex &index)
 
static ShowfotoItemInfo retrieveShowfotoItemInfo (const QModelIndex &index)
 

Protected Member Functions

void emitDataChangedForAll ()
 
void emitDataChangedForSelections (const QItemSelection &selection)
 
void finishIncrementalRefresh ()
 
void requestIncrementalRefresh ()
 
virtual void showfotoItemInfosAboutToBeRemoved (int, int)
 
virtual void showfotoItemInfosCleared ()
 
void startIncrementalRefresh ()
 

Protected Attributes

AbstractItemDragDropHandler * m_dragDropHandler
 

Member Enumeration Documentation

◆ ShowfotoItemModelRoles

Enumerator
ShowfotoItemModelPointerRole 

An ShowfotoItemModel* pointer to this model

ShowfotoItemModelInternalId 
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

◆ ShowfotoItemModel()

ShowFoto::ShowfotoItemModel::ShowfotoItemModel ( QObject *const  parent)
explicit

◆ ~ShowfotoItemModel()

ShowFoto::ShowfotoItemModel::~ShowfotoItemModel ( )
override

Member Function Documentation

◆ addShowfotoItemInfo()

void ShowFoto::ShowfotoItemModel::addShowfotoItemInfo ( const ShowfotoItemInfo info)

References addShowfotoItemInfos().

Referenced by slotFileUploaded().

◆ addShowfotoItemInfos()

void ShowFoto::ShowfotoItemModel::addShowfotoItemInfos ( const QList< ShowfotoItemInfo > &  infos)

◆ addShowfotoItemInfosSynchronously()

void ShowFoto::ShowfotoItemModel::addShowfotoItemInfosSynchronously ( const QList< ShowfotoItemInfo > &  infos)

◆ addShowfotoItemInfoSynchronously()

void ShowFoto::ShowfotoItemModel::addShowfotoItemInfoSynchronously ( const ShowfotoItemInfo info)

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

◆ allRefreshingFinished

void ShowFoto::ShowfotoItemModel::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.

◆ clearShowfotoItemInfos()

void ShowFoto::ShowfotoItemModel::clearShowfotoItemInfos ( )

Clears the ShowfotoItemInfos and resets the model.

References itemInfosAboutToBeRemoved(), itemInfosRemoved(), and showfotoItemInfosCleared().

Referenced by setShowfotoItemInfos().

◆ data()

QVariant ShowFoto::ShowfotoItemModel::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(), 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()

AbstractItemDragDropHandler * Digikam::DragDropModelImplementation::dragDropHandler ( ) const
inherited

◆ dropMimeData()

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

◆ emitDataChangedForAll()

void ShowFoto::ShowfotoItemModel::emitDataChangedForAll ( )
protected

◆ emitDataChangedForSelections()

void ShowFoto::ShowfotoItemModel::emitDataChangedForSelections ( const QItemSelection &  selection)
protected

◆ finishIncrementalRefresh()

void ShowFoto::ShowfotoItemModel::finishIncrementalRefresh ( )
protected

◆ flags()

Qt::ItemFlags ShowFoto::ShowfotoItemModel::flags ( const QModelIndex &  index) const
override

◆ hasImage() [1/2]

bool ShowFoto::ShowfotoItemModel::hasImage ( const ShowfotoItemInfo info) const

◆ hasImage() [2/2]

bool ShowFoto::ShowfotoItemModel::hasImage ( qlonglong  id) const

◆ headerData()

QVariant ShowFoto::ShowfotoItemModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role 
) const
override

◆ index()

◆ indexesForShowfotoItemId()

QList<QModelIndex> ShowFoto::ShowfotoItemModel::indexesForShowfotoItemId ( qlonglong  id) const

◆ indexesForShowfotoItemInfo()

QList< QModelIndex > ShowFoto::ShowfotoItemModel::indexesForShowfotoItemInfo ( const ShowfotoItemInfo info) const

◆ indexesForUrl()

QList< QModelIndex > ShowFoto::ShowfotoItemModel::indexesForUrl ( const QUrl &  fileUrl) const

◆ indexForShowfotoItemId()

QModelIndex ShowFoto::ShowfotoItemModel::indexForShowfotoItemId ( qlonglong  id) const

References index().

◆ indexForShowfotoItemInfo()

QModelIndex ShowFoto::ShowfotoItemModel::indexForShowfotoItemInfo ( const ShowfotoItemInfo info) const

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

References indexForUrl(), and ShowFoto::ShowfotoItemInfo::url.

Referenced by removeShowfotoItemInfo(), and removeShowfotoItemInfos().

◆ indexForUrl()

QModelIndex ShowFoto::ShowfotoItemModel::indexForUrl ( const QUrl &  fileUrl) const

Returns the index or ShowfotoItemInfo 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.

Referenced by indexForShowfotoItemInfo().

◆ isDragEnabled()

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

◆ isDropEnabled()

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

◆ isEmpty()

bool ShowFoto::ShowfotoItemModel::isEmpty ( ) const

◆ itemInfosAboutToBeAdded

void ShowFoto::ShowfotoItemModel::itemInfosAboutToBeAdded ( const QList< ShowfotoItemInfo > &  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

void ShowFoto::ShowfotoItemModel::itemInfosAboutToBeRemoved ( const QList< ShowfotoItemInfo > &  infos)
signal

Informs that ShowfotoItemInfos 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 clearShowfotoItemInfos().

Referenced by clearShowfotoItemInfos().

◆ itemInfosAdded

void ShowFoto::ShowfotoItemModel::itemInfosAdded ( const QList< ShowfotoItemInfo > &  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 ShowFoto::ShowfotoItemModel::itemInfosRemoved ( const QList< ShowfotoItemInfo > &  infos)
signal

Informs that ShowfotoItemInfos 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 clearShowfotoItemInfos().

Referenced by clearShowfotoItemInfos().

◆ mimeData()

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

◆ mimeTypes()

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

◆ numberOfIndexesForShowfotoItemId()

int ShowFoto::ShowfotoItemModel::numberOfIndexesForShowfotoItemId ( qlonglong  id) const

◆ numberOfIndexesForShowfotoItemInfo()

int ShowFoto::ShowfotoItemModel::numberOfIndexesForShowfotoItemInfo ( const ShowfotoItemInfo info) const

◆ preprocess

void ShowFoto::ShowfotoItemModel::preprocess ( const QList< ShowfotoItemInfo > &  infos)
signal

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

◆ processAdded

void ShowFoto::ShowfotoItemModel::processAdded ( const QList< ShowfotoItemInfo > &  infos)
signal

◆ reAddingFinished

void ShowFoto::ShowfotoItemModel::reAddingFinished ( )
slot

◆ reAddShowfotoItemInfos

void ShowFoto::ShowfotoItemModel::reAddShowfotoItemInfos ( const ShowfotoItemInfoList infos)
slot

◆ readyForIncrementalRefresh

void ShowFoto::ShowfotoItemModel::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.

◆ removeIndex()

void ShowFoto::ShowfotoItemModel::removeIndex ( const QModelIndex &  index)

Remove the given infos or indexes directly from the model.

References index(), and removeIndexs().

Referenced by removeShowfotoItemInfo(), and removeShowfotoItemInfos().

◆ removeIndexs()

void ShowFoto::ShowfotoItemModel::removeIndexs ( const QList< QModelIndex > &  indexes)

References index().

Referenced by removeIndex().

◆ removeShowfotoItemInfo()

void ShowFoto::ShowfotoItemModel::removeShowfotoItemInfo ( const ShowfotoItemInfo info)

◆ removeShowfotoItemInfos()

void ShowFoto::ShowfotoItemModel::removeShowfotoItemInfos ( const QList< ShowfotoItemInfo > &  infos)

◆ requestIncrementalRefresh()

void ShowFoto::ShowfotoItemModel::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.

◆ retrieveShowfotoItemId()

static qlonglong ShowFoto::ShowfotoItemModel::retrieveShowfotoItemId ( const QModelIndex &  index)
static

◆ retrieveShowfotoItemInfo()

ShowfotoItemInfo ShowFoto::ShowfotoItemModel::retrieveShowfotoItemInfo ( const QModelIndex &  index)
static

Retrieve the ShowfotoItemInfo object from the data() function of the given index The index may be from a QSortFilterProxyModel as long as an ShowfotoItemModel is at the end.

References index(), showfotoItemInfo(), ShowfotoItemModelInternalId, and ShowfotoItemModelPointerRole.

Referenced by ShowFoto::ShowfotoCoordinatesOverlay::checkIndex(), and ShowFoto::ShowfotoDelegate::paint().

◆ rowCount()

int ShowFoto::ShowfotoItemModel::rowCount ( const QModelIndex &  parent) const
override

QAbstractListModel implementations

◆ setDragDropHandler()

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

◆ setKeepsFileUrlCache()

void ShowFoto::ShowfotoItemModel::setKeepsFileUrlCache ( bool  keepCache)

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

◆ setSendRemovalSignals()

void ShowFoto::ShowfotoItemModel::setSendRemovalSignals ( bool  send)

DragDrop methods Enable sending of itemInfosAboutToBeRemoved and itemsInfosRemoved signals. Default: false

◆ setShowfotoItemInfos()

void ShowFoto::ShowfotoItemModel::setShowfotoItemInfos ( const QList< ShowfotoItemInfo > &  infos)

Clears and adds infos.

References addShowfotoItemInfos(), and clearShowfotoItemInfos().

◆ showfotoItemId() [1/2]

qlonglong ShowFoto::ShowfotoItemModel::showfotoItemId ( const QModelIndex &  index) const

◆ showfotoItemId() [2/2]

qlonglong ShowFoto::ShowfotoItemModel::showfotoItemId ( int  row) const

◆ showfotoItemIds() [1/2]

QList<qlonglong> ShowFoto::ShowfotoItemModel::showfotoItemIds ( ) const

◆ showfotoItemIds() [2/2]

QList<qlonglong> ShowFoto::ShowfotoItemModel::showfotoItemIds ( const QList< QModelIndex > &  indexes) const

◆ showfotoItemInfo() [1/3]

ShowfotoItemInfo ShowFoto::ShowfotoItemModel::showfotoItemInfo ( const QModelIndex &  index) const

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

References index().

Referenced by ShowFoto::ShowfotoThumbnailModel::data(), retrieveShowfotoItemInfo(), ShowFoto::ShowfotoSortFilterModel::showfotoItemInfo(), showfotoItemInfos(), slotFileDeleted(), and ShowFoto::ShowfotoThumbnailModel::slotThumbnailLoaded().

◆ showfotoItemInfo() [2/3]

ShowfotoItemInfo ShowFoto::ShowfotoItemModel::showfotoItemInfo ( const QUrl &  fileUrl) const

◆ showfotoItemInfo() [3/3]

ShowfotoItemInfo ShowFoto::ShowfotoItemModel::showfotoItemInfo ( int  row) const

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

◆ showfotoItemInfoRef() [1/2]

ShowfotoItemInfo & ShowFoto::ShowfotoItemModel::showfotoItemInfoRef ( const QModelIndex &  index) const

References index().

◆ showfotoItemInfoRef() [2/2]

ShowfotoItemInfo & ShowFoto::ShowfotoItemModel::showfotoItemInfoRef ( int  row) const

◆ showfotoItemInfos() [1/3]

QList< ShowfotoItemInfo > ShowFoto::ShowfotoItemModel::showfotoItemInfos ( ) const

◆ showfotoItemInfos() [2/3]

QList< ShowfotoItemInfo > ShowFoto::ShowfotoItemModel::showfotoItemInfos ( const QList< QModelIndex > &  indexes) const

◆ showfotoItemInfos() [3/3]

QList< ShowfotoItemInfo > ShowFoto::ShowfotoItemModel::showfotoItemInfos ( const QUrl &  fileUrl) const

◆ showfotoItemInfosAboutToBeRemoved()

virtual void ShowFoto::ShowfotoItemModel::showfotoItemInfosAboutToBeRemoved ( int  ,
int   
)
inlineprotectedvirtual

Called before rowsAboutToBeRemoved

◆ showfotoItemInfosCleared()

virtual void ShowFoto::ShowfotoItemModel::showfotoItemInfosCleared ( )
inlineprotectedvirtual

Called when the internal storage is cleared.

Reimplemented in ShowFoto::ShowfotoThumbnailModel.

Referenced by clearShowfotoItemInfos().

◆ slotFileDeleted

void ShowFoto::ShowfotoItemModel::slotFileDeleted ( const QString &  folder,
const QString &  file,
bool  status 
)
slot

References showfotoItemInfo().

◆ slotFileUploaded

void ShowFoto::ShowfotoItemModel::slotFileUploaded ( const ShowfotoItemInfo info)
slot

References addShowfotoItemInfo().

◆ startIncrementalRefresh()

void ShowFoto::ShowfotoItemModel::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().

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

◆ uniqueShowfotoItemInfos()

QList<ShowfotoItemInfo> ShowFoto::ShowfotoItemModel::uniqueShowfotoItemInfos ( ) const

Member Data Documentation

◆ m_dragDropHandler


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