digiKam
|
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 |
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 () |
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 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< CamItemInfo > | uniqueCamItemInfos () 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 | |
AbstractItemDragDropHandler * | m_dragDropHandler |
|
explicit |
|
override |
|
slot |
References addCamItemInfos().
Referenced by slotFileUploaded().
|
slot |
Referenced by addCamItemInfo(), setCameraThumbsController(), and setCamItemInfos().
void Digikam::ImportItemModel::addCamItemInfosSynchronously | ( | const Digikam::CamItemInfoList & | infos | ) |
References processAdded().
Referenced by 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().
|
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.
qlonglong Digikam::ImportItemModel::camItemId | ( | const QModelIndex & | index | ) | const |
References index().
Referenced by Digikam::ImportSortFilterModel::camItemId(), camItemIds(), and retrieveCamItemId().
qlonglong Digikam::ImportItemModel::camItemId | ( | int | row | ) | const |
QList< qlonglong > Digikam::ImportItemModel::camItemIds | ( | ) | const |
QList< qlonglong > Digikam::ImportItemModel::camItemIds | ( | const QList< QModelIndex > & | indexes | ) | const |
References camItemId(), and index().
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 Digikam::ImportItemModel::camItemInfo | ( | const QUrl & | fileUrl | ) | const |
References index(), and Digikam::CamItemInfo::url().
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.
CamItemInfo & Digikam::ImportItemModel::camItemInfoRef | ( | const QModelIndex & | index | ) | const |
References index().
Referenced by Digikam::ImportIconView::assignColorLabel(), Digikam::ImportIconView::assignColorLabelToSelected(), Digikam::ImportIconView::assignPickLabel(), Digikam::ImportIconView::assignPickLabelToSelected(), Digikam::ImportIconView::assignRating(), Digikam::ImportThumbnailBar::assignRating(), Digikam::ImportIconView::assignRatingToSelected(), Digikam::ImportIconView::assignTagToSelected(), Digikam::ImportIconView::camItemInfoRef(), Digikam::ImportIconView::removeTagFromSelected(), and Digikam::ImportRatingOverlay::updateRating().
CamItemInfo & Digikam::ImportItemModel::camItemInfoRef | ( | int | row | ) | const |
QList< CamItemInfo > Digikam::ImportItemModel::camItemInfos | ( | ) | const |
QList< CamItemInfo > Digikam::ImportItemModel::camItemInfos | ( | const QList< QModelIndex > & | indexes | ) | const |
References camItemInfo(), and index().
Referenced by Digikam::ImportDragDropHandler::createMimeData().
QList< CamItemInfo > Digikam::ImportItemModel::camItemInfos | ( | const QUrl & | fileUrl | ) | const |
References index(), and Digikam::CamItemInfo::url().
|
inlineprotectedvirtual |
Called when the internal storage is cleared.
Referenced by clearCamItemInfos().
void Digikam::ImportItemModel::clearCamItemInfos | ( | ) |
Clears the CamItemInfos and resets the model.
References camItemInfosCleared().
Referenced by setCamItemInfos().
|
override |
References ImportItemModelInternalId, ImportItemModelPointerRole, and index().
Referenced by Digikam::ImportThumbnailModel::data().
|
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().
|
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().
|
inherited |
|
inherited |
|
protected |
|
protected |
|
protected |
|
protected |
|
override |
References Digikam::DragDropModelImplementation::dragDropFlags(), and index().
bool Digikam::ImportItemModel::hasImage | ( | const CamItemInfo & | info | ) | const |
References Digikam::CamItemInfo::url().
bool Digikam::ImportItemModel::hasImage | ( | qlonglong | id | ) | const |
|
protected |
|
override |
|
override |
Referenced by camItemId(), camItemIds(), camItemInfo(), camItemInfoRef(), camItemInfos(), data(), Digikam::ImportThumbnailModel::data(), flags(), indexForCamItemId(), removeCamItemInfos(), removeIndex(), removeIndexs(), retrieveCamItemId(), retrieveCamItemInfo(), and Digikam::ImportThumbnailModel::setData().
QList< QModelIndex > Digikam::ImportItemModel::indexesForCamItemId | ( | qlonglong | id | ) | const |
Referenced by indexesForCamItemInfo(), and indexesForUrl().
QList< QModelIndex > Digikam::ImportItemModel::indexesForCamItemInfo | ( | const CamItemInfo & | info | ) | const |
References Digikam::CamItemInfo::id, and indexesForCamItemId().
QList< QModelIndex > Digikam::ImportItemModel::indexesForUrl | ( | const QUrl & | fileUrl | ) | const |
References indexesForCamItemId().
QModelIndex Digikam::ImportItemModel::indexForCamItemId | ( | qlonglong | id | ) | const |
References index().
Referenced by indexForCamItemInfo(), indexForUrl(), and removeCamItemInfos().
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().
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().
|
virtualinherited |
Referenced by Digikam::DragDropModelImplementation::dragDropFlagsV2().
|
virtualinherited |
Referenced by Digikam::DragDropModelImplementation::dragDropFlagsV2().
bool Digikam::ImportItemModel::isEmpty | ( | ) | const |
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.
|
signal |
Informs that ItemInfos will be added to the model. This signal is sent before the model data is changed and views are informed.
|
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().
|
inlineprotectedvirtual |
Called before rowsAboutToBeRemoved
|
signal |
Informs that ItemInfos have been added to the model. This signal is sent after the model data is changed and views are informed.
|
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().
bool Digikam::ImportItemModel::keepsFileUrlCache | ( | ) | const |
|
inherited |
|
inherited |
int Digikam::ImportItemModel::numberOfIndexesForCamItemId | ( | qlonglong | id | ) | const |
Referenced by numberOfIndexesForCamItemInfo().
int Digikam::ImportItemModel::numberOfIndexesForCamItemInfo | ( | const CamItemInfo & | info | ) | const |
References Digikam::CamItemInfo::id, and numberOfIndexesForCamItemId().
|
signal |
Connect to this signal only if you are the current preprocessor.
|
signal |
Referenced by addCamItemInfosSynchronously().
|
slot |
|
slot |
|
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().
void Digikam::ImportItemModel::removeCamItemInfo | ( | const CamItemInfo & | info | ) |
References removeCamItemInfos().
Referenced by slotFileDeleted().
void Digikam::ImportItemModel::removeCamItemInfos | ( | const QList< CamItemInfo > & | infos | ) |
References Digikam::CamItemInfo::id, index(), and indexForCamItemId().
Referenced by removeCamItemInfo().
void Digikam::ImportItemModel::removeIndex | ( | const QModelIndex & | index | ) |
Remove the given infos or indexes directly from the model.
References index(), and removeIndexs().
void Digikam::ImportItemModel::removeIndexs | ( | const QList< QModelIndex > & | indexes | ) |
References index().
Referenced by removeIndex().
|
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().
|
static |
References camItemId(), ImportItemModelInternalId, ImportItemModelPointerRole, and index().
|
static |
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.
References camItemInfo(), ImportItemModelInternalId, ImportItemModelPointerRole, and index().
Referenced by Digikam::ImportCoordinatesOverlay::checkIndex(), Digikam::ImportLockOverlay::checkIndex(), Digikam::ImportDownloadOverlay::checkIndex(), Digikam::ImportRotateOverlay::checkIndex(), and Digikam::ImportDelegate::paint().
|
override |
QAbstractListModel implementation.
|
virtual |
Used to set the camera controller, and connect with it.
Reimplemented in Digikam::ImportThumbnailModel.
References addCamItemInfos(), Digikam::CameraThumbsCtrl::cameraController(), slotFileDeleted(), and slotFileUploaded().
Referenced by Digikam::ImportThumbnailModel::setCameraThumbsController().
void Digikam::ImportItemModel::setCamItemInfos | ( | const CamItemInfoList & | infos | ) |
Clears and adds infos.
References addCamItemInfos(), and clearCamItemInfos().
|
inherited |
Set a drag drop handler.
References Digikam::DragDropModelImplementation::m_dragDropHandler.
Referenced by Digikam::DigikamItemView::DigikamItemView(), and Digikam::ImportIconView::ImportIconView().
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().
void Digikam::ImportItemModel::setSendRemovalSignals | ( | bool | send | ) |
DragDrop methods.
Enable sending of itemInfosAboutToBeRemoved and itemsInfosRemoved signals. Default: false
|
slot |
References camItemInfo(), and removeCamItemInfo().
Referenced by setCameraThumbsController().
|
slot |
References addCamItemInfo().
Referenced by setCameraThumbsController().
|
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().
|
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.
|
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.
QList< CamItemInfo > Digikam::ImportItemModel::uniqueCamItemInfos | ( | ) | const |
References Digikam::CamItemInfo::id.
|
protectedinherited |